All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] rng: Introduce SPL_DM_RNG
@ 2024-04-25 23:02 Marek Vasut
  2024-04-25 23:02 ` [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Marek Vasut @ 2024-04-25 23:02 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tim Harvey,
	Tom Rini

Add SPL variant of DM_RNG so that the DM_RNG can be disabled in SPL
if necessary. This may be necessary due to e.g. size constraints of
the SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Angelo Dureghello <angelo@kernel-space.org>
Cc: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Gaurav Jain <gaurav.jain@nxp.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 boot/pxe_utils.c        | 4 +---
 boot/vbe_request.c      | 2 +-
 drivers/Makefile        | 2 +-
 drivers/crypto/fsl/jr.c | 4 ++--
 drivers/rng/Kconfig     | 7 +++++++
 drivers/rng/Makefile    | 2 +-
 lib/uuid.c              | 2 +-
 net/net_rand.h          | 2 +-
 test/dm/Makefile        | 2 +-
 9 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 96205626750..5c1c962ff4c 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -21,9 +21,7 @@
 #include <errno.h>
 #include <linux/list.h>
 
-#ifdef CONFIG_DM_RNG
 #include <rng.h>
-#endif
 
 #include <splash.h>
 #include <asm/io.h>
@@ -323,7 +321,7 @@ static int label_localboot(struct pxe_label *label)
 
 static void label_boot_kaslrseed(void)
 {
-#ifdef CONFIG_DM_RNG
+#if CONFIG_IS_ENABLED(DM_RNG)
 	ulong fdt_addr;
 	struct fdt_header *working_fdt;
 	size_t n = 0x8;
diff --git a/boot/vbe_request.c b/boot/vbe_request.c
index 917251afa1c..0293ac6c869 100644
--- a/boot/vbe_request.c
+++ b/boot/vbe_request.c
@@ -36,7 +36,7 @@ static int handle_random_req(ofnode node, int default_size,
 	u32 size;
 	int ret;
 
-	if (!IS_ENABLED(CONFIG_DM_RNG))
+	if (!CONFIG_IS_ENABLED(DM_RNG))
 		return -ENOTSUPP;
 
 	if (ofnode_read_u32(node, "vbe,size", &size)) {
diff --git a/drivers/Makefile b/drivers/Makefile
index bf73b7718ce..9195dafd37e 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -126,7 +126,7 @@ obj-$(CONFIG_W1_EEPROM) += w1-eeprom/
 obj-$(CONFIG_MACH_PIC32) += ddr/microchip/
 obj-$(CONFIG_FUZZ) += fuzz/
 obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock/
-obj-$(CONFIG_DM_RNG) += rng/
+obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng/
 endif
 
 obj-y += soc/
diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index 203f1625215..8ae5c434bdb 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -787,7 +787,7 @@ init:
 	}
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 	if (ofnode_valid(scu_node)) {
-		if (IS_ENABLED(CONFIG_DM_RNG)) {
+		if (CONFIG_IS_ENABLED(DM_RNG)) {
 			ret = device_bind_driver(NULL, "caam-rng", "caam-rng", NULL);
 			if (ret)
 				printf("Couldn't bind rng driver (%d)\n", ret);
@@ -810,7 +810,7 @@ init:
 			return -1;
 		}
 
-		if (IS_ENABLED(CONFIG_DM_RNG)) {
+		if (CONFIG_IS_ENABLED(DM_RNG)) {
 			ret = device_bind_driver(NULL, "caam-rng", "caam-rng",
 						 NULL);
 			if (ret)
diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig
index cd72852a479..5758ae192a6 100644
--- a/drivers/rng/Kconfig
+++ b/drivers/rng/Kconfig
@@ -6,6 +6,13 @@ config DM_RNG
 	  This interface is used to initialise the rng device and to
 	  read the random seed from the device.
 
+config SPL_DM_RNG
+	bool "Driver support for Random Number Generator devices in SPL"
+	depends on SPL_DM
+	help
+	  This option is an SPL-variant of the DM_RNG option.
+	  See the help of DM_RNG for details.
+
 if DM_RNG
 
 config RNG_MESON
diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile
index ecae1a3da33..c1f1c616e00 100644
--- a/drivers/rng/Makefile
+++ b/drivers/rng/Makefile
@@ -3,7 +3,7 @@
 # Copyright (c) 2019, Linaro Limited
 #
 
-obj-$(CONFIG_DM_RNG) += rng-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng-uclass.o
 obj-$(CONFIG_RNG_MESON) += meson-rng.o
 obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o
 obj-$(CONFIG_RNG_MSM) += msm_rng.o
diff --git a/lib/uuid.c b/lib/uuid.c
index 2d7d99535e7..dfa2320ba26 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -378,7 +378,7 @@ void gen_rand_uuid(unsigned char *uuid_bin)
 	struct udevice *devp;
 	u32 randv = 0;
 
-	if (IS_ENABLED(CONFIG_DM_RNG)) {
+	if (CONFIG_IS_ENABLED(DM_RNG)) {
 		ret = uclass_get_device(UCLASS_RNG, 0, &devp);
 		if (!ret) {
 			ret = dm_rng_read(devp, &randv, sizeof(randv));
diff --git a/net/net_rand.h b/net/net_rand.h
index d3c5559adfd..686e85f2b53 100644
--- a/net/net_rand.h
+++ b/net/net_rand.h
@@ -42,7 +42,7 @@ static inline void srand_mac(void)
 	struct udevice *devp;
 	u32 randv = 0;
 
-	if (IS_ENABLED(CONFIG_DM_RNG)) {
+	if (CONFIG_IS_ENABLED(DM_RNG)) {
 		ret = uclass_get_device(UCLASS_RNG, 0, &devp);
 		if (ret) {
 			ret = dm_rng_read(devp, &randv, sizeof(randv));
diff --git a/test/dm/Makefile b/test/dm/Makefile
index a3ce7b3889f..c12589d487c 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -102,7 +102,7 @@ obj-$(CONFIG_DM_RESET) += reset.o
 obj-$(CONFIG_SYSRESET) += sysreset.o
 obj-$(CONFIG_DM_REGULATOR) += regulator.o
 obj-$(CONFIG_CMD_RKMTD) += rkmtd.o
-obj-$(CONFIG_DM_RNG) += rng.o
+obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng.o
 obj-$(CONFIG_DM_RTC) += rtc.o
 obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
 obj-$(CONFIG_SCSI) += scsi.o
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-25 23:02 [PATCH 1/3] rng: Introduce SPL_DM_RNG Marek Vasut
@ 2024-04-25 23:02 ` Marek Vasut
  2024-04-26  0:16   ` Tim Harvey
  2024-04-25 23:02 ` [PATCH 3/3] crypto/fsl: Differentiate between CAAM and DCP in Kconfig entry Marek Vasut
  2024-05-05 19:12 ` [PATCH 1/3] rng: Introduce SPL_DM_RNG Fabio Estevam
  2 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2024-04-25 23:02 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tim Harvey,
	Tom Rini

Add SPL variant of SPL_FSL_CAAM_RNG so that the SPL_FSL_CAAM_RNG can
be disabled in SPL if necessary. This may be necessary due to e.g.
size constraints of the SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Angelo Dureghello <angelo@kernel-space.org>
Cc: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Gaurav Jain <gaurav.jain@nxp.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/crypto/fsl/Kconfig  | 7 +++++++
 drivers/crypto/fsl/Makefile | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/fsl/Kconfig b/drivers/crypto/fsl/Kconfig
index 294e1c8a44e..9f58731bb67 100644
--- a/drivers/crypto/fsl/Kconfig
+++ b/drivers/crypto/fsl/Kconfig
@@ -78,6 +78,13 @@ config FSL_CAAM_RNG
 	  using the prediction resistance flag which means the DRGB is
 	  reseeded from the TRNG every time random data is generated.
 
+config SPL_FSL_CAAM_RNG
+	bool "Enable CAAM Random Number Generator support in SPL"
+	depends on SPL_DM_RNG
+	help
+	  This option is an SPL-variant of the FSL_CAAM_RNG option.
+	  See the help of FSL_CAAM_RNG for details.
+
 endif
 
 config FSL_DCP_RNG
diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
index 7a2543e16cc..4fbce519a0b 100644
--- a/drivers/crypto/fsl/Makefile
+++ b/drivers/crypto/fsl/Makefile
@@ -6,6 +6,6 @@ obj-y += sec.o
 obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
 obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
 obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
-obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
+obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
 obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
 obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] crypto/fsl: Differentiate between CAAM and DCP in Kconfig entry
  2024-04-25 23:02 [PATCH 1/3] rng: Introduce SPL_DM_RNG Marek Vasut
  2024-04-25 23:02 ` [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG Marek Vasut
@ 2024-04-25 23:02 ` Marek Vasut
  2024-05-05 19:12 ` [PATCH 1/3] rng: Introduce SPL_DM_RNG Fabio Estevam
  2 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2024-04-25 23:02 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tim Harvey,
	Tom Rini

Differentiate between "Enable Random Number Generator support" and
"Enable Random Number Generator support" in Kconfig entry, mark the
first as CAAM and the second as DCP, otherwise users cannot easily
decide which of the options is which and enable the correct one.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Angelo Dureghello <angelo@kernel-space.org>
Cc: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Gaurav Jain <gaurav.jain@nxp.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/crypto/fsl/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/fsl/Kconfig b/drivers/crypto/fsl/Kconfig
index 9f58731bb67..9ed56632fcd 100644
--- a/drivers/crypto/fsl/Kconfig
+++ b/drivers/crypto/fsl/Kconfig
@@ -69,7 +69,7 @@ config FSL_CAAM_JR_NTZ_ACCESS
 	  driver is used.
 
 config FSL_CAAM_RNG
-	bool "Enable Random Number Generator support"
+	bool "Enable CAAM Random Number Generator support"
 	depends on DM_RNG
 	default y
 	help
@@ -88,7 +88,7 @@ config SPL_FSL_CAAM_RNG
 endif
 
 config FSL_DCP_RNG
-	bool "Enable Random Number Generator support"
+	bool "Enable DCP Random Number Generator support"
 	depends on DM_RNG
 	help
 	  Enable support for the hardware based random number generator
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-25 23:02 ` [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG Marek Vasut
@ 2024-04-26  0:16   ` Tim Harvey
  2024-04-26  4:03     ` Marek Vasut
  0 siblings, 1 reply; 12+ messages in thread
From: Tim Harvey @ 2024-04-26  0:16 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini

On Thu, Apr 25, 2024 at 4:03 PM Marek Vasut <marex@denx.de> wrote:
>
> Add SPL variant of SPL_FSL_CAAM_RNG so that the SPL_FSL_CAAM_RNG can
> be disabled in SPL if necessary. This may be necessary due to e.g.
> size constraints of the SPL.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Angelo Dureghello <angelo@kernel-space.org>
> Cc: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Gaurav Jain <gaurav.jain@nxp.com>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Svyatoslav Ryhel <clamor95@gmail.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  drivers/crypto/fsl/Kconfig  | 7 +++++++
>  drivers/crypto/fsl/Makefile | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/fsl/Kconfig b/drivers/crypto/fsl/Kconfig
> index 294e1c8a44e..9f58731bb67 100644
> --- a/drivers/crypto/fsl/Kconfig
> +++ b/drivers/crypto/fsl/Kconfig
> @@ -78,6 +78,13 @@ config FSL_CAAM_RNG
>           using the prediction resistance flag which means the DRGB is
>           reseeded from the TRNG every time random data is generated.
>
> +config SPL_FSL_CAAM_RNG
> +       bool "Enable CAAM Random Number Generator support in SPL"
> +       depends on SPL_DM_RNG
> +       help
> +         This option is an SPL-variant of the FSL_CAAM_RNG option.
> +         See the help of FSL_CAAM_RNG for details.
> +
>  endif
>
>  config FSL_DCP_RNG
> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
> index 7a2543e16cc..4fbce519a0b 100644
> --- a/drivers/crypto/fsl/Makefile
> +++ b/drivers/crypto/fsl/Makefile
> @@ -6,6 +6,6 @@ obj-y += sec.o
>  obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>  obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>  obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>  obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>  obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
> --
> 2.43.0
>

Marek,

Thanks - this series does solve the issue I am seeing in the SPL when
enabling DM_RNG. Is this going to cause an issue for people who expect
it to be currently enabled and now have to manually enable it?

Best Regards,

Tim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26  0:16   ` Tim Harvey
@ 2024-04-26  4:03     ` Marek Vasut
  2024-04-26 14:39       ` Heinrich Schuchardt
  2024-04-29  9:02       ` [EXT] " Gaurav Jain
  0 siblings, 2 replies; 12+ messages in thread
From: Marek Vasut @ 2024-04-26  4:03 UTC (permalink / raw)
  To: Tim Harvey
  Cc: u-boot, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini

On 4/26/24 2:16 AM, Tim Harvey wrote:

>> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
>> index 7a2543e16cc..4fbce519a0b 100644
>> --- a/drivers/crypto/fsl/Makefile
>> +++ b/drivers/crypto/fsl/Makefile
>> @@ -6,6 +6,6 @@ obj-y += sec.o
>>   obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>>   obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>>   obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>>   obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>>   obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
>> --
>> 2.43.0
>>
> 
> Marek,

Hi,

> Thanks - this series does solve the issue I am seeing in the SPL when
> enabling DM_RNG. Is this going to cause an issue for people who expect
> it to be currently enabled and now have to manually enable it?

That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem 
to be no users, so I don't think we need to worry here, right ?

With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the 
users that enable DM_RNG, I am not seeing any obvious ones that would 
require SPL_DM_RNG too. What do you think ?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26  4:03     ` Marek Vasut
@ 2024-04-26 14:39       ` Heinrich Schuchardt
  2024-04-26 17:29         ` Marek Vasut
  2024-04-26 17:34         ` Tim Harvey
  2024-04-29  9:02       ` [EXT] " Gaurav Jain
  1 sibling, 2 replies; 12+ messages in thread
From: Heinrich Schuchardt @ 2024-04-26 14:39 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Michal Simek, Simon Glass, Stefan Roese,
	Sughosh Ganu, Svyatoslav Ryhel, Tom Rini, Tim Harvey

On 26.04.24 06:03, Marek Vasut wrote:
> On 4/26/24 2:16 AM, Tim Harvey wrote:
>
>>> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
>>> index 7a2543e16cc..4fbce519a0b 100644
>>> --- a/drivers/crypto/fsl/Makefile
>>> +++ b/drivers/crypto/fsl/Makefile
>>> @@ -6,6 +6,6 @@ obj-y += sec.o
>>>   obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>>>   obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>>>   obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
>>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
>>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>>>   obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>>>   obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
>>> --
>>> 2.43.0
>>>
>>
>> Marek,
>
> Hi,
>
>> Thanks - this series does solve the issue I am seeing in the SPL when
>> enabling DM_RNG. Is this going to cause an issue for people who expect
>> it to be currently enabled and now have to manually enable it?
>
> That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem
> to be no users, so I don't think we need to worry here, right ?
>
> With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the
> users that enable DM_RNG, I am not seeing any obvious ones that would
> require SPL_DM_RNG too. What do you think ?

Grepping for UCLASS_RNG should find usages.

The only possible SPL usage seems to be in net/net_rand.h. Here a
fallback to the mac address as seed exists.

Best regards

Heinrich


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26 14:39       ` Heinrich Schuchardt
@ 2024-04-26 17:29         ` Marek Vasut
  2024-04-26 17:34         ` Tim Harvey
  1 sibling, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2024-04-26 17:29 UTC (permalink / raw)
  To: Heinrich Schuchardt, Nishanth Menon
  Cc: u-boot, Angelo Dureghello, Emanuele Ghidoli, Fabio Estevam,
	Gaurav Jain, Michal Simek, Simon Glass, Stefan Roese,
	Sughosh Ganu, Svyatoslav Ryhel, Tom Rini, Tim Harvey

On 4/26/24 4:39 PM, Heinrich Schuchardt wrote:
> On 26.04.24 06:03, Marek Vasut wrote:
>> On 4/26/24 2:16 AM, Tim Harvey wrote:
>>
>>>> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
>>>> index 7a2543e16cc..4fbce519a0b 100644
>>>> --- a/drivers/crypto/fsl/Makefile
>>>> +++ b/drivers/crypto/fsl/Makefile
>>>> @@ -6,6 +6,6 @@ obj-y += sec.o
>>>>   obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>>>>   obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>>>>   obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
>>>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
>>>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>>>>   obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>>>>   obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
>>>> -- 
>>>> 2.43.0
>>>>
>>>
>>> Marek,
>>
>> Hi,
>>
>>> Thanks - this series does solve the issue I am seeing in the SPL when
>>> enabling DM_RNG. Is this going to cause an issue for people who expect
>>> it to be currently enabled and now have to manually enable it?
>>
>> That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem
>> to be no users, so I don't think we need to worry here, right ?
>>
>> With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the
>> users that enable DM_RNG, I am not seeing any obvious ones that would
>> require SPL_DM_RNG too. What do you think ?
> 
> Grepping for UCLASS_RNG should find usages.
> 
> The only possible SPL usage seems to be in net/net_rand.h. Here a
> fallback to the mac address as seed exists.

So this may need to be tested on AM335x with SPL ethernet boot ?
+CC Nishanth ?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26 14:39       ` Heinrich Schuchardt
  2024-04-26 17:29         ` Marek Vasut
@ 2024-04-26 17:34         ` Tim Harvey
  2024-04-26 19:31           ` Heinrich Schuchardt
  1 sibling, 1 reply; 12+ messages in thread
From: Tim Harvey @ 2024-04-26 17:34 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Marek Vasut, u-boot, Angelo Dureghello, Emanuele Ghidoli,
	Fabio Estevam, Gaurav Jain, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini

On Fri, Apr 26, 2024 at 7:45 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 26.04.24 06:03, Marek Vasut wrote:
> > On 4/26/24 2:16 AM, Tim Harvey wrote:
> >
> >>> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
> >>> index 7a2543e16cc..4fbce519a0b 100644
> >>> --- a/drivers/crypto/fsl/Makefile
> >>> +++ b/drivers/crypto/fsl/Makefile
> >>> @@ -6,6 +6,6 @@ obj-y += sec.o
> >>>   obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
> >>>   obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
> >>>   obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
> >>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
> >>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
> >>>   obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
> >>>   obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
> >>> --
> >>> 2.43.0
> >>>
> >>
> >> Marek,
> >
> > Hi,
> >
> >> Thanks - this series does solve the issue I am seeing in the SPL when
> >> enabling DM_RNG. Is this going to cause an issue for people who expect
> >> it to be currently enabled and now have to manually enable it?
> >
> > That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem
> > to be no users, so I don't think we need to worry here, right ?
> >
> > With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the
> > users that enable DM_RNG, I am not seeing any obvious ones that would
> > require SPL_DM_RNG too. What do you think ?
>
> Grepping for UCLASS_RNG should find usages.
>
> The only possible SPL usage seems to be in net/net_rand.h. Here a
> fallback to the mac address as seed exists.
>
> Best regards
>
> Heinrich
>

Hi Heinrich,

looks like its also used in lib/uuid.c by CONFIG_RANDOM_UUID and the
few configs have CONFIG_RANDOM_UUID=y do not have DM_RNG=y so not an
issue.

srand_mac is used in:
net/bootp.c which is CONFIG_CMD_BOOTP so not SPL
net/dhcpv6.c which is CONIFG_CMD_DHCP6 so not in SPL
net/net.c which is used by CONFIG_SPL_DM_ETH and the fallback you
refer to but 'git grep DM_RNG=y configs/ | cut -d: -f1 | xargs grep
SPL_DM_ETH' shows no results so I think this is ok right?

but I also see lib/efi_loader/efi_rng.c where UCLASS_RNG used by
efi_rng_protocol - I don't know anything about efi... is this going to
be used by SPL?

Best Regards,

Tim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26 17:34         ` Tim Harvey
@ 2024-04-26 19:31           ` Heinrich Schuchardt
  0 siblings, 0 replies; 12+ messages in thread
From: Heinrich Schuchardt @ 2024-04-26 19:31 UTC (permalink / raw)
  To: Tim Harvey
  Cc: Marek Vasut, u-boot, Angelo Dureghello, Emanuele Ghidoli,
	Fabio Estevam, Gaurav Jain, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini

On 4/26/24 19:34, Tim Harvey wrote:
> On Fri, Apr 26, 2024 at 7:45 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> On 26.04.24 06:03, Marek Vasut wrote:
>>> On 4/26/24 2:16 AM, Tim Harvey wrote:
>>>
>>>>> diff --git a/drivers/crypto/fsl/Makefile b/drivers/crypto/fsl/Makefile
>>>>> index 7a2543e16cc..4fbce519a0b 100644
>>>>> --- a/drivers/crypto/fsl/Makefile
>>>>> +++ b/drivers/crypto/fsl/Makefile
>>>>> @@ -6,6 +6,6 @@ obj-y += sec.o
>>>>>    obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>>>>>    obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>>>>>    obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
>>>>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
>>>>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>>>>>    obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>>>>>    obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
>>>>> --
>>>>> 2.43.0
>>>>>
>>>>
>>>> Marek,
>>>
>>> Hi,
>>>
>>>> Thanks - this series does solve the issue I am seeing in the SPL when
>>>> enabling DM_RNG. Is this going to cause an issue for people who expect
>>>> it to be currently enabled and now have to manually enable it?
>>>
>>> That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem
>>> to be no users, so I don't think we need to worry here, right ?
>>>
>>> With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the
>>> users that enable DM_RNG, I am not seeing any obvious ones that would
>>> require SPL_DM_RNG too. What do you think ?
>>
>> Grepping for UCLASS_RNG should find usages.
>>
>> The only possible SPL usage seems to be in net/net_rand.h. Here a
>> fallback to the mac address as seed exists.
>>
>> Best regards
>>
>> Heinrich
>>
>
> Hi Heinrich,
>
> looks like its also used in lib/uuid.c by CONFIG_RANDOM_UUID and the
> few configs have CONFIG_RANDOM_UUID=y do not have DM_RNG=y so not an
> issue.
>
> srand_mac is used in:
> net/bootp.c which is CONFIG_CMD_BOOTP so not SPL
> net/dhcpv6.c which is CONIFG_CMD_DHCP6 so not in SPL
> net/net.c which is used by CONFIG_SPL_DM_ETH and the fallback you
> refer to but 'git grep DM_RNG=y configs/ | cut -d: -f1 | xargs grep
> SPL_DM_ETH' shows no results so I think this is ok right?
>
> but I also see lib/efi_loader/efi_rng.c where UCLASS_RNG used by
> efi_rng_protocol - I don't know anything about efi... is this going to
> be used by SPL?

UEFI is only relevant in main U-Boot. The EFI_RNG_PROTOCOL is used for
KASLR by Linux but you can boot without it.

Best regards

Heinrich


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [EXT] Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-26  4:03     ` Marek Vasut
  2024-04-26 14:39       ` Heinrich Schuchardt
@ 2024-04-29  9:02       ` Gaurav Jain
  2024-04-29 12:32         ` Marek Vasut
  1 sibling, 1 reply; 12+ messages in thread
From: Gaurav Jain @ 2024-04-29  9:02 UTC (permalink / raw)
  To: Marek Vasut, tharvey@gateworks.com
  Cc: u-boot@lists.denx.de, Angelo Dureghello, Emanuele Ghidoli,
	Fabio Estevam, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini, Ye Li,
	Varun Sethi, Kshitiz Varshney

Hi Marek

> -----Original Message-----
> From: Marek Vasut <marex@denx.de>
> Sent: Friday, April 26, 2024 9:33 AM
> To: tharvey@gateworks.com
> Cc: u-boot@lists.denx.de; Angelo Dureghello <angelo@kernel-space.org>;
> Emanuele Ghidoli <emanuele.ghidoli@toradex.com>; Fabio Estevam
> <festevam@gmail.com>; Gaurav Jain <gaurav.jain@nxp.com>; Heinrich
> Schuchardt <xypron.glpk@gmx.de>; Michal Simek <michal.simek@amd.com>;
> Simon Glass <sjg@chromium.org>; Stefan Roese <sr@denx.de>; Sughosh Ganu
> <sughosh.ganu@linaro.org>; Svyatoslav Ryhel <clamor95@gmail.com>; Tom Rini
> <trini@konsulko.com>
> Subject: [EXT] Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
> 
> Caution: This is an external email. Please take care when clicking links or opening
> attachments. When in doubt, report the message using the 'Report this email'
> button
> 
> 
> On 4/26/24 2:16 AM, Tim Harvey wrote:
> 
> >> diff --git a/drivers/crypto/fsl/Makefile
> >> b/drivers/crypto/fsl/Makefile index 7a2543e16cc..4fbce519a0b 100644
> >> --- a/drivers/crypto/fsl/Makefile
> >> +++ b/drivers/crypto/fsl/Makefile
> >> @@ -6,6 +6,6 @@ obj-y += sec.o
> >>   obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
> >>   obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
> >>   obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
> >> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
> >> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
> >>   obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
> >>   obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
> >> --
> >> 2.43.0
> >>
> >
> > Marek,
> 
> Hi,
> 
> > Thanks - this series does solve the issue I am seeing in the SPL when
> > enabling DM_RNG. Is this going to cause an issue for people who expect
> > it to be currently enabled and now have to manually enable it?
> 
> That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem to be no
> users, so I don't think we need to worry here, right ?
> 
> With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the users
> that enable DM_RNG, I am not seeing any obvious ones that would require
> SPL_DM_RNG too. What do you think ?

FSL_CAAM_RNG is enabled based on DM_RNG. This patch will disable the build of drivers/crypto/fsl/rng.c in SPL.

Regards
Gaurav Jain

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [EXT] Re: [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG
  2024-04-29  9:02       ` [EXT] " Gaurav Jain
@ 2024-04-29 12:32         ` Marek Vasut
  0 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2024-04-29 12:32 UTC (permalink / raw)
  To: Gaurav Jain, tharvey@gateworks.com
  Cc: u-boot@lists.denx.de, Angelo Dureghello, Emanuele Ghidoli,
	Fabio Estevam, Heinrich Schuchardt, Michal Simek, Simon Glass,
	Stefan Roese, Sughosh Ganu, Svyatoslav Ryhel, Tom Rini, Ye Li,
	Varun Sethi, Kshitiz Varshney

On 4/29/24 11:02 AM, Gaurav Jain wrote:

Hi,

>>>> diff --git a/drivers/crypto/fsl/Makefile
>>>> b/drivers/crypto/fsl/Makefile index 7a2543e16cc..4fbce519a0b 100644
>>>> --- a/drivers/crypto/fsl/Makefile
>>>> +++ b/drivers/crypto/fsl/Makefile
>>>> @@ -6,6 +6,6 @@ obj-y += sec.o
>>>>    obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
>>>>    obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
>>>>    obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
>>>> -obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
>>>> +obj-$(CONFIG_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
>>>>    obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
>>>>    obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
>>>> --
>>>> 2.43.0
>>>>
>>>
>>> Marek,
>>
>> Hi,
>>
>>> Thanks - this series does solve the issue I am seeing in the SPL when
>>> enabling DM_RNG. Is this going to cause an issue for people who expect
>>> it to be currently enabled and now have to manually enable it?
>>
>> That's a good question. If I do '$ git grep FSL_CAAM_RNG' , there seem to be no
>> users, so I don't think we need to worry here, right ?
>>
>> With SPL_DM_RNG i.e. 1/3 I am a bit more concerned. But, looking at the users
>> that enable DM_RNG, I am not seeing any obvious ones that would require
>> SPL_DM_RNG too. What do you think ?
> 
> FSL_CAAM_RNG is enabled based on DM_RNG. This patch will disable the build of drivers/crypto/fsl/rng.c in SPL.

Is that actually a problem for any supported platform ?
(that is what is being discussed in this thread already)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] rng: Introduce SPL_DM_RNG
  2024-04-25 23:02 [PATCH 1/3] rng: Introduce SPL_DM_RNG Marek Vasut
  2024-04-25 23:02 ` [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG Marek Vasut
  2024-04-25 23:02 ` [PATCH 3/3] crypto/fsl: Differentiate between CAAM and DCP in Kconfig entry Marek Vasut
@ 2024-05-05 19:12 ` Fabio Estevam
  2 siblings, 0 replies; 12+ messages in thread
From: Fabio Estevam @ 2024-05-05 19:12 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Angelo Dureghello, Emanuele Ghidoli, Gaurav Jain,
	Heinrich Schuchardt, Michal Simek, Simon Glass, Stefan Roese,
	Sughosh Ganu, Svyatoslav Ryhel, Tim Harvey, Tom Rini

On Thu, Apr 25, 2024 at 8:03 PM Marek Vasut <marex@denx.de> wrote:
>
> Add SPL variant of DM_RNG so that the DM_RNG can be disabled in SPL
> if necessary. This may be necessary due to e.g. size constraints of
> the SPL.
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Applied all, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-05-05 19:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 23:02 [PATCH 1/3] rng: Introduce SPL_DM_RNG Marek Vasut
2024-04-25 23:02 ` [PATCH 2/3] crypto/fsl: Introduce SPL_FSL_CAAM_RNG Marek Vasut
2024-04-26  0:16   ` Tim Harvey
2024-04-26  4:03     ` Marek Vasut
2024-04-26 14:39       ` Heinrich Schuchardt
2024-04-26 17:29         ` Marek Vasut
2024-04-26 17:34         ` Tim Harvey
2024-04-26 19:31           ` Heinrich Schuchardt
2024-04-29  9:02       ` [EXT] " Gaurav Jain
2024-04-29 12:32         ` Marek Vasut
2024-04-25 23:02 ` [PATCH 3/3] crypto/fsl: Differentiate between CAAM and DCP in Kconfig entry Marek Vasut
2024-05-05 19:12 ` [PATCH 1/3] rng: Introduce SPL_DM_RNG Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.