linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmem: stm32: fix OPTEE dependency
@ 2023-01-27  9:41 Arnd Bergmann
  2023-01-27 10:43 ` Srinivas Kandagatla
  2023-02-01 12:49 ` Patrick DELAUNAY
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-01-27  9:41 UTC (permalink / raw)
  To: Srinivas Kandagatla, Etienne Carriere, Patrick Delaunay
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The stm32 nvmem driver fails to link as built-in when OPTEE
is a loadable module:

aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
stm32-bsec-optee-ta.c:(.text+0xc8): undefined reference to `tee_client_open_session'
aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
stm32-bsec-optee-ta.c:(.text+0x1fc): undefined reference to `tee_client_open_context'

Change the CONFIG_NVMEM_STM32_ROMEM definition so it can only
be built-in if OPTEE is either built-in or disabled, and
make NVMEM_STM32_BSEC_OPTEE_TA a hidden symbol instead.

Fixes: acdf68bdf2d4 ("nvmem: stm32: add OP-TEE support for STM32MP13x")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/nvmem/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index ed8ef7460be2..ae2c5257ed97 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -295,8 +295,7 @@ config NVMEM_SPRD_EFUSE
 	  will be called nvmem-sprd-efuse.
 
 config NVMEM_STM32_BSEC_OPTEE_TA
-	bool "STM32MP BSEC OP-TEE TA support for nvmem-stm32-romem driver"
-	depends on OPTEE
+	def_bool NVMEM_STM32_ROMEM && OPTEE
 	help
 	  Say y here to enable the accesses to STM32MP SoC OTPs by the OP-TEE
 	  trusted application STM32MP BSEC.
@@ -307,7 +306,7 @@ config NVMEM_STM32_BSEC_OPTEE_TA
 config NVMEM_STM32_ROMEM
 	tristate "STMicroelectronics STM32 factory-programmed memory support"
 	depends on ARCH_STM32 || COMPILE_TEST
-	imply NVMEM_STM32_BSEC_OPTEE_TA
+	depends on OPTEE || !OPTEE
 	help
 	  Say y here to enable read-only access for STMicroelectronics STM32
 	  factory-programmed memory area.
-- 
2.39.0


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

* Re: [PATCH] nvmem: stm32: fix OPTEE dependency
  2023-01-27  9:41 [PATCH] nvmem: stm32: fix OPTEE dependency Arnd Bergmann
@ 2023-01-27 10:43 ` Srinivas Kandagatla
  2023-02-01 12:49 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2023-01-27 10:43 UTC (permalink / raw)
  To: Arnd Bergmann, Etienne Carriere, Patrick Delaunay
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel



On 27/01/2023 09:41, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The stm32 nvmem driver fails to link as built-in when OPTEE
> is a loadable module:
> 
> aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
> stm32-bsec-optee-ta.c:(.text+0xc8): undefined reference to `tee_client_open_session'
> aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
> stm32-bsec-optee-ta.c:(.text+0x1fc): undefined reference to `tee_client_open_context'
> 
> Change the CONFIG_NVMEM_STM32_ROMEM definition so it can only
> be built-in if OPTEE is either built-in or disabled, and
> make NVMEM_STM32_BSEC_OPTEE_TA a hidden symbol instead.
> 
> Fixes: acdf68bdf2d4 ("nvmem: stm32: add OP-TEE support for STM32MP13x")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

thanks Anrd,

Applied thanks

--srini
>   drivers/nvmem/Kconfig | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> index ed8ef7460be2..ae2c5257ed97 100644
> --- a/drivers/nvmem/Kconfig
> +++ b/drivers/nvmem/Kconfig
> @@ -295,8 +295,7 @@ config NVMEM_SPRD_EFUSE
>   	  will be called nvmem-sprd-efuse.
>   
>   config NVMEM_STM32_BSEC_OPTEE_TA
> -	bool "STM32MP BSEC OP-TEE TA support for nvmem-stm32-romem driver"
> -	depends on OPTEE
> +	def_bool NVMEM_STM32_ROMEM && OPTEE
>   	help
>   	  Say y here to enable the accesses to STM32MP SoC OTPs by the OP-TEE
>   	  trusted application STM32MP BSEC.
> @@ -307,7 +306,7 @@ config NVMEM_STM32_BSEC_OPTEE_TA
>   config NVMEM_STM32_ROMEM
>   	tristate "STMicroelectronics STM32 factory-programmed memory support"
>   	depends on ARCH_STM32 || COMPILE_TEST
> -	imply NVMEM_STM32_BSEC_OPTEE_TA
> +	depends on OPTEE || !OPTEE
>   	help
>   	  Say y here to enable read-only access for STMicroelectronics STM32
>   	  factory-programmed memory area.

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

* Re: [PATCH] nvmem: stm32: fix OPTEE dependency
  2023-01-27  9:41 [PATCH] nvmem: stm32: fix OPTEE dependency Arnd Bergmann
  2023-01-27 10:43 ` Srinivas Kandagatla
