libacpi: Don't build x86-only AML for ARM64 mk_dsdt
PATCH v3 1/1 libacpi: Don't build x86-only AML for ARM64 mk_dsdt
Commit d6ac8e22c7c5 ("acpi/x86: define ACPI IO registers for PVH guests") broke ARM64 build of mk_dsdt.c due to introduction of XEN_ACPI_CPU_MAP[_LEN] macros that are needed only for x86 guests.
We could fix the build by dealing specifically with those macros but since post-MADT code is not executed on ARM64 anyway we can compile it for x86 only.
---
v3:
* Hide dm_version from ARM64 to prevent compiler from complaining that it is never read (although it is written).
FWFW, this passes a "pseudo-ARM64" build on x86
rm -f a.out; gcc -Wall -Werror -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -DCONFIG_ARM_64 -I/data/armxen/tools/libacpi/../../tools/include -D__XEN_TOOLS__ mk_dsdt.c; ls -l a.out -rwxrwxr-x 1 ostr ostr 9384 Dec 21 16:02 a.out
tools/libacpi/mk_dsdt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
tools/libacpi/mk_dsdt.c +11 -4
@@ -78,6 +78,7 @@ static void pop_block(void)printf ("}\n" ); } +#ifdef CONFIG_X86 static void pci_hotplug_notify (unsigned int slt) {stmt ("Notify" ,"\\_SB.PCI0.S%02X, EVT" , slt);
@@ -99,20 +100,23 @@ static void decision_tree(decision_tree (s, (s+e)/2 , var, leaf);pop_block (); } +#endif static struct option options[] = { {"maxcpu" ,1 ,0 ,'c' }, +#if defined(CONFIG_X86) {"dm-version" ,1 ,0 ,'q' }, +#endif {"debug" ,1 ,0 ,'d' }, {0 ,0 ,0 ,0 } };int main (int argc,char **argv) { -unsigned int slot, dev, intx, link, cpu, max_cpus; -dm_version dm_version =QEMU_XEN_TRADITIONAL ; - +unsigned int cpu, max_cpus;#if defined(CONFIG_X86 ) +dm_version dm_version =QEMU_XEN_TRADITIONAL ; +unsigned int slot, dev, intx, link; max_cpus =HVM_MAX_VCPUS ;#elif defined(CONFIG_ARM_64 ) max_cpus =GUEST_MAX_VCPUS ;
@@ -142,6 +146,7 @@ int main(int argc, char **argv) }break ; } +#if defined(CONFIG_X86 )case 'q' :if (strcmp (optarg,"qemu-xen" ) ==0 ) { dm_version =QEMU_XEN ;
@@ -154,6 +159,7 @@ int main(int argc, char **argv) return -1; }break ; +#endif case 'd' :if (*optarg =='y' ) debug = true;
@@ -242,7 +248,7 @@ int main(int argc, char **argv)pop_block ();/**** DSDT DefinitionBlock end ****/ return 0 ; -#endif +#else /* Operation Region 'PRST': bitmask of online CPUs. */ stmt("OperationRegion", "PRST, SystemIO, %#x, %d",
@@ -524,6 +530,7 @@ int main(int argc, char **argv)/**** DSDT DefinitionBlock end ****/ return 0 ; +#endif }/*
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 10 lines · Boris Ostrovsky
Commit
d6ac8e22c7c5("acpi/x86: define ACPI IO registers for PVH guests") broke ARM64 build ofmk_dsdt.cdue to introduction of XEN_ACPI_CPU_MAP[_LEN] macros that are needed only for x86 guests.We could fix the build by dealing specifically with those macros but since post-MADT code is not executed on ARM64 anyway we can compile it for x86 only.
Signed-off-by Boris Ostrovsky <[email protected]>
This works.
Quoted 89 lines
v3:
* Hidedm_versionfrom ARM64 to prevent compiler from complaining that it is never read (although it is written).FWFW, this passes a "pseudo-ARM64" build on x86
rm -f a.out; gcc -Wall -Werror -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -DCONFIG_ARM_64 -I/data/armxen/tools/libacpi/../../tools/include -D__XEN_TOOLS__
mk_dsdt.c; ls -l a.out(quoted diff) +0
-1-rwxrwxr-x 1 ostr ostr 9384 Dec 21 16:02 a.out tools/libacpi/mk_dsdt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)tools/libacpi/mk_dsdt.c +11
-4@@ -78,6 +78,7 @@ static void pop_block(void)printf ("}\n" ); } +#ifdef CONFIG_X86 static void pci_hotplug_notify (unsigned int slt) {stmt ("Notify" ,"\\_SB.PCI0.S%02X, EVT" , slt);@@ -99,20 +100,23 @@ static void decision_tree(decision_tree (s, (s+e)/2 , var, leaf);pop_block (); } +#endif static struct option options[] = { {"maxcpu" ,1 ,0 ,'c' }, +#if defined(CONFIG_X86) {"dm-version" ,1 ,0 ,'q' }, +#endif {"debug" ,1 ,0 ,'d' }, {0 ,0 ,0 ,0 } };int main (int argc,char **argv) { -unsigned int slot, dev, intx, link, cpu, max_cpus; -dm_version dm_version =QEMU_XEN_TRADITIONAL ; - +unsigned int cpu, max_cpus;#if defined(CONFIG_X86 ) +dm_version dm_version =QEMU_XEN_TRADITIONAL ; +unsigned int slot, dev, intx, link; max_cpus =HVM_MAX_VCPUS ;#elif defined(CONFIG_ARM_64 ) max_cpus =GUEST_MAX_VCPUS ;@@ -142,6 +146,7 @@ int main(int argc, char **argv) }break ; } +#if defined(CONFIG_X86 )case 'q' :if (strcmp (optarg,"qemu-xen" ) ==0 ) { dm_version =QEMU_XEN ;@@ -154,6 +159,7 @@ int main(int argc, char **argv) return -1; }break ; +#endif case 'd' :if (*optarg =='y' ) debug = true;@@ -242,7 +248,7 @@ int main(int argc, char **argv)pop_block ();/**** DSDT DefinitionBlock end ****/ return 0 ; -#endif +#else /* Operation Region 'PRST': bitmask of online CPUs. */ stmt("OperationRegion", "PRST, SystemIO, %#x, %d",@@ -524,6 +530,7 @@ int main(int argc, char **argv)/**** DSDT DefinitionBlock end ****/ return 0 ; +#endif }/* Signature · 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 21.12.16 at 22:07, <[email protected]> wrote:
tools/libacpi/mk_dsdt.c +3
-0@@ -99,20 +100,23 @@ static void decision_tree(decision_tree (s, (s+e)/2 , var, leaf);pop_block (); } +#endif static struct option options[] = { {"maxcpu" ,1 ,0 ,'c' }, +#if defined(CONFIG_X86) {"dm-version" ,1 ,0 ,'q' }, +#endif {"debug" ,1 ,0 ,'d' }, {0 ,0 ,0 ,0 } };int main (int argc,char **argv) {
tools/libacpi/mk_dsdt.c static void decision_tree( · line 122
Quoted 10 lines
tools/libacpi/mk_dsdt.c +3
-3-unsigned int slot, dev, intx, link, cpu, max_cpus; -dm_version dm_version =QEMU_XEN_TRADITIONAL ; - +unsigned int cpu, max_cpus;#if defined(CONFIG_X86 ) +dm_version dm_version =QEMU_XEN_TRADITIONAL ; +unsigned int slot, dev, intx, link; max_cpus =HVM_MAX_VCPUS ;#elif defined(CONFIG_ARM_64 ) max_cpus =GUEST_MAX_VCPUS ;
Please remember to not remove blank lines between declarations and statements. I'll fix this up while committing.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel