Message ID | 170060515641.2447486.11798332619205301829.stgit@djiang5-mobl3 (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | [v2] acpi: Fix ARM32 platforms compile issue introduced by fw_table changes | expand |
On Tue, Nov 21, 2023 at 11:19 PM Dave Jiang <dave.jiang@intel.com> wrote: > > Linus reported that: > After commit a103f46633fd the kernel stopped compiling for > several ARM32 platforms that I am building with a bare metal > compiler. Bare metal compilers (arm-none-eabi-) don't > define __linux__. > > This is because the header <acpi/platform/acenv.h> is now > in the include path for <linux/irq.h>: > > CC arch/arm/kernel/irq.o > CC kernel/sysctl.o > CC crypto/api.o > In file included from ../include/acpi/acpi.h:22, > from ../include/linux/fw_table.h:29, > from ../include/linux/acpi.h:18, > from ../include/linux/irqchip.h:14, > from ../arch/arm/kernel/irq.c:25: > ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment > 218 | #error Unknown target environment > | ^~~~~ > > The issue is caused by the introducing of splitting out the ACPI code to > support the new generic fw_table code. > > Rafael suggested [1] moving the fw_table.h include in linux/acpi.h to below > the linux/mutex.h. Remove the two includes in fw_table.h. Add include of > linux/acpi.h in fw_table.c before the fw_table.h include. > > Link: https://lore.kernel.org/linux-acpi/CAJZ5v0idWdJq3JSqQWLG5q+b+b=zkEdWR55rGYEoxh7R6N8kFQ@mail.gmail.com/ > Fixes: a103f46633fd ("acpi: Move common tables helper functions to common lib") > Reported-by: Linus Walleij <linus.walleij@linaro.org> > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > Signed-off-by: Dave Jiang <dave.jiang@intel.com> > --- > v2: > - Remove linux/acpi.h include as well in fw_table.h. (Sam) > --- > include/linux/acpi.h | 22 +++++++++++----------- > include/linux/fw_table.h | 3 --- > lib/fw_table.c | 1 + > 3 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 54189e0e5f41..4db54e928b36 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -15,7 +15,6 @@ > #include <linux/mod_devicetable.h> > #include <linux/property.h> > #include <linux/uuid.h> > -#include <linux/fw_table.h> > > struct irq_domain; > struct irq_domain_ops; > @@ -25,22 +24,13 @@ struct irq_domain_ops; > #endif > #include <acpi/acpi.h> > > -#ifdef CONFIG_ACPI_TABLE_LIB > -#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) > -#define __init_or_acpilib > -#define __initdata_or_acpilib > -#else > -#define EXPORT_SYMBOL_ACPI_LIB(x) > -#define __init_or_acpilib __init > -#define __initdata_or_acpilib __initdata > -#endif > - > #ifdef CONFIG_ACPI > > #include <linux/list.h> > #include <linux/dynamic_debug.h> > #include <linux/module.h> > #include <linux/mutex.h> > +#include <linux/fw_table.h> > > #include <acpi/acpi_bus.h> > #include <acpi/acpi_drivers.h> > @@ -48,6 +38,16 @@ struct irq_domain_ops; > #include <acpi/acpi_io.h> > #include <asm/acpi.h> > > +#ifdef CONFIG_ACPI_TABLE_LIB > +#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) > +#define __init_or_acpilib > +#define __initdata_or_acpilib > +#else > +#define EXPORT_SYMBOL_ACPI_LIB(x) > +#define __init_or_acpilib __init > +#define __initdata_or_acpilib __initdata > +#endif > + > static inline acpi_handle acpi_device_handle(struct acpi_device *adev) > { > return adev ? adev->handle : NULL; > diff --git a/include/linux/fw_table.h b/include/linux/fw_table.h > index ff8fa58d5818..ca49947f0a77 100644 > --- a/include/linux/fw_table.h > +++ b/include/linux/fw_table.h > @@ -25,9 +25,6 @@ struct acpi_subtable_proc { > int count; > }; > > -#include <linux/acpi.h> > -#include <acpi/acpi.h> > - > union acpi_subtable_headers { > struct acpi_subtable_header common; > struct acpi_hmat_structure hmat; > diff --git a/lib/fw_table.c b/lib/fw_table.c > index b51f30a28e47..c4831f3378be 100644 > --- a/lib/fw_table.c > +++ b/lib/fw_table.c > @@ -7,6 +7,7 @@ > * Copyright (C) 2023 Intel Corp. > */ > #include <linux/errno.h> > +#include <linux/acpi.h> > #include <linux/fw_table.h> Because fw_table.h is included via acpi.h, do you still need to include it directly here? > #include <linux/init.h> > #include <linux/kernel.h> > > >
On Tue, Nov 21, 2023 at 11:19 PM Dave Jiang <dave.jiang@intel.com> wrote: > Linus reported that: > After commit a103f46633fd the kernel stopped compiling for > several ARM32 platforms that I am building with a bare metal > compiler. Bare metal compilers (arm-none-eabi-) don't > define __linux__. > > This is because the header <acpi/platform/acenv.h> is now > in the include path for <linux/irq.h>: > > CC arch/arm/kernel/irq.o > CC kernel/sysctl.o > CC crypto/api.o > In file included from ../include/acpi/acpi.h:22, > from ../include/linux/fw_table.h:29, > from ../include/linux/acpi.h:18, > from ../include/linux/irqchip.h:14, > from ../arch/arm/kernel/irq.c:25: > ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment > 218 | #error Unknown target environment > | ^~~~~ > > The issue is caused by the introducing of splitting out the ACPI code to > support the new generic fw_table code. > > Rafael suggested [1] moving the fw_table.h include in linux/acpi.h to below > the linux/mutex.h. Remove the two includes in fw_table.h. Add include of > linux/acpi.h in fw_table.c before the fw_table.h include. > > Link: https://lore.kernel.org/linux-acpi/CAJZ5v0idWdJq3JSqQWLG5q+b+b=zkEdWR55rGYEoxh7R6N8kFQ@mail.gmail.com/ > Fixes: a103f46633fd ("acpi: Move common tables helper functions to common lib") > Reported-by: Linus Walleij <linus.walleij@linaro.org> > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > Signed-off-by: Dave Jiang <dave.jiang@intel.com> This works fine on my end. Tested-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On 11/22/23 06:14, Rafael J. Wysocki wrote: > On Tue, Nov 21, 2023 at 11:19 PM Dave Jiang <dave.jiang@intel.com> wrote: >> >> Linus reported that: >> After commit a103f46633fd the kernel stopped compiling for >> several ARM32 platforms that I am building with a bare metal >> compiler. Bare metal compilers (arm-none-eabi-) don't >> define __linux__. >> >> This is because the header <acpi/platform/acenv.h> is now >> in the include path for <linux/irq.h>: >> >> CC arch/arm/kernel/irq.o >> CC kernel/sysctl.o >> CC crypto/api.o >> In file included from ../include/acpi/acpi.h:22, >> from ../include/linux/fw_table.h:29, >> from ../include/linux/acpi.h:18, >> from ../include/linux/irqchip.h:14, >> from ../arch/arm/kernel/irq.c:25: >> ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment >> 218 | #error Unknown target environment >> | ^~~~~ >> >> The issue is caused by the introducing of splitting out the ACPI code to >> support the new generic fw_table code. >> >> Rafael suggested [1] moving the fw_table.h include in linux/acpi.h to below >> the linux/mutex.h. Remove the two includes in fw_table.h. Add include of >> linux/acpi.h in fw_table.c before the fw_table.h include. >> >> Link: https://lore.kernel.org/linux-acpi/CAJZ5v0idWdJq3JSqQWLG5q+b+b=zkEdWR55rGYEoxh7R6N8kFQ@mail.gmail.com/ >> Fixes: a103f46633fd ("acpi: Move common tables helper functions to common lib") >> Reported-by: Linus Walleij <linus.walleij@linaro.org> >> Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> >> Signed-off-by: Dave Jiang <dave.jiang@intel.com> >> --- >> v2: >> - Remove linux/acpi.h include as well in fw_table.h. (Sam) >> --- >> include/linux/acpi.h | 22 +++++++++++----------- >> include/linux/fw_table.h | 3 --- >> lib/fw_table.c | 1 + >> 3 files changed, 12 insertions(+), 14 deletions(-) >> >> diff --git a/include/linux/acpi.h b/include/linux/acpi.h >> index 54189e0e5f41..4db54e928b36 100644 >> --- a/include/linux/acpi.h >> +++ b/include/linux/acpi.h >> @@ -15,7 +15,6 @@ >> #include <linux/mod_devicetable.h> >> #include <linux/property.h> >> #include <linux/uuid.h> >> -#include <linux/fw_table.h> >> >> struct irq_domain; >> struct irq_domain_ops; >> @@ -25,22 +24,13 @@ struct irq_domain_ops; >> #endif >> #include <acpi/acpi.h> >> >> -#ifdef CONFIG_ACPI_TABLE_LIB >> -#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) >> -#define __init_or_acpilib >> -#define __initdata_or_acpilib >> -#else >> -#define EXPORT_SYMBOL_ACPI_LIB(x) >> -#define __init_or_acpilib __init >> -#define __initdata_or_acpilib __initdata >> -#endif >> - >> #ifdef CONFIG_ACPI >> >> #include <linux/list.h> >> #include <linux/dynamic_debug.h> >> #include <linux/module.h> >> #include <linux/mutex.h> >> +#include <linux/fw_table.h> >> >> #include <acpi/acpi_bus.h> >> #include <acpi/acpi_drivers.h> >> @@ -48,6 +38,16 @@ struct irq_domain_ops; >> #include <acpi/acpi_io.h> >> #include <asm/acpi.h> >> >> +#ifdef CONFIG_ACPI_TABLE_LIB >> +#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) >> +#define __init_or_acpilib >> +#define __initdata_or_acpilib >> +#else >> +#define EXPORT_SYMBOL_ACPI_LIB(x) >> +#define __init_or_acpilib __init >> +#define __initdata_or_acpilib __initdata >> +#endif >> + >> static inline acpi_handle acpi_device_handle(struct acpi_device *adev) >> { >> return adev ? adev->handle : NULL; >> diff --git a/include/linux/fw_table.h b/include/linux/fw_table.h >> index ff8fa58d5818..ca49947f0a77 100644 >> --- a/include/linux/fw_table.h >> +++ b/include/linux/fw_table.h >> @@ -25,9 +25,6 @@ struct acpi_subtable_proc { >> int count; >> }; >> >> -#include <linux/acpi.h> >> -#include <acpi/acpi.h> >> - >> union acpi_subtable_headers { >> struct acpi_subtable_header common; >> struct acpi_hmat_structure hmat; >> diff --git a/lib/fw_table.c b/lib/fw_table.c >> index b51f30a28e47..c4831f3378be 100644 >> --- a/lib/fw_table.c >> +++ b/lib/fw_table.c >> @@ -7,6 +7,7 @@ >> * Copyright (C) 2023 Intel Corp. >> */ >> #include <linux/errno.h> >> +#include <linux/acpi.h> >> #include <linux/fw_table.h> > > Because fw_table.h is included via acpi.h, do you still need to > include it directly here? No. I'll drop. > >> #include <linux/init.h> >> #include <linux/kernel.h> >> >> >>
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 54189e0e5f41..4db54e928b36 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -15,7 +15,6 @@ #include <linux/mod_devicetable.h> #include <linux/property.h> #include <linux/uuid.h> -#include <linux/fw_table.h> struct irq_domain; struct irq_domain_ops; @@ -25,22 +24,13 @@ struct irq_domain_ops; #endif #include <acpi/acpi.h> -#ifdef CONFIG_ACPI_TABLE_LIB -#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) -#define __init_or_acpilib -#define __initdata_or_acpilib -#else -#define EXPORT_SYMBOL_ACPI_LIB(x) -#define __init_or_acpilib __init -#define __initdata_or_acpilib __initdata -#endif - #ifdef CONFIG_ACPI #include <linux/list.h> #include <linux/dynamic_debug.h> #include <linux/module.h> #include <linux/mutex.h> +#include <linux/fw_table.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> @@ -48,6 +38,16 @@ struct irq_domain_ops; #include <acpi/acpi_io.h> #include <asm/acpi.h> +#ifdef CONFIG_ACPI_TABLE_LIB +#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI) +#define __init_or_acpilib +#define __initdata_or_acpilib +#else +#define EXPORT_SYMBOL_ACPI_LIB(x) +#define __init_or_acpilib __init +#define __initdata_or_acpilib __initdata +#endif + static inline acpi_handle acpi_device_handle(struct acpi_device *adev) { return adev ? adev->handle : NULL; diff --git a/include/linux/fw_table.h b/include/linux/fw_table.h index ff8fa58d5818..ca49947f0a77 100644 --- a/include/linux/fw_table.h +++ b/include/linux/fw_table.h @@ -25,9 +25,6 @@ struct acpi_subtable_proc { int count; }; -#include <linux/acpi.h> -#include <acpi/acpi.h> - union acpi_subtable_headers { struct acpi_subtable_header common; struct acpi_hmat_structure hmat; diff --git a/lib/fw_table.c b/lib/fw_table.c index b51f30a28e47..c4831f3378be 100644 --- a/lib/fw_table.c +++ b/lib/fw_table.c @@ -7,6 +7,7 @@ * Copyright (C) 2023 Intel Corp. */ #include <linux/errno.h> +#include <linux/acpi.h> #include <linux/fw_table.h> #include <linux/init.h> #include <linux/kernel.h>
Linus reported that: After commit a103f46633fd the kernel stopped compiling for several ARM32 platforms that I am building with a bare metal compiler. Bare metal compilers (arm-none-eabi-) don't define __linux__. This is because the header <acpi/platform/acenv.h> is now in the include path for <linux/irq.h>: CC arch/arm/kernel/irq.o CC kernel/sysctl.o CC crypto/api.o In file included from ../include/acpi/acpi.h:22, from ../include/linux/fw_table.h:29, from ../include/linux/acpi.h:18, from ../include/linux/irqchip.h:14, from ../arch/arm/kernel/irq.c:25: ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment 218 | #error Unknown target environment | ^~~~~ The issue is caused by the introducing of splitting out the ACPI code to support the new generic fw_table code. Rafael suggested [1] moving the fw_table.h include in linux/acpi.h to below the linux/mutex.h. Remove the two includes in fw_table.h. Add include of linux/acpi.h in fw_table.c before the fw_table.h include. Link: https://lore.kernel.org/linux-acpi/CAJZ5v0idWdJq3JSqQWLG5q+b+b=zkEdWR55rGYEoxh7R6N8kFQ@mail.gmail.com/ Fixes: a103f46633fd ("acpi: Move common tables helper functions to common lib") Reported-by: Linus Walleij <linus.walleij@linaro.org> Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> --- v2: - Remove linux/acpi.h include as well in fw_table.h. (Sam) --- include/linux/acpi.h | 22 +++++++++++----------- include/linux/fw_table.h | 3 --- lib/fw_table.c | 1 + 3 files changed, 12 insertions(+), 14 deletions(-)