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

Dmytro Prokopchuk1 posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/581a0752a1af3775fb676a70c4f42e7fb958dadc.1776758025.git.dmytro._5Fprokopchuk1@epam.com
xen/arch/arm/tee/ffa_private.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] xen/arm: ffa: fix build with clang/ATfE
Posted by Dmytro Prokopchuk1 2 weeks ago
Clang 22.x.x or Arm Toolchain for Embedded 22.x.x reports:

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

There is a fix for clang 16 in the git history:
a1a1e2b7dc4f ("xen/arm: ffa: fix build with clang")
which was broken by the following commit:
a90376c6adbc ("xen/arm: ffa: Add FF-A 1.2 endpoint memory access descriptors")

Remove __ro_after_init from the extern declaration of ffa_fw_version.
The attribute is already present on the definition in ffa.c, which is
sufficient and correct.

Fixes: a90376c6adbc ("xen/arm: ffa: Add FF-A 1.2 endpoint memory access descriptors")
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2467446333
---
 xen/arch/arm/tee/ffa_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index c291f32b56..e16bc0d83d 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -436,7 +436,7 @@ struct ffa_ctx {
 };
 
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 
 extern struct list_head ffa_ctx_head;
 extern rwlock_t ffa_ctx_list_rwlock;
-- 
2.43.0
Re: [PATCH] xen/arm: ffa: fix build with clang/ATfE
Posted by Bertrand Marquis 1 week, 6 days ago
Hi Dmytro,

> On 21 Apr 2026, at 10:13, Dmytro Prokopchuk1 <dmytro_prokopchuk1@epam.com> wrote:
> 
> Clang 22.x.x or Arm Toolchain for Embedded 22.x.x reports:
> 
> In file included from arch/arm/tee/ffa.c:75:
> arch/arm/tee/ffa_private.h:439:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]
>  439 | extern uint32_t __ro_after_init ffa_fw_version;
>      |                 ^
> 
> There is a fix for clang 16 in the git history:
> a1a1e2b7dc4f ("xen/arm: ffa: fix build with clang")
> which was broken by the following commit:
> a90376c6adbc ("xen/arm: ffa: Add FF-A 1.2 endpoint memory access descriptors")
> 
> Remove __ro_after_init from the extern declaration of ffa_fw_version.
> The attribute is already present on the definition in ffa.c, which is
> sufficient and correct.
> 
> Fixes: a90376c6adbc ("xen/arm: ffa: Add FF-A 1.2 endpoint memory access descriptors")
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>

Sounds right to me:

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

Cheers
Bertrand

> ---
> Test CI pipeline:
> https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2467446333
> ---
> xen/arch/arm/tee/ffa_private.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
> index c291f32b56..e16bc0d83d 100644
> --- a/xen/arch/arm/tee/ffa_private.h
> +++ b/xen/arch/arm/tee/ffa_private.h
> @@ -436,7 +436,7 @@ struct ffa_ctx {
> };
> 
> extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
> -extern uint32_t __ro_after_init ffa_fw_version;
> +extern uint32_t ffa_fw_version;
> 
> extern struct list_head ffa_ctx_head;
> extern rwlock_t ffa_ctx_list_rwlock;
> -- 
> 2.43.0