Re: [PATCH][next] hwrng: exynos: check for -ve error return from readl_poll_timeout

2018-01-29 Thread Łukasz Stelmach
*trng; > - u32 val; > + int val; > > max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4)); Fixed. https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=a8bc71d4960391f732ec0307ebd69e4a25aaf4d3 -- Łukasz Stelmach Samsung R Institute Poland Samsung Electronics signature.asc Description: PGP signature

Re: [PATCH] hwrng: exynos - Signedness bug in exynos_trng_do_read()

2018-01-11 Thread Łukasz Stelmach
It was <2018-01-10 śro 10:36>, when Dan Carpenter wrote: > "val" needs to be signed for the error handling to work. > > Fixes: 6cd225cc5d8a ("hwrng: exynos - add Samsung Exynos True RNG driver") > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.c

Re: [PATCH -next] hwrng: exynos - remove redundant dev_err call in exynos_trng_probe()

2018-01-11 Thread Łukasz Stelmach
It was <2018-01-10 śro 14:30>, when Wei Yongjun wrote: > There is a error message within devm_ioremap_resource > already, so remove the dev_err call to avoid redundant > error message. > > Signed-off-by: Wei Yongjun <weiyongj...@huawei.com> Acked-by: Łukasz Stelm

Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-27 Thread Łukasz Stelmach
It was <2017-12-22 pią 19:30>, when Philippe Ombredanne wrote: > On Fri, Dec 22, 2017 at 5:38 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote: >>> Łukasz, >>> >>>

