All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/16] Xen ARM DomU ACPI support
@ 2016-09-02  2:55 Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
                   ` (18 more replies)
  0 siblings, 19 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

The design of this feature is described as below.
Firstly, the toolstack (libxl) generates the ACPI tables according the
number of vcpus and gic controller.

Then, it copies these ACPI tables to DomU non-RAM memory map space and
passes them to UEFI firmware through the "ARM multiboot" protocol.

At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
and installs these tables like the usual way and passes both ACPI and DT
information to the Xen DomU.

Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
since it's enough now.

This has been tested using guest kernel with the Dom0 ACPI support
patches which could be fetched from linux master or:
https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen

The UEFI binary could be fetched from or built from edk2 master branch:
http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd

This series can be fetched from:
https://git.linaro.org/people/shannon.zhao/xen.git  domu_acpi_v5

Changes since v4:
* make changes in tools/configure.ac instead of tools/configure
* add libxl_arm_no_acpi.c for no acpi build
* add a function to get the acpi table size and use it to set maxmem
* drop HVM_PARAM_CALLBACK_TYPE_PPI_MASK and update hvm_set_callback_via
* add libxl__arch_domain_build_info_acpi_setdefault to set b_info->acpi
  default value separately
* update ACPI_OEM_ID
* set gtdt->counter_block_addresss and gtdt->counter_read_block_address
* add a BUILD_BUG_ON to check if GUEST_MAX_VCPUS >= MAX_VIRT_CPUS

Changes since v3:
* use goto style error handle
* unify configuration option for ACPI
* use extended_checksum instead of checksum in RSDP table
* only require iasl on arm64
* count acpi tables size for maxmem

Changes since v2:
* return error for 32bit domain with acpi enabled
* include actypes.h to reuse the definitions
* rename libxl_arm_acpi.h to libxl_arm.h
* use ACPI_MADT_ENABLED
* rebased on top of Boris's ACPI branch to reuse mk_dsdt.c

Changes since v1:
* move ACPI tables generation codes to a new file
* use static asl file to generate DSDT table and include processor
  device objects
* assign a non-RAM map for ACPI blob
* use existing ACPI table definitions under xen/include/acpi/
* add a configuration for user to enable/disable ACPI generation
* calculate the ACPI table checksum

Shannon Zhao (16):
  tools/libxl: Add an unified configuration option for ACPI
  libxl/arm: prepare for constructing ACPI tables
  libxl/arm: Generate static ACPI DSDT table
  libxl/arm: Estimate the size of ACPI tables
  libxl/arm: Construct ACPI RSDP table
  libxl/arm: Construct ACPI XSDT table
  libxl/arm: Construct ACPI GTDT table
  libxl/arm: Factor MPIDR computing codes out as a helper
  libxl/arm: Construct ACPI MADT table
  libxl/arm: Construct ACPI FADT table
  libxl/arm: Construct ACPI DSDT table
  libxl/arm: Factor finalise_one_memory_node as a gerneric function
  libxl/arm: Add ACPI module
  public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI
  libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
  libxl/arm: Add the size of ACPI tables to maxmem

 docs/man/xl.cfg.pod.5.in           |   1 +
 docs/misc/arm/device-tree/acpi.txt |  24 +++
 tools/configure.ac                 |   2 +-
 tools/libacpi/Makefile             |  13 +-
 tools/libacpi/mk_dsdt.c            |  27 ++-
 tools/libxl/Makefile               |  10 +
 tools/libxl/libxl_arch.h           |   6 +-
 tools/libxl/libxl_arm.c            | 101 +++++++--
 tools/libxl/libxl_arm.h            |  48 +++++
 tools/libxl/libxl_arm_acpi.c       | 409 +++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_arm_no_acpi.c    |  40 ++++
 tools/libxl/libxl_create.c         |   4 +-
 tools/libxl/libxl_dm.c             |   4 +-
 tools/libxl/libxl_dom.c            |   2 +-
 tools/libxl/libxl_internal.h       |   6 +
 tools/libxl/libxl_types.idl        |   4 +
 tools/libxl/libxl_x86.c            |   8 +-
 tools/libxl/xl_cmdimpl.c           |   2 +-
 xen/arch/arm/domain.c              |   1 +
 xen/arch/arm/domain_build.c        |   8 +-
 xen/arch/x86/hvm/irq.c             |   2 +-
 xen/include/public/arch-arm.h      |   7 +
 xen/include/public/hvm/params.h    |   3 +
 23 files changed, 705 insertions(+), 27 deletions(-)
 create mode 100644 docs/misc/arm/device-tree/acpi.txt
 create mode 100644 tools/libxl/libxl_arm.h
 create mode 100644 tools/libxl/libxl_arm_acpi.c
 create mode 100644 tools/libxl/libxl_arm_no_acpi.c

-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02 14:29   ` Wei Liu
  2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Since the existing configuration option "u.hvm.acpi" is x86 specific and
we want to reuse it on ARM as well, add a unified option "acpi" for
x86 and ARM, and for ARM it's disabled by default.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 docs/man/xl.cfg.pod.5.in     | 1 +
 tools/libxl/libxl_arch.h     | 4 ++++
 tools/libxl/libxl_arm.c      | 6 ++++++
 tools/libxl/libxl_create.c   | 4 +++-
 tools/libxl/libxl_dm.c       | 4 ++--
 tools/libxl/libxl_internal.h | 6 ++++++
 tools/libxl/libxl_types.idl  | 4 ++++
 tools/libxl/libxl_x86.c      | 6 ++++++
 tools/libxl/xl_cmdimpl.c     | 2 +-
 9 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index a685b83..9242e3d 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -1237,6 +1237,7 @@ the virtual firmware to the guest Operating System. ACPI is required
 by most modern guest Operating Systems. This option is enabled by
 default and usually you should omit it. However it may be necessary to
 disable ACPI for compatibility with some guest Operating Systems.
+This option is true for x86 while it's false for ARM by default.
 
 =item B<acpi_s3=BOOLEAN>
 
diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
index 7c6536b..337061f 100644
--- a/tools/libxl/libxl_arch.h
+++ b/tools/libxl/libxl_arch.h
@@ -65,4 +65,8 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc,
 int libxl__dom_load_acpi(libxl__gc *gc,
 			 libxl_domain_build_info *info,
 			 struct xc_dom_image *dom);
+
+_hidden
+void libxl__arch_domain_build_info_acpi_setdefault(
+                                        libxl_domain_build_info *b_info);
 #endif
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index bd3d611..8ec5cd5 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -985,6 +985,12 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc,
     return 0;
 }
 
+void libxl__arch_domain_build_info_acpi_setdefault(
+                                        libxl_domain_build_info *b_info)
+{
+    libxl_defbool_setdefault(&b_info->acpi, false);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 08822e3..b5737ab 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -215,6 +215,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->event_channels)
         b_info->event_channels = 1023;
 
+    libxl__arch_domain_build_info_acpi_setdefault(b_info);
+
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
         if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT)