@ 2023-02-01 12:49 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick DELAUNAY @ 2023-02-01 12:49 UTC (permalink / raw)
  To: Arnd Bergmann, Srinivas Kandagatla, Etienne Carriere
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel

Hi

On 1/27/23 10:41, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The stm32 nvmem driver fails to link as built-in when OPTEE
> is a loadable module:
>
> aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
> stm32-bsec-optee-ta.c:(.text+0xc8): undefined reference to `tee_client_open_session'
> aarch64-linux-ld: drivers/nvmem/stm32-bsec-optee-ta.o: in function `stm32_bsec:
> stm32-bsec-optee-ta.c:(.text+0x1fc): undefined reference to `tee_client_open_context'
>
> Change the CONFIG_NVMEM_STM32_ROMEM definition so it can only
> be built-in if OPTEE is either built-in or disabled, and
> make NVMEM_STM32_BSEC_OPTEE_TA a hidden symbol instead.
>
> Fixes: acdf68bdf2d4 ("nvmem: stm32: add OP-TEE support for STM32MP13x")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/nvmem/Kconfig | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> index ed8ef7460be2..ae2c5257ed97 100644
> --- a/drivers/nvmem/Kconfig
> +++ b/drivers/nvmem/Kconfig
> @@ -295,8 +295,7 @@ config NVMEM_SPRD_EFUSE
>   	  will be called nvmem-sprd-efuse.
>   
>   config NVMEM_STM32_BSEC_OPTEE_TA
> -	bool "STM32MP BSEC OP-TEE TA support for nvmem-stm32-romem driver"
> -	depends on OPTEE
> +	def_bool NVMEM_STM32_ROMEM && OPTEE
>   	help
>   	  Say y here to enable the accesses to STM32MP SoC OTPs by the OP-TEE
>   	  trusted application STM32MP BSEC.
> @@ -307,7 +306,7 @@ config NVMEM_STM32_BSEC_OPTEE_TA
>   config NVMEM_STM32_ROMEM
>   	tristate "STMicroelectronics STM32 factory-programmed memory support"
>   	depends on ARCH_STM32 || COMPILE_TEST
> -	imply NVMEM_STM32_BSEC_OPTEE_TA
> +	depends on OPTEE || !OPTEE
>   	help
>   	  Say y here to enable read-only access for STMicroelectronics STM32
>   	  factory-programmed memory area.


Thanks for the fix,


I test several case....

  at least the logical configurations:

OP-TEE=n and NVMEM_STM32_ROMEM=m

OP-TEE=y and NVMEM_STM32_ROMEM=m

OP-TEE=n and NVMEM_STM32_ROMEM=y

OP-TEE=y and NVMEM_STM32_ROMEM=y


but I miss this case

OP-TEE=m and NVMEM_STM32_ROMEM=y




Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick





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

end of thread, other threads:[~2023-02-01 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27  9:41 [PATCH] nvmem: stm32: fix OPTEE dependency Arnd Bergmann
2023-01-27 10:43 ` Srinivas Kandagatla
2023-02-01 12:49 ` Patrick DELAUNAY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).