Re: [PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
It was <2017-12-22 pią 14:34>, when Philippe Ombredanne wrote: > Łukasz, > > On Fri, Dec 22, 2017 at 2:23 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> Add support for True Random Number Generator found in Samsung Exynos >> 5250+ SoCs. >>

[PATCH v4] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> Reviewed-by: Krzysztof Kozlowski <k...@kernel.org> --- Changes since v3: - Fixed typo in the secongd argument of MODULE_DEVICE_TABLE (Thanks

Re: [PATCH v3 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-22 Thread Łukasz Stelmach
It was <2017-12-22 pią 09:35>, when Herbert Xu wrote: > On Fri, Dec 22, 2017 at 09:29:38AM +0100, Marek Szyprowski wrote: >> Hi, >> >> On 2017-12-22 09:24, Herbert Xu wrote: >> >On Mon, Dec 04, 2017 at 01:53:50PM +0100, Łukasz Stelmach wrote: >> >

[PATCH v3 3/4] crypto: exynos - Reseed PRNG after generating 2^16 random bytes

2017-12-12 Thread Łukasz Stelmach
entropy, but it helps preventing backtracking the internal state of the device from its output sequence, and hence, prevents potential attacker from predicting numbers to be generated. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> Reviewed-by: Stephan Mueller <smuel...@c

[PATCH v3 4/4] crypto: exynos - Introduce mutex to prevent concurrent access to hardware

2017-12-12 Thread Łukasz Stelmach
() function enables switching between different threads waiting for the driver to generate random numbers for them. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> Reviewed-by: Krzysztof Kozlowski <k...@kernel.org> --- drivers/crypto/exynos-rng.c | 21 + 1

[PATCH v3 2/4] crypto: exynos - Improve performance of PRNG

2017-12-12 Thread Łukasz Stelmach
Use memcpy_fromio() instead of custom exynos_rng_copy_random() function to retrieve generated numbers from the registers of PRNG. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- drivers/crypto/exynos-rng.c | 31 ++- 1 file changed, 2 insertions(

[PATCH v3 0/4] Assorted changes for Exynos PRNG driver

2017-12-12 Thread Łukasz Stelmach
rom an error path. - Removed dev_info() reporting hardware presence from exynos_rng_probe(). Łukasz Stelmach (4): crypto: exynos - Support Exynos5250+ SoCs crypto: exynos - Improve performance of PRNG crypto: exynos - Reseed PRNG after generating 2^16 random bytes crypto: exynos - Introduce mu

[PATCH v3 1/4] crypto: exynos - Support Exynos5250+ SoCs

2017-12-12 Thread Łukasz Stelmach
Add support for PRNG in Exynos5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../bindings/crypto/samsung,exynos-rng4.txt| 4 +++- drivers/crypto/exynos-rng.c| 27 -- 2 files changed, 28 insertions(+), 3 del

Re: [PATCH v2 2/4] crypto: exynos - Improve performance of PRNG

2017-12-12 Thread Łukasz Stelmach
It was <2017-12-11 pon 15:54>, when Krzysztof Kozlowski wrote: > On Mon, Dec 11, 2017 at 3:06 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> Cc: Marek Szyprowski <m.szyprow...@samsung.com>, Bartlomiej >> Zolnierkiewicz <b.zolnier...@samsu

[PATCH v4] ARM: dts: exynos: Add nodes for True Random Number Generator

2017-12-12 Thread Łukasz Stelmach
Add nodes for the True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- Changes since v3: - Rebased accroding to Krzysztof Kozłowski's request arch/arm/boot/dts/exynos5.dtsi| 5 + arch/arm/boot/dts/exynos525

Re: [PATCH v3 3/3] ARM: dts: exynos: Add nodes for True Random Number Generator

2017-12-12 Thread Łukasz Stelmach
It was <2017-12-11 pon 19:49>, when Krzysztof Kozlowski wrote: > On Mon, Dec 04, 2017 at 01:53:51PM +0100, Łukasz Stelmach wrote: >> Add nodes for the True Random Number Generator found in Samsung Exynos >> 5250+ SoCs. >> >> Signed-off-by: Łukasz Stelmach <l.s

Re: [PATCH v2 4/4] crypto: exynos - Introduce mutex to prevent concurrent access to hardware

2017-12-12 Thread Łukasz Stelmach
It was <2017-12-11 pon 16:03>, when Krzysztof Kozlowski wrote: > On Mon, Dec 11, 2017 at 3:06 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> Cc: Marek Szyprowski <m.szyprow...@samsung.com>, Bartlomiej Zolnierkiewicz >> <b.zolnier...@samsung.com&

[PATCH v2 4/4] crypto: exynos - Introduce mutex to prevent concurrent access to hardware

2017-12-11 Thread Łukasz Stelmach
om accessing the hardware at the same time. The sequence of mutex_lock() and mutex_unlock() in the exynos_rng_reseed() function enables switching between different threads waiting for the driver to generate random numbers for them. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> -

[PATCH v2 3/4] crypto: exynos - Reseed PRNG after generating 2^16 random bytes

2017-12-11 Thread Łukasz Stelmach
but it helps preventing backtracking the internal state of the device from its output sequence, and hence, prevents potential attacker from predicting numbers to be generated. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> Reviewed-by: Stephan Mueller <smuel...@chronox.de> --- dri

[PATCH v2 0/4] Assorted changes for Exynos PRNG driver

2017-12-11 Thread Łukasz Stelmach
enum and a define according to Krzysztof Kozłowski's recommendations. - Brought back cpu_relax() in a rearranged loop in exynos_rng_get_random(). - Moved an assignment of the read valuea away from an error path. - Removed dev_info() reporting hardware presence from exynos_rng_probe(). Łukasz

[PATCH v2 2/4] crypto: exynos - Improve performance of PRNG

2017-12-11 Thread Łukasz Stelmach
h worse than in a loop without cpu_relax(). Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- drivers/crypto/exynos-rng.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c

[PATCH v2 1/4] crypto: exynos - Support Exynos5250+ SoCs

2017-12-11 Thread Łukasz Stelmach
Cc: Marek Szyprowski <m.szyprow...@samsung.com>, Bartlomiej Zolnierkiewicz <b.zolnier...@samsung.com> Add support for PRNG in Exynos5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../bindings/crypto/samsung,exynos-rng4.txt| 4 ++- drivers/c

Re: [PATCH 1/3] crypto: exynos - Support Exynos5250+ SoCs

2017-12-07 Thread Łukasz Stelmach
It was <2017-12-06 śro 16:28>, when Krzysztof Kozlowski wrote: > On Wed, Dec 6, 2017 at 3:53 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> It was <2017-12-06 śro 15:05>, when Krzysztof Kozlowski wrote: >>> On Wed, Dec 6, 2017 at 2:42 PM,

Re: [PATCH 1/3] crypto: exynos - Support Exynos5250+ SoCs

2017-12-06 Thread Łukasz Stelmach
It was <2017-12-06 śro 15:05>, when Krzysztof Kozlowski wrote: > On Wed, Dec 6, 2017 at 2:42 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> It was <2017-12-05 wto 14:34>, when Krzysztof Kozlowski wrote: >>> On Tue, Dec 5, 2017 at 1:35 PM,

Re: [PATCH 1/3] crypto: exynos - Support Exynos5250+ SoCs

2017-12-06 Thread Łukasz Stelmach
It was <2017-12-05 wto 14:34>, when Krzysztof Kozlowski wrote: > On Tue, Dec 5, 2017 at 1:35 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> Add support for PRNG in Exynos5250+ SoCs. >> >> Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com&

Re: [PATCH 2/3] crypto: exynos - Improve performance of PRNG

2017-12-06 Thread Łukasz Stelmach
It was <2017-12-06 śro 12:37>, when Krzysztof Kozlowski wrote: > On Wed, Dec 6, 2017 at 12:32 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> It was <2017-12-05 wto 19:06>, when Krzysztof Kozlowski wrote: >>> On Tue, Dec 5, 2017 at 6:53 PM, Krzy

locking in prng

2017-12-06 Thread Łukasz Stelmach
or userspace and the driver or should the driver has its own lock to serialize hardware access? Kind regards, -- Łukasz Stelmach Samsung R Institute Poland Samsung Electronics signature.asc Description: PGP signature

Re: [PATCH 2/3] crypto: exynos - Improve performance of PRNG

2017-12-06 Thread Łukasz Stelmach
It was <2017-12-05 wto 19:06>, when Krzysztof Kozlowski wrote: > On Tue, Dec 5, 2017 at 6:53 PM, Krzysztof Kozlowski <k...@kernel.org> wrote: >> On Tue, Dec 05, 2017 at 05:43:10PM +0100, Łukasz Stelmach wrote: >>> It was <2017-12-05 wto 14:54>, when Stepha

Re: [PATCH 2/3] crypto: exynos - Improve performance of PRNG

2017-12-05 Thread Łukasz Stelmach
It was <2017-12-05 wto 14:54>, when Stephan Mueller wrote: > Am Dienstag, 5. Dezember 2017, 13:35:57 CET schrieb Łukasz Stelmach: > > Hi Łukasz, > >> Use memcpy_fromio() instead of custom exynos_rng_copy_random() function >> to retrieve generated numbers from the re

[PATCH] crypto: exynos - Icrease the priority of the driver

2017-12-05 Thread Łukasz Stelmach
in the kernel command line). Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- Thank you Stephan Mueller for explanations. drivers/crypto/exynos-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c index 4b2ed1

[RFC] crypto: exynos - Icrease the priority of the driver

2017-12-05 Thread Łukasz Stelmach
exynos-rng is one of many implementations of stdrng. With priority as low as 100 it isn't selected, if software implementations (DRBG) are available. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- If not 1000, what is the best value, what is the policy? drivers/crypto/

[PATCH 3/3] crypto: exynos - Reseed PRNG after generating 2^16 random bytes

2017-12-05 Thread Łukasz Stelmach
Reseed PRNG after reading 65 kB of randomness. Although this may reduce performance, in most casese the loss is not noticable. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- drivers/crypto/exynos-rng.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-)

[PATCH 0/3] Assorted changes for Exynos PRNG driver

2017-12-05 Thread Łukasz Stelmach
output performance by using memcpy() rather than a custom function to retriev random bytes from registers. Patch #3 Reseed the PRNG after reading 2^16 bytes. Simmilar approach is implemented in DRBG. (Thanks Stephan Mueller) Łukasz Stelmach (3): crypto: exynos - Support Exynos5250+ SoCs crypto

[PATCH 2/3] crypto: exynos - Improve performance of PRNG

2017-12-05 Thread Łukasz Stelmach
Use memcpy_fromio() instead of custom exynos_rng_copy_random() function to retrieve generated numbers from the registers of PRNG. Remove unnecessary invocation of cpu_relax(). Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- drivers/crypto/exynos-rng.

[PATCH 1/3] crypto: exynos - Support Exynos5250+ SoCs

2017-12-05 Thread Łukasz Stelmach
Add support for PRNG in Exynos5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../bindings/crypto/samsung,exynos-rng4.txt| 4 ++- drivers/crypto/exynos-rng.c| 36 -- 2 files changed, 36 insertions(+), 4 del

[PATCH v3 1/3] dt-bindings: hwrng: Add Samsung Exynos 5250+ True RNG bindings

2017-12-04 Thread Łukasz Stelmach
Add binding documentation for the True Random Number Generator found on Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../devicetree/bindings/rng/samsung,exynos5250-trng.txt | 17 + 1 file changed, 17 insertions(+) create mode

[PATCH v3 0/3] True RNG driver for Samsung Exynos 5250+ SoCs

2017-12-04 Thread Łukasz Stelmach
Hello. The following patches add support for the true random number generator found in Samsung Exynos 5250+ SoCs. Patch #1 adds documentation for devicetree bindings. Patch #2 introduces the driver and appropriate changes in Makefile and Kconfig. Patch #3 adds nodes in devicetree files for

[PATCH v3 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-12-04 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- MAINTAINERS | 7 + drivers/char/hw_random/Kconfig | 12 ++ drivers/char/hw_random/Makefile | 1 + driver

[PATCH v3 3/3] ARM: dts: exynos: Add nodes for True Random Number Generator

2017-12-04 Thread Łukasz Stelmach
Add nodes for the True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- arch/arm/boot/dts/exynos5.dtsi| 5 + arch/arm/boot/dts/exynos5250.dtsi | 5 + arch/arm/boot/dts/exynos5410.dtsi | 5 + arch/arm/bo

[PATCH v2 3/3] ARM: dts: exynos: Add nodes for True Random Number Generator

2017-11-27 Thread Łukasz Stelmach
Add nodes for the True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- arch/arm/boot/dts/exynos5.dtsi| 5 + arch/arm/boot/dts/exynos5250.dtsi | 5 + arch/arm/boot/dts/exynos5410.dtsi | 5 + arch/arm/bo

[PATCH v2 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-11-27 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- MAINTAINERS | 7 + drivers/char/hw_random/Kconfig | 12 ++ drivers/char/hw_random/Makefile | 1 + driver

[PATCH v2 1/3] dt-bindings: hwrng: Add Samsung Exynos 5250+ True RNG bindings

2017-11-27 Thread Łukasz Stelmach
Add binding documentation for the True Random Number Generator found on Samsung Exynos 5250+ SoCs. Acked-by: Rob Herring <r...@kernel.org> Reviewed-by: Krzysztof Kozlowski <k...@kernel.org> Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../devicetree/bindings/rng/

[PATCH v2 0/3] True RNG driver for Samsung Exynos 5250+ SoCs

2017-11-27 Thread Łukasz Stelmach
t/lists/linux-samsung-soc/msg61253.html https://patchwork.kernel.org/patch/10072967/ https://patchwork.kernel.org/patch/10072971/ https://patchwork.kernel.org/patch/10072963/ Łukasz Stelmach (3): dt-bindings: hwrng: Add Samsung Exynos 5250+ True RNG bindings hwrng: exynos - add Samsung Exynos Tr

Re: [PATCH 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-11-26 Thread Łukasz Stelmach
;> + u32 val; >> + >> + max = max > (EXYNOS_TRNG_FIFO_LEN * 4) ? >> + (EXYNOS_TRNG_FIFO_LEN * 4) : max; > > max is always > 32. This condition is not required. No, it is not. http://elixir.free-electrons.com/linux/latest/source/drivers/ch

Re: [PATCH 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-11-23 Thread Łukasz Stelmach
It was <2017-11-23 czw 17:31>, when Krzysztof Kozlowski wrote: > On Thu, Nov 23, 2017 at 4:09 PM, Łukasz Stelmach <l.stelm...@samsung.com> > wrote: >> Add support for True Random Number Generator found in Samsung Exynos >> 5250+ SoCs. >> >> Signed-off-b

[PATCH 2/3] hwrng: exynos - add Samsung Exynos True RNG driver

2017-11-23 Thread Łukasz Stelmach
Add support for True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- MAINTAINERS | 7 + drivers/char/hw_random/Kconfig | 12 ++ drivers/char/hw_random/Makefile | 1 + driver

[PATCH 1/3] dt-bindings: hwrng: Add Samsung Exynos 5250+ True RNG bindings

2017-11-23 Thread Łukasz Stelmach
Add binding documentation for the True Random Number Generator found on Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- .../devicetree/bindings/rng/samsung,exynos5250-trng.txt | 17 + 1 file changed, 17 insertions(+) create mode

[PATCH 0/3] True RNG driver for Samsung Exynos 5250+ SoCs

2017-11-23 Thread Łukasz Stelmach
for Exynos SoCs. Łukasz Stelmach (3): dt-bindings: hwrng: Add Samsung Exynos 5250+ True RNG bindings hwrng: exynos - add Samsung Exynos True RNG driver ARM: dts: exynos: Add nodes for True Random Number Generator .../bindings/rng/samsung,exynos5250-trng.txt | 17 ++ MAINTAINERS

[PATCH 3/3] ARM: dts: exynos: Add nodes for True Random Number Generator

2017-11-23 Thread Łukasz Stelmach
Add nodes for the True Random Number Generator found in Samsung Exynos 5250+ SoCs. Signed-off-by: Łukasz Stelmach <l.stelm...@samsung.com> --- arch/arm/boot/dts/exynos5.dtsi| 5 + arch/arm/boot/dts/exynos5250.dtsi | 5 + arch/arm/boot/dts/exynos5410.dtsi | 5 + arch/arm/bo