@@ -454,7 +456,7 @@ int libxl__domain_build(libxl__gc *gc,
         localents = libxl__calloc(gc, 9, sizeof(char *));
         i = 0;
         localents[i++] = "platform/acpi";
-        localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
+        localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";
         localents[i++] = "platform/acpi_s3";
         localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
         localents[i++] = "platform/acpi_s4";
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index de16a59..7b5ebc6 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -583,7 +583,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
         if (b_info->u.hvm.soundhw) {
             flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
-        if (libxl_defbool_val(b_info->u.hvm.acpi)) {
+        if (libxl__acpi_defbool_val(b_info)) {
             flexarray_append(dm_args, "-acpi");
         }
         if (b_info->max_vcpus > 1) {
@@ -1204,7 +1204,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         if (b_info->u.hvm.soundhw) {
             flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
         }
-        if (!libxl_defbool_val(b_info->u.hvm.acpi)) {
+        if (!libxl__acpi_defbool_val(b_info)) {
             flexarray_append(dm_args, "-no-acpi");
         }
         if (b_info->max_vcpus > 1) {
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 991a1cc..9a34a04 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -4267,6 +4267,12 @@ _hidden int libxl__read_sysfs_file_contents(libxl__gc *gc,
 #define LIBXL_QEMU_USER_PREFIX "xen-qemuuser"
 #define LIBXL_QEMU_USER_BASE   LIBXL_QEMU_USER_PREFIX"-domid"
 #define LIBXL_QEMU_USER_SHARED LIBXL_QEMU_USER_PREFIX"-shared"
+
+static inline bool libxl__acpi_defbool_val(const libxl_domain_build_info *b_info)
+{
+    return libxl_defbool_val(b_info->acpi) &&
+           libxl_defbool_val(b_info->u.hvm.acpi);
+}
 #endif
 
 /*
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 98bfc3a..a02446f 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -494,11 +494,15 @@ libxl_domain_build_info = Struct("domain_build_info",[
     # Note that the partial device tree should avoid to use the phandle
     # 65000 which is reserved by the toolstack.
     ("device_tree",      string),
+    ("acpi",             libxl_defbool),
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware",         string),
                                        ("bios",             libxl_bios_type),
                                        ("pae",              libxl_defbool),
                                        ("apic",             libxl_defbool),
+                                       # The following acpi field is deprecated.
+                                       # Please use the unified acpi field above
+                                       # which works for both x86 and ARM.
                                        ("acpi",             libxl_defbool),
                                        ("acpi_s3",          libxl_defbool),
                                        ("acpi_s4",          libxl_defbool),
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 42f2139..e9127bb 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -570,6 +570,12 @@ out:
     return rc;
 }
 
+void libxl__arch_domain_build_info_acpi_setdefault(
+                                        libxl_domain_build_info *b_info)
+{
+    libxl_defbool_setdefault(&b_info->acpi, true);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 1d06598..be17702 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1547,6 +1547,7 @@ static void parse_config_data(const char *config_source,
     b_info->cmdline = parse_cmdline(config);
 
     xlu_cfg_get_defbool(config, "driver_domain", &c_info->driver_domain, 0);
+    xlu_cfg_get_defbool(config, "acpi", &b_info->acpi, 0);
 
     switch(b_info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
@@ -1576,7 +1577,6 @@ static void parse_config_data(const char *config_source,
 
         xlu_cfg_get_defbool(config, "pae", &b_info->u.hvm.pae, 0);
         xlu_cfg_get_defbool(config, "apic", &b_info->u.hvm.apic, 0);
-        xlu_cfg_get_defbool(config, "acpi", &b_info->u.hvm.acpi, 0);
         xlu_cfg_get_defbool(config, "acpi_s3", &b_info->u.hvm.acpi_s3, 0);
         xlu_cfg_get_defbool(config, "acpi_s4", &b_info->u.hvm.acpi_s4, 0);
         xlu_cfg_get_defbool(config, "nx", &b_info->u.hvm.nx, 0);
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02 14:29   ` Wei Liu
  2016-09-12 14:41   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
                   ` (16 subsequent siblings)
  18 siblings, 2 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

It only constructs the ACPI tables for 64-bit ARM DomU when user enables
acpi because 32-bit DomU doesn't support ACPI. And the generation codes
are only built for 64-bit toolstack.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/Makefile            |  7 +++++
 tools/libxl/libxl_arm.c         | 24 +++++++++++++++-
 tools/libxl/libxl_arm.h         | 33 ++++++++++++++++++++++
 tools/libxl/libxl_arm_acpi.c    | 62 +++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_arm_no_acpi.c | 34 ++++++++++++++++++++++
 xen/include/public/arch-arm.h   |  4 +++
 6 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 tools/libxl/libxl_arm.h
 create mode 100644 tools/libxl/libxl_arm_acpi.c
 create mode 100644 tools/libxl/libxl_arm_no_acpi.c

diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index a148374..afd93de 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -90,6 +90,13 @@ acpi:
 
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
 LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
+ifeq ($(CONFIG_ARM_64),y)
+LIBXL_OBJS-y += libxl_arm_acpi.o
+libxl_arm_acpi.o: libxl_arm_acpi.c
+	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
+else
+LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_no_acpi.o
+endif
 
 ifeq ($(CONFIG_NetBSD),y)
 LIBXL_OBJS-y += libxl_netbsd.o
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 8ec5cd5..333c9a1 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -1,6 +1,7 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
 #include "libxl_libfdt_compat.h"
+#include "libxl_arm.h"
 
 #include <xc_dom.h>
 #include <stdbool.h>
@@ -885,8 +886,29 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
                                            libxl__domain_build_state *state,
                                            struct xc_dom_image *dom)
 {
+    int rc;
+
     assert(info->type == LIBXL_DOMAIN_TYPE_PV);
-    return libxl__prepare_dtb(gc, info, state, dom);
+    rc = libxl__prepare_dtb(gc, info, state, dom);
+    if (rc) goto out;
+
+    if (!libxl_defbool_val(info->acpi)) {
+        LOG(DEBUG, "Generating ACPI tables is disabled by user.");
+        rc = 0;
+        goto out;
+    }
+
+    if (strcmp(dom->guest_type, "xen-3.0-aarch64")) {
+        /* ACPI is only supported for 64-bit guest currently. */
+        LOG(ERROR, "Can not enable libxl option 'acpi' for %s", dom->guest_type);
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = libxl__prepare_acpi(gc, info, state, dom);
+
+out:
+    return rc;
 }
 
 static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
new file mode 100644
index 0000000..1c01177
--- /dev/null
+++ b/tools/libxl/libxl_arm.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2016      Linaro Ltd.
+ *
+ * Author: Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_internal.h"
+#include "libxl_arch.h"
+
+#include <xc_dom.h>
+
+_hidden
+int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
+                        libxl__domain_build_state *state,
+                        struct xc_dom_image *dom);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
new file mode 100644
index 0000000..810aed8
--- /dev/null
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -0,0 +1,62 @@
+/*
+ * ARM DomU ACPI generation
+ *
+ * Copyright (C) 2016      Linaro Ltd.
+ *
+ * Author: Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_arm.h"
+
+#include <stdint.h>
+
+/* Below typedefs are useful for the headers under acpi/ */
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
+#include <acpi/acconfig.h>
+#include <acpi/actbl.h>
+
+int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
+                        libxl__domain_build_state *state,
+                        struct xc_dom_image *dom)
+{
+    const libxl_version_info *vers;
+    int rc = 0;
+
+    vers = libxl_get_version_info(CTX);
+    if (vers == NULL) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
+        vers->xen_version_major, vers->xen_version_minor);
+
+    dom->acpi_modules[0].data = NULL;
+    dom->acpi_modules[0].length = 0;
+    dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
+
+out:
+    return rc;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/libxl/libxl_arm_no_acpi.c b/tools/libxl/libxl_arm_no_acpi.c
new file mode 100644
index 0000000..e7f7411
--- /dev/null
+++ b/tools/libxl/libxl_arm_no_acpi.c
@@ -0,0 +1,34 @@
+/*
+ * ARM DomU ACPI generation
+ *
+ * Copyright (C) 2016      Linaro Ltd.
+ *
+ * Author: Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_arm.h"
+
+int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
+                        libxl__domain_build_state *state,
+                        struct xc_dom_image *dom)
+{
+    return ERROR_FAIL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 870bc3b..4b4c959 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -406,6 +406,10 @@ typedef uint64_t xen_callback_t;
 #define GUEST_GICV3_GICR0_BASE     0x03020000ULL    /* vCPU0 - vCPU127 */
 #define GUEST_GICV3_GICR0_SIZE     0x01000000ULL
 
+/* ACPI tables physical address */
+#define GUEST_ACPI_BASE 0x20000000ULL
+#define GUEST_ACPI_SIZE 0x02000000ULL
+
 /*
  * 16MB == 4096 pages reserved for guest to use as a region to map its
  * grant table in.
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02 14:29   ` Wei Liu
  2016-09-12 14:44   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
                   ` (15 subsequent siblings)
  18 siblings, 2 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

It uses static DSDT table like the way x86 uses. Currently the DSDT
table only contains processor device objects and it generates the
maximal objects which so far is 128.

While the GUEST_MAX_VCPUS is defined under __XEN__ or __XEN_TOOLS__, it
needs to add -D__XEN_TOOLS__ to compile mk_dsdt.c.

Also only check iasl for aarch64 in configure since ACPI on ARM32 is not
supported.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
Note: this patch needs to be rebased on Boris's v3 patchset for only 
generating dsdt_anycpu_arm.c for ARM64.
---
 tools/configure.ac            |  2 +-
 tools/libacpi/Makefile        | 13 ++++++++++++-
 tools/libacpi/mk_dsdt.c       | 27 ++++++++++++++++++++++++++-
 tools/libxl/Makefile          |  5 ++++-
 tools/libxl/libxl_arm_acpi.c  |  5 +++++
 xen/arch/arm/domain.c         |  1 +
 xen/include/public/arch-arm.h |  3 +++
 7 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/tools/configure.ac b/tools/configure.ac
index 0229d44..b4e0c80 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -335,7 +335,7 @@ dnl "host" here means the platform on which the hypervisor and tools is
 dnl going to run, not the platform on which we are building (known as
 dnl "build" in gnu speak).
 case "$host_cpu" in
-i[[3456]]86|x86_64)
+i[[3456]]86|x86_64|aarch64)
     AX_PATH_PROG_OR_FAIL([IASL], [iasl])
     ;;
 esac
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index d741ac5..b1965cc 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -19,6 +19,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 
 # Sources to be generated
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c  dsdt_anycpu_qemu_xen.c dsdt_pvh.c)
+C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h)
 
 vpath iasl $(PATH)
@@ -32,7 +33,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 	cd $(CURDIR)
 
 $(MK_DSDT): mk_dsdt.c
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
 
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
 	awk 'NR > 1 {print s} {s=$$0}' $< > $@
@@ -62,6 +63,16 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl $(ACPI_BUILD_DIR)/dsdt_pvh.asl
 	echo "int dsdt_pvh_len=sizeof(dsdt_pvh);" >>$@
 	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
 
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+	printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"Xen\", \"ARM\", 1)\n{" > $@
+	$(MK_DSDT) --debug=$(debug) >> $@
+
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+	iasl -vs -p $(ACPI_BUILD_DIR)/$* -tc $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+	sed -e 's/AmlCode/dsdt_anycpu_arm/g' $(ACPI_BUILD_DIR)/$*.hex >$@
+	echo "int dsdt_anycpu_arm_len=sizeof(dsdt_anycpu_arm);" >>$@
+	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
+
 iasl:
 	@echo
 	@echo "ACPI ASL compiler (iasl) is needed"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 7d76784..a56e0f0 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -17,7 +17,11 @@
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdbool.h>
+#if defined(__i386__) || defined(__x86_64__)
 #include <xen/hvm/hvm_info_table.h>
+#elif defined(__aarch64__)
+#include <xen/arch-arm.h>
+#endif
 
 static unsigned int indent_level;
 static bool debug = false;
@@ -104,10 +108,16 @@ static struct option options[] = {
 
 int main(int argc, char **argv)
 {
-    unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
+    unsigned int slot, dev, intx, link, cpu, max_cpus;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
     bool no_dm = 0;
 
+#if defined(__i386__) || defined(__x86_64__)
+    max_cpus = HVM_MAX_VCPUS;
+#elif defined(__aarch64__)
+    max_cpus = GUEST_MAX_VCPUS;
+#endif
+
     for ( ; ; )
     {
         int opt = getopt_long(argc, argv, "", options, NULL);
@@ -161,6 +171,7 @@ int main(int argc, char **argv)
     /**** Processor start ****/
     push_block("Scope", "\\_SB");
 
+#if defined(__i386__) || defined(__x86_64__)
     /* MADT checksum */
     stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
     push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
@@ -174,6 +185,7 @@ int main(int argc, char **argv)
     pop_block();
     stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
     pop_block();
+#endif
 
     /* Define processor objects and control methods. */
     for ( cpu = 0; cpu < max_cpus; cpu++)
@@ -182,6 +194,11 @@ int main(int argc, char **argv)
 
         stmt("Name", "_HID, \"ACPI0007\"");
 
+        stmt("Name", "_UID, %d", cpu);
+#if defined(__aarch64__)
+        pop_block();
+        continue;
+#endif
         /* Name this processor's MADT LAPIC descriptor. */
         stmt("OperationRegion", 
              "MATR, SystemMemory, Add(\\_SB.MAPA, %d), 8", cpu*8);
@@ -220,6 +237,14 @@ int main(int argc, char **argv)
         pop_block();
     }
 
+#if defined(__aarch64__)
+    pop_block();
+    /**** Processor end ****/
+    pop_block();
+    /**** DSDT DefinitionBlock end ****/
+    return 0;
+#endif
+
     /* Operation Region 'PRST': bitmask of online CPUs. */
     stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32");
     push_block("Field", "PRST, ByteAcc, NoLock, Preserve");
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index afd93de..15a9046 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -91,7 +91,10 @@ acpi:
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
 LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
 ifeq ($(CONFIG_ARM_64),y)
-LIBXL_OBJS-y += libxl_arm_acpi.o
+LIBXL_OBJS-y += libxl_arm_acpi.o dsdt_anycpu_arm.o
+dsdt_anycpu_arm.c:
+	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR)
+
 libxl_arm_acpi.o: libxl_arm_acpi.c
 	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
 else
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 810aed8..0851411 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -29,6 +29,11 @@ typedef uint64_t u64;
 #include <acpi/acconfig.h>
 #include <acpi/actbl.h>
 
+_hidden
+extern const unsigned char dsdt_anycpu_arm[];
+_hidden
+extern const int dsdt_anycpu_arm_len;
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 61fc08e..234d994 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -548,6 +548,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
 {
     int rc;
 
+    BUILD_BUG_ON(GUEST_MAX_VCPUS < MAX_VIRT_CPUS);
     d->arch.relmem = RELMEM_not_started;
 
     /* Idle domains do not need this setup */
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 4b4c959..1bef2ee 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -435,6 +435,9 @@ typedef uint64_t xen_callback_t;
 #define GUEST_RAM_BANK_BASES   { GUEST_RAM0_BASE, GUEST_RAM1_BASE }
 #define GUEST_RAM_BANK_SIZES   { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE }
 
+/* Current supported guest VCPUs */
+#define GUEST_MAX_VCPUS 128
+
 /* Interrupts */
 #define GUEST_TIMER_VIRT_PPI    27
 #define GUEST_TIMER_PHYS_S_PPI  29
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (2 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Estimate the size of ACPI tables and reserve a memory map space for ACPI
tables.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 0851411..b91f3f6 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -34,12 +34,108 @@ extern const unsigned char dsdt_anycpu_arm[];
 _hidden
 extern const int dsdt_anycpu_arm_len;
 
+enum {
+    RSDP,
+    XSDT,
+    GTDT,
+    MADT,
+    FADT,
+    DSDT,
+    NUMS,
+};
+
+struct acpitable {
+    uint64_t addr;
+    size_t size;
+};
+
+static int libxl__estimate_madt_size(libxl__gc *gc,
+                                     libxl_domain_build_info *info,
+                                     xc_domain_configuration_t *xc_config)
+{
+    int rc;
+
+    switch (xc_config->gic_version) {
+    case XEN_DOMCTL_CONFIG_GIC_V2:
+        rc = sizeof(struct acpi_table_madt) +
+             sizeof(struct acpi_madt_generic_interrupt) * info->max_vcpus +
+             sizeof(struct acpi_madt_generic_distributor);
+        break;
+    case XEN_DOMCTL_CONFIG_GIC_V3:
+        rc = sizeof(struct acpi_table_madt) +
+             sizeof(struct acpi_madt_generic_interrupt) * info->max_vcpus +
+             sizeof(struct acpi_madt_generic_distributor) +
+             sizeof(struct acpi_madt_generic_redistributor);
+        break;
+    default:
+        LOG(ERROR, "Unknown GIC version");
+        rc = ERROR_FAIL;
+        break;
+    }
+
+    return rc;
+}
+
+static int libxl__estimate_acpi_size(libxl__gc *gc,
+                                     libxl_domain_build_info *info,
+                                     struct xc_dom_image *dom,
+                                     xc_domain_configuration_t *xc_config,
+                                     struct acpitable acpitables[])
+{
+    int rc;
+
+    acpitables[RSDP].addr = GUEST_ACPI_BASE;
+    acpitables[RSDP].size = sizeof(struct acpi_table_rsdp);
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[RSDP].size, 3);
+
+    acpitables[XSDT].addr = GUEST_ACPI_BASE + dom->acpi_modules[0].length;
+    /*
+     * Currently only 3 tables(GTDT, FADT, MADT) are pointed by XSDT. Alloc
+     * entries for them.
+     */
+    acpitables[XSDT].size = sizeof(struct acpi_table_xsdt) +
+                            sizeof(uint64_t) * 2;
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[XSDT].size, 3);
+
+    acpitables[GTDT].addr = GUEST_ACPI_BASE + dom->acpi_modules[0].length;
+    acpitables[GTDT].size = sizeof(struct acpi_table_gtdt);
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[GTDT].size, 3);
+
+    acpitables[MADT].addr = GUEST_ACPI_BASE + dom->acpi_modules[0].length;
+
+    rc = libxl__estimate_madt_size(gc, info, xc_config);
+    if (rc < 0)
+        goto out;
+
+    acpitables[MADT].size = rc;
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[MADT].size, 3);
+
+    acpitables[FADT].addr = GUEST_ACPI_BASE + dom->acpi_modules[0].length;
+    acpitables[FADT].size = sizeof(struct acpi_table_fadt);
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[FADT].size, 3);
+
+    acpitables[DSDT].addr = GUEST_ACPI_BASE + dom->acpi_modules[0].length;
+    acpitables[DSDT].size = dsdt_anycpu_arm_len;
+    dom->acpi_modules[0].length += ROUNDUP(acpitables[DSDT].size, 3);
+
+    assert(dom->acpi_modules[0].length <= GUEST_ACPI_SIZE);
+    dom->acpi_modules[0].data = libxl__zalloc(gc, dom->acpi_modules[0].length);
+
+    rc = 0;
+out:
+    return rc;
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
 {
     const libxl_version_info *vers;
     int rc = 0;
+    struct acpitable acpitables[NUMS];
+
+    /* convenience aliases */
+    xc_domain_configuration_t *xc_config = &state->config;
 
     vers = libxl_get_version_info(CTX);
     if (vers == NULL) {
@@ -54,6 +150,8 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     dom->acpi_modules[0].length = 0;
     dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
 
+    rc = libxl__estimate_acpi_size(gc, info, dom, xc_config, acpitables);
+
 out:
     return rc;
 }
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (3 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 14:58   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
                   ` (13 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Construct ACPI RSDP table and add a helper to calculate the ACPI table
checksum.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index b91f3f6..83ad954 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -34,6 +34,10 @@ extern const unsigned char dsdt_anycpu_arm[];
 _hidden
 extern const int dsdt_anycpu_arm_len;
 
+#define ACPI_OEM_ID "Xen"
+#define ACPI_OEM_TABLE_ID "ARM"
+#define ACPI_ASL_COMPILER_ID "XL"
+
 enum {
     RSDP,
     XSDT,
@@ -126,6 +130,37 @@ out:
     return rc;
 }
 
+static void calculate_checksum(void *table, uint32_t checksum_offset,
+                               uint32_t length)
+{
+    uint8_t *p, sum = 0;
+
+    p = table;
+    p[checksum_offset] = 0;
+
+    while (length--)
+        sum = sum + *p++;
+
+    p = table;
+    p[checksum_offset] = -sum;
+}
+
+static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom,
+                           struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[RSDP].addr - GUEST_ACPI_BASE;
+    struct acpi_table_rsdp *rsdp = (void *)dom->acpi_modules[0].data + offset;
+
+    memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
+    memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id));
+    rsdp->length = acpitables[RSDP].size;
+    rsdp->revision = 0x02;
+    rsdp->xsdt_physical_address = acpitables[XSDT].addr;
+    calculate_checksum(rsdp,
+                       offsetof(struct acpi_table_rsdp, extended_checksum),
+                       acpitables[RSDP].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -151,6 +186,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
 
     rc = libxl__estimate_acpi_size(gc, info, dom, xc_config, acpitables);
+    if (rc)
+        goto out;
+
+    make_acpi_rsdp(gc, dom, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (4 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:05   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
                   ` (12 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 83ad954..93ba2d1 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -161,6 +161,35 @@ static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom,
                        acpitables[RSDP].size);
 }
 
+static void make_acpi_header(struct acpi_table_header *h, const char *sig,
+                             size_t len, uint8_t rev)
+{
+    memcpy(h->signature, sig, 4);
+    h->length = len;
+    h->revision = rev;
+    memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id));
+    memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, sizeof(h->oem_table_id));
+    h->oem_revision = 0;
+    memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID,
+           sizeof(h->asl_compiler_id));
+    h->asl_compiler_revision = 0;
+    h->checksum = 0;
+}
+
+static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom,
+                           struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[XSDT].addr - GUEST_ACPI_BASE;
+    struct acpi_table_xsdt *xsdt = (void *)dom->acpi_modules[0].data + offset;
+
+    xsdt->table_offset_entry[0] = acpitables[MADT].addr;
+    xsdt->table_offset_entry[1] = acpitables[GTDT].addr;
+    xsdt->table_offset_entry[2] = acpitables[FADT].addr;
+    make_acpi_header(&xsdt->header, "XSDT", acpitables[XSDT].size, 1);
+    calculate_checksum(xsdt, offsetof(struct acpi_table_header, checksum),
+                       acpitables[XSDT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -190,6 +219,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
         goto out;
 
     make_acpi_rsdp(gc, dom, acpitables);
+    make_acpi_xsdt(gc, dom, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (5 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:08   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Construct GTDT table with the interrupt information of timers.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 93ba2d1..ab49d57 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -25,10 +25,24 @@ typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
 typedef uint64_t u64;
+typedef int64_t s64;
 
 #include <acpi/acconfig.h>
 #include <acpi/actbl.h>
 
+#ifndef BITS_PER_LONG
+#ifdef _LP64
+#define BITS_PER_LONG 64
+#else
+#define BITS_PER_LONG 32
+#endif
+#endif
+#define ACPI_MACHINE_WIDTH __BITS_PER_LONG
+#define COMPILER_DEPENDENT_INT64 int64_t
+#define COMPILER_DEPENDENT_UINT64 uint64_t
+
+#include <acpi/actypes.h>
+
 _hidden
 extern const unsigned char dsdt_anycpu_arm[];
 _hidden
@@ -190,6 +204,29 @@ static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom,
                        acpitables[XSDT].size);
 }
 
+static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom,
+                           struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[GTDT].addr - GUEST_ACPI_BASE;
+    struct acpi_table_gtdt *gtdt = (void *)dom->acpi_modules[0].data + offset;
+
+    gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI;
+    gtdt->non_secure_el1_flags =
+                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
+                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
+    gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI;
+    gtdt->virtual_timer_flags =
+                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
+                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
+
+    gtdt->counter_block_addresss = 0xFFFFFFFFFFFFFFFF;
+    gtdt->counter_read_block_address = 0xFFFFFFFFFFFFFFFF;
+
+    make_acpi_header(&gtdt->header, "GTDT", acpitables[GTDT].size, 2);
+    calculate_checksum(gtdt, offsetof(struct acpi_table_header, checksum),
+                       acpitables[GTDT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -220,6 +257,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 
     make_acpi_rsdp(gc, dom, acpitables);
     make_acpi_xsdt(gc, dom, acpitables);
+    make_acpi_gtdt(gc, dom, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (6 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Factor MPIDR computing codes out as a helper, so it could be shared
between DT and ACPI.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
---
 tools/libxl/libxl_arm.c |  8 +-------
 tools/libxl/libxl_arm.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 333c9a1..2a4577c 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -309,13 +309,7 @@ static int make_cpus_node(libxl__gc *gc, void *fdt, int nr_cpus,
     for (i = 0; i < nr_cpus; i++) {
         const char *name;
 
-        /*
-         * According to ARM CPUs bindings, the reg field should match
-         * the MPIDR's affinity bits. We will use AFF0 and AFF1 when
-         * constructing the reg value of the guest at the moment, for it
-         * is enough for the current max vcpu number.
-         */
-        mpidr_aff = (i & 0x0f) | (((i >> 4) & 0xff) << 8);
+        mpidr_aff = libxl__compute_mpdir(i);
         name = GCSPRINTF("cpu@%"PRIx64, mpidr_aff);
 
         res = fdt_begin_node(fdt, name);
diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
index 1c01177..a91ff93 100644
--- a/tools/libxl/libxl_arm.h
+++ b/tools/libxl/libxl_arm.h
@@ -24,6 +24,17 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom);
 
+static inline uint64_t libxl__compute_mpdir(unsigned int cpuid)
+{
+    /*
+     * According to ARM CPUs bindings, the reg field should match
+     * the MPIDR's affinity bits. We will use AFF0 and AFF1 when
+     * constructing the reg value of the guest at the moment, for it
+     * is enough for the current max vcpu number.
+     */
+    return (cpuid & 0x0f) | (((cpuid >> 4) & 0xff) << 8);
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (7 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:09   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
                   ` (9 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

According to the GIC version, construct the MADT table.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 84 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index ab49d57..d3358b3 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -227,6 +227,89 @@ static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom,
                        acpitables[GTDT].size);
 }
 
+static void make_acpi_madt_gicc(void *table, int nr_cpus, uint64_t gicc_base)
+{
+    int i;
+    struct acpi_madt_generic_interrupt *gicc = table;
+
+    for (i = 0; i < nr_cpus; i++) {
+        gicc->header.type = ACPI_MADT_TYPE_GENERIC_INTERRUPT;
+        gicc->header.length = sizeof(*gicc);
+        gicc->base_address = gicc_base;
+        gicc->cpu_interface_number = i;
+        gicc->arm_mpidr = libxl__compute_mpdir(i);
+        gicc->uid = i;
+        gicc->flags = ACPI_MADT_ENABLED;
+        gicc++;
+    }
+}
+
+static void make_acpi_madt_gicd(void *table, uint64_t gicd_base,
+                                uint8_t gic_version)
+{
+    struct acpi_madt_generic_distributor *gicd = table;
+
+    gicd->header.type = ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR;
+    gicd->header.length = sizeof(*gicd);
+    gicd->base_address = gicd_base;
+    /* This version field has no meaning before ACPI 5.1 errata. */
+    gicd->version = gic_version;
+}
+
+static void make_acpi_madt_gicr(void *table, uint64_t gicr_base,
+                                uint64_t gicr_size)
+{
+    struct acpi_madt_generic_redistributor *gicr = table;
+
+    gicr->header.type = ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR;
+    gicr->header.length = sizeof(*gicr);
+    gicr->base_address = gicr_base;
+    gicr->length = gicr_size;
+}
+
+static int make_acpi_madt(libxl__gc *gc, struct xc_dom_image *dom, int nr_cpus,
+                          xc_domain_configuration_t *xc_config,
+                          struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[MADT].addr - GUEST_ACPI_BASE;
+    void *table = dom->acpi_modules[0].data + offset;
+    struct acpi_table_madt *madt = table;
+    int rc = 0;
+
+    switch (xc_config->gic_version) {
+    case XEN_DOMCTL_CONFIG_GIC_V2:
+        table += sizeof(struct acpi_table_madt);
+        make_acpi_madt_gicc(table, nr_cpus, GUEST_GICC_BASE);
+
+        table += sizeof(struct acpi_madt_generic_interrupt) * nr_cpus;
+        make_acpi_madt_gicd(table, GUEST_GICD_BASE, ACPI_MADT_GIC_VERSION_V2);
+        break;
+    case XEN_DOMCTL_CONFIG_GIC_V3:
+        table += sizeof(struct acpi_table_madt);
+        make_acpi_madt_gicc(table, nr_cpus, 0);
+
+        table += sizeof(struct acpi_madt_generic_interrupt) * nr_cpus;
+        make_acpi_madt_gicd(table, GUEST_GICV3_GICD_BASE,
+                            ACPI_MADT_GIC_VERSION_V3);
+
+        table += sizeof(struct acpi_madt_generic_distributor);
+        make_acpi_madt_gicr(table, GUEST_GICV3_GICR0_BASE,
+                            GUEST_GICV3_GICR0_SIZE);
+        break;
+    default:
+        LOG(ERROR, "Unknown GIC version");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    make_acpi_header(&madt->header, "APIC", acpitables[MADT].size, 3);
+    calculate_checksum(madt, offsetof(struct acpi_table_header, checksum),
+                       acpitables[MADT].size);
+
+out:
+    return rc;
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -258,6 +341,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     make_acpi_rsdp(gc, dom, acpitables);
     make_acpi_xsdt(gc, dom, acpitables);
     make_acpi_gtdt(gc, dom, acpitables);
+    rc = make_acpi_madt(gc, dom, info->max_vcpus, xc_config, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (8 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:10   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
                   ` (8 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index d3358b3..407f9d5 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -310,6 +310,25 @@ out:
     return rc;
 }
 
+static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom,
+                           struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[FADT].addr - GUEST_ACPI_BASE;
+    struct acpi_table_fadt *fadt = (void *)dom->acpi_modules[0].data + offset;
+
+    /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+    fadt->flags = ACPI_FADT_HW_REDUCED;
+    fadt->arm_boot_flags = ACPI_FADT_PSCI_COMPLIANT | ACPI_FADT_PSCI_USE_HVC;
+
+    /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
+    fadt->minor_revision = 0x1;
+    fadt->dsdt = acpitables[DSDT].addr;
+
+    make_acpi_header(&fadt->header, "FACP", acpitables[FADT].size, 5);
+    calculate_checksum(fadt, offsetof(struct acpi_table_header, checksum),
+                       acpitables[FADT].size);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -342,6 +361,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     make_acpi_xsdt(gc, dom, acpitables);
     make_acpi_gtdt(gc, dom, acpitables);
     rc = make_acpi_madt(gc, dom, info->max_vcpus, xc_config, acpitables);
+    if (rc)
+        goto out;
+
+    make_acpi_fadt(gc, dom, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (9 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:13   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
                   ` (7 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Copy the static DSDT table into ACPI blob.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 407f9d5..30e4d66 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -329,6 +329,15 @@ static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom,
                        acpitables[FADT].size);
 }
 
+static void make_acpi_dsdt(libxl__gc *gc, struct xc_dom_image *dom,
+                           struct acpitable acpitables[])
+{
+    uint64_t offset = acpitables[DSDT].addr - GUEST_ACPI_BASE;
+    void *dsdt = dom->acpi_modules[0].data + offset;
+
+    memcpy(dsdt, dsdt_anycpu_arm, dsdt_anycpu_arm_len);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -365,6 +374,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
         goto out;
 
     make_acpi_fadt(gc, dom, acpitables);
+    make_acpi_dsdt(gc, dom, acpitables);
 
 out:
     return rc;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (10 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 13/16] libxl/arm: Add ACPI module Shannon Zhao
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Rename finalise_one_memory_node to finalise_one_node and pass the node
name via function parameter.

This is useful for adding ACPI module which will be added by a later
patch.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
---
 tools/libxl/libxl_arm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 2a4577c..f7f2c60 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -905,11 +905,11 @@ out:
     return rc;
 }
 
-static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
-                                     uint64_t base, uint64_t size)
+static void finalise_one_node(libxl__gc *gc, void *fdt, const char *uname,
+                              uint64_t base, uint64_t size)
 {
     int node, res;
-    const char *name = GCSPRINTF("/memory@%"PRIx64, base);
+    const char *name = GCSPRINTF("%s@%"PRIx64, uname, base);
 
     node = fdt_path_offset(fdt, name);
     assert(node > 0);
@@ -972,7 +972,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     for (i = 0; i < GUEST_RAM_BANKS; i++) {
         const uint64_t size = (uint64_t)dom->rambank_size[i] << XC_PAGE_SHIFT;
 
-        finalise_one_memory_node(gc, fdt, bankbase[i], size);
+        finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
     }
 
     debug_dump_fdt(gc, fdt);
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 13/16] libxl/arm: Add ACPI module
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (11 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Add the ARM Multiboot module for ACPI, so UEFI or DomU can get the base
address of ACPI tables from it.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
---
 docs/misc/arm/device-tree/acpi.txt | 24 ++++++++++++++++++++++++
 tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 docs/misc/arm/device-tree/acpi.txt

diff --git a/docs/misc/arm/device-tree/acpi.txt b/docs/misc/arm/device-tree/acpi.txt
new file mode 100644
index 0000000..3e70157
--- /dev/null
+++ b/docs/misc/arm/device-tree/acpi.txt
@@ -0,0 +1,24 @@
+DomU ACPI module
+================================
+
+Xen toolstack passes the domU ACPI tables via a reference in the /chosen node of
+the device tree.
+
+Each node contains the following properties:
+
+- compatible
+
+	"xen,guest-acpi", "multiboot,module"
+
+- reg
+
+	Specifies the physical address and the length of the module.
+	RSDP table is always located at the beginning of this region.
+
+Examples
+========
+
+	module@0x20000000 {
+		compatible = "xen,guest-acpi", "multiboot,module";
+		reg = <0x20000000 0x1234>;
+	};
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index f7f2c60..6f0bc70 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -285,6 +285,25 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
         if (res) return res;
     }
 
+    if (libxl_defbool_val(info->acpi)) {
+        const uint64_t acpi_base = GUEST_ACPI_BASE;
+        const char *name = GCSPRINTF("module@%"PRIx64, acpi_base);
+
+        res = fdt_begin_node(fdt, name);
+        if (res) return res;
+
+        res = fdt_property_compat(gc, fdt, 2, "xen,guest-acpi",
+                                  "multiboot,module");
+        if (res) return res;
+
+        res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
+                                1, 0, 0);
+        if (res) return res;
+
+        res = fdt_end_node(fdt);
+        if (res) return res;
+    }
+
     res = fdt_end_node(fdt);
     if (res) return res;
 
@@ -975,6 +994,11 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
         finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
     }
 
+    if (dom->acpi_modules[0].data) {
+        finalise_one_node(gc, fdt, "/chosen/module", GUEST_ACPI_BASE,
+                          dom->acpi_modules[0].length);
+    }
+
     debug_dump_fdt(gc, fdt);
 
     return 0;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (12 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 13/16] libxl/arm: Add ACPI module Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-02  6:18   ` Jan Beulich
  2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, julien.grall, shannon.zhao, Jan Beulich,
	boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update
them in evtchn_fixup().

Also use HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT in hvm_set_callback_via().

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 xen/arch/arm/domain_build.c     | 8 +++++---
 xen/arch/x86/hvm/irq.c          | 2 +-
 xen/include/public/hvm/params.h | 3 +++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 60db9e4..494115b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2019,9 +2019,11 @@ static void evtchn_fixup(struct domain *d, struct kernel_info *kinfo)
            d->arch.evtchn_irq);
 
     /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */
-    val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56;
-    val |= (2 << 8); /* Active-low level-sensitive  */
-    val |= d->arch.evtchn_irq & 0xff;
+    val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT;
+    /* Active-low level-sensitive  */
+    val |= (HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL <<
+            HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT);
+    val |= d->arch.evtchn_irq;
     d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val;
 
     /*
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 5323d7c..7c5836b 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -325,7 +325,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
     unsigned int gsi=0, pdev=0, pintx=0;
     uint8_t via_type;
 
-    via_type = (uint8_t)(via >> 56) + 1;
+    via_type = (uint8_t)(via >> HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT) + 1;
     if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) ||
          (via_type > HVMIRQ_callback_vector) )
         via_type = HVMIRQ_callback_none;
diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index f7338a3..a161de1 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -30,6 +30,7 @@
  */
 
 #define HVM_PARAM_CALLBACK_IRQ 0
+#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT     56
 /*
  * How should CPU0 event-channel notifications be delivered?
  *
@@ -66,6 +67,8 @@
  * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to
  * the notification is handled by the interrupt controller.
  */
+#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT     8
+#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2
 #endif
 
 /*
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (13 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:14   ` Julien Grall
  2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

The guest kernel will get the event channel interrupt information via
domain param HVM_PARAM_CALLBACK_IRQ. Initialize it here.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 6f0bc70..e73d65e 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -900,8 +900,21 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
                                            struct xc_dom_image *dom)
 {
     int rc;
+    uint64_t val;
 
     assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+
+    /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
+    val = (uint64_t)HVM_PARAM_CALLBACK_TYPE_PPI << HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT;
+    /* Active-low level-sensitive  */
+    val |= (HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL <<
+            HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT);
+    val |= GUEST_EVTCHN_PPI;
+    rc = xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CALLBACK_IRQ,
+                          val);
+    if (rc)
+        return rc;
+
     rc = libxl__prepare_dtb(gc, info, state, dom);
     if (rc) goto out;
 
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (14 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
@ 2016-09-02  2:55 ` Shannon Zhao
  2016-09-12 15:18   ` Julien Grall
  2016-09-02 14:31 ` [PATCH v5 00/16] Xen ARM DomU ACPI support Wei Liu
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  2:55 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	julien.grall, shannon.zhao, boris.ostrovsky

From: Shannon Zhao <shannon.zhao@linaro.org>

Here it adds the ACPI tables size to set the target maxmem to avoid
providing less available memory for guest.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arch.h        |  2 +-
 tools/libxl/libxl_arm.c         | 18 +++++++++++++++++-
 tools/libxl/libxl_arm.h         |  4 ++++
 tools/libxl/libxl_arm_acpi.c    | 20 ++++++++++++++++++++
 tools/libxl/libxl_arm_no_acpi.c |  6 ++++++
 tools/libxl/libxl_dom.c         |  2 +-
 tools/libxl/libxl_x86.c         |  2 +-
 7 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
index 337061f..d62fa4c 100644
--- a/tools/libxl/libxl_arch.h
+++ b/tools/libxl/libxl_arch.h
@@ -30,7 +30,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 /* arch specific internal domain creation function */
 _hidden
 int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-               uint32_t domid);
+                              libxl__domain_build_state *state, uint32_t domid);
 
 /* setup arch specific hardware description, i.e. DTB on ARM */
 _hidden
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index e73d65e..c7d4f65 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -101,8 +101,24 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 }
 
 int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-                              uint32_t domid)
+                              libxl__domain_build_state *state, uint32_t domid)
 {
+    libxl_domain_build_info *const info = &d_config->b_info;
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    int size;
+
+    /* Add the size of ACPI tables to maxmem if ACPI is enabled for guest. */
+    if (libxl_defbool_val(info->acpi)) {
+        size = libxl__get_acpi_size(gc, info, state);
+        if (size < 0)
+            return ERROR_FAIL;
+        if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
+                                LIBXL_MAXMEM_CONSTANT + (size + 1023) / 1024)) {
+            LOGE(ERROR, "Couldn't set max memory");
+            return ERROR_FAIL;
+        }
+    }
+
     return 0;
 }
 
diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
index a91ff93..37b1f15 100644
--- a/tools/libxl/libxl_arm.h
+++ b/tools/libxl/libxl_arm.h
@@ -24,6 +24,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom);
 
+_hidden
+int libxl__get_acpi_size(libxl__gc *gc, libxl_domain_build_info *info,
+                         libxl__domain_build_state *state);
+
 static inline uint64_t libxl__compute_mpdir(unsigned int cpuid)
 {
     /*
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 30e4d66..9854c7a 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -94,6 +94,26 @@ static int libxl__estimate_madt_size(libxl__gc *gc,
     return rc;
 }
 
+int libxl__get_acpi_size(libxl__gc *gc, libxl_domain_build_info *info,
+                         libxl__domain_build_state *state)
+{
+    int size;
+
+    size = libxl__estimate_madt_size(gc, info, &state->config);
+    if (size < 0)
+        goto out;
+
+    size = ROUNDUP(size, 3) +
+           ROUNDUP(sizeof(struct acpi_table_rsdp), 3) +
+           ROUNDUP(sizeof(struct acpi_table_xsdt), 3) +
+           ROUNDUP(sizeof(struct acpi_table_gtdt), 3) +
+           ROUNDUP(sizeof(struct acpi_table_fadt), 3) +
+           ROUNDUP(sizeof(dsdt_anycpu_arm_len), 3);
+
+out:
+    return size;
+}
+
 static int libxl__estimate_acpi_size(libxl__gc *gc,
                                      libxl_domain_build_info *info,
                                      struct xc_dom_image *dom,
diff --git a/tools/libxl/libxl_arm_no_acpi.c b/tools/libxl/libxl_arm_no_acpi.c
index e7f7411..5eeb825 100644
--- a/tools/libxl/libxl_arm_no_acpi.c
+++ b/tools/libxl/libxl_arm_no_acpi.c
@@ -25,6 +25,12 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     return ERROR_FAIL;
 }
 
+int libxl__get_acpi_size(libxl__gc *gc, libxl_domain_build_info *info,
+                         libxl__domain_build_state *state)
+{
+    return ERROR_FAIL;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 7dbf614..a2cd350 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -437,7 +437,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
 #endif
     }
 
-    rc = libxl__arch_domain_create(gc, d_config, domid);
+    rc = libxl__arch_domain_create(gc, d_config, state, domid);
 
     return rc;
 }
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index e9127bb..c872089 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -285,7 +285,7 @@ static int libxl__e820_alloc(libxl__gc *gc, uint32_t domid,
 }
 
 int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-        uint32_t domid)
+                              libxl__domain_build_state *state, uint32_t domid)
 {
     int ret = 0;
     int tsc_mode;
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI
  2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
@ 2016-09-02  6:18   ` Jan Beulich
  2016-09-02  7:23     ` Shannon Zhao
  0 siblings, 1 reply; 56+ messages in thread
From: Jan Beulich @ 2016-09-02  6:18 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, julien.grall, shannon.zhao,
	boris.ostrovsky

>>> On 02.09.16 at 04:55, <zhaoshenglong@huawei.com> wrote:
> --- a/xen/include/public/hvm/params.h
> +++ b/xen/include/public/hvm/params.h
> @@ -30,6 +30,7 @@
>   */
>  
>  #define HVM_PARAM_CALLBACK_IRQ 0
> +#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT     56

This covering the top 8 bits, just the shift value might indeed be
enough.

> @@ -66,6 +67,8 @@
>   * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to
>   * the notification is handled by the interrupt controller.
>   */
> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT     8
> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2

Here, however, I don't see how the shift value alone can be of
use when wanting to extract the relevant bits. I think this (and
for consistency also the other) value should be specified as a
mask, with users expected to have mechanisms like our
MASK_EXTR() / MASK_INSR() available.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI
  2016-09-02  6:18   ` Jan Beulich
@ 2016-09-02  7:23     ` Shannon Zhao
  2016-09-02  8:17       ` Jan Beulich
  0 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-02  7:23 UTC (permalink / raw)
  To: Jan Beulich
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, julien.grall, shannon.zhao,
	boris.ostrovsky



On 2016/9/2 14:18, Jan Beulich wrote:
>>>> On 02.09.16 at 04:55, <zhaoshenglong@huawei.com> wrote:
>> --- a/xen/include/public/hvm/params.h
>> +++ b/xen/include/public/hvm/params.h
>> @@ -30,6 +30,7 @@
>>   */
>>  
>>  #define HVM_PARAM_CALLBACK_IRQ 0
>> +#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT     56
> 
> This covering the top 8 bits, just the shift value might indeed be
> enough.
> 
>> @@ -66,6 +67,8 @@
>>   * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to
>>   * the notification is handled by the interrupt controller.
>>   */
>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT     8
>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2
> 
> Here, however, I don't see how the shift value alone can be of
> use when wanting to extract the relevant bits. I think this (and
> for consistency also the other) value should be specified as a
> mask, with users expected to have mechanisms like our
> MASK_EXTR() / MASK_INSR() available.
> 
Ok, will add the mask. Thanks.

-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI
  2016-09-02  7:23     ` Shannon Zhao
@ 2016-09-02  8:17       ` Jan Beulich
  0 siblings, 0 replies; 56+ messages in thread
From: Jan Beulich @ 2016-09-02  8:17 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, julien.grall, shannon.zhao,
	boris.ostrovsky

>>> On 02.09.16 at 09:23, <zhaoshenglong@huawei.com> wrote:

> 
> On 2016/9/2 14:18, Jan Beulich wrote:
>>>>> On 02.09.16 at 04:55, <zhaoshenglong@huawei.com> wrote:
>>> --- a/xen/include/public/hvm/params.h
>>> +++ b/xen/include/public/hvm/params.h
>>> @@ -30,6 +30,7 @@
>>>   */
>>>  
>>>  #define HVM_PARAM_CALLBACK_IRQ 0
>>> +#define HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT     56
>> 
>> This covering the top 8 bits, just the shift value might indeed be
>> enough.
>> 
>>> @@ -66,6 +67,8 @@
>>>   * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to
>>>   * the notification is handled by the interrupt controller.
>>>   */
>>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT     8
>>> +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2
>> 
>> Here, however, I don't see how the shift value alone can be of
>> use when wanting to extract the relevant bits. I think this (and
>> for consistency also the other) value should be specified as a
>> mask, with users expected to have mechanisms like our
>> MASK_EXTR() / MASK_INSR() available.
>> 
> Ok, will add the mask. Thanks.

And just to avoid any misunderstanding (and another extra round
trip): I mean there to be _only_ a mask definition, without any
shift values (as those can be derived).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI
  2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
@ 2016-09-02 14:29   ` Wei Liu
  0 siblings, 0 replies; 56+ messages in thread
From: Wei Liu @ 2016-09-02 14:29 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	julien.grall, shannon.zhao, boris.ostrovsky

On Fri, Sep 02, 2016 at 10:55:24AM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> Since the existing configuration option "u.hvm.acpi" is x86 specific and
> we want to reuse it on ARM as well, add a unified option "acpi" for
> x86 and ARM, and for ARM it's disabled by default.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables
  2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
@ 2016-09-02 14:29   ` Wei Liu
  2016-09-12 14:41   ` Julien Grall
  1 sibling, 0 replies; 56+ messages in thread
From: Wei Liu @ 2016-09-02 14:29 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	julien.grall, shannon.zhao, boris.ostrovsky

On Fri, Sep 02, 2016 at 10:55:25AM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> It only constructs the ACPI tables for 64-bit ARM DomU when user enables
> acpi because 32-bit DomU doesn't support ACPI. And the generation codes
> are only built for 64-bit toolstack.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

The code looks reasonable to me.

Subject to an ack from ARM maintainers:

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table
  2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
@ 2016-09-02 14:29   ` Wei Liu
  2016-09-12 14:44   ` Julien Grall
  1 sibling, 0 replies; 56+ messages in thread
From: Wei Liu @ 2016-09-02 14:29 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	julien.grall, shannon.zhao, boris.ostrovsky

On Fri, Sep 02, 2016 at 10:55:26AM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> It uses static DSDT table like the way x86 uses. Currently the DSDT
> table only contains processor device objects and it generates the
> maximal objects which so far is 128.
> 
> While the GUEST_MAX_VCPUS is defined under __XEN__ or __XEN_TOOLS__, it
> needs to add -D__XEN_TOOLS__ to compile mk_dsdt.c.
> 
> Also only check iasl for aarch64 in configure since ACPI on ARM32 is not
> supported.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> Note: this patch needs to be rebased on Boris's v3 patchset for only 
> generating dsdt_anycpu_arm.c for ARM64.
> ---
>  tools/configure.ac            |  2 +-

Note to Ian and myself: need to rerun autogen.sh while committing.

>  tools/libacpi/Makefile        | 13 ++++++++++++-
>  tools/libacpi/mk_dsdt.c       | 27 ++++++++++++++++++++++++++-

This could use review from Jan, Boris and Andrew.

>  tools/libxl/Makefile          |  5 ++++-
>  tools/libxl/libxl_arm_acpi.c  |  5 +++++

Again, subject from an ack from ARM maintainers:

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (15 preceding siblings ...)
  2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
@ 2016-09-02 14:31 ` Wei Liu
  2016-09-12 15:22 ` Julien Grall
  2016-09-13 11:56 ` Julien Grall
  18 siblings, 0 replies; 56+ messages in thread
From: Wei Liu @ 2016-09-02 14:31 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	julien.grall, shannon.zhao, boris.ostrovsky

Thanks for posting.

I go over all the patches and I think this series is in good shape. I
will defer most of the table construction code to ARM maintainers.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables
  2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
  2016-09-02 14:29   ` Wei Liu
@ 2016-09-12 14:41   ` Julien Grall
  1 sibling, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 14:41 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> It only constructs the ACPI tables for 64-bit ARM DomU when user enables
> acpi because 32-bit DomU doesn't support ACPI. And the generation codes
> are only built for 64-bit toolstack.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/Makefile            |  7 +++++
>  tools/libxl/libxl_arm.c         | 24 +++++++++++++++-
>  tools/libxl/libxl_arm.h         | 33 ++++++++++++++++++++++
>  tools/libxl/libxl_arm_acpi.c    | 62 +++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_arm_no_acpi.c | 34 ++++++++++++++++++++++
>  xen/include/public/arch-arm.h   |  4 +++
>  6 files changed, 163 insertions(+), 1 deletion(-)
>  create mode 100644 tools/libxl/libxl_arm.h
>  create mode 100644 tools/libxl/libxl_arm_acpi.c
>  create mode 100644 tools/libxl/libxl_arm_no_acpi.c
>
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index a148374..afd93de 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -90,6 +90,13 @@ acpi:
>
>  LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
>  LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
> +ifeq ($(CONFIG_ARM_64),y)
> +LIBXL_OBJS-y += libxl_arm_acpi.o
> +libxl_arm_acpi.o: libxl_arm_acpi.c
> +	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
> +else
> +LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_no_acpi.o
> +endif
>
>  ifeq ($(CONFIG_NetBSD),y)
>  LIBXL_OBJS-y += libxl_netbsd.o
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index 8ec5cd5..333c9a1 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -1,6 +1,7 @@
>  #include "libxl_internal.h"
>  #include "libxl_arch.h"
>  #include "libxl_libfdt_compat.h"
> +#include "libxl_arm.h"
>
>  #include <xc_dom.h>
>  #include <stdbool.h>
> @@ -885,8 +886,29 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
>                                             libxl__domain_build_state *state,
>                                             struct xc_dom_image *dom)
>  {
> +    int rc;
> +
>      assert(info->type == LIBXL_DOMAIN_TYPE_PV);
> -    return libxl__prepare_dtb(gc, info, state, dom);
> +    rc = libxl__prepare_dtb(gc, info, state, dom);
> +    if (rc) goto out;
> +
> +    if (!libxl_defbool_val(info->acpi)) {
> +        LOG(DEBUG, "Generating ACPI tables is disabled by user.");
> +        rc = 0;
> +        goto out;
> +    }
> +
> +    if (strcmp(dom->guest_type, "xen-3.0-aarch64")) {
> +        /* ACPI is only supported for 64-bit guest currently. */
> +        LOG(ERROR, "Can not enable libxl option 'acpi' for %s", dom->guest_type);
> +        rc = ERROR_FAIL;
> +        goto out;
> +    }
> +
> +    rc = libxl__prepare_acpi(gc, info, state, dom);
> +
> +out:
> +    return rc;
>  }
>
>  static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
> diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
> new file mode 100644
> index 0000000..1c01177
> --- /dev/null
> +++ b/tools/libxl/libxl_arm.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_internal.h"
> +#include "libxl_arch.h"
> +
> +#include <xc_dom.h>
> +
> +_hidden
> +int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> +                        libxl__domain_build_state *state,
> +                        struct xc_dom_image *dom);
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> new file mode 100644
> index 0000000..810aed8
> --- /dev/null
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -0,0 +1,62 @@
> +/*
> + * ARM DomU ACPI generation
> + *
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_arm.h"
> +
> +#include <stdint.h>
> +
> +/* Below typedefs are useful for the headers under acpi/ */
> +typedef uint8_t u8;
> +typedef uint16_t u16;
> +typedef uint32_t u32;
> +typedef uint64_t u64;
> +
> +#include <acpi/acconfig.h>
> +#include <acpi/actbl.h>
> +
> +int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> +                        libxl__domain_build_state *state,
> +                        struct xc_dom_image *dom)
> +{
> +    const libxl_version_info *vers;
> +    int rc = 0;
> +
> +    vers = libxl_get_version_info(CTX);
> +    if (vers == NULL) {
> +        rc = ERROR_FAIL;
> +        goto out;
> +    }
> +
> +    LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
> +        vers->xen_version_major, vers->xen_version_minor);
> +
> +    dom->acpi_modules[0].data = NULL;
> +    dom->acpi_modules[0].length = 0;
> +    dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
> +
> +out:
> +    return rc;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxl/libxl_arm_no_acpi.c b/tools/libxl/libxl_arm_no_acpi.c
> new file mode 100644
> index 0000000..e7f7411
> --- /dev/null
> +++ b/tools/libxl/libxl_arm_no_acpi.c
> @@ -0,0 +1,34 @@
> +/*
> + * ARM DomU ACPI generation
> + *
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_arm.h"
> +
> +int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> +                        libxl__domain_build_state *state,
> +                        struct xc_dom_image *dom)
> +{
> +    return ERROR_FAIL;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 870bc3b..4b4c959 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -406,6 +406,10 @@ typedef uint64_t xen_callback_t;
>  #define GUEST_GICV3_GICR0_BASE     0x03020000ULL    /* vCPU0 - vCPU127 */
>  #define GUEST_GICV3_GICR0_SIZE     0x01000000ULL
>
> +/* ACPI tables physical address */
> +#define GUEST_ACPI_BASE 0x20000000ULL
> +#define GUEST_ACPI_SIZE 0x02000000ULL
> +
>  /*
>   * 16MB == 4096 pages reserved for guest to use as a region to map its
>   * grant table in.
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table
  2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
  2016-09-02 14:29   ` Wei Liu
@ 2016-09-12 14:44   ` Julien Grall
  1 sibling, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 14:44 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> It uses static DSDT table like the way x86 uses. Currently the DSDT
> table only contains processor device objects and it generates the
> maximal objects which so far is 128.
>
> While the GUEST_MAX_VCPUS is defined under __XEN__ or __XEN_TOOLS__, it
> needs to add -D__XEN_TOOLS__ to compile mk_dsdt.c.
>
> Also only check iasl for aarch64 in configure since ACPI on ARM32 is not
> supported.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
> Note: this patch needs to be rebased on Boris's v3 patchset for only
> generating dsdt_anycpu_arm.c for ARM64.
> ---
>  tools/configure.ac            |  2 +-
>  tools/libacpi/Makefile        | 13 ++++++++++++-
>  tools/libacpi/mk_dsdt.c       | 27 ++++++++++++++++++++++++++-
>  tools/libxl/Makefile          |  5 ++++-
>  tools/libxl/libxl_arm_acpi.c  |  5 +++++
>  xen/arch/arm/domain.c         |  1 +
>  xen/include/public/arch-arm.h |  3 +++
>  7 files changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/tools/configure.ac b/tools/configure.ac
> index 0229d44..b4e0c80 100644
> --- a/tools/configure.ac
> +++ b/tools/configure.ac
> @@ -335,7 +335,7 @@ dnl "host" here means the platform on which the hypervisor and tools is
>  dnl going to run, not the platform on which we are building (known as
>  dnl "build" in gnu speak).
>  case "$host_cpu" in
> -i[[3456]]86|x86_64)
> +i[[3456]]86|x86_64|aarch64)
>      AX_PATH_PROG_OR_FAIL([IASL], [iasl])
>      ;;
>  esac
> diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
> index d741ac5..b1965cc 100644
> --- a/tools/libacpi/Makefile
> +++ b/tools/libacpi/Makefile
> @@ -19,6 +19,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
>
>  # Sources to be generated
>  C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c  dsdt_anycpu_qemu_xen.c dsdt_pvh.c)
> +C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
>  H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h)
>
>  vpath iasl $(PATH)
> @@ -32,7 +33,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
>  	cd $(CURDIR)
>
>  $(MK_DSDT): mk_dsdt.c
> -	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
> +	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
>
>  $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
>  	awk 'NR > 1 {print s} {s=$$0}' $< > $@
> @@ -62,6 +63,16 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl $(ACPI_BUILD_DIR)/dsdt_pvh.asl
>  	echo "int dsdt_pvh_len=sizeof(dsdt_pvh);" >>$@
>  	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
>
> +$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
> +	printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"Xen\", \"ARM\", 1)\n{" > $@
> +	$(MK_DSDT) --debug=$(debug) >> $@
> +
> +$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
> +	iasl -vs -p $(ACPI_BUILD_DIR)/$* -tc $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
> +	sed -e 's/AmlCode/dsdt_anycpu_arm/g' $(ACPI_BUILD_DIR)/$*.hex >$@
> +	echo "int dsdt_anycpu_arm_len=sizeof(dsdt_anycpu_arm);" >>$@
> +	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
> +
>  iasl:
>  	@echo
>  	@echo "ACPI ASL compiler (iasl) is needed"
> diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
> index 7d76784..a56e0f0 100644
> --- a/tools/libacpi/mk_dsdt.c
> +++ b/tools/libacpi/mk_dsdt.c
> @@ -17,7 +17,11 @@
>  #include <getopt.h>
>  #include <stdlib.h>
>  #include <stdbool.h>
> +#if defined(__i386__) || defined(__x86_64__)
>  #include <xen/hvm/hvm_info_table.h>
> +#elif defined(__aarch64__)
> +#include <xen/arch-arm.h>
> +#endif
>
>  static unsigned int indent_level;
>  static bool debug = false;
> @@ -104,10 +108,16 @@ static struct option options[] = {
>
>  int main(int argc, char **argv)
>  {
> -    unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
> +    unsigned int slot, dev, intx, link, cpu, max_cpus;
>      dm_version dm_version = QEMU_XEN_TRADITIONAL;
>      bool no_dm = 0;
>
> +#if defined(__i386__) || defined(__x86_64__)
> +    max_cpus = HVM_MAX_VCPUS;
> +#elif defined(__aarch64__)
> +    max_cpus = GUEST_MAX_VCPUS;
> +#endif
> +
>      for ( ; ; )
>      {
>          int opt = getopt_long(argc, argv, "", options, NULL);
> @@ -161,6 +171,7 @@ int main(int argc, char **argv)
>      /**** Processor start ****/
>      push_block("Scope", "\\_SB");
>
> +#if defined(__i386__) || defined(__x86_64__)
>      /* MADT checksum */
>      stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
>      push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
> @@ -174,6 +185,7 @@ int main(int argc, char **argv)
>      pop_block();
>      stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
>      pop_block();
> +#endif
>
>      /* Define processor objects and control methods. */
>      for ( cpu = 0; cpu < max_cpus; cpu++)
> @@ -182,6 +194,11 @@ int main(int argc, char **argv)
>
>          stmt("Name", "_HID, \"ACPI0007\"");
>
> +        stmt("Name", "_UID, %d", cpu);
> +#if defined(__aarch64__)
> +        pop_block();
> +        continue;
> +#endif
>          /* Name this processor's MADT LAPIC descriptor. */
>          stmt("OperationRegion",
>               "MATR, SystemMemory, Add(\\_SB.MAPA, %d), 8", cpu*8);
> @@ -220,6 +237,14 @@ int main(int argc, char **argv)
>          pop_block();
>      }
>
> +#if defined(__aarch64__)
> +    pop_block();
> +    /**** Processor end ****/
> +    pop_block();
> +    /**** DSDT DefinitionBlock end ****/
> +    return 0;
> +#endif
> +
>      /* Operation Region 'PRST': bitmask of online CPUs. */
>      stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32");
>      push_block("Field", "PRST, ByteAcc, NoLock, Preserve");
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index afd93de..15a9046 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -91,7 +91,10 @@ acpi:
>  LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
>  LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
>  ifeq ($(CONFIG_ARM_64),y)
> -LIBXL_OBJS-y += libxl_arm_acpi.o
> +LIBXL_OBJS-y += libxl_arm_acpi.o dsdt_anycpu_arm.o
> +dsdt_anycpu_arm.c:
> +	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR)
> +
>  libxl_arm_acpi.o: libxl_arm_acpi.c
>  	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
>  else
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index 810aed8..0851411 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -29,6 +29,11 @@ typedef uint64_t u64;
>  #include <acpi/acconfig.h>
>  #include <acpi/actbl.h>
>
> +_hidden
> +extern const unsigned char dsdt_anycpu_arm[];
> +_hidden
> +extern const int dsdt_anycpu_arm_len;
> +
>  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>                          libxl__domain_build_state *state,
>                          struct xc_dom_image *dom)
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 61fc08e..234d994 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -548,6 +548,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
>  {
>      int rc;
>
> +    BUILD_BUG_ON(GUEST_MAX_VCPUS < MAX_VIRT_CPUS);
>      d->arch.relmem = RELMEM_not_started;
>
>      /* Idle domains do not need this setup */
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 4b4c959..1bef2ee 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -435,6 +435,9 @@ typedef uint64_t xen_callback_t;
>  #define GUEST_RAM_BANK_BASES   { GUEST_RAM0_BASE, GUEST_RAM1_BASE }
>  #define GUEST_RAM_BANK_SIZES   { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE }
>
> +/* Current supported guest VCPUs */
> +#define GUEST_MAX_VCPUS 128
> +
>  /* Interrupts */
>  #define GUEST_TIMER_VIRT_PPI    27
>  #define GUEST_TIMER_PHYS_S_PPI  29
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table
  2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
@ 2016-09-12 14:58   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 14:58 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Construct ACPI RSDP table and add a helper to calculate the ACPI table
> checksum.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/libxl_arm_acpi.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index b91f3f6..83ad954 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -34,6 +34,10 @@ extern const unsigned char dsdt_anycpu_arm[];
>  _hidden
>  extern const int dsdt_anycpu_arm_len;
>
> +#define ACPI_OEM_ID "Xen"
> +#define ACPI_OEM_TABLE_ID "ARM"
> +#define ACPI_ASL_COMPILER_ID "XL"
> +
>  enum {
>      RSDP,
>      XSDT,
> @@ -126,6 +130,37 @@ out:
>      return rc;
>  }
>
> +static void calculate_checksum(void *table, uint32_t checksum_offset,
> +                               uint32_t length)
> +{
> +    uint8_t *p, sum = 0;
> +
> +    p = table;
> +    p[checksum_offset] = 0;
> +
> +    while (length--)
> +        sum = sum + *p++;
> +
> +    p = table;
> +    p[checksum_offset] = -sum;
> +}
> +
> +static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom,
> +                           struct acpitable acpitables[])
> +{
> +    uint64_t offset = acpitables[RSDP].addr - GUEST_ACPI_BASE;
> +    struct acpi_table_rsdp *rsdp = (void *)dom->acpi_modules[0].data + offset;
> +
> +    memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
> +    memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id));
> +    rsdp->length = acpitables[RSDP].size;
> +    rsdp->revision = 0x02;
> +    rsdp->xsdt_physical_address = acpitables[XSDT].addr;
> +    calculate_checksum(rsdp,
> +                       offsetof(struct acpi_table_rsdp, extended_checksum),
> +                       acpitables[RSDP].size);
> +}
> +
>  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>                          libxl__domain_build_state *state,
>                          struct xc_dom_image *dom)
> @@ -151,6 +186,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>      dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
>
>      rc = libxl__estimate_acpi_size(gc, info, dom, xc_config, acpitables);
> +    if (rc)
> +        goto out;
> +
> +    make_acpi_rsdp(gc, dom, acpitables);
>
>  out:
>      return rc;
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table
  2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
@ 2016-09-12 15:05   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:05 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/libxl_arm_acpi.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index 83ad954..93ba2d1 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -161,6 +161,35 @@ static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom,
>                         acpitables[RSDP].size);
>  }
>
> +static void make_acpi_header(struct acpi_table_header *h, const char *sig,
> +                             size_t len, uint8_t rev)
> +{
> +    memcpy(h->signature, sig, 4);
> +    h->length = len;
> +    h->revision = rev;
> +    memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id));
> +    memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, sizeof(h->oem_table_id));
> +    h->oem_revision = 0;
> +    memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID,
> +           sizeof(h->asl_compiler_id));
> +    h->asl_compiler_revision = 0;
> +    h->checksum = 0;
> +}
> +
> +static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom,
> +                           struct acpitable acpitables[])
> +{
> +    uint64_t offset = acpitables[XSDT].addr - GUEST_ACPI_BASE;
> +    struct acpi_table_xsdt *xsdt = (void *)dom->acpi_modules[0].data + offset;
> +
> +    xsdt->table_offset_entry[0] = acpitables[MADT].addr;
> +    xsdt->table_offset_entry[1] = acpitables[GTDT].addr;
> +    xsdt->table_offset_entry[2] = acpitables[FADT].addr;
> +    make_acpi_header(&xsdt->header, "XSDT", acpitables[XSDT].size, 1);
> +    calculate_checksum(xsdt, offsetof(struct acpi_table_header, checksum),
> +                       acpitables[XSDT].size);
> +}
> +
>  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>                          libxl__domain_build_state *state,
>                          struct xc_dom_image *dom)
> @@ -190,6 +219,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>          goto out;
>
>      make_acpi_rsdp(gc, dom, acpitables);
> +    make_acpi_xsdt(gc, dom, acpitables);
>
>  out:
>      return rc;
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table
  2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
