Hi Jacob,

I guess the issue is fixed for your platform by removing gicv2 inclusion (supposedly your platform is gicv3 based).

Coming back to context mgmt library issue you pointed out earlier,  the change you suggested does make sense as we save/restore few of the gicv3 EL2 registers only if multiple EL2 components(CTX_INCLUDE_EL2_REGS) are present.
In an ideal world we could get rid of any IP specific registers save/restores from generic context mgmt library and create hooks which can be invoked by generic code. In the master branch i have recently introduced a function just for GIC save resotre "el2_sysregs_context_save_gic()" but it is still in context_mgmt.c file.

Feel free to post your patch.

Thanks
Manish


From: Jacob Kroon via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 18 April 2024 08:03
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: [TF-A] Re: gicv2.h vs gicv3.h conflict
 
We think the issue is that our platform_def.h included drivers/arm/gicv2.h, that looks wrong.

Jacob

On Thu, Apr 18, 2024 at 8:30 AM Jacob Kroon <jacob.kroon@gmail.com> wrote:
Hi,

I'm upgrading the ATF I use from 2.4 to 2.8, and ran into a header conflict. The change

  https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/13806

introduced an inclusion of

  include/drivers/arm/gicv3.h

in lib/el3_runtime/aarch64/context_mgmt.c, but in my build environment that .c file also includes

  include/drivers/arm/gicv2.h

so now I get macro redefinition of "INT_ID_MASK" errors when compiling. Is it an error, that in my build environment the gicv2.h gets included ?

I've solved it locally by doing:

diff --git a/lib/el3_runtime/aarch64/context_mgmt.c b/lib/el3_runtime/aarch64/context_mgmt.c
index 866ac4154..395635a86 100644
--- a/lib/el3_runtime/aarch64/context_mgmt.c
+++ b/lib/el3_runtime/aarch64/context_mgmt.c
@@ -18,7 +18,9 @@
 #include <common/bl_common.h>
 #include <common/debug.h>
 #include <context.h>
+#if CTX_INCLUDE_EL2_REGS
 #include <drivers/arm/gicv3.h>
+#endif
 #include <lib/el3_runtime/context_mgmt.h>
 #include <lib/el3_runtime/pubsub_events.h>
 #include <lib/extensions/amu.h>

but I am not sure whether this is the correct fix or not, or if I am doing something else wrong here. Any suggestions on what would be the correct fix ?

Regards
Jacob