diff mbox

[v3] libacpi: Don't build x86-only AML for ARM64 mk_dsdt

Message ID 1482354440-2951-1-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Ostrovsky Dec. 21, 2016, 9:07 p.m. UTC
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.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
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(-)

Comments

Stefano Stabellini Dec. 21, 2016, 10:01 p.m. UTC | #1
On Wed, 21 Dec 2016, Boris Ostrovsky wrote:
> 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.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

This works.

Tested-by: Stefano Stabellini <sstabellini@kernel.org>


> 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(-)
> 
> diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
> index 9421f3f..935770d 100644
> --- a/tools/libacpi/mk_dsdt.c
> +++ b/tools/libacpi/mk_dsdt.c
> @@ -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
>  }
>  
>  /*
> -- 
> 2.7.4
>
Jan Beulich Dec. 22, 2016, 8:35 a.m. UTC | #2
>>> On 21.12.16 at 22:07, <boris.ostrovsky@oracle.com> wrote:
> @@ -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;

Please remember to not remove blank lines between declarations
and statements. I'll fix this up while committing.

Jan
diff mbox

Patch

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 9421f3f..935770d 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -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
 }
 
 /*