@ 2016-09-12 15:08   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:08 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Construct GTDT table with the interrupt information of timers.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  tools/libxl/libxl_arm_acpi.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index 93ba2d1..ab49d57 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -25,10 +25,24 @@ typedef uint8_t u8;
>  typedef uint16_t u16;
>  typedef uint32_t u32;
>  typedef uint64_t u64;
> +typedef int64_t s64;
>
>  #include <acpi/acconfig.h>
>  #include <acpi/actbl.h>
>
> +#ifndef BITS_PER_LONG
> +#ifdef _LP64
> +#define BITS_PER_LONG 64
> +#else
> +#define BITS_PER_LONG 32
> +#endif
> +#endif
> +#define ACPI_MACHINE_WIDTH __BITS_PER_LONG
> +#define COMPILER_DEPENDENT_INT64 int64_t
> +#define COMPILER_DEPENDENT_UINT64 uint64_t
> +
> +#include <acpi/actypes.h>
> +
>  _hidden
>  extern const unsigned char dsdt_anycpu_arm[];
>  _hidden
> @@ -190,6 +204,29 @@ static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom,
>                         acpitables[XSDT].size);
>  }
>
> +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom,
> +                           struct acpitable acpitables[])
> +{
> +    uint64_t offset = acpitables[GTDT].addr - GUEST_ACPI_BASE;
> +    struct acpi_table_gtdt *gtdt = (void *)dom->acpi_modules[0].data + offset;
> +
> +    gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI;
> +    gtdt->non_secure_el1_flags =
> +                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
> +                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
> +    gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI;
> +    gtdt->virtual_timer_flags =
> +                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
> +                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
> +
> +    gtdt->counter_block_addresss = 0xFFFFFFFFFFFFFFFF;
> +    gtdt->counter_read_block_address = 0xFFFFFFFFFFFFFFFF;

NIT: You could have used ~((uint64_t)0). This is less error-prone than 
the 0xFF..FF.

Regardless:

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table
  2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
@ 2016-09-12 15:09   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:09 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> According to the GIC version, construct the MADT table.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table
  2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
@ 2016-09-12 15:10   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:10 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table
  2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
@ 2016-09-12 15:13   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:13 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Copy the static DSDT table into ACPI blob.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/libxl_arm_acpi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index 407f9d5..30e4d66 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -329,6 +329,15 @@ static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom,
>                         acpitables[FADT].size);
>  }
>
> +static void make_acpi_dsdt(libxl__gc *gc, struct xc_dom_image *dom,
> +                           struct acpitable acpitables[])
> +{
> +    uint64_t offset = acpitables[DSDT].addr - GUEST_ACPI_BASE;
> +    void *dsdt = dom->acpi_modules[0].data + offset;
> +
> +    memcpy(dsdt, dsdt_anycpu_arm, dsdt_anycpu_arm_len);
> +}
> +
>  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>                          libxl__domain_build_state *state,
>                          struct xc_dom_image *dom)
> @@ -365,6 +374,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>          goto out;
>
>      make_acpi_fadt(gc, dom, acpitables);
> +    make_acpi_dsdt(gc, dom, acpitables);
>
>  out:
>      return rc;
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
  2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
