xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] Xen ARM DomU ACPI support
@ 2016-05-31  4:43 Shannon Zhao
  2016-05-31  4:43 ` [PATCH 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
                   ` (15 more replies)
  0 siblings, 16 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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 memory 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:
https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen

Shannon Zhao (14):
  libxl/arm: Fix the function name in error log
  libxl/arm: Factor out codes for generating DTB
  libxc: Add placeholders for ACPI tables blob and size
  tools: add ACPI tables relevant definitions
  libxl/arm: Construct ACPI GTDT table
  libxl/arm: Construct ACPI FADT table
  libxl/arm: Construct ACPI DSDT table
  libxl/arm: Construct ACPI MADT table
  libxl/arm: Construct ACPI XSDT table
  libxl/arm: Construct ACPI RSDP table
  libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
  libxl/arm: Add ACPI module
  libxl/arm: initialize memory information of ACPI blob
  libxc/xc_dom_core: Copy ACPI tables to guest memory space

 tools/libxc/include/acpi_defs.h | 277 ++++++++++++++++++++++++++++++++
 tools/libxc/include/xc_dom.h    |  17 ++
 tools/libxc/xc_dom_arm.c        |  16 +-
 tools/libxc/xc_dom_core.c       |  59 +++++++
 tools/libxl/libxl_arm.c         | 345 +++++++++++++++++++++++++++++++++++++++-
 5 files changed, 706 insertions(+), 8 deletions(-)
 create mode 100644 tools/libxc/include/acpi_defs.h

-- 
2.0.4



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

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

* [PATCH 01/14] libxl/arm: Fix the function name in error log
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 02/14] libxl/arm: Factor out codes for generating DTB Shannon Zhao
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

It should be xc_dom_devicetree_mem instead of xc_dom_devicetree_file.

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 1195b37..c6d77e3 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -872,7 +872,7 @@ next_resize:
 
     res = xc_dom_devicetree_mem(dom, fdt, fdt_totalsize(fdt));
     if (res) {
-        LOGE(ERROR, "xc_dom_devicetree_file failed");
+        LOGE(ERROR, "xc_dom_devicetree_mem failed");
         rc = ERROR_FAIL;
         goto out;
     }
-- 
2.0.4



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

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

