[PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h

Alejandro Vallejo posted 19 patches 5 months ago
There is a newer version of this series
[PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h
Posted by Alejandro Vallejo 5 months ago
... as they can be forward-declared changing arrays for pointers in the function
declarations.

No functional change.

Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
---
 xen/arch/arm/include/asm/setup.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 6cf272c160..0f9e531a34 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -3,7 +3,6 @@
 
 #include <public/version.h>
 #include <asm/p2m.h>
-#include <xen/bootfdt.h>
 #include <xen/device_tree.h>
 
 #if defined(CONFIG_MMU)
@@ -14,6 +13,9 @@
 
 #define MAX_FDT_SIZE SZ_2M
 
+struct membank;
+struct membanks;
+
 struct map_range_data
 {
     struct domain *d;
@@ -32,13 +34,13 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
 size_t estimate_efi_size(unsigned int mem_nr_banks);
 
 void acpi_create_efi_system_table(struct domain *d,
-                                  struct membank tbl_add[]);
+                                  struct membank *tbl_add);
 
 void acpi_create_efi_mmap_table(struct domain *d,
                                 const struct membanks *mem,
-                                struct membank tbl_add[]);
+                                struct membank *tbl_add);
 
-int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
+int acpi_make_efi_nodes(void *fdt, struct membank *tbl_add);
 
 void create_dom0(void);
 
-- 
2.43.0
Re: [PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h
Posted by Stefano Stabellini 5 months ago
On Fri, 30 May 2025, Alejandro Vallejo wrote:
> ... as they can be forward-declared changing arrays for pointers in the function
> declarations.
> 
> No functional change.
> 
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
> ---
>  xen/arch/arm/include/asm/setup.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
> index 6cf272c160..0f9e531a34 100644
> --- a/xen/arch/arm/include/asm/setup.h
> +++ b/xen/arch/arm/include/asm/setup.h
> @@ -3,7 +3,6 @@
>  
>  #include <public/version.h>
>  #include <asm/p2m.h>
> -#include <xen/bootfdt.h>
>  #include <xen/device_tree.h>

This change breaks the build on ARM:

  CC      xsm/xsm_policy.o
xsm/xsm_policy.c: In function ‘xsm_dt_policy_init’:
xsm/xsm_policy.c:71:30: error: implicit declaration of function ‘boot_module_find_by_kind’ [-Werror=implicit-function-declaration]
   71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
xsm/xsm_policy.c:71:30: error: nested extern declaration of ‘boot_module_find_by_kind’ [-Werror=nested-externs]
xsm/xsm_policy.c:71:55: error: ‘BOOTMOD_XSM’ undeclared (first use in this function)
   71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
      |                                                       ^~~~~~~~~~~
xsm/xsm_policy.c:71:55: note: each undeclared identifier is reported only once for each function it appears in
xsm/xsm_policy.c:74:22: error: dereferencing pointer to incomplete type ‘struct bootmodule’
   74 |     if ( !mod || !mod->size )
      |                      ^~
cc1: all warnings being treated as errors
make[2]: *** [Rules.mk:249: xsm/xsm_policy.o] Error 1
make[1]: *** [build.mk:72: xsm] Error 2
make: *** [Makefile:619: xen] Error 2

The rest looks OK


>  #if defined(CONFIG_MMU)
> @@ -14,6 +13,9 @@
>  
>  #define MAX_FDT_SIZE SZ_2M
>  
> +struct membank;
> +struct membanks;
> +
>  struct map_range_data
>  {
>      struct domain *d;
> @@ -32,13 +34,13 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
>  size_t estimate_efi_size(unsigned int mem_nr_banks);
>  
>  void acpi_create_efi_system_table(struct domain *d,
> -                                  struct membank tbl_add[]);
> +                                  struct membank *tbl_add);
>  
>  void acpi_create_efi_mmap_table(struct domain *d,
>                                  const struct membanks *mem,
> -                                struct membank tbl_add[]);
> +                                struct membank *tbl_add);
>  
> -int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
> +int acpi_make_efi_nodes(void *fdt, struct membank *tbl_add);
>  
>  void create_dom0(void);
>  
> -- 
> 2.43.0
> 
Re: [PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h
Posted by Alejandro Vallejo 4 months, 3 weeks ago
On Sat May 31, 2025 at 2:51 AM CEST, Stefano Stabellini wrote:
> On Fri, 30 May 2025, Alejandro Vallejo wrote:
>> ... as they can be forward-declared changing arrays for pointers in the function
>> declarations.
>> 
>> No functional change.
>> 
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>>  xen/arch/arm/include/asm/setup.h | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
>> index 6cf272c160..0f9e531a34 100644
>> --- a/xen/arch/arm/include/asm/setup.h
>> +++ b/xen/arch/arm/include/asm/setup.h
>> @@ -3,7 +3,6 @@
>>  
>>  #include <public/version.h>
>>  #include <asm/p2m.h>
>> -#include <xen/bootfdt.h>
>>  #include <xen/device_tree.h>
>
> This change breaks the build on ARM:
>
>   CC      xsm/xsm_policy.o
> xsm/xsm_policy.c: In function ‘xsm_dt_policy_init’:
> xsm/xsm_policy.c:71:30: error: implicit declaration of function ‘boot_module_find_by_kind’ [-Werror=implicit-function-declaration]
>    71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
>       |                              ^~~~~~~~~~~~~~~~~~~~~~~~
> xsm/xsm_policy.c:71:30: error: nested extern declaration of ‘boot_module_find_by_kind’ [-Werror=nested-externs]
> xsm/xsm_policy.c:71:55: error: ‘BOOTMOD_XSM’ undeclared (first use in this function)
>    71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
>       |                                                       ^~~~~~~~~~~
> xsm/xsm_policy.c:71:55: note: each undeclared identifier is reported only once for each function it appears in
> xsm/xsm_policy.c:74:22: error: dereferencing pointer to incomplete type ‘struct bootmodule’
>    74 |     if ( !mod || !mod->size )
>       |                      ^~
> cc1: all warnings being treated as errors
> make[2]: *** [Rules.mk:249: xsm/xsm_policy.o] Error 1
> make[1]: *** [build.mk:72: xsm] Error 2
> make: *** [Makefile:619: xen] Error 2
>
> The rest looks OK

I see what goes on now. Later on the header shuffling fixes this breakage (somehow).

This is very much non-essential. I'll drop it for now and have another crack
later on after the patches I do care most about get through.

Cheers,
Alejandro
Re: [PATCH 05/19] arm: Remove dependencies with membank(s) definitions from setup.h
Posted by Alejandro Vallejo 5 months ago
On Sat May 31, 2025 at 2:51 AM CEST, Stefano Stabellini wrote:
> On Fri, 30 May 2025, Alejandro Vallejo wrote:
>> ... as they can be forward-declared changing arrays for pointers in the function
>> declarations.
>> 
>> No functional change.
>> 
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>>  xen/arch/arm/include/asm/setup.h | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
>> index 6cf272c160..0f9e531a34 100644
>> --- a/xen/arch/arm/include/asm/setup.h
>> +++ b/xen/arch/arm/include/asm/setup.h
>> @@ -3,7 +3,6 @@
>>  
>>  #include <public/version.h>
>>  #include <asm/p2m.h>
>> -#include <xen/bootfdt.h>
>>  #include <xen/device_tree.h>
>
> This change breaks the build on ARM:
>
>   CC      xsm/xsm_policy.o
> xsm/xsm_policy.c: In function ‘xsm_dt_policy_init’:
> xsm/xsm_policy.c:71:30: error: implicit declaration of function ‘boot_module_find_by_kind’ [-Werror=implicit-function-declaration]
>    71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
>       |                              ^~~~~~~~~~~~~~~~~~~~~~~~
> xsm/xsm_policy.c:71:30: error: nested extern declaration of ‘boot_module_find_by_kind’ [-Werror=nested-externs]
> xsm/xsm_policy.c:71:55: error: ‘BOOTMOD_XSM’ undeclared (first use in this function)
>    71 |     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_XSM);
>       |                                                       ^~~~~~~~~~~
> xsm/xsm_policy.c:71:55: note: each undeclared identifier is reported only once for each function it appears in
> xsm/xsm_policy.c:74:22: error: dereferencing pointer to incomplete type ‘struct bootmodule’
>    74 |     if ( !mod || !mod->size )
>       |                      ^~
> cc1: all warnings being treated as errors
> make[2]: *** [Rules.mk:249: xsm/xsm_policy.o] Error 1
> make[1]: *** [build.mk:72: xsm] Error 2
> make: *** [Makefile:619: xen] Error 2
>
> The rest looks OK

Ugh. The series passed regular CI, but it must not have had XSM compiled-in. I'll
sort that out and re-send.

Cheers,
Alejandro