@ 2016-09-12 15:14   ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:14 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> The guest kernel will get the event channel interrupt information via
> domain param HVM_PARAM_CALLBACK_IRQ. Initialize it here.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/libxl_arm.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index 6f0bc70..e73d65e 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -900,8 +900,21 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
>                                             struct xc_dom_image *dom)
>  {
>      int rc;
> +    uint64_t val;
>
>      assert(info->type == LIBXL_DOMAIN_TYPE_PV);
> +
> +    /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
> +    val = (uint64_t)HVM_PARAM_CALLBACK_TYPE_PPI << HVM_PARAM_CALLBACK_IRQ_TYPE_SHIFT;
> +    /* Active-low level-sensitive  */
> +    val |= (HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL <<
> +            HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_SHIFT);
> +    val |= GUEST_EVTCHN_PPI;
> +    rc = xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CALLBACK_IRQ,
> +                          val);
> +    if (rc)
> +        return rc;
> +
>      rc = libxl__prepare_dtb(gc, info, state, dom);
>      if (rc) goto out;
>
>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
@ 2016-09-12 15:18   ` Julien Grall
  2016-09-13  7:03     ` Shannon Zhao
  0 siblings, 1 reply; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:18 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Here it adds the ACPI tables size to set the target maxmem to avoid
> providing less available memory for guest.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  tools/libxl/libxl_arch.h        |  2 +-
>  tools/libxl/libxl_arm.c         | 18 +++++++++++++++++-
>  tools/libxl/libxl_arm.h         |  4 ++++
>  tools/libxl/libxl_arm_acpi.c    | 20 ++++++++++++++++++++
>  tools/libxl/libxl_arm_no_acpi.c |  6 ++++++
>  tools/libxl/libxl_dom.c         |  2 +-
>  tools/libxl/libxl_x86.c         |  2 +-
>  7 files changed, 50 insertions(+), 4 deletions(-)
>
> diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
> index 337061f..d62fa4c 100644
> --- a/tools/libxl/libxl_arch.h
> +++ b/tools/libxl/libxl_arch.h
> @@ -30,7 +30,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>  /* arch specific internal domain creation function */
>  _hidden
>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> -               uint32_t domid);
> +                              libxl__domain_build_state *state, uint32_t domid);
>
>  /* setup arch specific hardware description, i.e. DTB on ARM */
>  _hidden
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index e73d65e..c7d4f65 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -101,8 +101,24 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>  }
>
>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> -                              uint32_t domid)
> +                              libxl__domain_build_state *state, uint32_t domid)
>  {
> +    libxl_domain_build_info *const info = &d_config->b_info;
> +    libxl_ctx *ctx = libxl__gc_owner(gc);
> +    int size;
> +
> +    /* Add the size of ACPI tables to maxmem if ACPI is enabled for guest. */
> +    if (libxl_defbool_val(info->acpi)) {
> +        size = libxl__get_acpi_size(gc, info, state);
> +        if (size < 0)
> +            return ERROR_FAIL;
> +        if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
> +                                LIBXL_MAXMEM_CONSTANT + (size + 1023) / 1024)) {

I still have some concern about use info->target_memkb + 
LIBXL_MAXMEM_CONSTANT here. What if the generic code decide to change 
the computation?

We may forgot to replicate here. My suggestion on the previous version 
was to have in the common code

xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + 
LIBXL_MAXMEM_CONSTANT + libxl__arch_memory_constant());