* [PATCH 02/14] libxl/arm: Factor out codes for generating DTB
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
  2016-05-31  4:43 ` [PATCH 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 03/14] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Factor out codes for generating DTB to prepare for adding ACPI tables
generation codes.

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index c6d77e3..9e99159 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -747,10 +747,9 @@ static int copy_partial_fdt(libxl__gc *gc, void *fdt, void *pfdt)
 
 #define FDT_MAX_SIZE (1<<20)
 
-int libxl__arch_domain_init_hw_description(libxl__gc *gc,
-                                           libxl_domain_build_info *info,
-                                           libxl__domain_build_state *state,
-                                           struct xc_dom_image *dom)
+static int prepare_dtb(libxl__gc *gc, libxl_domain_build_info *info,
+                       libxl__domain_build_state *state,
+                       struct xc_dom_image *dom)
 {
     void *fdt = NULL;
     void *pfdt = NULL;
@@ -764,8 +763,6 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
     /* convenience aliases */
     xc_domain_configuration_t *xc_config = &state->config;
 
-    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
-
     vers = libxl_get_version_info(CTX);
     if (vers == NULL) return ERROR_FAIL;
 
@@ -883,6 +880,15 @@ out:
     return rc;
 }
 
+int libxl__arch_domain_init_hw_description(libxl__gc *gc,
+                                           libxl_domain_build_info *info,
+                                           libxl__domain_build_state *state,
+                                           struct xc_dom_image *dom)
+{
+    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+    return prepare_dtb(gc, info, state, dom);
+}
+
 static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
                                      uint64_t base, uint64_t size)
 {
-- 
2.0.4



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

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

* [PATCH 03/14] libxc: Add placeholders for ACPI tables blob and size
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
  2016-05-31  4:43 ` [PATCH 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
  2016-05-31  4:43 ` [PATCH 02/14] libxl/arm: Factor out codes for generating DTB Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 04/14] tools: add ACPI tables relevant definitions Shannon Zhao
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Currently it only needs ACPI table RSDP, XSDT, GTDT, MADT, FADT, DSDT
for ARM VM. So only add placeholders for them here.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxc/include/xc_dom.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index 6cb10c4..0fe54dd 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -56,6 +56,20 @@ struct xc_dom_phys {
     xen_pfn_t count;
 };
 
+struct acpitable {
+    void *table;
+    size_t size;
+};
+
+struct acpitable_blob {
+    struct acpitable rsdp;
+    struct acpitable xsdt;
+    struct acpitable gtdt;
+    struct acpitable madt;
+    struct acpitable fadt;
+    struct acpitable dsdt;
+};
+
 struct xc_dom_image {
     /* files */
     void *kernel_blob;
@@ -64,6 +78,8 @@ struct xc_dom_image {
     size_t ramdisk_size;
     void *devicetree_blob;
     size_t devicetree_size;
+    struct acpitable_blob *acpitable_blob;
+    size_t acpitable_size;
 
     size_t max_kernel_size;
     size_t max_ramdisk_size;
@@ -92,6 +108,7 @@ struct xc_dom_image {
     struct xc_dom_seg p2m_seg;
     struct xc_dom_seg pgtables_seg;
     struct xc_dom_seg devicetree_seg;
+    struct xc_dom_seg acpi_seg;
     struct xc_dom_seg start_info_seg; /* HVMlite only */
     xen_pfn_t start_info_pfn;
     xen_pfn_t console_pfn;
-- 
2.0.4



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

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

* [PATCH 04/14] tools: add ACPI tables relevant definitions
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (2 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 03/14] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 05/14] libxl/arm: Construct ACPI GTDT table Shannon Zhao
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Add ACPI tables relevant definitions for generating ACPI tables for ARM
guest later. Currently RSDP, XSDT, GTDT, MADT, FADT and DSDT tables will
be used.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxc/include/acpi_defs.h | 277 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 277 insertions(+)
 create mode 100644 tools/libxc/include/acpi_defs.h

diff --git a/tools/libxc/include/acpi_defs.h b/tools/libxc/include/acpi_defs.h
new file mode 100644
index 0000000..9389a96
--- /dev/null
+++ b/tools/libxc/include/acpi_defs.h
@@ -0,0 +1,277 @@
+#ifndef _ACPI_DEFS_H_
+#define _ACPI_DEFS_H_
+
+#define ACPI_BUILD_APPNAME6 "XenARM"
+#define ACPI_BUILD_APPNAME4 "Xen "
+
+#pragma pack (1)
+
+/* Root System Description Pointer Structure. */
+struct acpi_rsdp_descriptor {        /* Root System Descriptor Pointer */
+    uint64_t signature;              /* ACPI signature, contains "RSD PTR " */
+    uint8_t  checksum;               /* To make sum of struct == 0 */
+    uint8_t  oem_id[6];             /* OEM identification */
+    uint8_t  revision;               /* Must be 0 for 1.0, 2 for 2.0 */
+    uint32_t rsdt_physical_address;  /* 32-bit physical address of RSDT */
+    uint32_t length;                 /* XSDT Length in bytes including hdr */
+    uint64_t xsdt_physical_address;  /* 64-bit physical address of XSDT */
+    uint8_t  extended_checksum;      /* Checksum of entire table */
+    uint8_t  reserved[3];           /* Reserved field must be 0 */
+};
+
+/* ACPI common table header. */
+struct acpi_table_header {
+    uint32_t signature;          /* ACPI signature (4 ASCII characters) */ \
+    uint32_t length;                 /* Length of table, in bytes, including header */ \
+    uint8_t  revision;               /* ACPI Specification minor version # */ \
+    uint8_t  checksum;               /* To make sum of entire table == 0 */ \
+    uint8_t  oem_id[6];             /* OEM identification */ \
+    uint8_t  oem_table_id[8];       /* OEM table identification */ \
+    uint32_t oem_revision;           /* OEM revision number */ \
+    uint8_t  asl_compiler_id[4];    /* ASL compiler vendor ID */ \
+    uint32_t asl_compiler_revision;  /* ASL compiler revision number */
+};
+
+/* Extended System Description Table (XSDT). */
+struct acpi_xsdt_descriptor {
+    struct acpi_table_header header;
+    uint64_t entry[0];
+};
+
+/* Generic Timer Description Table (GTDT). */
+#define ACPI_GTDT_INTERRUPT_MODE        0
+#define ACPI_GTDT_INTERRUPT_POLARITY    1
+#define ACPI_GTDT_ALWAYS_ON             2
+
+/* Triggering */
+#define ACPI_LEVEL_SENSITIVE            ((uint8_t) 0x00)
+#define ACPI_EDGE_SENSITIVE             ((uint8_t) 0x01)
+
+/* Polarity */
+#define ACPI_ACTIVE_HIGH                ((uint8_t) 0x00)
+#define ACPI_ACTIVE_LOW                 ((uint8_t) 0x01)
+
+struct acpi_gtdt_descriptor {
+    struct acpi_table_header header;
+    uint64_t counter_block_addresss;
+    uint32_t reserved;
+    uint32_t secure_el1_interrupt;
+    uint32_t secure_el1_flags;
+    uint32_t non_secure_el1_interrupt;
+    uint32_t non_secure_el1_flags;
+    uint32_t virtual_timer_interrupt;
+    uint32_t virtual_timer_flags;
+    uint32_t non_secure_el2_interrupt;
+    uint32_t non_secure_el2_flags;
+    uint64_t counter_read_block_address;
+    uint32_t platform_timer_count;
+    uint32_t platform_timer_offset;
+};
+
+/* Multiple APIC Description Table header definition (MADT). */
+struct acpi_madt_descriptor
+{
+    struct acpi_table_header header;     /* ACPI common table header */
+    uint32_t local_apic_address;     /* Physical address of local APIC */
+    uint32_t flags;
+};
+
+/* Values for Type in APIC sub-headers. */
+
+#define ACPI_APIC_PROCESSOR          0
+#define ACPI_APIC_IO                 1
+#define ACPI_APIC_XRUPT_OVERRIDE     2
+#define ACPI_APIC_NMI                3
+#define ACPI_APIC_LOCAL_NMI          4
+#define ACPI_APIC_ADDRESS_OVERRIDE   5
+#define ACPI_APIC_IO_SAPIC           6
+#define ACPI_APIC_LOCAL_SAPIC        7
+#define ACPI_APIC_XRUPT_SOURCE       8
+#define ACPI_APIC_LOCAL_X2APIC       9
+#define ACPI_APIC_LOCAL_X2APIC_NMI      10
+#define ACPI_APIC_GENERIC_INTERRUPT     11
+#define ACPI_APIC_GENERIC_DISTRIBUTOR   12
+#define ACPI_APIC_GENERIC_MSI_FRAME     13
+#define ACPI_APIC_GENERIC_REDISTRIBUTOR 14
+#define ACPI_APIC_RESERVED              15   /* 15 and greater are reserved */
+
+/*
+ * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE).
+ */
+#define ACPI_SUB_HEADER_DEF   /* Common ACPI sub-structure header */\
+    uint8_t  type;                               \
+    uint8_t  length;
+
+/* Sub-structures for MADT */
+
+struct acpi_madt_generic_interrupt {
+    ACPI_SUB_HEADER_DEF
+    uint16_t reserved;
+    uint32_t cpu_interface_number;
+    uint32_t uid;
+    uint32_t flags;
+    uint32_t parking_version;
+    uint32_t performance_interrupt;
+    uint64_t parked_address;
+    uint64_t base_address;
+    uint64_t gicv_base_address;
+    uint64_t gich_base_address;
+    uint32_t vgic_interrupt;
+    uint64_t gicr_base_address;
+    uint64_t arm_mpidr;
+};
+
+struct acpi_madt_generic_distributor {
+    ACPI_SUB_HEADER_DEF
+    uint16_t reserved;
+    uint32_t gic_id;
+    uint64_t base_address;
+    uint32_t global_irq_base;
+    uint8_t version;
+    uint8_t reserved2[3];
+};
+
+struct acpi_madt_generic_msi_frame {
+    ACPI_SUB_HEADER_DEF
+    uint16_t reserved;
+    uint32_t gic_msi_frame_id;
+    uint64_t base_address;
+    uint32_t flags;
+    uint16_t spi_count;
+    uint16_t spi_base;
+};
+
+struct acpi_madt_generic_redistributor {
+    ACPI_SUB_HEADER_DEF
+    uint16_t reserved;
+    uint64_t base_address;
+    uint32_t range_length;
+};
+
+enum {
+    ACPI_FADT_F_WBINVD,
+    ACPI_FADT_F_WBINVD_FLUSH,
+    ACPI_FADT_F_PROC_C1,
+    ACPI_FADT_F_P_LVL2_UP,
+    ACPI_FADT_F_PWR_BUTTON,
+    ACPI_FADT_F_SLP_BUTTON,
+    ACPI_FADT_F_FIX_RTC,
+    ACPI_FADT_F_RTC_S4,
+    ACPI_FADT_F_TMR_VAL_EXT,
+    ACPI_FADT_F_DCK_CAP,
+    ACPI_FADT_F_RESET_REG_SUP,
+    ACPI_FADT_F_SEALED_CASE,
+    ACPI_FADT_F_HEADLESS,
+    ACPI_FADT_F_CPU_SW_SLP,
+    ACPI_FADT_F_PCI_EXP_WAK,
+    ACPI_FADT_F_USE_PLATFORM_CLOCK,
+    ACPI_FADT_F_S4_RTC_STS_VALID,
+    ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE,
+    ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL,
+    ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE,
+    ACPI_FADT_F_HW_REDUCED_ACPI,
+    ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE,
+};
+
+enum {
+    ACPI_FADT_ARM_USE_PSCI_G_0_2 = 0,
+    ACPI_FADT_ARM_PSCI_USE_HVC = 1,
+};
+
+struct acpi_generic_address {
+    uint8_t space_id;        /* Address space where struct or register exists */
+    uint8_t bit_width;       /* Size in bits of given register */
+    uint8_t bit_offset;      /* Bit offset within the register */
+    uint8_t access_width;    /* Minimum Access size (ACPI 3.0) */
+    uint64_t address;        /* 64-bit address of struct or register */
+};
+
+struct acpi_fadt_descriptor {
+    struct acpi_table_header header;    /* ACPI common table header */ \
+    uint32_t firmware_ctrl;  /* Physical address of FACS */ \
+    uint32_t dsdt;         /* Physical address of DSDT */ \
+    uint8_t  model;        /* System Interrupt Model */ \
+    uint8_t  reserved1;    /* Reserved */ \
+    uint16_t sci_int;      /* System vector of SCI interrupt */ \
+    uint32_t smi_cmd;      /* Port address of SMI command port */ \
+    uint8_t  acpi_enable;  /* Value to write to smi_cmd to enable ACPI */ \
+    uint8_t  acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
+    /* Value to write to SMI CMD to enter S4BIOS state */ \
+    uint8_t  S4bios_req; \
+    uint8_t  reserved2;    /* Reserved - must be zero */ \
+    /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
+    uint32_t pm1a_evt_blk; \
+    /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
+    uint32_t pm1b_evt_blk; \
+    uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
+    uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
+    uint32_t pm2_cnt_blk;  /* Port address of Power Mgt 2 Control Reg Blk */ \
+    uint32_t pm_tmr_blk;   /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
+    /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
+    uint32_t gpe0_blk; \
+    /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
+    uint32_t gpe1_blk; \
+    uint8_t  pm1_evt_len;  /* Byte length of ports at pm1_x_evt_blk */ \
+    uint8_t  pm1_cnt_len;  /* Byte length of ports at pm1_x_cnt_blk */ \
+    uint8_t  pm2_cnt_len;  /* Byte Length of ports at pm2_cnt_blk */ \
+    uint8_t  pm_tmr_len;   /* Byte Length of ports at pm_tm_blk */ \
+    uint8_t  gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
+    uint8_t  gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
+    uint8_t  gpe1_base;    /* Offset in gpe model where gpe1 events start */ \
+    uint8_t  reserved3;    /* Reserved */ \
+    uint16_t plvl2_lat;    /* Worst case HW latency to enter/exit C2 state */ \
+    uint16_t plvl3_lat;    /* Worst case HW latency to enter/exit C3 state */ \
+    uint16_t flush_size;   /* Size of area read to flush caches */ \
+    uint16_t flush_stride; /* Stride used in flushing caches */ \
+    uint8_t  duty_offset;  /* Bit location of duty cycle field in p_cnt reg */ \
+    uint8_t  duty_width;   /* Bit width of duty cycle field in p_cnt reg */ \
+    uint8_t  day_alrm;     /* Index to day-of-month alarm in RTC CMOS RAM */ \
+    uint8_t  mon_alrm;     /* Index to month-of-year alarm in RTC CMOS RAM */ \
+    uint8_t  century;      /* Index to century in RTC CMOS RAM */
+    /* IA-PC Boot Architecture Flags (see below for individual flags) */
+    uint16_t boot_flags;
+    uint8_t reserved;    /* Reserved, must be zero */
+    /* Miscellaneous flag bits (see below for individual flags) */
+    uint32_t flags;
+    /* 64-bit address of the Reset register */
+    struct acpi_generic_address reset_register;
+    /* Value to write to the reset_register port to reset the system */
+    uint8_t reset_value;
+    /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */
+    uint16_t arm_boot_flags;
+    uint8_t minor_revision;  /* FADT Minor Revision (ACPI 5.1) */
+    uint64_t Xfacs;          /* 64-bit physical address of FACS */
+    uint64_t Xdsdt;          /* 64-bit physical address of DSDT */
+    /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
+    struct acpi_generic_address xpm1a_event_block;
+    /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
+    struct acpi_generic_address xpm1b_event_block;
+    /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
+    struct acpi_generic_address xpm1a_control_block;
+    /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
+    struct acpi_generic_address xpm1b_control_block;
+    /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
+    struct acpi_generic_address xpm2_control_block;
+    /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
+    struct acpi_generic_address xpm_timer_block;
+    /* 64-bit Extended General Purpose Event 0 Reg Blk address */
+    struct acpi_generic_address xgpe0_block;
+    /* 64-bit Extended General Purpose Event 1 Reg Blk address */
+    struct acpi_generic_address xgpe1_block;
+    /* 64-bit Sleep Control register (ACPI 5.0) */
+    struct acpi_generic_address sleep_control;
+    /* 64-bit Sleep Status register (ACPI 5.0) */
+    struct acpi_generic_address sleep_status;
+};
+
+#endif /* _ACPI_DEFS_H_ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
2.0.4



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

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

* [PATCH 05/14] libxl/arm: Construct ACPI GTDT table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (3 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 04/14] tools: add ACPI tables relevant definitions Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 06/14] libxl/arm: Construct ACPI FADT table Shannon Zhao
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 9e99159..0fb4f69 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -3,6 +3,7 @@
 #include "libxl_libfdt_compat.h"
 
 #include <xc_dom.h>
+#include <acpi_defs.h>
 #include <stdbool.h>
 #include <libfdt.h>
 #include <assert.h>
@@ -880,13 +881,85 @@ out:
     return rc;
 }
 
+static void make_acpi_header(struct acpi_table_header *h, const char *sig,
+                             int len, uint8_t rev)
+{
+    memcpy(&h->signature, sig, 4);
+    h->length = len;
+    h->revision = rev;
+    memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
+    memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
+    memcpy(h->oem_table_id + 4, sig, 4);
+    h->oem_revision = 1;
+    memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);
+    h->asl_compiler_revision = 1;
+    h->checksum = 0;
+}
+
+static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_gtdt_descriptor *gtdt;
+
+    gtdt = libxl__zalloc(gc, sizeof(*gtdt));
+
+    gtdt->secure_el1_interrupt = GUEST_TIMER_PHYS_S_PPI;
+    gtdt->secure_el1_flags = (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
+                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
+    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);
+
+    make_acpi_header(&gtdt->header, "GTDT", sizeof(*gtdt), 2);
+
+    dom->acpitable_blob->gtdt.table = (void *)gtdt;
+    /* Align to 64bit. */
+    dom->acpitable_blob->gtdt.size = sizeof(*gtdt);
+    dom->acpitable_size += dom->acpitable_blob->gtdt.size;
+}
+
+static int 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;
+
+    /* convenience aliases */
+    xc_domain_configuration_t *xc_config = &state->config;
+
+    vers = libxl_get_version_info(CTX);
+    if (vers == NULL)
+        return ERROR_FAIL;
+
+    LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
+        vers->xen_version_major, vers->xen_version_minor);
+
+    /* Alloc memory for ACPI blob placeholders. */
+    dom->acpitable_blob = libxl__zalloc(gc, sizeof(struct acpitable_blob));
+    dom->acpitable_size = 0;
+
+    make_acpi_gtdt(gc, dom);
+
+    return 0;
+}
+
 int libxl__arch_domain_init_hw_description(libxl__gc *gc,
                                            libxl_domain_build_info *info,
                                            libxl__domain_build_state *state,
                                            struct xc_dom_image *dom)
 {
+    int rc;
+
     assert(info->type == LIBXL_DOMAIN_TYPE_PV);
-    return prepare_dtb(gc, info, state, dom);
+    rc = prepare_dtb(gc, info, state, dom);
+    if (rc)
+        return rc;
+
+    return prepare_acpi(gc, info, state, dom);
 }
 
 static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
-- 
2.0.4



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

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

* [PATCH 06/14] libxl/arm: Construct ACPI FADT table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (4 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 05/14] libxl/arm: Construct ACPI GTDT table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 07/14] libxl/arm: Construct ACPI DSDT table Shannon Zhao
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 0fb4f69..c3b8fb4 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -922,6 +922,28 @@ static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom)
     dom->acpitable_size += dom->acpitable_blob->gtdt.size;
 }
 
+static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_fadt_descriptor *fadt;
+
+    fadt = libxl__zalloc(gc, sizeof(*fadt));
+
+    /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+    fadt->flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI;
+    fadt->arm_boot_flags = (1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) |
+                           (1 << ACPI_FADT_ARM_PSCI_USE_HVC);
+
+    /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
+    fadt->minor_revision = 0x1;
+
+    make_acpi_header(&fadt->header, "FACP", sizeof(*fadt), 5);
+
+    dom->acpitable_blob->fadt.table = (void *)fadt;
+    /* Align to 64bit. */
+    dom->acpitable_blob->fadt.size = sizeof(*fadt);
+    dom->acpitable_size += dom->acpitable_blob->fadt.size;
+}
+
 static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -943,6 +965,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     dom->acpitable_size = 0;
 
     make_acpi_gtdt(gc, dom);
+    make_acpi_fadt(gc, dom);
 
     return 0;
 }
-- 
2.0.4



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

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

* [PATCH 07/14] libxl/arm: Construct ACPI DSDT table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (5 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 06/14] libxl/arm: Construct ACPI FADT table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 08/14] libxl/arm: Construct ACPI MADT table Shannon Zhao
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Currently there is only the table header in DSDT table.

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index c3b8fb4..7949635 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -944,6 +944,20 @@ static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom)
     dom->acpitable_size += dom->acpitable_blob->fadt.size;
 }
 
+static void make_acpi_dsdt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_table_header *dsdt;
+
+    /* Currently there is only the table header in DSDT table. */
+    dsdt = libxl__zalloc(gc, sizeof(*dsdt));
+    make_acpi_header((void *)dsdt, "DSDT", sizeof(*dsdt), 2);
+
+    dom->acpitable_blob->dsdt.table = (void *)dsdt;
+    /* Align to 64bit. */
+    dom->acpitable_blob->dsdt.size = ROUNDUP(sizeof(*dsdt), 3);
+    dom->acpitable_size += ROUNDUP(dom->acpitable_blob->dsdt.size, 3);
+}
+
 static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -966,6 +980,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 
     make_acpi_gtdt(gc, dom);
     make_acpi_fadt(gc, dom);
+    make_acpi_dsdt(gc, dom);
 
     return 0;
 }
-- 
2.0.4



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

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

* [PATCH 08/14] libxl/arm: Construct ACPI MADT table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (6 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 07/14] libxl/arm: Construct ACPI DSDT table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 09/14] libxl/arm: Construct ACPI XSDT table Shannon Zhao
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 7949635..f72f692 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -958,11 +958,115 @@ static void make_acpi_dsdt(libxl__gc *gc, struct xc_dom_image *dom)
     dom->acpitable_size += ROUNDUP(dom->acpitable_blob->dsdt.size, 3);
 }
 
+static void make_acpi_madt_gicc(void *table, int nr_cpus, uint64_t gicc_base)
+{
+    uint32_t i;
+    uint64_t mpidr_aff;
+    struct acpi_madt_generic_interrupt *gicc = table;
+
+    for (i = 0; i < nr_cpus; i++) {
+        gicc->type = ACPI_APIC_GENERIC_INTERRUPT;
+        gicc->length = sizeof(*gicc);
+        gicc->base_address = gicc_base;
+        gicc->cpu_interface_number = i;
+
+        /*
+         * We will use AFF0 and AFF1 when constructing the MPIDR 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);
+        gicc->arm_mpidr = mpidr_aff;
+        gicc->uid = i;
+        gicc->flags = 1;
+
+        gicc += 1;
+    }
+}
+
+static void make_acpi_madt_gicd(void *table, uint64_t gicd_base,
+                                uint8_t gic_version)
+{
+    struct acpi_madt_generic_distributor *gicd = table;
+
+    gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;
+    gicd->length = sizeof(*gicd);
+    gicd->base_address = gicd_base;
+    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->type = ACPI_APIC_GENERIC_REDISTRIBUTOR;
+    gicr->length = sizeof(*gicr);
+    gicr->base_address = gicr_base;
+    gicr->range_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)
+{
+    uint32_t size;
+    void *table;
+    struct acpi_madt_descriptor *madt;
+
+    switch (xc_config->gic_version) {
+    case XEN_DOMCTL_CONFIG_GIC_V2:
+        size = sizeof(struct acpi_madt_descriptor) +
+               sizeof(struct acpi_madt_generic_interrupt) * nr_cpus +
+               sizeof(struct acpi_madt_generic_distributor);
+        table = libxl__zalloc(gc, size);
+        madt = (struct acpi_madt_descriptor *)table;
+
+        table += sizeof(struct acpi_madt_descriptor);
+        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, 2);
+        break;
+    case XEN_DOMCTL_CONFIG_GIC_V3:
+        size = sizeof(struct acpi_madt_descriptor) +
+               sizeof(struct acpi_madt_generic_interrupt) * nr_cpus +
+               sizeof(struct acpi_madt_generic_distributor) +
+               sizeof(struct acpi_madt_generic_redistributor);
+        table = libxl__zalloc(gc, size);
+        madt = (struct acpi_madt_descriptor *)table;
+
+        table += sizeof(struct acpi_madt_descriptor);
+        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, 3);
+
+        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 %s",
+            gicv_to_string(xc_config->gic_version));
+        return ERROR_FAIL;
+    }
+
+    make_acpi_header(&madt->header, "APIC", size, 3);
+
+    dom->acpitable_blob->madt.table = (void *)madt;
+    /* Align to 64bit. */
+    dom->acpitable_blob->madt.size = size;
+    dom->acpitable_size += dom->acpitable_blob->madt.size;
+
+    return 0;
+}
+
 static int 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;
 
     /* convenience aliases */
     xc_domain_configuration_t *xc_config = &state->config;
@@ -981,6 +1085,9 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     make_acpi_gtdt(gc, dom);
     make_acpi_fadt(gc, dom);
     make_acpi_dsdt(gc, dom);
+    rc = make_acpi_madt(gc, dom, info->max_vcpus, xc_config);
+    if (rc)
+	return rc;
 
     return 0;
 }
-- 
2.0.4



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

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

* [PATCH 09/14] libxl/arm: Construct ACPI XSDT table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (7 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 08/14] libxl/arm: Construct ACPI MADT table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 10/14] libxl/arm: Construct ACPI RSDP table Shannon Zhao
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index f72f692..84ea8b6 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -1061,6 +1061,27 @@ static int make_acpi_madt(libxl__gc *gc, struct xc_dom_image *dom, int nr_cpus,
     return 0;
 }
 
+static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    uint32_t size;
+    struct acpi_xsdt_descriptor *xsdt;
+
+    /*
+     * Currently only 3 tables(GTDT, FADT, MADT) are pointed by XSDT. Alloc
+     * entries for them but the entry values will be specified when they are
+     * copied to the guest memory.
+     */
+    size = sizeof(*xsdt) + sizeof(uint64_t) * 3;
+    xsdt = libxl__zalloc(gc, size);
+
+    make_acpi_header(&xsdt->header, "XSDT", size, 1);
+
+    dom->acpitable_blob->xsdt.table = (void *)xsdt;
+    /* Align to 64bit. */
+    dom->acpitable_blob->xsdt.size = size;
+    dom->acpitable_size += dom->acpitable_blob->xsdt.size;
+}
+
 static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -1089,6 +1110,8 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     if (rc)
 	return rc;
 
+    make_acpi_xsdt(gc, dom);
+
     return 0;
 }
 
-- 
2.0.4



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

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

* [PATCH 10/14] libxl/arm: Construct ACPI RSDP table
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (8 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 09/14] libxl/arm: Construct ACPI XSDT table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 84ea8b6..1bef9b0 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -1082,6 +1082,23 @@ static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom)
     dom->acpitable_size += dom->acpitable_blob->xsdt.size;
 }
 
+static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_rsdp_descriptor *rsdp;
+
+    rsdp = libxl__zalloc(gc, sizeof(*rsdp));
+    memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
+    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
+    rsdp->length = sizeof(*rsdp);
+    rsdp->revision = 0x02;
+    rsdp->checksum = 0;
+
+    dom->acpitable_blob->rsdp.table = (void *)rsdp;
+    /* Align to 64bit. */
+    dom->acpitable_blob->rsdp.size = sizeof(*rsdp);
+    dom->acpitable_size += dom->acpitable_blob->rsdp.size;
+}
+
 static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -1111,6 +1128,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 	return rc;
 
     make_acpi_xsdt(gc, dom);
+    make_acpi_rsdp(gc, dom);
 
     return 0;
 }
-- 
2.0.4



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

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

* [PATCH 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (9 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 10/14] libxl/arm: Construct ACPI RSDP table Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 12/14] libxl/arm: Add ACPI module Shannon Zhao
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

If Xen guest boots with ACPI, the guest kernel will get the event
channel interrupt information via domain param HVM_PARAM_CALLBACK_IRQ.
Initialize that domain param.

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 1bef9b0..13259f8 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -1105,6 +1105,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
 {
     const libxl_version_info *vers;
     int rc;
+    uint64_t val;
 
     /* convenience aliases */
     xc_domain_configuration_t *xc_config = &state->config;
@@ -1130,7 +1131,12 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     make_acpi_xsdt(gc, dom);
     make_acpi_rsdp(gc, dom);
 
-    return 0;
+    /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
+    val = (uint64_t)HVM_PARAM_CALLBACK_TYPE_PPI << 56;
+    val |= (2 << 8); /* Active-low level-sensitive  */
+    val |= GUEST_EVTCHN_PPI & 0xff;
+    return xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CALLBACK_IRQ,
+                            val);
 }
 
 int libxl__arch_domain_init_hw_description(libxl__gc *gc,
-- 
2.0.4



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

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

* [PATCH 12/14] libxl/arm: Add ACPI module
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (10 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 13/14] libxl/arm: initialize memory information of ACPI blob Shannon Zhao
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

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

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

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 13259f8..e7cb578 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -285,6 +285,26 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
         if (res) return res;
     }
 
+    res = fdt_begin_node(fdt, "modules");
+    if (res) return res;
+
+    res = fdt_begin_node(fdt, "module@0");
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 2, "xen,linux-acpi",
+                              "xen,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;
+
     res = fdt_end_node(fdt);
     if (res) return res;
 
-- 
2.0.4



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

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

* [PATCH 13/14] libxl/arm: initialize memory information of ACPI blob
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (11 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 12/14] libxl/arm: Add ACPI module Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:43 ` [PATCH 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space Shannon Zhao
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Assign the guest memory space for ACPI tables and replace the reg in DT
with real values.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxc/xc_dom_arm.c | 16 +++++++++++++++-
 tools/libxl/libxl_arm.c  | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 64a8b67..e21e3e9 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -383,9 +383,11 @@ static int meminit(struct xc_dom_image *dom)
     const uint64_t kernsize = kernend - kernbase;
     const uint64_t dtb_size = dom->devicetree_blob ?
         ROUNDUP(dom->devicetree_size, XC_PAGE_SHIFT) : 0;
+    const uint64_t acpi_size = dom->acpitable_blob ?
+        ROUNDUP(dom->acpitable_size, XC_PAGE_SHIFT) : 0;
     const uint64_t ramdisk_size = dom->ramdisk_blob ?
         ROUNDUP(dom->ramdisk_size, XC_PAGE_SHIFT) : 0;
-    const uint64_t modsize = dtb_size + ramdisk_size;
+    const uint64_t modsize = dtb_size + acpi_size + ramdisk_size;
     const uint64_t ram128mb = bankbase[0] + (128<<20);
 
     xen_pfn_t p2m_size;
@@ -500,6 +502,18 @@ static int meminit(struct xc_dom_image *dom)
         modbase += dtb_size;
     }
 
+    if ( acpi_size )
+    {
+        dom->acpi_seg.vstart = modbase;
+        dom->acpi_seg.vend = modbase + acpi_size;
+
+        DOMPRINTF("%s: acpi: 0x%" PRIx64 " -> 0x%" PRIx64 "",
+                  __FUNCTION__,
+                  dom->acpi_seg.vstart, dom->acpi_seg.vend);
+
+        modbase += dtb_size;
+    }
+
     return 0;
 }
 
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index e7cb578..bf1eeea 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -230,6 +230,27 @@ static int fdt_property_regs(libxl__gc *gc, void *fdt,
     return fdt_property(fdt, "reg", regs, sizeof(regs));
 }
 
