diff mbox series

[v3,07/10] xen/arm: gate make_gicv3_domU_node with CONFIG_GICV3

Message ID 20211116063155.901183-8-penny.zheng@arm.com (mailing list archive)
State Superseded
Headers show
Series direct-map memory map | expand

Commit Message

Penny Zheng Nov. 16, 2021, 6:31 a.m. UTC
This commit gates function make_gicv3_domU_node with CONFIG_GICV3, and
also adds ASSERT_UNREACHABLE to catch any misuse.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
v3 changes:
- new commit
---
 xen/arch/arm/domain_build.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Julien Grall Nov. 24, 2021, 6:11 p.m. UTC | #1
Hi Penny,

On 16/11/2021 06:31, Penny Zheng wrote:
> This commit gates function make_gicv3_domU_node with CONFIG_GICV3, and
> also adds ASSERT_UNREACHABLE to catch any misuse.
> 
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> ---
> v3 changes:
> - new commit
> ---
>   xen/arch/arm/domain_build.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index c419a4b2cc..24f3edf069 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2279,6 +2279,7 @@ static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
>       return res;
>   }
>   
> +#ifdef CONFIG_GICV3
>   static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
>   {
>       void *fdt = kinfo->fdt;
> @@ -2328,6 +2329,12 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
>   
>       return res;
>   }
> +#else
> +static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
> +{
> +    ASSERT_UNREACHABLE();

This will break compilation on at least prod build with CONFIG_GICV3=n. 
However...

> +}
> +#endif

... I would prefer to #ifdef the case (as you did in the previous 
version). That said, if you strongly prefer this approach then I am OK 
with it.

>   
>   static int __init make_gic_domU_node(struct kernel_info *kinfo)
>   {
> 

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c419a4b2cc..24f3edf069 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2279,6 +2279,7 @@  static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
     return res;
 }
 
+#ifdef CONFIG_GICV3
 static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
 {
     void *fdt = kinfo->fdt;
@@ -2328,6 +2329,12 @@  static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
 
     return res;
 }
+#else
+static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
+{
+    ASSERT_UNREACHABLE();
+}
+#endif
 
 static int __init make_gic_domU_node(struct kernel_info *kinfo)
 {