Or a similar name.

> +            LOGE(ERROR, "Couldn't set max memory");
> +            return ERROR_FAIL;
> +        }
> +    }
> +
>      return 0;
>  }

Regards,


-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (16 preceding siblings ...)
  2016-09-02 14:31 ` [PATCH v5 00/16] Xen ARM DomU ACPI support Wei Liu
@ 2016-09-12 15:22 ` Julien Grall
  2016-09-13  6:30   ` Shannon Zhao
  2016-09-13 11:56 ` Julien Grall
  18 siblings, 1 reply; 56+ messages in thread
From: Julien Grall @ 2016-09-12 15:22 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> The design of this feature is described as below.
> Firstly, the toolstack (libxl) generates the ACPI tables according the
> number of vcpus and gic controller.
>
> Then, it copies these ACPI tables to DomU non-RAM memory map space and
> passes them to UEFI firmware through the "ARM multiboot" protocol.
>
> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
> and installs these tables like the usual way and passes both ACPI and DT
> information to the Xen DomU.
>
> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
> since it's enough now.
>
> This has been tested using guest kernel with the Dom0 ACPI support
> patches which could be fetched from linux master or:
> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>
> The UEFI binary could be fetched from or built from edk2 master branch:
> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>
> This series can be fetched from:
> https://git.linaro.org/people/shannon.zhao/xen.git  domu_acpi_v5

This branch is based on a fairly out of date xen. Do you have a branch 
rebased on the latest upstream + Boris ACPI v3?

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-12 15:22 ` Julien Grall
@ 2016-09-13  6:30   ` Shannon Zhao
  0 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-13  6:30 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky



On 2016/9/12 23:22, Julien Grall wrote:
> Hi Shannon,
> 
> On 02/09/16 03:55, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> The design of this feature is described as below.
>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>> number of vcpus and gic controller.
>>
>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>
>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>> and installs these tables like the usual way and passes both ACPI and DT
>> information to the Xen DomU.
>>
>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
>> since it's enough now.
>>
>> This has been tested using guest kernel with the Dom0 ACPI support
>> patches which could be fetched from linux master or:
>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>
>>
>> The UEFI binary could be fetched from or built from edk2 master branch:
>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>
>> This series can be fetched from:
>> https://git.linaro.org/people/shannon.zhao/xen.git  domu_acpi_v5
> 
> This branch is based on a fairly out of date xen. Do you have a branch
> rebased on the latest upstream + Boris ACPI v3?
> 
You can fetch the updated branch from:
https://git.linaro.org/people/shannon.zhao/xen.git  domu_acpi_v5_new

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-12 15:18   ` Julien Grall
@ 2016-09-13  7:03     ` Shannon Zhao
  2016-09-13 10:38       ` Julien Grall
  0 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-13  7:03 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky



On 2016/9/12 23:18, Julien Grall wrote:
> Hi Shannon,
> 
> On 02/09/16 03:55, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> Here it adds the ACPI tables size to set the target maxmem to avoid
>> providing less available memory for guest.
>>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>  tools/libxl/libxl_arch.h        |  2 +-
>>  tools/libxl/libxl_arm.c         | 18 +++++++++++++++++-
>>  tools/libxl/libxl_arm.h         |  4 ++++
>>  tools/libxl/libxl_arm_acpi.c    | 20 ++++++++++++++++++++
>>  tools/libxl/libxl_arm_no_acpi.c |  6 ++++++
>>  tools/libxl/libxl_dom.c         |  2 +-
>>  tools/libxl/libxl_x86.c         |  2 +-
>>  7 files changed, 50 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
>> index 337061f..d62fa4c 100644
>> --- a/tools/libxl/libxl_arch.h
>> +++ b/tools/libxl/libxl_arch.h
>> @@ -30,7 +30,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>>  /* arch specific internal domain creation function */
>>  _hidden
>>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
>> *d_config,
>> -               uint32_t domid);
>> +                              libxl__domain_build_state *state,
>> uint32_t domid);
>>
>>  /* setup arch specific hardware description, i.e. DTB on ARM */
>>  _hidden
>> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
>> index e73d65e..c7d4f65 100644
>> --- a/tools/libxl/libxl_arm.c
>> +++ b/tools/libxl/libxl_arm.c
>> @@ -101,8 +101,24 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>>  }
>>
>>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
>> *d_config,
>> -                              uint32_t domid)
>> +                              libxl__domain_build_state *state,
>> uint32_t domid)
>>  {
>> +    libxl_domain_build_info *const info = &d_config->b_info;
>> +    libxl_ctx *ctx = libxl__gc_owner(gc);
>> +    int size;
>> +
>> +    /* Add the size of ACPI tables to maxmem if ACPI is enabled for
>> guest. */
>> +    if (libxl_defbool_val(info->acpi)) {
>> +        size = libxl__get_acpi_size(gc, info, state);
>> +        if (size < 0)
>> +            return ERROR_FAIL;
>> +        if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
>> +                                LIBXL_MAXMEM_CONSTANT + (size + 1023)
>> / 1024)) {
> 
> I still have some concern about use info->target_memkb +
> LIBXL_MAXMEM_CONSTANT here. What if the generic code decide to change
> the computation?
> 
> We may forgot to replicate here. My suggestion on the previous version
> was to have in the common code
> 
> xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
> LIBXL_MAXMEM_CONSTANT + libxl__arch_memory_constant());
> 
> Or a similar name.
> 
Just to confirm, do you mean that having a arch function to get the size
each arch needs and adding the size in libxl__build_pre()?

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-13  7:03     ` Shannon Zhao
@ 2016-09-13 10:38       ` Julien Grall
  2016-09-15 10:46         ` Wei Liu
  2016-09-19 14:53         ` Ian Jackson
  0 siblings, 2 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-13 10:38 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 13/09/16 08:03, Shannon Zhao wrote:
>
>
> On 2016/9/12 23:18, Julien Grall wrote:
>> Hi Shannon,
>>
>> On 02/09/16 03:55, Shannon Zhao wrote:
>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>
>>> Here it adds the ACPI tables size to set the target maxmem to avoid
>>> providing less available memory for guest.
>>>
>>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>>> ---
>>>  tools/libxl/libxl_arch.h        |  2 +-
>>>  tools/libxl/libxl_arm.c         | 18 +++++++++++++++++-
>>>  tools/libxl/libxl_arm.h         |  4 ++++
>>>  tools/libxl/libxl_arm_acpi.c    | 20 ++++++++++++++++++++
>>>  tools/libxl/libxl_arm_no_acpi.c |  6 ++++++
>>>  tools/libxl/libxl_dom.c         |  2 +-
>>>  tools/libxl/libxl_x86.c         |  2 +-
>>>  7 files changed, 50 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
>>> index 337061f..d62fa4c 100644
>>> --- a/tools/libxl/libxl_arch.h
>>> +++ b/tools/libxl/libxl_arch.h
>>> @@ -30,7 +30,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>>>  /* arch specific internal domain creation function */
>>>  _hidden
>>>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
>>> *d_config,
>>> -               uint32_t domid);
>>> +                              libxl__domain_build_state *state,
>>> uint32_t domid);
>>>
>>>  /* setup arch specific hardware description, i.e. DTB on ARM */
>>>  _hidden
>>> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
>>> index e73d65e..c7d4f65 100644
>>> --- a/tools/libxl/libxl_arm.c
>>> +++ b/tools/libxl/libxl_arm.c
>>> @@ -101,8 +101,24 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
>>>  }
>>>
>>>  int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
>>> *d_config,
>>> -                              uint32_t domid)
>>> +                              libxl__domain_build_state *state,
>>> uint32_t domid)
>>>  {
>>> +    libxl_domain_build_info *const info = &d_config->b_info;
>>> +    libxl_ctx *ctx = libxl__gc_owner(gc);
>>> +    int size;
>>> +
>>> +    /* Add the size of ACPI tables to maxmem if ACPI is enabled for
>>> guest. */
>>> +    if (libxl_defbool_val(info->acpi)) {
>>> +        size = libxl__get_acpi_size(gc, info, state);
>>> +        if (size < 0)
>>> +            return ERROR_FAIL;
>>> +        if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
>>> +                                LIBXL_MAXMEM_CONSTANT + (size + 1023)
>>> / 1024)) {
>>
>> I still have some concern about use info->target_memkb +
>> LIBXL_MAXMEM_CONSTANT here. What if the generic code decide to change
>> the computation?
>>
>> We may forgot to replicate here. My suggestion on the previous version
>> was to have in the common code
>>
>> xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
>> LIBXL_MAXMEM_CONSTANT + libxl__arch_memory_constant());
>>
>> Or a similar name.
>>
> Just to confirm, do you mean that having a arch function to get the size
> each arch needs and adding the size in libxl__build_pre()?

That's correct. Wei, Ian, do you have any opinions on this?

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
                   ` (17 preceding siblings ...)
  2016-09-12 15:22 ` Julien Grall
@ 2016-09-13 11:56 ` Julien Grall
  2016-09-13 13:06   ` Shannon Zhao
  18 siblings, 1 reply; 56+ messages in thread
From: Julien Grall @ 2016-09-13 11:56 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> The design of this feature is described as below.
> Firstly, the toolstack (libxl) generates the ACPI tables according the
> number of vcpus and gic controller.
>
> Then, it copies these ACPI tables to DomU non-RAM memory map space and
> passes them to UEFI firmware through the "ARM multiboot" protocol.
>
> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
> and installs these tables like the usual way and passes both ACPI and DT
> information to the Xen DomU.
>
> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
> since it's enough now.
>
> This has been tested using guest kernel with the Dom0 ACPI support
> patches which could be fetched from linux master or:
> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>
> The UEFI binary could be fetched from or built from edk2 master branch:
> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd

On which commit this EFI binary is based? I am trying to rebuild myself, 
and go no luck to boot it so far.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-13 11:56 ` Julien Grall
@ 2016-09-13 13:06   ` Shannon Zhao
  2016-09-13 15:17     ` Julien Grall
  0 siblings, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-13 13:06 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky

Hi Julien,

On 2016/9/13 19:56, Julien Grall wrote:
> Hi Shannon,
> 
> On 02/09/16 03:55, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> The design of this feature is described as below.
>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>> number of vcpus and gic controller.
>>
>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>
>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>> and installs these tables like the usual way and passes both ACPI and DT
>> information to the Xen DomU.
>>
>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
>> since it's enough now.
>>
>> This has been tested using guest kernel with the Dom0 ACPI support
>> patches which could be fetched from linux master or:
>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>
>>
>> The UEFI binary could be fetched from or built from edk2 master branch:
>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
> 
> On which commit this EFI binary is based? I am trying to rebuild myself,
> and go no luck to boot it so far.
> 
I forgot the exact commit. But I just tried below commit which adds the
support to edk2 and the guest can boot up successfully with ACPI.

402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-13 13:06   ` Shannon Zhao
@ 2016-09-13 15:17     ` Julien Grall
  2016-09-13 15:18       ` Julien Grall
  2016-09-14  0:56       ` Shannon Zhao
  0 siblings, 2 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-13 15:17 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky



On 13/09/16 14:06, Shannon Zhao wrote:
> Hi Julien,

Hello Shannon,

> On 2016/9/13 19:56, Julien Grall wrote:
>> Hi Shannon,
>>
>> On 02/09/16 03:55, Shannon Zhao wrote:
>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>
>>> The design of this feature is described as below.
>>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>>> number of vcpus and gic controller.
>>>
>>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>
>>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>>> and installs these tables like the usual way and passes both ACPI and DT
>>> information to the Xen DomU.
>>>
>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT tables
>>> since it's enough now.
>>>
>>> This has been tested using guest kernel with the Dom0 ACPI support
>>> patches which could be fetched from linux master or:
>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>
>>>
>>> The UEFI binary could be fetched from or built from edk2 master branch:
>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>
>> On which commit this EFI binary is based? I am trying to rebuild myself,
>> and go no luck to boot it so far.
>>
> I forgot the exact commit. But I just tried below commit which adds the
> support to edk2 and the guest can boot up successfully with ACPI.
>
> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM

Thanks, the commit does not build on my platform. After some help for 
Ard I managed to boot UEFI with the patch [1] applied.

However Linux does not boot when passing acpi=on and abort with the 
following message:

(d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
(d86) 6NR_IRQS:64 nr_irqs:64 0
(d86) 3No valid GICC entries exist
(d86) 0Kernel panic - not syncing: No interrupt controller found.
(d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
(d86) dHardware name: XENVM-4.8 (DT)
(d86) Call trace:
(d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
(d86) [<ffff0000080888c4>] show_stack+0x14/0x20
(d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
(d86) [<ffff00000815c24c>] panic+0x10c/0x250
(d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
(d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
(d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
(d86) 0---[ end Kernel panic - not syncing: No interrupt controller found.

This is because the header.length for GICC is not valid for ACPI 5.1 
(see BAD_MADT_GICC_ENTRY). So please check all the size of each table 
against ACPI 5.1.

My configuration is Linux 4.8-rc6 on Juno r2 (e.g GICv2 interrupt 
controller).

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-13 15:17     ` Julien Grall
@ 2016-09-13 15:18       ` Julien Grall
  2016-09-14  0:56       ` Shannon Zhao
  1 sibling, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-13 15:18 UTC (permalink / raw)
  To: Shannon Zhao, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky



On 13/09/16 16:17, Julien Grall wrote:
>
>
> On 13/09/16 14:06, Shannon Zhao wrote:
>> Hi Julien,
>
> Hello Shannon,
>
>> On 2016/9/13 19:56, Julien Grall wrote:
>>> Hi Shannon,
>>>
>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>
>>>> The design of this feature is described as below.
>>>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>>>> number of vcpus and gic controller.
>>>>
>>>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>
>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>>>> and installs these tables like the usual way and passes both ACPI
>>>> and DT
>>>> information to the Xen DomU.
>>>>
>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>> tables
>>>> since it's enough now.
>>>>
>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>> patches which could be fetched from linux master or:
>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>
>>>>
>>>>
>>>> The UEFI binary could be fetched from or built from edk2 master branch:
>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>
>>> On which commit this EFI binary is based? I am trying to rebuild myself,
>>> and go no luck to boot it so far.
>>>
>> I forgot the exact commit. But I just tried below commit which adds the
>> support to edk2 and the guest can boot up successfully with ACPI.
>>
>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>
> Thanks, the commit does not build on my platform. After some help for
> Ard I managed to boot UEFI with the patch [1] applied.
>
> However Linux does not boot when passing acpi=on and abort with the
> following message:
>
> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
> (d86) 6NR_IRQS:64 nr_irqs:64 0
> (d86) 3No valid GICC entries exist
> (d86) 0Kernel panic - not syncing: No interrupt controller found.
> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
> (d86) dHardware name: XENVM-4.8 (DT)
> (d86) Call trace:
> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller found.
>
> This is because the header.length for GICC is not valid for ACPI 5.1
> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
> against ACPI 5.1.
>
> My configuration is Linux 4.8-rc6 on Juno r2 (e.g GICv2 interrupt
> controller).


I forgot to post the link for [1].

https://lists.01.org/pipermail/edk2-devel/2016-September/001666.html

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-13 15:17     ` Julien Grall
  2016-09-13 15:18       ` Julien Grall
@ 2016-09-14  0:56       ` Shannon Zhao
  2016-09-14  1:06         ` Stefano Stabellini
  1 sibling, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-14  0:56 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng,
	shannon.zhao, boris.ostrovsky



On 2016/9/13 23:17, Julien Grall wrote:
> 
> 
> On 13/09/16 14:06, Shannon Zhao wrote:
>> Hi Julien,
> 
> Hello Shannon,
> 
>> On 2016/9/13 19:56, Julien Grall wrote:
>>> Hi Shannon,
>>>
>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>
>>>> The design of this feature is described as below.
>>>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>>>> number of vcpus and gic controller.
>>>>
>>>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>
>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>>>> and installs these tables like the usual way and passes both ACPI
>>>> and DT
>>>> information to the Xen DomU.
>>>>
>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>> tables
>>>> since it's enough now.
>>>>
>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>> patches which could be fetched from linux master or:
>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>
>>>>
>>>>
>>>> The UEFI binary could be fetched from or built from edk2 master branch:
>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>
>>> On which commit this EFI binary is based? I am trying to rebuild myself,
>>> and go no luck to boot it so far.
>>>
>> I forgot the exact commit. But I just tried below commit which adds the
>> support to edk2 and the guest can boot up successfully with ACPI.
>>
>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
> 
> Thanks, the commit does not build on my platform. After some help for
> Ard I managed to boot UEFI with the patch [1] applied.
> 
> However Linux does not boot when passing acpi=on and abort with the
> following message:
> 
> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
> (d86) 6NR_IRQS:64 nr_irqs:64 0
> (d86) 3No valid GICC entries exist
> (d86) 0Kernel panic - not syncing: No interrupt controller found.
> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
> (d86) dHardware name: XENVM-4.8 (DT)
> (d86) Call trace:
> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller found.
> 
> This is because the header.length for GICC is not valid for ACPI 5.1
> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
> against ACPI 5.1.
> 
Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
One solution is that we still use ACPI 5.1 and make gicc->header.length
76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
support in Linux was introduced after ACPI 6.0.

Which one do you prefer?

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  0:56       ` Shannon Zhao
@ 2016-09-14  1:06         ` Stefano Stabellini
  2016-09-14  7:14           ` Julien Grall
  0 siblings, 1 reply; 56+ messages in thread
From: Stefano Stabellini @ 2016-09-14  1:06 UTC (permalink / raw)
  To: Shannon Zhao
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	Julien Grall, shannon.zhao, boris.ostrovsky

On Wed, 14 Sep 2016, Shannon Zhao wrote:
> On 2016/9/13 23:17, Julien Grall wrote:
> > 
> > 
> > On 13/09/16 14:06, Shannon Zhao wrote:
> >> Hi Julien,
> > 
> > Hello Shannon,
> > 
> >> On 2016/9/13 19:56, Julien Grall wrote:
> >>> Hi Shannon,
> >>>
> >>> On 02/09/16 03:55, Shannon Zhao wrote:
> >>>> From: Shannon Zhao <shannon.zhao@linaro.org>
> >>>>
> >>>> The design of this feature is described as below.
> >>>> Firstly, the toolstack (libxl) generates the ACPI tables according the
> >>>> number of vcpus and gic controller.
> >>>>
> >>>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
> >>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
> >>>>
> >>>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
> >>>> and installs these tables like the usual way and passes both ACPI
> >>>> and DT
> >>>> information to the Xen DomU.
> >>>>
> >>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
> >>>> tables
> >>>> since it's enough now.
> >>>>
> >>>> This has been tested using guest kernel with the Dom0 ACPI support
> >>>> patches which could be fetched from linux master or:
> >>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
> >>>>
> >>>>
> >>>>
> >>>> The UEFI binary could be fetched from or built from edk2 master branch:
> >>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
> >>>
> >>> On which commit this EFI binary is based? I am trying to rebuild myself,
> >>> and go no luck to boot it so far.
> >>>
> >> I forgot the exact commit. But I just tried below commit which adds the
> >> support to edk2 and the guest can boot up successfully with ACPI.
> >>
> >> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
> > 
> > Thanks, the commit does not build on my platform. After some help for
> > Ard I managed to boot UEFI with the patch [1] applied.
> > 
> > However Linux does not boot when passing acpi=on and abort with the
> > following message:
> > 
> > (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
> > (d86) 6NR_IRQS:64 nr_irqs:64 0
> > (d86) 3No valid GICC entries exist
> > (d86) 0Kernel panic - not syncing: No interrupt controller found.
> > (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
> > (d86) dHardware name: XENVM-4.8 (DT)
> > (d86) Call trace:
> > (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
> > (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
> > (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
> > (d86) [<ffff00000815c24c>] panic+0x10c/0x250
> > (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
> > (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
> > (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
> > (d86) 0---[ end Kernel panic - not syncing: No interrupt controller found.
> > 
> > This is because the header.length for GICC is not valid for ACPI 5.1
> > (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
> > against ACPI 5.1.
> > 
> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
> One solution is that we still use ACPI 5.1 and make gicc->header.length
> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
> support in Linux was introduced after ACPI 6.0.
> 
> Which one do you prefer?

Certainly the versions of all tables need to be consistent. I would
prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
upgrading to 6.0 causes a large amount of changes to your patches).

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  1:06         ` Stefano Stabellini
@ 2016-09-14  7:14           ` Julien Grall
  2016-09-14  7:32             ` Shannon Zhao
  2016-09-14 20:48             ` Stefano Stabellini
  0 siblings, 2 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-14  7:14 UTC (permalink / raw)
  To: Stefano Stabellini, Shannon Zhao
  Cc: wei.liu2, ian.jackson, peter.huangpeng, xen-devel, shannon.zhao,
	boris.ostrovsky

Hello,

On 14/09/2016 02:06, Stefano Stabellini wrote:
> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>> On 2016/9/13 23:17, Julien Grall wrote:
>>>
>>>
>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>> Hi Julien,
>>>
>>> Hello Shannon,
>>>
>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>> Hi Shannon,
>>>>>
>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>
>>>>>> The design of this feature is described as below.
>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables according the
>>>>>> number of vcpus and gic controller.
>>>>>>
>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map space and
>>>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>>>
>>>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot" protocol
>>>>>> and installs these tables like the usual way and passes both ACPI
>>>>>> and DT
>>>>>> information to the Xen DomU.
>>>>>>
>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>>>> tables
>>>>>> since it's enough now.
>>>>>>
>>>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>>>> patches which could be fetched from linux master or:
>>>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>
>>>>>>
>>>>>>
>>>>>> The UEFI binary could be fetched from or built from edk2 master branch:
>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>
>>>>> On which commit this EFI binary is based? I am trying to rebuild myself,
>>>>> and go no luck to boot it so far.
>>>>>
>>>> I forgot the exact commit. But I just tried below commit which adds the
>>>> support to edk2 and the guest can boot up successfully with ACPI.
>>>>
>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>>>
>>> Thanks, the commit does not build on my platform. After some help for
>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>
>>> However Linux does not boot when passing acpi=on and abort with the
>>> following message:
>>>
>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>> (d86) 3No valid GICC entries exist
>>> (d86) 0Kernel panic - not syncing: No interrupt controller found.
>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>> (d86) dHardware name: XENVM-4.8 (DT)
>>> (d86) Call trace:
>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller found.
>>>
>>> This is because the header.length for GICC is not valid for ACPI 5.1
>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
>>> against ACPI 5.1.
>>>
>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>> One solution is that we still use ACPI 5.1 and make gicc->header.length
>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
>> support in Linux was introduced after ACPI 6.0.
>>
>> Which one do you prefer?
>
> Certainly the versions of all tables need to be consistent. I would
> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
> upgrading to 6.0 causes a large amount of changes to your patches).

I disagree on this, we should use the first version of ACPI that is 
fully supporting ARM because a guest operating system may choose to 
support the first one (there is a lot hardware platform out which only 
provides ACPI 5.1).

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  7:14           ` Julien Grall
@ 2016-09-14  7:32             ` Shannon Zhao
  2016-09-14  7:40               ` Julien Grall
  2016-09-14 20:48             ` Stefano Stabellini
  1 sibling, 1 reply; 56+ messages in thread
From: Shannon Zhao @ 2016-09-14  7:32 UTC (permalink / raw)
  To: Julien Grall, Stefano Stabellini
  Cc: wei.liu2, ian.jackson, peter.huangpeng, xen-devel, shannon.zhao,
	boris.ostrovsky



On 2016/9/14 15:14, Julien Grall wrote:
> Hello,
> 
> On 14/09/2016 02:06, Stefano Stabellini wrote:
>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>
>>>>
>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>> Hi Julien,
>>>>
>>>> Hello Shannon,
>>>>
>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>> Hi Shannon,
>>>>>>
>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>
>>>>>>> The design of this feature is described as below.
>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
>>>>>>> according the
>>>>>>> number of vcpus and gic controller.
>>>>>>>
>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
>>>>>>> space and
>>>>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>>>>
>>>>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot"
>>>>>>> protocol
>>>>>>> and installs these tables like the usual way and passes both ACPI
>>>>>>> and DT
>>>>>>> information to the Xen DomU.
>>>>>>>
>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>>>>> tables
>>>>>>> since it's enough now.
>>>>>>>
>>>>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>>>>> patches which could be fetched from linux master or:
>>>>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The UEFI binary could be fetched from or built from edk2 master
>>>>>>> branch:
>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>
>>>>>> On which commit this EFI binary is based? I am trying to rebuild
>>>>>> myself,
>>>>>> and go no luck to boot it so far.
>>>>>>
>>>>> I forgot the exact commit. But I just tried below commit which adds
>>>>> the
>>>>> support to edk2 and the guest can boot up successfully with ACPI.
>>>>>
>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>>>>
>>>> Thanks, the commit does not build on my platform. After some help for
>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>
>>>> However Linux does not boot when passing acpi=on and abort with the
>>>> following message:
>>>>
>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>> (d86) 3No valid GICC entries exist
>>>> (d86) 0Kernel panic - not syncing: No interrupt controller found.
>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>> (d86) Call trace:
>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller
>>>> found.
>>>>
>>>> This is because the header.length for GICC is not valid for ACPI 5.1
>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
>>>> against ACPI 5.1.
>>>>
>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>> One solution is that we still use ACPI 5.1 and make gicc->header.length
>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
>>> support in Linux was introduced after ACPI 6.0.
>>>
>>> Which one do you prefer?
>>
>> Certainly the versions of all tables need to be consistent. I would
>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>> upgrading to 6.0 causes a large amount of changes to your patches).
> 
> I disagree on this, we should use the first version of ACPI that is
> fully supporting ARM because a guest operating system may choose to
> support the first one (there is a lot hardware platform out which only
> provides ACPI 5.1).
> 
So you prefer we should set the gicc->header.length to 76 and still use
ACPI 5.1, right?

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  7:32             ` Shannon Zhao
@ 2016-09-14  7:40               ` Julien Grall
  2016-09-14  8:01                 ` Shannon Zhao
  0 siblings, 1 reply; 56+ messages in thread
From: Julien Grall @ 2016-09-14  7:40 UTC (permalink / raw)
  To: Shannon Zhao, Stefano Stabellini
  Cc: wei.liu2, ian.jackson, peter.huangpeng, xen-devel, shannon.zhao,
	boris.ostrovsky



On 14/09/2016 08:32, Shannon Zhao wrote:
> 
> 
> On 2016/9/14 15:14, Julien Grall wrote:
>> Hello,
>>
>> On 14/09/2016 02:06, Stefano Stabellini wrote:
>>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>>
>>>>>
>>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>>> Hi Julien,
>>>>>
>>>>> Hello Shannon,
>>>>>
>>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>>> Hi Shannon,
>>>>>>>
>>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>>
>>>>>>>> The design of this feature is described as below.
>>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
>>>>>>>> according the
>>>>>>>> number of vcpus and gic controller.
>>>>>>>>
>>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
>>>>>>>> space and
>>>>>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>>>>>
>>>>>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot"
>>>>>>>> protocol
>>>>>>>> and installs these tables like the usual way and passes both ACPI
>>>>>>>> and DT
>>>>>>>> information to the Xen DomU.
>>>>>>>>
>>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>>>>>> tables
>>>>>>>> since it's enough now.
>>>>>>>>
>>>>>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>>>>>> patches which could be fetched from linux master or:
>>>>>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> The UEFI binary could be fetched from or built from edk2 master
>>>>>>>> branch:
>>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>>
>>>>>>> On which commit this EFI binary is based? I am trying to rebuild
>>>>>>> myself,
>>>>>>> and go no luck to boot it so far.
>>>>>>>
>>>>>> I forgot the exact commit. But I just tried below commit which adds
>>>>>> the
>>>>>> support to edk2 and the guest can boot up successfully with ACPI.
>>>>>>
>>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>>>>>
>>>>> Thanks, the commit does not build on my platform. After some help for
>>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>>
>>>>> However Linux does not boot when passing acpi=on and abort with the
>>>>> following message:
>>>>>
>>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
>>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>>> (d86) 3No valid GICC entries exist
>>>>> (d86) 0Kernel panic - not syncing: No interrupt controller found.
>>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>>> (d86) Call trace:
>>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller
>>>>> found.
>>>>>
>>>>> This is because the header.length for GICC is not valid for ACPI 5.1
>>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
>>>>> against ACPI 5.1.
>>>>>
>>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
>>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>>> One solution is that we still use ACPI 5.1 and make gicc->header.length
>>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
>>>> support in Linux was introduced after ACPI 6.0.
>>>>
>>>> Which one do you prefer?
>>>
>>> Certainly the versions of all tables need to be consistent. I would
>>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>>> upgrading to 6.0 causes a large amount of changes to your patches).
>>
>> I disagree on this, we should use the first version of ACPI that is
>> fully supporting ARM because a guest operating system may choose to
>> support the first one (there is a lot hardware platform out which only
>> provides ACPI 5.1).
>>
> So you prefer we should set the gicc->header.length to 76 and still use
> ACPI 5.1, right?

That would be my preference. From my understanding, the main difference
between 6.0 and 5.1 for the MADT is a field "reserved" has been added at
the end of the GICC subtable.

However, I am wondering whether the Linux check should be relaxed.
#define BAD_MADT_GICC_ENTRY(entry, end)                                         \
        (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) ||       \
         (entry)->header.length != ACPI_MADT_GICC_LENGTH)

But the definition of BAD_MADT_ENTRY is more relaxed as it only requires
to be greater than the size of the structure.

#define BAD_MADT_ENTRY(entry, end) (                                        \
                (!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
                ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))

Any opinions?

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  7:40               ` Julien Grall
@ 2016-09-14  8:01                 ` Shannon Zhao
  0 siblings, 0 replies; 56+ messages in thread
From: Shannon Zhao @ 2016-09-14  8:01 UTC (permalink / raw)
  To: Julien Grall, Stefano Stabellini
  Cc: wei.liu2, ian.jackson, peter.huangpeng, xen-devel, shannon.zhao,
	boris.ostrovsky



On 2016/9/14 15:40, Julien Grall wrote:
> 
> On 14/09/2016 08:32, Shannon Zhao wrote:
>> > 
>> > 
>> > On 2016/9/14 15:14, Julien Grall wrote:
>>> >> Hello,
>>> >>
>>> >> On 14/09/2016 02:06, Stefano Stabellini wrote:
>>>> >>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>>>> >>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>>> >>>>>
>>>>>> >>>>>
>>>>>> >>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>>>> >>>>>> Hi Julien,
>>>>>> >>>>>
>>>>>> >>>>> Hello Shannon,
>>>>>> >>>>>
>>>>>>> >>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>>>> >>>>>>> Hi Shannon,
>>>>>>>> >>>>>>>
>>>>>>>> >>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>>>> >>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> The design of this feature is described as below.
>>>>>>>>> >>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
>>>>>>>>> >>>>>>>> according the
>>>>>>>>> >>>>>>>> number of vcpus and gic controller.
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
>>>>>>>>> >>>>>>>> space and
>>>>>>>>> >>>>>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot"
>>>>>>>>> >>>>>>>> protocol
>>>>>>>>> >>>>>>>> and installs these tables like the usual way and passes both ACPI
>>>>>>>>> >>>>>>>> and DT
>>>>>>>>> >>>>>>>> information to the Xen DomU.
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>>>>>>> >>>>>>>> tables
>>>>>>>>> >>>>>>>> since it's enough now.
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>>>>>>> >>>>>>>> patches which could be fetched from linux master or:
>>>>>>>>> >>>>>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>>
>>>>>>>>> >>>>>>>> The UEFI binary could be fetched from or built from edk2 master
>>>>>>>>> >>>>>>>> branch:
>>>>>>>>> >>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>>> >>>>>>>
>>>>>>>> >>>>>>> On which commit this EFI binary is based? I am trying to rebuild
>>>>>>>> >>>>>>> myself,
>>>>>>>> >>>>>>> and go no luck to boot it so far.
>>>>>>>> >>>>>>>
>>>>>>> >>>>>> I forgot the exact commit. But I just tried below commit which adds
>>>>>>> >>>>>> the
>>>>>>> >>>>>> support to edk2 and the guest can boot up successfully with ACPI.
>>>>>>> >>>>>>
>>>>>>> >>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>>>>>> >>>>>
>>>>>> >>>>> Thanks, the commit does not build on my platform. After some help for
>>>>>> >>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>>> >>>>>
>>>>>> >>>>> However Linux does not boot when passing acpi=on and abort with the
>>>>>> >>>>> following message:
>>>>>> >>>>>
>>>>>> >>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
>>>>>> >>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>>>> >>>>> (d86) 3No valid GICC entries exist
>>>>>> >>>>> (d86) 0Kernel panic - not syncing: No interrupt controller found.
>>>>>> >>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>>>> >>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>>>> >>>>> (d86) Call trace:
>>>>>> >>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>>>> >>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>>>> >>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>>>> >>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>>>> >>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>>>> >>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>>>> >>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>>>> >>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller
>>>>>> >>>>> found.
>>>>>> >>>>>
>>>>>> >>>>> This is because the header.length for GICC is not valid for ACPI 5.1
>>>>>> >>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
>>>>>> >>>>> against ACPI 5.1.
>>>>>> >>>>>
>>>>> >>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
>>>>> >>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>>>> >>>> One solution is that we still use ACPI 5.1 and make gicc->header.length
>>>>> >>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
>>>>> >>>> support in Linux was introduced after ACPI 6.0.
>>>>> >>>>
>>>>> >>>> Which one do you prefer?
>>>> >>>
>>>> >>> Certainly the versions of all tables need to be consistent. I would
>>>> >>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>>>> >>> upgrading to 6.0 causes a large amount of changes to your patches).
>>> >>
>>> >> I disagree on this, we should use the first version of ACPI that is
>>> >> fully supporting ARM because a guest operating system may choose to
>>> >> support the first one (there is a lot hardware platform out which only
>>> >> provides ACPI 5.1).
>>> >>
>> > So you prefer we should set the gicc->header.length to 76 and still use
>> > ACPI 5.1, right?
> That would be my preference. From my understanding, the main difference
> between 6.0 and 5.1 for the MADT is a field "reserved" has been added at
> the end of the GICC subtable.
> 
> However, I am wondering whether the Linux check should be relaxed.
> #define BAD_MADT_GICC_ENTRY(entry, end)                                         \
>         (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) ||       \
>          (entry)->header.length != ACPI_MADT_GICC_LENGTH)
> 
Look at the commit log of this definition, it's used to solve the
problem that linux boots fail when hardware uses ACPI 5.1 because
BAD_MADT_ENTRY() returns true. Maybe it could check if the
(entry)->header.length is greater than 76.

> But the definition of BAD_MADT_ENTRY is more relaxed as it only requires
> to be greater than the size of the structure.
> 
> #define BAD_MADT_ENTRY(entry, end) (                                        \
>                 (!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
>                 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
> 
> Any opinions?
Anyway, for old Linux kernel or other OSes I think we could set
gicc->header.length to 76 and use ACPI 5.1.

Thanks,
-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14  7:14           ` Julien Grall
  2016-09-14  7:32             ` Shannon Zhao
@ 2016-09-14 20:48             ` Stefano Stabellini
  2016-09-14 21:26               ` Julien Grall
  1 sibling, 1 reply; 56+ messages in thread
From: Stefano Stabellini @ 2016-09-14 20:48 UTC (permalink / raw)
  To: Julien Grall
  Cc: Stefano Stabellini, wei.liu2, ian.jackson, peter.huangpeng,
	xen-devel, shannon.zhao, Shannon Zhao, boris.ostrovsky

On Wed, 14 Sep 2016, Julien Grall wrote:

> Hello,
> 
> On 14/09/2016 02:06, Stefano Stabellini wrote:
> > On Wed, 14 Sep 2016, Shannon Zhao wrote:
> > > On 2016/9/13 23:17, Julien Grall wrote:
> > > > 
> > > > 
> > > > On 13/09/16 14:06, Shannon Zhao wrote:
> > > > > Hi Julien,
> > > > 
> > > > Hello Shannon,
> > > > 
> > > > > On 2016/9/13 19:56, Julien Grall wrote:
> > > > > > Hi Shannon,
> > > > > > 
> > > > > > On 02/09/16 03:55, Shannon Zhao wrote:
> > > > > > > From: Shannon Zhao <shannon.zhao@linaro.org>
> > > > > > > 
> > > > > > > The design of this feature is described as below.
> > > > > > > Firstly, the toolstack (libxl) generates the ACPI tables according
> > > > > > > the
> > > > > > > number of vcpus and gic controller.
> > > > > > > 
> > > > > > > Then, it copies these ACPI tables to DomU non-RAM memory map space
> > > > > > > and
> > > > > > > passes them to UEFI firmware through the "ARM multiboot" protocol.
> > > > > > > 
> > > > > > > At last, UEFI gets the ACPI tables through the "ARM multiboot"
> > > > > > > protocol
> > > > > > > and installs these tables like the usual way and passes both ACPI
> > > > > > > and DT
> > > > > > > information to the Xen DomU.
> > > > > > > 
> > > > > > > Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
> > > > > > > tables
> > > > > > > since it's enough now.
> > > > > > > 
> > > > > > > This has been tested using guest kernel with the Dom0 ACPI support
> > > > > > > patches which could be fetched from linux master or:
> > > > > > > https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > The UEFI binary could be fetched from or built from edk2 master
> > > > > > > branch:
> > > > > > > http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
> > > > > > 
> > > > > > On which commit this EFI binary is based? I am trying to rebuild
> > > > > > myself,
> > > > > > and go no luck to boot it so far.
> > > > > > 
> > > > > I forgot the exact commit. But I just tried below commit which adds
> > > > > the
> > > > > support to edk2 and the guest can boot up successfully with ACPI.
> > > > > 
> > > > > 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
> > > > 
> > > > Thanks, the commit does not build on my platform. After some help for
> > > > Ard I managed to boot UEFI with the patch [1] applied.
> > > > 
> > > > However Linux does not boot when passing acpi=on and abort with the
> > > > following message:
> > > > 
> > > > (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
> > > > (d86) 6NR_IRQS:64 nr_irqs:64 0
> > > > (d86) 3No valid GICC entries exist
> > > > (d86) 0Kernel panic - not syncing: No interrupt controller found.
> > > > (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
> > > > (d86) dHardware name: XENVM-4.8 (DT)
> > > > (d86) Call trace:
> > > > (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
> > > > (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
> > > > (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
> > > > (d86) [<ffff00000815c24c>] panic+0x10c/0x250
> > > > (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
> > > > (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
> > > > (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
> > > > (d86) 0---[ end Kernel panic - not syncing: No interrupt controller
> > > > found.
> > > > 
> > > > This is because the header.length for GICC is not valid for ACPI 5.1
> > > > (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
> > > > against ACPI 5.1.
> > > > 
> > > Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
> > > updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
> > > One solution is that we still use ACPI 5.1 and make gicc->header.length
> > > 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
> > > support in Linux was introduced after ACPI 6.0.
> > > 
> > > Which one do you prefer?
> > 
> > Certainly the versions of all tables need to be consistent. I would
> > prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
> > upgrading to 6.0 causes a large amount of changes to your patches).
> 
> I disagree on this, we should use the first version of ACPI that is fully
> supporting ARM because a guest operating system may choose to support the
> first one (there is a lot hardware platform out which only provides ACPI 5.1).

And I thought that compatibility was supposed to be ACPI's strong suit.
I mistakenly had the impression that new ACPI releases weren't suppose
to break old OSes. I take back my comment, you are right that we should
stay on 5.1 (including all the erratas, many are important for ARM).

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-14 20:48             ` Stefano Stabellini
@ 2016-09-14 21:26               ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-14 21:26 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: wei.liu2, ian.jackson, peter.huangpeng, xen-devel, shannon.zhao,
	Shannon Zhao, boris.ostrovsky

Hi Stefano,

On 14/09/2016 21:48, Stefano Stabellini wrote:
> On Wed, 14 Sep 2016, Julien Grall wrote:
>> On 14/09/2016 02:06, Stefano Stabellini wrote:
>>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>>
>>>>>
>>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>>> Hi Julien,
>>>>>
>>>>> Hello Shannon,
>>>>>
>>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>>> Hi Shannon,
>>>>>>>
>>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>>
>>>>>>>> The design of this feature is described as below.
>>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables according
>>>>>>>> the
>>>>>>>> number of vcpus and gic controller.
>>>>>>>>
>>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map space
>>>>>>>> and
>>>>>>>> passes them to UEFI firmware through the "ARM multiboot" protocol.
>>>>>>>>
>>>>>>>> At last, UEFI gets the ACPI tables through the "ARM multiboot"
>>>>>>>> protocol
>>>>>>>> and installs these tables like the usual way and passes both ACPI
>>>>>>>> and DT
>>>>>>>> information to the Xen DomU.
>>>>>>>>
>>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT, DSDT
>>>>>>>> tables
>>>>>>>> since it's enough now.
>>>>>>>>
>>>>>>>> This has been tested using guest kernel with the Dom0 ACPI support
>>>>>>>> patches which could be fetched from linux master or:
>>>>>>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> The UEFI binary could be fetched from or built from edk2 master
>>>>>>>> branch:
>>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>>
>>>>>>> On which commit this EFI binary is based? I am trying to rebuild
>>>>>>> myself,
>>>>>>> and go no luck to boot it so far.
>>>>>>>
>>>>>> I forgot the exact commit. But I just tried below commit which adds
>>>>>> the
>>>>>> support to edk2 and the guest can boot up successfully with ACPI.
>>>>>>
>>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
>>>>>
>>>>> Thanks, the commit does not build on my platform. After some help for
>>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>>
>>>>> However Linux does not boot when passing acpi=on and abort with the
>>>>> following message:
>>>>>
>>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
>>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>>> (d86) 3No valid GICC entries exist
>>>>> (d86) 0Kernel panic - not syncing: No interrupt controller found.
>>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>>> (d86) Call trace:
>>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt controller
>>>>> found.
>>>>>
>>>>> This is because the header.length for GICC is not valid for ACPI 5.1
>>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each table
>>>>> against ACPI 5.1.
>>>>>
>>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is already
>>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>>> One solution is that we still use ACPI 5.1 and make gicc->header.length
>>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM ACPI
>>>> support in Linux was introduced after ACPI 6.0.
>>>>
>>>> Which one do you prefer?
>>>
>>> Certainly the versions of all tables need to be consistent. I would
>>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>>> upgrading to 6.0 causes a large amount of changes to your patches).
>>
>> I disagree on this, we should use the first version of ACPI that is fully
>> supporting ARM because a guest operating system may choose to support the
>> first one (there is a lot hardware platform out which only provides ACPI 5.1).
>
> And I thought that compatibility was supposed to be ACPI's strong suit.
> I mistakenly had the impression that new ACPI releases weren't suppose
> to break old OSes. I take back my comment, you are right that we should
> stay on 5.1 (including all the erratas, many are important for ARM).
>

IIRC, early version of ACPI used to have some incompatibility. I will 
have to go through the ACPI spec to find the main differences between 
5.1 and 6.0 for ARM.

Assuming the newer versions are backward compatible, it might be good to 
written down somewhere (maybe a public headers) that the guest OS should 
not assume a specific version of ACPI. This would avoid to tie us on 
ACPI 5.1 and allow us to upgrade the tables on a next release of Xen.

In any case, we should be consistent accross all the ACPI tables (e.g 
version, size of the tables...) to accommodate picky OSes. For now, I 
would stay on ACPI 5.1 for safety.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-13 10:38       ` Julien Grall
@ 2016-09-15 10:46         ` Wei Liu
  2016-09-19 14:53         ` Ian Jackson
  1 sibling, 0 replies; 56+ messages in thread
From: Wei Liu @ 2016-09-15 10:46 UTC (permalink / raw)
  To: Julien Grall
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	shannon.zhao, Shannon Zhao, boris.ostrovsky

On Tue, Sep 13, 2016 at 11:38:35AM +0100, Julien Grall wrote:
> Hi Shannon,
> 
> On 13/09/16 08:03, Shannon Zhao wrote:
> >
> >
> >On 2016/9/12 23:18, Julien Grall wrote:
> >>Hi Shannon,
> >>
> >>On 02/09/16 03:55, Shannon Zhao wrote:
> >>>From: Shannon Zhao <shannon.zhao@linaro.org>
> >>>
> >>>Here it adds the ACPI tables size to set the target maxmem to avoid
> >>>providing less available memory for guest.
> >>>
> >>>Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> >>>---
> >>> tools/libxl/libxl_arch.h        |  2 +-
> >>> tools/libxl/libxl_arm.c         | 18 +++++++++++++++++-
> >>> tools/libxl/libxl_arm.h         |  4 ++++
> >>> tools/libxl/libxl_arm_acpi.c    | 20 ++++++++++++++++++++
> >>> tools/libxl/libxl_arm_no_acpi.c |  6 ++++++
> >>> tools/libxl/libxl_dom.c         |  2 +-
> >>> tools/libxl/libxl_x86.c         |  2 +-
> >>> 7 files changed, 50 insertions(+), 4 deletions(-)
> >>>
> >>>diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
> >>>index 337061f..d62fa4c 100644
> >>>--- a/tools/libxl/libxl_arch.h
> >>>+++ b/tools/libxl/libxl_arch.h
> >>>@@ -30,7 +30,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
> >>> /* arch specific internal domain creation function */
> >>> _hidden
> >>> int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
> >>>*d_config,
> >>>-               uint32_t domid);
> >>>+                              libxl__domain_build_state *state,
> >>>uint32_t domid);
> >>>
> >>> /* setup arch specific hardware description, i.e. DTB on ARM */
> >>> _hidden
> >>>diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> >>>index e73d65e..c7d4f65 100644
> >>>--- a/tools/libxl/libxl_arm.c
> >>>+++ b/tools/libxl/libxl_arm.c
> >>>@@ -101,8 +101,24 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
> >>> }
> >>>
> >>> int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config
> >>>*d_config,
> >>>-                              uint32_t domid)
> >>>+                              libxl__domain_build_state *state,
> >>>uint32_t domid)
> >>> {
> >>>+    libxl_domain_build_info *const info = &d_config->b_info;
> >>>+    libxl_ctx *ctx = libxl__gc_owner(gc);
> >>>+    int size;
> >>>+
> >>>+    /* Add the size of ACPI tables to maxmem if ACPI is enabled for
> >>>guest. */
> >>>+    if (libxl_defbool_val(info->acpi)) {
> >>>+        size = libxl__get_acpi_size(gc, info, state);
> >>>+        if (size < 0)
> >>>+            return ERROR_FAIL;
> >>>+        if (xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
> >>>+                                LIBXL_MAXMEM_CONSTANT + (size + 1023)
> >>>/ 1024)) {
> >>
> >>I still have some concern about use info->target_memkb +
> >>LIBXL_MAXMEM_CONSTANT here. What if the generic code decide to change
> >>the computation?
> >>
> >>We may forgot to replicate here. My suggestion on the previous version
> >>was to have in the common code
> >>
> >>xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
> >>LIBXL_MAXMEM_CONSTANT + libxl__arch_memory_constant());
> >>
> >>Or a similar name.
> >>
> >Just to confirm, do you mean that having a arch function to get the size
> >each arch needs and adding the size in libxl__build_pre()?
> 
> That's correct. Wei, Ian, do you have any opinions on this?
> 

I'm fine with that.

Wei.

> Regards,
> 
> -- 
> Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem
  2016-09-13 10:38       ` Julien Grall
  2016-09-15 10:46         ` Wei Liu
@ 2016-09-19 14:53         ` Ian Jackson
  1 sibling, 0 replies; 56+ messages in thread
From: Ian Jackson @ 2016-09-19 14:53 UTC (permalink / raw)
  To: Julien Grall
  Cc: sstabellini, wei.liu2, peter.huangpeng, xen-devel, shannon.zhao,
	Shannon Zhao, boris.ostrovsky

Julien Grall writes ("Re: [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem"):
> On 13/09/16 08:03, Shannon Zhao wrote:
...
> >> xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
> >> LIBXL_MAXMEM_CONSTANT + libxl__arch_memory_constant());
> >>
> >> Or a similar name.
> >>
> > Just to confirm, do you mean that having a arch function to get the size
> > each arch needs and adding the size in libxl__build_pre()?
> 
> That's correct. Wei, Ian, do you have any opinions on this?

Yes, I think Julien's suggestion is a good one.  The name is fine IMO.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-15 12:35   ` Boris Ostrovsky
@ 2016-09-15 13:46     ` Julien Grall
  0 siblings, 0 replies; 56+ messages in thread
From: Julien Grall @ 2016-09-15 13:46 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	shannon.zhao, zhaoshenglong



On 15/09/2016 13:35, Boris Ostrovsky wrote:
> On 09/15/2016 04:58 AM, Julien Grall wrote:
> I think Jan mentioned at some point that certain versions of Windows
> require an early revision although IIRC it was 2.0. So perhaps at some
> point we could drop support for pre-2.0 versions, but this was never
> going to be part of my series --- the goal was only to make it available
> to libxl.

Thank you for the information!

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-15  8:58 ` Julien Grall
@ 2016-09-15 12:35   ` Boris Ostrovsky
  2016-09-15 13:46     ` Julien Grall
  0 siblings, 1 reply; 56+ messages in thread
From: Boris Ostrovsky @ 2016-09-15 12:35 UTC (permalink / raw)
  To: Julien Grall
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	shannon.zhao, zhaoshenglong

On 09/15/2016 04:58 AM, Julien Grall wrote:
> Hi Boris,
>
> On 15/09/2016 03:17, Boris Ostrovsky wrote:
>>
>> ----- julien.grall@arm.com wrote:
>>
>>> Hi Stefano,
>>>
>>> On 14/09/2016 21:48, Stefano Stabellini wrote:
>>>> On Wed, 14 Sep 2016, Julien Grall wrote:
>>>>> On 14/09/2016 02:06, Stefano Stabellini wrote:
>>>>>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>>>>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>>>>>> Hi Julien,
>>>>>>>>
>>>>>>>> Hello Shannon,
>>>>>>>>
>>>>>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>>>>>> Hi Shannon,
>>>>>>>>>>
>>>>>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>>>>>
>>>>>>>>>>> The design of this feature is described as below.
>>>>>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
>>> according
>>>>>>>>>>> the
>>>>>>>>>>> number of vcpus and gic controller.
>>>>>>>>>>>
>>>>>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
>>> space
>>>>>>>>>>> and
>>>>>>>>>>> passes them to UEFI firmware through the "ARM multiboot"
>>> protocol.
>>>>>>>>>>>
>>>>>>>>>>> At last, UEFI gets the ACPI tables through the "ARM
>>> multiboot"
>>>>>>>>>>> protocol
>>>>>>>>>>> and installs these tables like the usual way and passes both
>>> ACPI
>>>>>>>>>>> and DT
>>>>>>>>>>> information to the Xen DomU.
>>>>>>>>>>>
>>>>>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT,
>>> DSDT
>>>>>>>>>>> tables
>>>>>>>>>>> since it's enough now.
>>>>>>>>>>>
>>>>>>>>>>> This has been tested using guest kernel with the Dom0 ACPI
>>> support
>>>>>>>>>>> patches which could be fetched from linux master or:
>>>>>>>>>>>
>>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> The UEFI binary could be fetched from or built from edk2
>>> master
>>>>>>>>>>> branch:
>>>>>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>>>>>
>>>>>>>>>> On which commit this EFI binary is based? I am trying to
>>> rebuild
>>>>>>>>>> myself,
>>>>>>>>>> and go no luck to boot it so far.
>>>>>>>>>>
>>>>>>>>> I forgot the exact commit. But I just tried below commit which
>>> adds
>>>>>>>>> the
>>>>>>>>> support to edk2 and the guest can boot up successfully with
>>> ACPI.
>>>>>>>>>
>>>>>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen
>>> ARM
>>>>>>>>
>>>>>>>> Thanks, the commit does not build on my platform. After some
>>> help for
>>>>>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>>>>>
>>>>>>>> However Linux does not boot when passing acpi=on and abort with
>>> the
>>>>>>>> following message:
>>>>>>>>
>>>>>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64,
>>> nr_cpu_ids=1
>>>>>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>>>>>> (d86) 3No valid GICC entries exist
>>>>>>>> (d86) 0Kernel panic - not syncing: No interrupt controller
>>> found.
>>>>>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>>>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>>>>>> (d86) Call trace:
>>>>>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>>>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>>>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>>>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>>>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>>>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>>>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>>>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt
>>> controller
>>>>>>>> found.
>>>>>>>>
>>>>>>>> This is because the header.length for GICC is not valid for ACPI
>>> 5.1
>>>>>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each
>>> table
>>>>>>>> against ACPI 5.1.
>>>>>>>>
>>>>>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is
>>> already
>>>>>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>>>>>> One solution is that we still use ACPI 5.1 and make
>>> gicc->header.length
>>>>>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM
>>> ACPI
>>>>>>> support in Linux was introduced after ACPI 6.0.
>>>>>>>
>>>>>>> Which one do you prefer?
>>>>>>
>>>>>> Certainly the versions of all tables need to be consistent. I
>>> would
>>>>>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>>>>>> upgrading to 6.0 causes a large amount of changes to your
>>> patches).
>>>>>
>>>>> I disagree on this, we should use the first version of ACPI that is
>>> fully
>>>>> supporting ARM because a guest operating system may choose to
>>> support the
>>>>> first one (there is a lot hardware platform out which only provides
>>> ACPI 5.1).
>>>>
>>>> And I thought that compatibility was supposed to be ACPI's strong
>>> suit.
>>>> I mistakenly had the impression that new ACPI releases weren't
>>> suppose
>>>> to break old OSes. I take back my comment, you are right that we
>>> should
>>>> stay on 5.1 (including all the erratas, many are important for ARM).
>>>>
>>>
>>> IIRC, early version of ACPI used to have some incompatibility. I will
>>> have to go through the ACPI spec to find the main differences between
>>> 5.1 and 6.0 for ARM.
>>
>>
>> Transition from 1.x to 2.0 introduced incompatibilities (I believe in
>> RSDP
>> structure definition) but I thought that since then they kept
>> everything back
>> compatible.
>
> Not related to ARM. But is it the reason why you keep an early version
> of ACPI for HVM guest and never upgraded?

I think Jan mentioned at some point that certain versions of Windows
require an early revision although IIRC it was 2.0. So perhaps at some
point we could drop support for pre-2.0 versions, but this was never
going to be part of my series --- the goal was only to make it available
to libxl.


-boris



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
  2016-09-15  2:17 Boris Ostrovsky
@ 2016-09-15  8:58 ` Julien Grall
  2016-09-15 12:35   ` Boris Ostrovsky
  0 siblings, 1 reply; 56+ messages in thread
From: Julien Grall @ 2016-09-15  8:58 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	shannon.zhao, zhaoshenglong

Hi Boris,

On 15/09/2016 03:17, Boris Ostrovsky wrote:
>
> ----- julien.grall@arm.com wrote:
>
>> Hi Stefano,
>>
>> On 14/09/2016 21:48, Stefano Stabellini wrote:
>>> On Wed, 14 Sep 2016, Julien Grall wrote:
>>>> On 14/09/2016 02:06, Stefano Stabellini wrote:
>>>>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
>>>>>> On 2016/9/13 23:17, Julien Grall wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 13/09/16 14:06, Shannon Zhao wrote:
>>>>>>>> Hi Julien,
>>>>>>>
>>>>>>> Hello Shannon,
>>>>>>>
>>>>>>>> On 2016/9/13 19:56, Julien Grall wrote:
>>>>>>>>> Hi Shannon,
>>>>>>>>>
>>>>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
>>>>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>>>>>>>
>>>>>>>>>> The design of this feature is described as below.
>>>>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
>> according
>>>>>>>>>> the
>>>>>>>>>> number of vcpus and gic controller.
>>>>>>>>>>
>>>>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
>> space
>>>>>>>>>> and
>>>>>>>>>> passes them to UEFI firmware through the "ARM multiboot"
>> protocol.
>>>>>>>>>>
>>>>>>>>>> At last, UEFI gets the ACPI tables through the "ARM
>> multiboot"
>>>>>>>>>> protocol
>>>>>>>>>> and installs these tables like the usual way and passes both
>> ACPI
>>>>>>>>>> and DT
>>>>>>>>>> information to the Xen DomU.
>>>>>>>>>>
>>>>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT,
>> DSDT
>>>>>>>>>> tables
>>>>>>>>>> since it's enough now.
>>>>>>>>>>
>>>>>>>>>> This has been tested using guest kernel with the Dom0 ACPI
>> support
>>>>>>>>>> patches which could be fetched from linux master or:
>>>>>>>>>>
>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The UEFI binary could be fetched from or built from edk2
>> master
>>>>>>>>>> branch:
>>>>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
>>>>>>>>>
>>>>>>>>> On which commit this EFI binary is based? I am trying to
>> rebuild
>>>>>>>>> myself,
>>>>>>>>> and go no luck to boot it so far.
>>>>>>>>>
>>>>>>>> I forgot the exact commit. But I just tried below commit which
>> adds
>>>>>>>> the
>>>>>>>> support to edk2 and the guest can boot up successfully with
>> ACPI.
>>>>>>>>
>>>>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen
>> ARM
>>>>>>>
>>>>>>> Thanks, the commit does not build on my platform. After some
>> help for
>>>>>>> Ard I managed to boot UEFI with the patch [1] applied.
>>>>>>>
>>>>>>> However Linux does not boot when passing acpi=on and abort with
>> the
>>>>>>> following message:
>>>>>>>
>>>>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64,
>> nr_cpu_ids=1
>>>>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
>>>>>>> (d86) 3No valid GICC entries exist
>>>>>>> (d86) 0Kernel panic - not syncing: No interrupt controller
>> found.
>>>>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
>>>>>>> (d86) dHardware name: XENVM-4.8 (DT)
>>>>>>> (d86) Call trace:
>>>>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
>>>>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
>>>>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
>>>>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
>>>>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
>>>>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
>>>>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
>>>>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt
>> controller
>>>>>>> found.
>>>>>>>
>>>>>>> This is because the header.length for GICC is not valid for ACPI
>> 5.1
>>>>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each
>> table
>>>>>>> against ACPI 5.1.
>>>>>>>
>>>>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is
>> already
>>>>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
>>>>>> One solution is that we still use ACPI 5.1 and make
>> gicc->header.length
>>>>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM
>> ACPI
>>>>>> support in Linux was introduced after ACPI 6.0.
>>>>>>
>>>>>> Which one do you prefer?
>>>>>
>>>>> Certainly the versions of all tables need to be consistent. I
>> would
>>>>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
>>>>> upgrading to 6.0 causes a large amount of changes to your
>> patches).
>>>>
>>>> I disagree on this, we should use the first version of ACPI that is
>> fully
>>>> supporting ARM because a guest operating system may choose to
>> support the
>>>> first one (there is a lot hardware platform out which only provides
>> ACPI 5.1).
>>>
>>> And I thought that compatibility was supposed to be ACPI's strong
>> suit.
>>> I mistakenly had the impression that new ACPI releases weren't
>> suppose
>>> to break old OSes. I take back my comment, you are right that we
>> should
>>> stay on 5.1 (including all the erratas, many are important for ARM).
>>>
>>
>> IIRC, early version of ACPI used to have some incompatibility. I will
>> have to go through the ACPI spec to find the main differences between
>> 5.1 and 6.0 for ARM.
>
>
> Transition from 1.x to 2.0 introduced incompatibilities (I believe in RSDP
> structure definition) but I thought that since then they kept everything back
> compatible.

Not related to ARM. But is it the reason why you keep an early version 
of ACPI for HVM guest and never upgraded?

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v5 00/16] Xen ARM DomU ACPI support
@ 2016-09-15  2:17 Boris Ostrovsky
  2016-09-15  8:58 ` Julien Grall
  0 siblings, 1 reply; 56+ messages in thread
From: Boris Ostrovsky @ 2016-09-15  2:17 UTC (permalink / raw)
  To: julien.grall
  Cc: sstabellini, wei.liu2, ian.jackson, peter.huangpeng, xen-devel,
	shannon.zhao, zhaoshenglong


----- julien.grall@arm.com wrote:

> Hi Stefano,
> 
> On 14/09/2016 21:48, Stefano Stabellini wrote:
> > On Wed, 14 Sep 2016, Julien Grall wrote:
> >> On 14/09/2016 02:06, Stefano Stabellini wrote:
> >>> On Wed, 14 Sep 2016, Shannon Zhao wrote:
> >>>> On 2016/9/13 23:17, Julien Grall wrote:
> >>>>>
> >>>>>
> >>>>> On 13/09/16 14:06, Shannon Zhao wrote:
> >>>>>> Hi Julien,
> >>>>>
> >>>>> Hello Shannon,
> >>>>>
> >>>>>> On 2016/9/13 19:56, Julien Grall wrote:
> >>>>>>> Hi Shannon,
> >>>>>>>
> >>>>>>> On 02/09/16 03:55, Shannon Zhao wrote:
> >>>>>>>> From: Shannon Zhao <shannon.zhao@linaro.org>
> >>>>>>>>
> >>>>>>>> The design of this feature is described as below.
> >>>>>>>> Firstly, the toolstack (libxl) generates the ACPI tables
> according
> >>>>>>>> the
> >>>>>>>> number of vcpus and gic controller.
> >>>>>>>>
> >>>>>>>> Then, it copies these ACPI tables to DomU non-RAM memory map
> space
> >>>>>>>> and
> >>>>>>>> passes them to UEFI firmware through the "ARM multiboot"
> protocol.
> >>>>>>>>
> >>>>>>>> At last, UEFI gets the ACPI tables through the "ARM
> multiboot"
> >>>>>>>> protocol
> >>>>>>>> and installs these tables like the usual way and passes both
> ACPI
> >>>>>>>> and DT
> >>>>>>>> information to the Xen DomU.
> >>>>>>>>
> >>>>>>>> Currently libxl only generates RSDP, XSDT, GTDT, MADT, FADT,
> DSDT
> >>>>>>>> tables
> >>>>>>>> since it's enough now.
> >>>>>>>>
> >>>>>>>> This has been tested using guest kernel with the Dom0 ACPI
> support
> >>>>>>>> patches which could be fetched from linux master or:
> >>>>>>>>
> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> The UEFI binary could be fetched from or built from edk2
> master
> >>>>>>>> branch:
> >>>>>>>> http://people.linaro.org/~shannon.zhao/DomU_ACPI/XEN_EFI.fd
> >>>>>>>
> >>>>>>> On which commit this EFI binary is based? I am trying to
> rebuild
> >>>>>>> myself,
> >>>>>>> and go no luck to boot it so far.
> >>>>>>>
> >>>>>> I forgot the exact commit. But I just tried below commit which
> adds
> >>>>>> the
> >>>>>> support to edk2 and the guest can boot up successfully with
> ACPI.
> >>>>>>
> >>>>>> 402dde6 ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen
> ARM
> >>>>>
> >>>>> Thanks, the commit does not build on my platform. After some
> help for
> >>>>> Ard I managed to boot UEFI with the patch [1] applied.
> >>>>>
> >>>>> However Linux does not boot when passing acpi=on and abort with
> the
> >>>>> following message:
> >>>>>
> >>>>> (d86) 6RCU: Adjusting geometry for rcu_fanout_leaf=64,
> nr_cpu_ids=1
> >>>>> (d86) 6NR_IRQS:64 nr_irqs:64 0
> >>>>> (d86) 3No valid GICC entries exist
> >>>>> (d86) 0Kernel panic - not syncing: No interrupt controller
> found.
> >>>>> (d86) dCPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6+ #420
> >>>>> (d86) dHardware name: XENVM-4.8 (DT)
> >>>>> (d86) Call trace:
> >>>>> (d86) [<ffff000008088708>] dump_backtrace+0x0/0x1a8
> >>>>> (d86) [<ffff0000080888c4>] show_stack+0x14/0x20
> >>>>> (d86) [<ffff0000083d6c2c>] dump_stack+0x94/0xb8
> >>>>> (d86) [<ffff00000815c24c>] panic+0x10c/0x250
> >>>>> (d86) [<ffff000008c223f8>] init_IRQ+0x24/0x2c
> >>>>> (d86) [<ffff000008c20a24>] start_kernel+0x238/0x394
> >>>>> (d86) [<ffff000008c201bc>] __primary_switched+0x30/0x74
> >>>>> (d86) 0---[ end Kernel panic - not syncing: No interrupt
> controller
> >>>>> found.
> >>>>>
> >>>>> This is because the header.length for GICC is not valid for ACPI
> 5.1
> >>>>> (see BAD_MADT_GICC_ENTRY). So please check all the size of each
> table
> >>>>> against ACPI 5.1.
> >>>>>
> >>>> Oops. The reason is that acpi_madt_generic_interrupt in Xen is
> already
> >>>> updated to ACPI 6.0 and the length is 80 not 76 of ACPI 5.1.
> >>>> One solution is that we still use ACPI 5.1 and make
> gicc->header.length
> >>>> 76. Other one is that we update to ACPI 6.0 since the Xen ARM
> ACPI
> >>>> support in Linux was introduced after ACPI 6.0.
> >>>>
> >>>> Which one do you prefer?
> >>>
> >>> Certainly the versions of all tables need to be consistent. I
> would
> >>> prefer to have ACPI 6.0 but 5.1 is acceptable too (especially if
> >>> upgrading to 6.0 causes a large amount of changes to your
> patches).
> >>
> >> I disagree on this, we should use the first version of ACPI that is
> fully
> >> supporting ARM because a guest operating system may choose to
> support the
> >> first one (there is a lot hardware platform out which only provides
> ACPI 5.1).
> >
> > And I thought that compatibility was supposed to be ACPI's strong
> suit.
> > I mistakenly had the impression that new ACPI releases weren't
> suppose
> > to break old OSes. I take back my comment, you are right that we
> should
> > stay on 5.1 (including all the erratas, many are important for ARM).
> >
> 
> IIRC, early version of ACPI used to have some incompatibility. I will
> have to go through the ACPI spec to find the main differences between
> 5.1 and 6.0 for ARM.


Transition from 1.x to 2.0 introduced incompatibilities (I believe in RSDP
structure definition) but I thought that since then they kept everything back
compatible.

-boris


> 
> Assuming the newer versions are backward compatible, it might be good
> to
> written down somewhere (maybe a public headers) that the guest OS
> should
> not assume a specific version of ACPI. This would avoid to tie us on
> ACPI 5.1 and allow us to upgrade the tables on a next release of Xen.
> 
> In any case, we should be consistent accross all the ACPI tables (e.g
> version, size of the tables...) to accommodate picky OSes. For now, I
> would stay on ACPI 5.1 for safety.
> 
> Regards,
> 
> --
> Julien Grall
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2016-09-19 14:53 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-12 14:41   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-12 14:44   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-09-12 14:58   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-09-12 15:05   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-09-12 15:08   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-09-12 15:09   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-09-12 15:10   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-09-12 15:13   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 13/16] libxl/arm: Add ACPI module Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
2016-09-02  6:18   ` Jan Beulich
2016-09-02  7:23     ` Shannon Zhao
2016-09-02  8:17       ` Jan Beulich
2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-09-12 15:14   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
2016-09-12 15:18   ` Julien Grall
2016-09-13  7:03     ` Shannon Zhao
2016-09-13 10:38       ` Julien Grall
2016-09-15 10:46         ` Wei Liu
2016-09-19 14:53         ` Ian Jackson
2016-09-02 14:31 ` [PATCH v5 00/16] Xen ARM DomU ACPI support Wei Liu
2016-09-12 15:22 ` Julien Grall
2016-09-13  6:30   ` Shannon Zhao
2016-09-13 11:56 ` Julien Grall
2016-09-13 13:06   ` Shannon Zhao
2016-09-13 15:17     ` Julien Grall
2016-09-13 15:18       ` Julien Grall
2016-09-14  0:56       ` Shannon Zhao
2016-09-14  1:06         ` Stefano Stabellini
2016-09-14  7:14           ` Julien Grall
2016-09-14  7:32             ` Shannon Zhao
2016-09-14  7:40               ` Julien Grall
2016-09-14  8:01                 ` Shannon Zhao
2016-09-14 20:48             ` Stefano Stabellini
2016-09-14 21:26               ` Julien Grall
2016-09-15  2:17 Boris Ostrovsky
2016-09-15  8:58 ` Julien Grall
2016-09-15 12:35   ` Boris Ostrovsky
2016-09-15 13:46     ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.