+static int fdt_property_inplace_regs(void *fdt, int nodeoffset,
+                                     unsigned addr_cells, unsigned size_cells,
+                                     unsigned num_regs, ...)
+{
+    uint32_t regs[num_regs*(addr_cells+size_cells)];
+    be32 *cells = &regs[0];
+    int i;
+    va_list ap;
+    uint64_t base, size;
+
+    va_start(ap, num_regs);
+    for (i = 0 ; i < num_regs; i++) {
+        base = addr_cells ? va_arg(ap, uint64_t) : 0;
+        size = size_cells ? va_arg(ap, uint64_t) : 0;
+        set_range(&cells, addr_cells, size_cells, base, size);
+    }
+    va_end(ap);
+
+    return fdt_setprop_inplace(fdt, nodeoffset, "reg", regs, sizeof(regs));
+}
+
 static int make_root_properties(libxl__gc *gc,
                                 const libxl_version_info *vers,
                                 void *fdt)
@@ -1209,6 +1230,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
 
     const struct xc_dom_seg *ramdisk = dom->ramdisk_blob ?
         &dom->ramdisk_seg : NULL;
+    const struct xc_dom_seg *acpi = dom->acpitable_blob ?
+        &dom->acpi_seg : NULL;
 
     if (ramdisk) {
         int chosen, res;
@@ -1238,6 +1261,23 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
 
     }
 
