[PATCH v2] xen/arm: ffa: fix build with clang

Stewart Hildebrand posted 1 patch 3 weeks, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20250108164054.338799-1-stewart.hildebrand@amd.com
xen/arch/arm/tee/ffa.c         | 2 +-
xen/arch/arm/tee/ffa_private.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
[PATCH v2] xen/arm: ffa: fix build with clang
Posted by Stewart Hildebrand 3 weeks, 6 days ago
Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]
extern uint32_t __ro_after_init ffa_fw_version;
                ^

The variable ffa_fw_version is only used in ffa.c. Remove the
declaration in the header and make the definition in ffa.c static.

Fixes: 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
v1->v2:
* remove declaration and make definition static
---
 xen/arch/arm/tee/ffa.c         | 2 +-
 xen/arch/arm/tee/ffa_private.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 87775ed88ffd..3bbdd7168a6b 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -72,7 +72,7 @@
 #include "ffa_private.h"
 
 /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
-uint32_t __ro_after_init ffa_fw_version;
+static uint32_t __ro_after_init ffa_fw_version;
 
 /* Features supported by the SPMC or secure world when present */
 DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index d441c0ca5598..c4cd65538908 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -326,7 +326,6 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);

base-commit: 70f5a875becc9444a959830b10a361982c31a366
-- 
2.47.1
Re: [PATCH v2] xen/arm: ffa: fix build with clang
Posted by Oleksii Kurochko 3 weeks, 5 days ago
On 1/8/25 5:40 PM, Stewart Hildebrand wrote:
> Clang 16 reports:
>
> In file included from arch/arm/tee/ffa.c:72:
> arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]
> extern uint32_t __ro_after_init ffa_fw_version;
>                  ^
>
> The variable ffa_fw_version is only used in ffa.c. Remove the
> declaration in the header and make the definition in ffa.c static.
>
> Fixes: 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>

Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

> ---
> v1->v2:
> * remove declaration and make definition static
> ---
>   xen/arch/arm/tee/ffa.c         | 2 +-
>   xen/arch/arm/tee/ffa_private.h | 1 -
>   2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
> index 87775ed88ffd..3bbdd7168a6b 100644
> --- a/xen/arch/arm/tee/ffa.c
> +++ b/xen/arch/arm/tee/ffa.c
> @@ -72,7 +72,7 @@
>   #include "ffa_private.h"
>   
>   /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
> -uint32_t __ro_after_init ffa_fw_version;
> +static uint32_t __ro_after_init ffa_fw_version;
>   
>   /* Features supported by the SPMC or secure world when present */
>   DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
> diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
> index d441c0ca5598..c4cd65538908 100644
> --- a/xen/arch/arm/tee/ffa_private.h
> +++ b/xen/arch/arm/tee/ffa_private.h
> @@ -326,7 +326,6 @@ extern void *ffa_rx;
>   extern void *ffa_tx;
>   extern spinlock_t ffa_rx_buffer_lock;
>   extern spinlock_t ffa_tx_buffer_lock;
> -extern uint32_t __ro_after_init ffa_fw_version;
>   extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
>   
>   bool ffa_shm_domain_destroy(struct domain *d);
>
> base-commit: 70f5a875becc9444a959830b10a361982c31a366
Re: [PATCH v2] xen/arm: ffa: fix build with clang
Posted by Bertrand Marquis 3 weeks, 6 days ago
Hi Stewart,

> On 8 Jan 2025, at 17:40, Stewart Hildebrand <Stewart.Hildebrand@amd.com> wrote:
> 
> Clang 16 reports:
> 
> In file included from arch/arm/tee/ffa.c:72:
> arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]
> extern uint32_t __ro_after_init ffa_fw_version;
>                ^
> 
> The variable ffa_fw_version is only used in ffa.c. Remove the
> declaration in the header and make the definition in ffa.c static.
> 
> Fixes: 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>

Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> v1->v2:
> * remove declaration and make definition static
> ---
> xen/arch/arm/tee/ffa.c         | 2 +-
> xen/arch/arm/tee/ffa_private.h | 1 -
> 2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
> index 87775ed88ffd..3bbdd7168a6b 100644
> --- a/xen/arch/arm/tee/ffa.c
> +++ b/xen/arch/arm/tee/ffa.c
> @@ -72,7 +72,7 @@
> #include "ffa_private.h"
> 
> /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
> -uint32_t __ro_after_init ffa_fw_version;
> +static uint32_t __ro_after_init ffa_fw_version;
> 
> /* Features supported by the SPMC or secure world when present */
> DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
> diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
> index d441c0ca5598..c4cd65538908 100644
> --- a/xen/arch/arm/tee/ffa_private.h
> +++ b/xen/arch/arm/tee/ffa_private.h
> @@ -326,7 +326,6 @@ extern void *ffa_rx;
> extern void *ffa_tx;
> extern spinlock_t ffa_rx_buffer_lock;
> extern spinlock_t ffa_tx_buffer_lock;
> -extern uint32_t __ro_after_init ffa_fw_version;
> extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
> 
> bool ffa_shm_domain_destroy(struct domain *d);
> 
> base-commit: 70f5a875becc9444a959830b10a361982c31a366
> -- 
> 2.47.1
>