lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 03 Nov 2017 13:19:29 -0700
From:   Eric Anholt <eric@...olt.net>
To:     Florian Fainelli <f.fainelli@...il.com>,
        linux-kernel@...r.kernel.org
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Matt Mackall <mpm@...enic.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        "maintainer\:BROADCOM BCM281XX\/BCM11XXX\/BCM216XX ARM ARCHITE..." 
        <bcm-kernel-feedback-list@...adcom.com>,
        Stefan Wahren <stefan.wahren@...e.com>,
        PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>,
        Russell King <rmk+kernel@...linux.org.uk>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Harald Freudenberger <freude@...ux.vnet.ibm.com>,
        Sean Wang <sean.wang@...iatek.com>,
        Martin Kaiser <martin@...ser.cx>,
        Steffen Trumtrar <s.trumtrar@...gutronix.de>,
        "open list\:HARDWARE RANDOM NUMBER GENERATOR CORE" 
        <linux-crypto@...r.kernel.org>,
        "open list\:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        "moderated list\:BROADCOM BCM2835 ARM ARCHITECTURE" 
        <linux-rpi-kernel@...ts.infradead.org>,
        "moderated list\:BRO ADCOM BCM2835 ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 08/12] hwrng: bcm2835-rng: Abstract I/O accessors

Florian Fainelli <f.fainelli@...il.com> writes:

> In preparation for allowing BCM63xx to use this driver, we abstract I/O
> accessors such that we can easily change those later on.
>
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
> ---
>  drivers/char/hw_random/bcm2835-rng.c | 27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index 35928efb52e7..500275d55044 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -42,6 +42,17 @@ static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng)
>  	return container_of(rng, struct bcm2835_rng_priv, rng);
>  }
>  
> +static inline u32 rng_readl(struct bcm2835_rng_priv *priv, u32 offset)
> +{
> +	return readl(priv->base + offset);
> +}
> +
> +static inline void rng_writel(struct bcm2835_rng_priv *priv, u32 val,
> +			      u32 offset)
> +{
> +	writel(val, priv->base + offset);
> +}
> +
>  static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
>  			       bool wait)
>  {
> @@ -49,18 +60,18 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
>  	u32 max_words = max / sizeof(u32);
>  	u32 num_words, count;
>  
> -	while ((__raw_readl(priv->base + RNG_STATUS) >> 24) == 0) {
> +	while ((rng_readl(priv, RNG_STATUS) >> 24) == 0) {
>  		if (!wait)
>  			return 0;
>  		cpu_relax();
>  	}

What was the difference between the __raw_readl and readl that's now
being done in the new call?  Is it important?

>  	/* set warm-up count & enable */
> -	__raw_writel(RNG_WARMUP_COUNT, priv->base + RNG_STATUS);
> -	__raw_writel(RNG_RBGEN, priv->base + RNG_CTRL);
> +	rng_writel(priv, RNG_WARMUP_COUNT, RNG_STATUS);
> +	rng_writel(priv, RNG_RBGEN, RNG_CTRL);

Similar question.

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists