diff mbox series

xen/acpi: Allow xen/acpi.h to be included on non-ACPI archs

Message ID 20240405182031.396528-1-sanastasio@raptorengineering.com (mailing list archive)
State New, archived
Headers show
Series xen/acpi: Allow xen/acpi.h to be included on non-ACPI archs | expand

Commit Message

Shawn Anastasio April 5, 2024, 6:20 p.m. UTC
Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
that the header can be included on architectures without ACPI support,
like ppc.

This change revealed some missing #includes across the ARM tree, so fix
those as well.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/arm/arm32/mmu/mm.c     | 1 +
 xen/arch/arm/arm64/smpboot.c    | 3 ++-
 xen/arch/arm/domain_build.c     | 1 -
 xen/arch/arm/gic-v2.c           | 1 -
 xen/arch/arm/gic-v3.c           | 2 --
 xen/arch/arm/include/asm/acpi.h | 1 -
 xen/arch/arm/mmu/setup.c        | 1 +
 xen/arch/arm/psci.c             | 1 +
 xen/arch/arm/smpboot.c          | 1 +
 xen/arch/arm/traps.c            | 3 ++-
 xen/common/sched/boot-cpupool.c | 2 +-
 xen/include/xen/acpi.h          | 8 ++++++--
 12 files changed, 15 insertions(+), 10 deletions(-)

Comments

Jan Beulich April 8, 2024, 6:54 a.m. UTC | #1
On 05.04.2024 20:20, Shawn Anastasio wrote:
> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
> that the header can be included on architectures without ACPI support,
> like ppc.
> 
> This change revealed some missing #includes across the ARM tree, so fix
> those as well.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
albeit preferably with ...

> @@ -118,6 +121,7 @@ extern u32 pci_mmcfg_base_addr;
>  #else	/*!CONFIG_ACPI*/
>  
>  #define acpi_mp_config	0
> +#define acpi_disabled (true)

... the unnecessary parentheses avoided here.

Jan
Michal Orzel April 9, 2024, 8:01 a.m. UTC | #2
Hi Shawn,

On 05/04/2024 20:20, Shawn Anastasio wrote:
> 
> 
> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
> that the header can be included on architectures without ACPI support,
> like ppc.
> 
> This change revealed some missing #includes across the ARM tree, so fix
> those as well.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
Shawn Anastasio April 9, 2024, 10:16 p.m. UTC | #3
On 4/8/24 1:54 AM, Jan Beulich wrote:
> On 05.04.2024 20:20, Shawn Anastasio wrote:
>> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
>> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
>> that the header can be included on architectures without ACPI support,
>> like ppc.
>>
>> This change revealed some missing #includes across the ARM tree, so fix
>> those as well.
>>
>> Suggested-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks.

> albeit preferably with ...
> 
>> @@ -118,6 +121,7 @@ extern u32 pci_mmcfg_base_addr;
>>  #else	/*!CONFIG_ACPI*/
>>  
>>  #define acpi_mp_config	0
>> +#define acpi_disabled (true)
> 
> ... the unnecessary parentheses avoided here.
>

If you'd like to handle this durring commit, that would be fine with me.
Otherwise let me know if you'd like a v2 to be sent.

> Jan

Thanks,
Shawn
Andrew Cooper April 11, 2024, 12:05 p.m. UTC | #4
On 09/04/2024 11:16 pm, Shawn Anastasio wrote:
> On 4/8/24 1:54 AM, Jan Beulich wrote:
>> On 05.04.2024 20:20, Shawn Anastasio wrote:
>>> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
>>> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
>>> that the header can be included on architectures without ACPI support,
>>> like ppc.
>>>
>>> This change revealed some missing #includes across the ARM tree, so fix
>>> those as well.
>>>
>>> Suggested-by: Jan Beulich <jbeulich@suse.com>
>>> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
> Thanks.
>
>> albeit preferably with ...
>>
>>> @@ -118,6 +121,7 @@ extern u32 pci_mmcfg_base_addr;
>>>  #else	/*!CONFIG_ACPI*/
>>>  
>>>  #define acpi_mp_config	0
>>> +#define acpi_disabled (true)
>> ... the unnecessary parentheses avoided here.
>>
> If you'd like to handle this durring commit, that would be fine with me.
> Otherwise let me know if you'd like a v2 to be sent.

I've fixed on commit.  No need to send a v2.

Thanks.

~Andrew
Andrew Cooper April 11, 2024, 1:15 p.m. UTC | #5
On 05/04/2024 7:20 pm, Shawn Anastasio wrote:
> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
> that the header can be included on architectures without ACPI support,
> like ppc.
>
> This change revealed some missing #includes across the ARM tree, so fix
> those as well.
>
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
> ---
>  xen/arch/arm/arm32/mmu/mm.c     | 1 +
>  xen/arch/arm/arm64/smpboot.c    | 3 ++-
>  xen/arch/arm/domain_build.c     | 1 -
>  xen/arch/arm/gic-v2.c           | 1 -
>  xen/arch/arm/gic-v3.c           | 2 --
>  xen/arch/arm/include/asm/acpi.h | 1 -
>  xen/arch/arm/mmu/setup.c        | 1 +
>  xen/arch/arm/psci.c             | 1 +
>  xen/arch/arm/smpboot.c          | 1 +
>  xen/arch/arm/traps.c            | 3 ++-
>  xen/common/sched/boot-cpupool.c | 2 +-
>  xen/include/xen/acpi.h          | 8 ++++++--
>  12 files changed, 15 insertions(+), 10 deletions(-)


Pre-push testing found a randconfig error caused by this: 
https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/6602857882

Henry diagnosed this as "arm asm/acpi.h includes the arm asm/setup.h
then asm/p2m.h then finally asm/current.h".

pt.c uses smp_processor_id() explicitly, so should include
asm/current.h.  I've folded the following delta in to fix the issue,

diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c
index a7755728aeda..da28d669e796 100644
--- a/xen/arch/arm/mmu/pt.c
+++ b/xen/arch/arm/mmu/pt.c
@@ -11,6 +11,7 @@
 #include <xen/sizes.h>
 #include <xen/vmap.h>
 
+#include <asm/current.h>
 #include <asm/fixmap.h>
 
 #ifdef NDEBUG


But I suspect this may not be the only instance.

~Andrew
Henry Wang April 11, 2024, 1:24 p.m. UTC | #6
Hi Andrew,

On 4/11/2024 9:15 PM, Andrew Cooper wrote:
> On 05/04/2024 7:20 pm, Shawn Anastasio wrote:
>> Conditionalize xen/acpi.h's inclusion of acpi/acpi.h and asm/acpi.h on
>> CONFIG_ACPI and import ARM's !CONFIG_ACPI stub for acpi_disabled() so
>> that the header can be included on architectures without ACPI support,
>> like ppc.
>>
>> This change revealed some missing #includes across the ARM tree, so fix
>> those as well.
>>
>> Suggested-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
>> ---
>>   xen/arch/arm/arm32/mmu/mm.c     | 1 +
>>   xen/arch/arm/arm64/smpboot.c    | 3 ++-
>>   xen/arch/arm/domain_build.c     | 1 -
>>   xen/arch/arm/gic-v2.c           | 1 -
>>   xen/arch/arm/gic-v3.c           | 2 --
>>   xen/arch/arm/include/asm/acpi.h | 1 -
>>   xen/arch/arm/mmu/setup.c        | 1 +
>>   xen/arch/arm/psci.c             | 1 +
>>   xen/arch/arm/smpboot.c          | 1 +
>>   xen/arch/arm/traps.c            | 3 ++-
>>   xen/common/sched/boot-cpupool.c | 2 +-
>>   xen/include/xen/acpi.h          | 8 ++++++--
>>   12 files changed, 15 insertions(+), 10 deletions(-)
>
> Pre-push testing found a randconfig error caused by this:
> https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/6602857882
>
> Henry diagnosed this as "arm asm/acpi.h includes the arm asm/setup.h
> then asm/p2m.h then finally asm/current.h".
>
> pt.c uses smp_processor_id() explicitly, so should include
> asm/current.h.  I've folded the following delta in to fix the issue,

I tried to build with below diff locally and confirm below diff will fix 
the build error reported by the randconfig job of gitlab-ci.

Kind regards,
Henry

> diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c
> index a7755728aeda..da28d669e796 100644
> --- a/xen/arch/arm/mmu/pt.c
> +++ b/xen/arch/arm/mmu/pt.c
> @@ -11,6 +11,7 @@
>   #include <xen/sizes.h>
>   #include <xen/vmap.h>
>   
> +#include <asm/current.h>
>   #include <asm/fixmap.h>
>   
>   #ifdef NDEBUG
>
>
> But I suspect this may not be the only instance.
>
> ~Andrew
>
diff mbox series

Patch

diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index cb441ca87c..0ab6ae52a6 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -3,6 +3,7 @@ 
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/libfdt/libfdt-xen.h>
+#include <xen/mm.h>
 #include <xen/param.h>
 #include <xen/pfn.h>
 #include <asm/fixmap.h>
diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
index bf81d018b3..a225fae64d 100644
--- a/xen/arch/arm/arm64/smpboot.c
+++ b/xen/arch/arm/arm64/smpboot.c
@@ -1,4 +1,6 @@ 
+#include <xen/acpi.h>
 #include <xen/cpu.h>
+#include <xen/device_tree.h>
 #include <xen/lib.h>
 #include <xen/init.h>
 #include <xen/errno.h>
@@ -7,7 +9,6 @@ 
 #include <xen/vmap.h>
 #include <asm/io.h>
 #include <asm/psci.h>
-#include <asm/acpi.h>
 
 struct smp_enable_ops {
         int             (*prepare_cpu)(int cpu);
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 085d88671e..54232ed4cb 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -18,7 +18,6 @@ 
 #include <xen/acpi.h>
 #include <xen/vmap.h>
 #include <xen/warning.h>
-#include <acpi/actables.h>
 #include <asm/device.h>
 #include <asm/kernel.h>
 #include <asm/setup.h>
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 5d6885e389..02043c0d4b 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -22,7 +22,6 @@ 
 #include <xen/libfdt/libfdt.h>
 #include <xen/sizes.h>
 #include <xen/acpi.h>
-#include <acpi/actables.h>
 #include <asm/p2m.h>
 #include <asm/domain.h>
 #include <asm/platform.h>
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 1cb1360606..cd3e1acf79 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -25,8 +25,6 @@ 
 #include <xen/sched.h>
 #include <xen/sizes.h>
 
-#include <acpi/actables.h>
-
 #include <asm/cpufeature.h>
 #include <asm/device.h>
 #include <asm/gic.h>
diff --git a/xen/arch/arm/include/asm/acpi.h b/xen/arch/arm/include/asm/acpi.h
index e53973e054..13756dd341 100644
--- a/xen/arch/arm/include/asm/acpi.h
+++ b/xen/arch/arm/include/asm/acpi.h
@@ -74,7 +74,6 @@  static inline void enable_acpi(void)
     acpi_disabled = false;
 }
 #else
-#define acpi_disabled (true)
 #define disable_acpi()
 #define enable_acpi()
 #endif
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 57f1b46499..c0cb17ca2e 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -10,6 +10,7 @@ 
 #include <xen/sizes.h>
 #include <xen/vmap.h>
 
+#include <asm/setup.h>
 #include <asm/fixmap.h>
 
 /* Override macros from asm/page.h to make them work with mfn_t */
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 695d2fa1f1..b6860a7760 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -9,6 +9,7 @@ 
  */
 
 
+#include <xen/acpi.h>
 #include <xen/types.h>
 #include <xen/init.h>
 #include <xen/mm.h>
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index a84e706d77..6efed87678 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -7,6 +7,7 @@ 
  * Copyright (c) 2011 Citrix Systems.
  */
 
+#include <xen/acpi.h>
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/delay.h>
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9cffe7f790..083157d6f2 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -7,6 +7,7 @@ 
  * Copyright (c) 2011 Citrix Systems.
  */
 
+#include <xen/acpi.h>
 #include <xen/domain_page.h>
 #include <xen/errno.h>
 #include <xen/hypercall.h>
@@ -30,7 +31,6 @@ 
 #include <public/sched.h>
 #include <public/xen.h>
 
-#include <asm/acpi.h>
 #include <asm/cpuerrata.h>
 #include <asm/cpufeature.h>
 #include <asm/event.h>
@@ -38,6 +38,7 @@ 
 #include <asm/mem_access.h>
 #include <asm/mmio.h>
 #include <asm/regs.h>
+#include <asm/setup.h>
 #include <asm/smccc.h>
 #include <asm/traps.h>
 #include <asm/vgic.h>
diff --git a/xen/common/sched/boot-cpupool.c b/xen/common/sched/boot-cpupool.c
index 5955e6f9a9..feeac3b704 100644
--- a/xen/common/sched/boot-cpupool.c
+++ b/xen/common/sched/boot-cpupool.c
@@ -7,8 +7,8 @@ 
  * Copyright (C) 2022 Arm Ltd.
  */
 
+#include <xen/acpi.h>
 #include <xen/sched.h>
-#include <asm/acpi.h>
 
 /*
  * pool_cpu_map:   Index is logical cpu number, content is cpupool id, (-1) for
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 6a2f5983fd..73ca4ad75c 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -37,10 +37,10 @@ 
 
 #ifndef __ASSEMBLY__
 
+#include <xen/errno.h>
 #include <xen/list.h>
 
-#include <acpi/acpi.h>
-#include <asm/acpi.h>
+#include <public/xen.h>
 
 #define ACPI_MADT_GET_(fld, x) (((x) & ACPI_MADT_##fld##_MASK) / \
 	(ACPI_MADT_##fld##_MASK & -ACPI_MADT_##fld##_MASK))
@@ -54,6 +54,9 @@ 
 
 #ifdef CONFIG_ACPI
 
+#include <acpi/acpi.h>
+#include <asm/acpi.h>
+
 extern acpi_physical_address rsdp_hint;
 
 extern bool opt_acpi_verbose;
@@ -118,6 +121,7 @@  extern u32 pci_mmcfg_base_addr;
 #else	/*!CONFIG_ACPI*/
 
 #define acpi_mp_config	0
+#define acpi_disabled (true)
 
 static inline int acpi_boot_init(void)
 {