+    if (acpi)
+    {
+        int module, res;
+
+        module = fdt_path_offset(fdt, "/chosen/modules/module@0");
+        assert(module > 0);
+
+        LOG(DEBUG, "/chosen/modules/module@0 updating acpi properties to cover "
+            "%"PRIx64"-%"PRIx64,
+            acpi->vstart, acpi->vend);
+
+        res = fdt_property_inplace_regs(fdt, module, ROOT_ADDRESS_CELLS,
+                                        ROOT_SIZE_CELLS, 1, acpi->vstart,
+                                        acpi->vend - acpi->vstart + 1);
+        assert(!res);
+    }
+
     for (i = 0; i < GUEST_RAM_BANKS; i++) {
         const uint64_t size = (uint64_t)dom->rambank_size[i] << XC_PAGE_SHIFT;
 
-- 
2.0.4



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

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

* [PATCH 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (12 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 13/14] libxl/arm: initialize memory information of ACPI blob Shannon Zhao
@ 2016-05-31  4:43 ` Shannon Zhao
  2016-05-31  4:56 ` [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
  2016-05-31 19:42 ` Konrad Rzeszutek Wilk
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:43 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, ian.jackson, peter.huangpeng, julien.grall,
	shannon.zhao, wei.liu2

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

Copy all the ACPI tables to guest memory space and also initialize the
address of the tables.

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

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 55c779d..6d91a46 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -33,6 +33,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "acpi_defs.h"
 
 /* ------------------------------------------------------------------------ */
 /* debugging                                                                */
@@ -1096,6 +1097,64 @@ int xc_dom_build_image(struct xc_dom_image *dom)
         memcpy(devicetreemap, dom->devicetree_blob, dom->devicetree_size);
     }
 
+    /* load ACPI tables */
+    if ( dom->acpitable_blob )
+    {
+        void *acpitablemap;
+        uint64_t start = dom->acpi_seg.vstart;
+        struct acpi_xsdt_descriptor *xsdt;
+        struct acpi_rsdp_descriptor *rsdp;
+        struct acpi_fadt_descriptor *fadt;
+
+        if ( xc_dom_alloc_segment(dom, &dom->acpi_seg, "acpitable",
+                                  start, dom->acpitable_size) != 0 )
+            goto err;
+
+        acpitablemap = xc_dom_seg_to_ptr(dom, &dom->acpi_seg);
+        if ( acpitablemap == NULL )
+        {
+            DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->acpi_seg) => NULL",
+                      __FUNCTION__);
+            goto err;
+        }
+
+        rsdp = (struct acpi_rsdp_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->rsdp.table,
+               dom->acpitable_blob->rsdp.size);
+        start += dom->acpitable_blob->rsdp.size;
+        acpitablemap += dom->acpitable_blob->rsdp.size;
+
+        xsdt = (struct acpi_xsdt_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->xsdt.table,
+               dom->acpitable_blob->xsdt.size);
+        rsdp->xsdt_physical_address = start;
+        start += dom->acpitable_blob->xsdt.size;
+        acpitablemap += dom->acpitable_blob->xsdt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->madt.table,
+               dom->acpitable_blob->madt.size);
+        xsdt->entry[0] = start;
+        start += dom->acpitable_blob->madt.size;
+        acpitablemap += dom->acpitable_blob->madt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->gtdt.table,
+               dom->acpitable_blob->gtdt.size);
+        xsdt->entry[1] = start;
+        start += dom->acpitable_blob->gtdt.size;
+        acpitablemap += dom->acpitable_blob->gtdt.size;
+
+        fadt = (struct acpi_fadt_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->fadt.table,
+               dom->acpitable_blob->fadt.size);
+        xsdt->entry[2] = start;
+        start += dom->acpitable_blob->fadt.size;
+        acpitablemap += dom->acpitable_blob->fadt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->dsdt.table,
+               dom->acpitable_blob->dsdt.size);
+        fadt->dsdt = start;
+    }
+
     /* allocate other pages */
     if ( !dom->arch_hooks->p2m_base_supported ||
          dom->parms.p2m_base >= dom->parms.virt_base ||
-- 
2.0.4



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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (13 preceding siblings ...)
  2016-05-31  4:43 ` [PATCH 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space Shannon Zhao
@ 2016-05-31  4:56 ` Shannon Zhao
  2016-05-31 19:42 ` Konrad Rzeszutek Wilk
  15 siblings, 0 replies; 26+ messages in thread
From: Shannon Zhao @ 2016-05-31  4:56 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, julien.grall, sstabellini, ian.jackson, shannon.zhao

Sorry, I Cc'ed the wrong email address of Wei Liu. I'll resend these
patches. Please ignore these ones.

On 2016/5/31 12:43, 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 memory 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:
> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
> 
> Shannon Zhao (14):
>   libxl/arm: Fix the function name in error log
>   libxl/arm: Factor out codes for generating DTB
>   libxc: Add placeholders for ACPI tables blob and size
>   tools: add ACPI tables relevant definitions
>   libxl/arm: Construct ACPI GTDT table
>   libxl/arm: Construct ACPI FADT table
>   libxl/arm: Construct ACPI DSDT table
>   libxl/arm: Construct ACPI MADT table
>   libxl/arm: Construct ACPI XSDT table
>   libxl/arm: Construct ACPI RSDP table
>   libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
>   libxl/arm: Add ACPI module
>   libxl/arm: initialize memory information of ACPI blob
>   libxc/xc_dom_core: Copy ACPI tables to guest memory space
> 
>  tools/libxc/include/acpi_defs.h | 277 ++++++++++++++++++++++++++++++++
>  tools/libxc/include/xc_dom.h    |  17 ++
>  tools/libxc/xc_dom_arm.c        |  16 +-
>  tools/libxc/xc_dom_core.c       |  59 +++++++
>  tools/libxl/libxl_arm.c         | 345 +++++++++++++++++++++++++++++++++++++++-
>  5 files changed, 706 insertions(+), 8 deletions(-)
>  create mode 100644 tools/libxc/include/acpi_defs.h
> 

-- 
Shannon


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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
                   ` (14 preceding siblings ...)
  2016-05-31  4:56 ` [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
@ 2016-05-31 19:42 ` Konrad Rzeszutek Wilk
  2016-05-31 20:51   ` Boris Ostrovsky
  15 siblings, 1 reply; 26+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-05-31 19:42 UTC (permalink / raw)
  To: Shannon Zhao, boris.ostrovsky
  Cc: sstabellini, ian.jackson, peter.huangpeng, xen-devel,
	julien.grall, shannon.zhao, wei.liu2

On Tue, May 31, 2016 at 12:43:22PM +0800, 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.

CC-ing Boris - who has been working on exposing ACPI tables
for PVH guests.

Is there some way of re-using some of the code? 
> 
> Then, it copies these ACPI tables to DomU memory 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:
> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
> 
> Shannon Zhao (14):
>   libxl/arm: Fix the function name in error log
>   libxl/arm: Factor out codes for generating DTB
>   libxc: Add placeholders for ACPI tables blob and size
>   tools: add ACPI tables relevant definitions
>   libxl/arm: Construct ACPI GTDT table
>   libxl/arm: Construct ACPI FADT table
>   libxl/arm: Construct ACPI DSDT table
>   libxl/arm: Construct ACPI MADT table
>   libxl/arm: Construct ACPI XSDT table
>   libxl/arm: Construct ACPI RSDP table
>   libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
>   libxl/arm: Add ACPI module
>   libxl/arm: initialize memory information of ACPI blob
>   libxc/xc_dom_core: Copy ACPI tables to guest memory space
> 
>  tools/libxc/include/acpi_defs.h | 277 ++++++++++++++++++++++++++++++++
>  tools/libxc/include/xc_dom.h    |  17 ++
>  tools/libxc/xc_dom_arm.c        |  16 +-
>  tools/libxc/xc_dom_core.c       |  59 +++++++
>  tools/libxl/libxl_arm.c         | 345 +++++++++++++++++++++++++++++++++++++++-
>  5 files changed, 706 insertions(+), 8 deletions(-)
>  create mode 100644 tools/libxc/include/acpi_defs.h
> 
> -- 
> 2.0.4
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-05-31 19:42 ` Konrad Rzeszutek Wilk
@ 2016-05-31 20:51   ` Boris Ostrovsky
  2016-06-01 12:42     ` Julien Grall
  0 siblings, 1 reply; 26+ messages in thread
From: Boris Ostrovsky @ 2016-05-31 20:51 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, Jan Beulich, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, julien.grall, shannon.zhao, wei.liu2,
	Roger Pau Monné

On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
> CC-ing Boris - who has been working on exposing ACPI tables
> for PVH guests.
>
> Is there some way of re-using some of the code? 

Indeed it would be good to keep all ACPI code in single place.

I sent a patch series a while ago
(http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
but because of release work it hasn't been reviewed yet. Shannon, can
you take a look at it and see whether you code can make use of what is
proposed there? It builds all the tables that you are building here
except for GTDT and provides libxc interface.

(Copying Roger, Andrew and Jan)

-boris


>> Then, it copies these ACPI tables to DomU memory 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:
>> https://git.kernel.org/cgit/linux/kernel/git/mfleming/efi.git/log/?h=efi/arm-xen
>>
>> Shannon Zhao (14):
>>   libxl/arm: Fix the function name in error log
>>   libxl/arm: Factor out codes for generating DTB
>>   libxc: Add placeholders for ACPI tables blob and size
>>   tools: add ACPI tables relevant definitions
>>   libxl/arm: Construct ACPI GTDT table
>>   libxl/arm: Construct ACPI FADT table
>>   libxl/arm: Construct ACPI DSDT table
>>   libxl/arm: Construct ACPI MADT table
>>   libxl/arm: Construct ACPI XSDT table
>>   libxl/arm: Construct ACPI RSDP table
>>   libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ
>>   libxl/arm: Add ACPI module
>>   libxl/arm: initialize memory information of ACPI blob
>>   libxc/xc_dom_core: Copy ACPI tables to guest memory space
>>
>>  tools/libxc/include/acpi_defs.h | 277 ++++++++++++++++++++++++++++++++
>>  tools/libxc/include/xc_dom.h    |  17 ++
>>  tools/libxc/xc_dom_arm.c        |  16 +-
>>  tools/libxc/xc_dom_core.c       |  59 +++++++
>>  tools/libxl/libxl_arm.c         | 345 +++++++++++++++++++++++++++++++++++++++-
>>  5 files changed, 706 insertions(+), 8 deletions(-)
>>  create mode 100644 tools/libxc/include/acpi_defs.h
>>
>> -- 
>> 2.0.4
>>
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel



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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-05-31 20:51   ` Boris Ostrovsky
@ 2016-06-01 12:42     ` Julien Grall
  2016-06-01 12:59       ` Boris Ostrovsky
  0 siblings, 1 reply; 26+ messages in thread
From: Julien Grall @ 2016-06-01 12:42 UTC (permalink / raw)
  To: Boris Ostrovsky, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, shannon.zhao, Jan Beulich,
	Roger Pau Monné

Hi Boris,

On 31/05/16 21:51, Boris Ostrovsky wrote:
> On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
>> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
>> CC-ing Boris - who has been working on exposing ACPI tables
>> for PVH guests.
>>
>> Is there some way of re-using some of the code?
>
> Indeed it would be good to keep all ACPI code in single place.
>
> I sent a patch series a while ago
> (http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
> but because of release work it hasn't been reviewed yet. Shannon, can
> you take a look at it and see whether you code can make use of what is
> proposed there? It builds all the tables that you are building here
> except for GTDT and provides libxc interface.

AFAICT, your library is creating ACPI 1.0/2.0 tables. However the 
support for ARM has been added in ACPI 5.1.

Looking at the list of tables built by the library, we might be able to 
re-use the code for SRAT, SLIT, FADT, RSDP. The rest is x86 specific 
(WAET, MADT, HPET, SSDT_{PM,S3,S4}, TCPA (?)).

In the current state, I think the benefits for ARM is very limited. I 
agree that having a common library to manipulate ACPI would be nice, 
however, this would need a better abstraction to support different 
version and avoid to build unnecessary code.

Regards,

-- 
Julien Grall

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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 12:42     ` Julien Grall
@ 2016-06-01 12:59       ` Boris Ostrovsky
  2016-06-01 13:21         ` Julien Grall
  0 siblings, 1 reply; 26+ messages in thread
From: Boris Ostrovsky @ 2016-06-01 12:59 UTC (permalink / raw)
  To: Julien Grall, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, shannon.zhao, Jan Beulich,
	Roger Pau Monné

On 06/01/2016 08:42 AM, Julien Grall wrote:
> Hi Boris,
>
> On 31/05/16 21:51, Boris Ostrovsky wrote:
>> On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
>>> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
>>> CC-ing Boris - who has been working on exposing ACPI tables
>>> for PVH guests.
>>>
>>> Is there some way of re-using some of the code?
>>
>> Indeed it would be good to keep all ACPI code in single place.
>>
>> I sent a patch series a while ago
>> (http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
>>
>> but because of release work it hasn't been reviewed yet. Shannon, can
>> you take a look at it and see whether you code can make use of what is
>> proposed there? It builds all the tables that you are building here
>> except for GTDT and provides libxc interface.
>
> AFAICT, your library is creating ACPI 1.0/2.0 tables. However the
> support for ARM has been added in ACPI 5.1.
>
> Looking at the list of tables built by the library, we might be able
> to re-use the code for SRAT, SLIT, FADT, RSDP. The rest is x86
> specific (WAET, MADT, HPET, SSDT_{PM,S3,S4}, TCPA (?)).

The interface allows choosing which tables to generate so that shouldn't
be a problem.

>
> In the current state, I think the benefits for ARM is very limited. I
> agree that having a common library to manipulate ACPI would be nice,
> however, this would need a better abstraction to support different
> version and avoid to build unnecessary code.
>

Can you suggest improvements to that series so that (even if not now but
at some point later) it is easier to integrate ARM and x86? Again, this
code is an RFC so now is the time to do it right.

-boris
> Regards,
>


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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 12:59       ` Boris Ostrovsky
@ 2016-06-01 13:21         ` Julien Grall
  2016-06-01 13:39           ` Boris Ostrovsky
  2016-06-01 13:53           ` Shannon Zhao
  0 siblings, 2 replies; 26+ messages in thread
From: Julien Grall @ 2016-06-01 13:21 UTC (permalink / raw)
  To: Boris Ostrovsky, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, shannon.zhao, Jan Beulich,
	Roger Pau Monné



On 01/06/16 13:59, Boris Ostrovsky wrote:
> On 06/01/2016 08:42 AM, Julien Grall wrote:
>> On 31/05/16 21:51, Boris Ostrovsky wrote:
>>> On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
>>>> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
>>>> CC-ing Boris - who has been working on exposing ACPI tables
>>>> for PVH guests.
>>>>
>>>> Is there some way of re-using some of the code?
>>>
>>> Indeed it would be good to keep all ACPI code in single place.
>>>
>>> I sent a patch series a while ago
>>> (http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
>>>
>>> but because of release work it hasn't been reviewed yet. Shannon, can
>>> you take a look at it and see whether you code can make use of what is
>>> proposed there? It builds all the tables that you are building here
>>> except for GTDT and provides libxc interface.
>>
>> AFAICT, your library is creating ACPI 1.0/2.0 tables. However the
>> support for ARM has been added in ACPI 5.1.
>>
>> Looking at the list of tables built by the library, we might be able
>> to re-use the code for SRAT, SLIT, FADT, RSDP. The rest is x86
>> specific (WAET, MADT, HPET, SSDT_{PM,S3,S4}, TCPA (?)).
>
> The interface allows choosing which tables to generate so that shouldn't
> be a problem.

Would it be possible to opt-out some of the tables at built-time. Maybe 
by moving the code in separate files?

>>
>> In the current state, I think the benefits for ARM is very limited. I
>> agree that having a common library to manipulate ACPI would be nice,
>> however, this would need a better abstraction to support different
>> version and avoid to build unnecessary code.
>>
>
> Can you suggest improvements to that series so that (even if not now but
> at some point later) it is easier to integrate ARM and x86? Again, this
> code is an RFC so now is the time to do it right.

I agree :). I think the 2 points that would make easier to integrate ARM 
are:
    - Newer version of ACPI (I know that you need to keep ACPI 1.0/2.0 
for some old guests).
    - Possibility to have per-arch tables and fields. For instance the 
MADT will be different for ARM. Also, some fields in the FADT are ARM 
specific (see arm_boot_flags).

I have not yet review this series, so it is my best guess. Shannon, any 
opinions?

Regards,

-- 
Julien Grall

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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 13:21         ` Julien Grall
@ 2016-06-01 13:39           ` Boris Ostrovsky
  2016-06-01 13:53           ` Shannon Zhao
  1 sibling, 0 replies; 26+ messages in thread
From: Boris Ostrovsky @ 2016-06-01 13:39 UTC (permalink / raw)
  To: Julien Grall, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, shannon.zhao, Jan Beulich,
	Roger Pau Monné

On 06/01/2016 09:21 AM, Julien Grall wrote:
>
>
> On 01/06/16 13:59, Boris Ostrovsky wrote:
>> On 06/01/2016 08:42 AM, Julien Grall wrote:
>>> On 31/05/16 21:51, Boris Ostrovsky wrote:
>>>> On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
>>>>> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
>>>>> CC-ing Boris - who has been working on exposing ACPI tables
>>>>> for PVH guests.
>>>>>
>>>>> Is there some way of re-using some of the code?
>>>>
>>>> Indeed it would be good to keep all ACPI code in single place.
>>>>
>>>> I sent a patch series a while ago
>>>> (http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
>>>>
>>>>
>>>> but because of release work it hasn't been reviewed yet. Shannon, can
>>>> you take a look at it and see whether you code can make use of what is
>>>> proposed there? It builds all the tables that you are building here
>>>> except for GTDT and provides libxc interface.
>>>
>>> AFAICT, your library is creating ACPI 1.0/2.0 tables. However the
>>> support for ARM has been added in ACPI 5.1.
>>>
>>> Looking at the list of tables built by the library, we might be able
>>> to re-use the code for SRAT, SLIT, FADT, RSDP. The rest is x86
>>> specific (WAET, MADT, HPET, SSDT_{PM,S3,S4}, TCPA (?)).
>>
>> The interface allows choosing which tables to generate so that shouldn't
>> be a problem.
>
> Would it be possible to opt-out some of the tables at built-time.
> Maybe by moving the code in separate files?

You mean per-arch (like what you are saying below)? Sure, if we can
identify which tables the we can split them into separate files.

-boris

>
>>>
>>> In the current state, I think the benefits for ARM is very limited. I
>>> agree that having a common library to manipulate ACPI would be nice,
>>> however, this would need a better abstraction to support different
>>> version and avoid to build unnecessary code.
>>>
>>
>> Can you suggest improvements to that series so that (even if not now but
>> at some point later) it is easier to integrate ARM and x86? Again, this
>> code is an RFC so now is the time to do it right.
>
> I agree :). I think the 2 points that would make easier to integrate
> ARM are:
>    - Newer version of ACPI (I know that you need to keep ACPI 1.0/2.0
> for some old guests).
>    - Possibility to have per-arch tables and fields. For instance the
> MADT will be different for ARM. Also, some fields in the FADT are ARM
> specific (see arm_boot_flags).
>
> I have not yet review this series, so it is my best guess. Shannon,
> any opinions?
>
> Regards,
>



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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 13:21         ` Julien Grall
  2016-06-01 13:39           ` Boris Ostrovsky
@ 2016-06-01 13:53           ` Shannon Zhao
  2016-06-01 14:36             ` Boris Ostrovsky
  1 sibling, 1 reply; 26+ messages in thread
From: Shannon Zhao @ 2016-06-01 13:53 UTC (permalink / raw)
  To: Julien Grall, Boris Ostrovsky, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, Jan Beulich, Roger Pau Monné

On 2016年06月01日 21:21, Julien Grall wrote:
> 
> 
> On 01/06/16 13:59, Boris Ostrovsky wrote:
>> On 06/01/2016 08:42 AM, Julien Grall wrote:
>>> On 31/05/16 21:51, Boris Ostrovsky wrote:
>>>> On 05/31/2016 03:42 PM, Konrad Rzeszutek Wilk wrote:
>>>>> On Tue, May 31, 2016 at 12:43:22PM +0800, 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.
>>>>> CC-ing Boris - who has been working on exposing ACPI tables
>>>>> for PVH guests.
>>>>>
>>>>> Is there some way of re-using some of the code?
>>>>
>>>> Indeed it would be good to keep all ACPI code in single place.
>>>>
>>>> I sent a patch series a while ago
>>>> (http://lists.xenproject.org/archives/html/xen-devel/2016-04/msg00625.html)
>>>>
>>>>
>>>> but because of release work it hasn't been reviewed yet. Shannon, can
>>>> you take a look at it and see whether you code can make use of what is
>>>> proposed there? It builds all the tables that you are building here
>>>> except for GTDT and provides libxc interface.
>>>
>>> AFAICT, your library is creating ACPI 1.0/2.0 tables. However the
>>> support for ARM has been added in ACPI 5.1.
>>>
>>> Looking at the list of tables built by the library, we might be able
>>> to re-use the code for SRAT, SLIT, FADT, RSDP. The rest is x86
>>> specific (WAET, MADT, HPET, SSDT_{PM,S3,S4}, TCPA (?)).
>>
>> The interface allows choosing which tables to generate so that shouldn't
>> be a problem.
> 
> Would it be possible to opt-out some of the tables at built-time. Maybe
> by moving the code in separate files?
> 
>>>
>>> In the current state, I think the benefits for ARM is very limited. I
>>> agree that having a common library to manipulate ACPI would be nice,
>>> however, this would need a better abstraction to support different
>>> version and avoid to build unnecessary code.
>>>
>>
>> Can you suggest improvements to that series so that (even if not now but
>> at some point later) it is easier to integrate ARM and x86? Again, this
>> code is an RFC so now is the time to do it right.
> 
> I agree :). I think the 2 points that would make easier to integrate ARM
> are:
>    - Newer version of ACPI (I know that you need to keep ACPI 1.0/2.0
> for some old guests).
>    - Possibility to have per-arch tables and fields. For instance the
> MADT will be different for ARM. Also, some fields in the FADT are ARM
> specific (see arm_boot_flags).
> 
> I have not yet review this series, so it is my best guess. Shannon, any
> opinions?
Actually I think there are two tables can be reused: RSDP and XSDT(while
which are smaller codes, I don't think it needs to be mixed with
others). The other tables are arch specific because the contents are
totally different. So if we want to add some generic generating table
funtions, we might pass a lot of arch specific information to these
functions which looks like inconvenient and ugly.
And this situation for x86 and ARM is similar with QEMU. You can have a
look at hw/arm/virt-acpi-build.c and hw/i386/acpi-build.c in QEMU source
code. The two only reuse the build_rsdt() function.

Thanks,
-- 
Shannon

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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 13:53           ` Shannon Zhao
@ 2016-06-01 14:36             ` Boris Ostrovsky
  2016-06-01 14:56               ` Shannon Zhao
  0 siblings, 1 reply; 26+ messages in thread
From: Boris Ostrovsky @ 2016-06-01 14:36 UTC (permalink / raw)
  To: Shannon Zhao, Julien Grall, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, Jan Beulich, Roger Pau Monné

On 06/01/2016 09:53 AM, Shannon Zhao wrote:
>
> Actually I think there are two tables can be reused: RSDP and XSDT(while
> which are smaller codes, I don't think it needs to be mixed with
> others). The other tables are arch specific because the contents are
> totally different. So if we want to add some generic generating table
> funtions, we might pass a lot of arch specific information to these
> functions which looks like inconvenient and ugly.
> And this situation for x86 and ARM is similar with QEMU. You can have a
> look at hw/arm/virt-acpi-build.c and hw/i386/acpi-build.c in QEMU source
> code. The two only reuse the build_rsdt() function.

Are these differences due to architecture or ACPI version? I can see
that ARM uses 5.1 at least but not sure about i386.

-boris


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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 14:36             ` Boris Ostrovsky
@ 2016-06-01 14:56               ` Shannon Zhao
  2016-06-01 15:05                 ` Julien Grall
  0 siblings, 1 reply; 26+ messages in thread
From: Shannon Zhao @ 2016-06-01 14:56 UTC (permalink / raw)
  To: Boris Ostrovsky, Julien Grall, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, Jan Beulich, Roger Pau Monné

On 2016年06月01日 22:36, Boris Ostrovsky wrote:
> On 06/01/2016 09:53 AM, Shannon Zhao wrote:
>> >
>> > Actually I think there are two tables can be reused: RSDP and XSDT(while
>> > which are smaller codes, I don't think it needs to be mixed with
>> > others). The other tables are arch specific because the contents are
>> > totally different. So if we want to add some generic generating table
>> > funtions, we might pass a lot of arch specific information to these
>> > functions which looks like inconvenient and ugly.
>> > And this situation for x86 and ARM is similar with QEMU. You can have a
>> > look at hw/arm/virt-acpi-build.c and hw/i386/acpi-build.c in QEMU source
>> > code. The two only reuse the build_rsdt() function.
> Are these differences due to architecture or ACPI version? I can see
> that ARM uses 5.1 at least but not sure about i386.
Yes, ARM uses 5.1+.

-- 
Shannon

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

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

* Re: [PATCH 00/14] Xen ARM DomU ACPI support
  2016-06-01 14:56               ` Shannon Zhao
@ 2016-06-01 15:05                 ` Julien Grall
  0 siblings, 0 replies; 26+ messages in thread
From: Julien Grall @ 2016-06-01 15:05 UTC (permalink / raw)
  To: Shannon Zhao, Boris Ostrovsky, Konrad Rzeszutek Wilk, Shannon Zhao
  Cc: sstabellini, wei.liu2, Andrew Cooper, ian.jackson,
	peter.huangpeng, xen-devel, Jan Beulich, Roger Pau Monné



On 01/06/16 15:56, Shannon Zhao wrote:
> On 2016年06月01日 22:36, Boris Ostrovsky wrote:
>> On 06/01/2016 09:53 AM, Shannon Zhao wrote:
>>>>
>>>> Actually I think there are two tables can be reused: RSDP and XSDT(while
>>>> which are smaller codes, I don't think it needs to be mixed with
>>>> others). The other tables are arch specific because the contents are
>>>> totally different. So if we want to add some generic generating table
>>>> funtions, we might pass a lot of arch specific information to these
>>>> functions which looks like inconvenient and ugly.
>>>> And this situation for x86 and ARM is similar with QEMU. You can have a
>>>> look at hw/arm/virt-acpi-build.c and hw/i386/acpi-build.c in QEMU source
>>>> code. The two only reuse the build_rsdt() function.
>> Are these differences due to architecture or ACPI version? I can see
>> that ARM uses 5.1 at least but not sure about i386.

I think i386 is using ACPI v1.0. They are using AcpiFadtDescriptorRev1 
whilst ARM is using ACPIFadtDescriptorRes5_1.

The difference between the version can be found in hw/acpi/acpi-defs.h

Regards,

-- 
Julien Grall

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

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

end of thread, other threads:[~2016-06-01 15:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
2016-05-31  4:43 ` [PATCH 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
2016-05-31  4:43 ` [PATCH 02/14] libxl/arm: Factor out codes for generating DTB Shannon Zhao
2016-05-31  4:43 ` [PATCH 03/14] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
2016-05-31  4:43 ` [PATCH 04/14] tools: add ACPI tables relevant definitions Shannon Zhao
2016-05-31  4:43 ` [PATCH 05/14] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 06/14] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 07/14] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 08/14] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 09/14] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 10/14] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-05-31  4:43 ` [PATCH 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-05-31  4:43 ` [PATCH 12/14] libxl/arm: Add ACPI module Shannon Zhao
2016-05-31  4:43 ` [PATCH 13/14] libxl/arm: initialize memory information of ACPI blob Shannon Zhao
2016-05-31  4:43 ` [PATCH 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space Shannon Zhao
2016-05-31  4:56 ` [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
2016-05-31 19:42 ` Konrad Rzeszutek Wilk
2016-05-31 20:51   ` Boris Ostrovsky
2016-06-01 12:42     ` Julien Grall
2016-06-01 12:59       ` Boris Ostrovsky
2016-06-01 13:21         ` Julien Grall
2016-06-01 13:39           ` Boris Ostrovsky
2016-06-01 13:53           ` Shannon Zhao
2016-06-01 14:36             ` Boris Ostrovsky
2016-06-01 14:56               ` Shannon Zhao
2016-06-01 15:05                 ` Julien Grall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).