Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315506 > unrolled thread

[PATCH v3 00/17] Add ACPI support for Xen Dom0 on ARM64

Started byShannon Zhao <zhaoshenglong@huawei.com>
First post2016-01-23 04:30 +0100
Last post2016-01-25 13:30 +0100
Articles 13 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 00/17] Add ACPI support for Xen Dom0 on ARM64 Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-23 04:30 +0100
    [PATCH v3 04/17] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-23 04:30 +0100
    [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-23 04:30 +0100
      Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture  directory Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-25 17:50 +0100
        Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture  directory Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-26 09:20 +0100
          Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture  directory Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-26 12:40 +0100
            Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture  directory Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-26 13:30 +0100
    [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-23 04:30 +0100
      Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM  virtual platforms Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-25 17:00 +0100
        Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM  virtual platforms Mark Rutland <mark.rutland@arm.com> - 2016-01-25 17:10 +0100
          Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM  virtual platforms Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-25 17:10 +0100
    [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-23 04:30 +0100
      Re: [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-25 13:30 +0100

#1315506 — [PATCH v3 00/17] Add ACPI support for Xen Dom0 on ARM64

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-23 04:30 +0100
Subject[PATCH v3 00/17] Add ACPI support for Xen Dom0 on ARM64
Message-ID<qTX3H-5bz-3@gated-at.bofh.it>
From: Shannon Zhao <shannon.zhao@linaro.org>

This patch set adds ACPI support for Xen Dom0 on ARM64. The relevant Xen
ACPI on ARM64 design document could be found from [1].

This patch set adds a new FDT node "uefi" under /hypervisor to pass UEFI
information. Introduce a bus notifier of AMBA and Platform bus to map
the new added device's MMIO space. Make Xen domain use
xlated_setup_gnttab_pages to setup grant table and a new hypercall to
get event-channel irq.

Regarding the initialization flow of Linux kernel, it needs to move
xen_early_init() before efi_init(). Then xen_early_init() will check
whether it runs on Xen through the /hypervisor node and efi_init() will
call a new function fdt_find_xen_uefi_params(), to parse those
xen,uefi-* parameters just like the existing efi_get_fdt_params().

And in arm64_enable_runtime_services() it will check whether it runs on
Xen and call another new function xen_efi_runtime_setup() to setup
runtime service instead of efi_native_runtime_setup(). The
xen_efi_runtime_setup() will assign the runtime function pointers with
the functions of driver/xen/efi.c.

And since we pass a /hypervisor node and a /chosen node to Dom0, it
needs to check whether the DTS only contains a /hypervisor node and a
/chosen node in acpi_boot_table_init().

Patches are tested on FVP base model. The corresponding Xen patches can
be fetched from [2].

Thanks,
Shannon

[1] http://lists.xen.org/archives/html/xen-devel/2015-11/msg00488.html
[2] http://git.linaro.org/people/shannon.zhao/xen.git  ACPI_XEN_ARM_V3

Changes since v2:
* Use 0 to check if it should ignore the UART
* Fix the use of page_to_xen_pfn
* Factor ACPI and DT parts in xen_guest_init
* Check "uefi" node by full path
* Fix the statement of Documentation/devicetree/bindings/arm/xen.txt

Changes since v1:
* Rebase on linux mainline and wallclock patch from Stefano
* Refactor AMBA and platform device MMIO map to one file
* Use EFI_PARAVIRT to check if it supports XEN EFI
* Refactor Xen EFI codes
* Address other comments

Shannon Zhao (17):
  Xen: ACPI: Hide UART used by Xen
  xen/grant-table: Move xlated_setup_gnttab_pages to common place
  Xen: xlate: Use page_to_xen_pfn instead of page_to_pfn
  arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table
  xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio
  Xen: ARM: Add support for mapping platform device mmio
  Xen: ARM: Add support for mapping AMBA device mmio
  Xen: public/hvm: sync changes of HVM_PARAM_CALLBACK_VIA ABI from Xen
  xen/hvm/params: Add a new delivery type for event-channel in
    HVM_PARAM_CALLBACK_IRQ
  arm/xen: Get event-channel irq through HVM_PARAM when booting with
    ACPI
  ARM: XEN: Move xen_early_init() before efi_init()
  ARM64: ACPI: Check if it runs on Xen to enable or disable ACPI
  ARM: Xen: Document UEFI support on Xen ARM virtual platforms
  XEN: EFI: Move x86 specific codes to architecture directory
  ARM64: XEN: Add a function to initialize Xen specific UEFI runtime
    services
  FDT: Add a helper to get specified name subnode
  Xen: EFI: Parse DT parameters for Xen specific UEFI

 Documentation/devicetree/bindings/arm/xen.txt |  34 +++++
 arch/arm/xen/enlighten.c                      | 109 +++++++++++----
 arch/arm64/include/asm/xen/xen-ops.h          |   6 +
 arch/arm64/kernel/acpi.c                      |  12 +-
 arch/arm64/kernel/efi.c                       |  17 ++-
 arch/arm64/kernel/setup.c                     |   2 +-
 arch/arm64/xen/Makefile                       |   1 +
 arch/arm64/xen/efi.c                          |  40 ++++++
 arch/x86/xen/efi.c                            | 112 ++++++++++++++++
 arch/x86/xen/grant-table.c                    |  57 +-------
 drivers/acpi/bus.c                            |  36 ++++-
 drivers/firmware/efi/efi.c                    |  45 ++++++-
 drivers/of/fdt.c                              |  35 +++++
 drivers/xen/Kconfig                           |   2 +-
 drivers/xen/Makefile                          |   1 +
 drivers/xen/arm-device.c                      | 184 ++++++++++++++++++++++++++
 drivers/xen/efi.c                             | 174 +++++-------------------
 drivers/xen/xlate_mmu.c                       |  67 ++++++++++
 include/linux/of_fdt.h                        |   2 +
 include/xen/interface/hvm/params.h            |  36 ++++-
 include/xen/interface/memory.h                |   1 +
 include/xen/xen-ops.h                         |  32 +++--
 22 files changed, 757 insertions(+), 248 deletions(-)
 create mode 100644 arch/arm64/include/asm/xen/xen-ops.h
 create mode 100644 arch/arm64/xen/efi.c
 create mode 100644 drivers/xen/arm-device.c

-- 
2.0.4

[toc] | [next] | [standalone]


#1315507 — [PATCH v3 04/17] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-23 04:30 +0100
Subject[PATCH v3 04/17] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table
Message-ID<qTX3J-5bz-37@gated-at.bofh.it>
In reply to#1315506
From: Shannon Zhao <shannon.zhao@linaro.org>

Use xen_xlate_map_ballooned_pages to setup grant table. Then it doesn't
rely on DT or ACPI to pass the start address and size of grant table.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/enlighten.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index afe6175..6d90a62 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -266,18 +266,10 @@ static int __init xen_guest_init(void)
 {
 	struct xen_add_to_physmap xatp;
 	struct shared_info *shared_info_page = NULL;
-	struct resource res;
-	phys_addr_t grant_frames;
 
 	if (!xen_domain())
 		return 0;
 
-	if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
-		pr_err("Xen grant table base address not found\n");
-		return -ENODEV;
-	}
-	grant_frames = res.start;
-
 	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
 	if (!xen_events_irq) {
 		pr_err("Xen event channel interrupt not found\n");
@@ -312,7 +304,10 @@ static int __init xen_guest_init(void)
 	if (xen_vcpu_info == NULL)
 		return -ENOMEM;
 
-	if (gnttab_setup_auto_xlat_frames(grant_frames)) {
+	xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames();
+	if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn,
+					  &xen_auto_xlat_grant_frames.vaddr,
+					  xen_auto_xlat_grant_frames.count)) {
 		free_percpu(xen_vcpu_info);
 		return -ENOMEM;
 	}
-- 
2.0.4

[toc] | [prev] | [next] | [standalone]


#1315508 — [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-23 04:30 +0100
Subject[PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory
Message-ID<qTX3J-5bz-33@gated-at.bofh.it>
In reply to#1315506
From: Shannon Zhao <shannon.zhao@linaro.org>

Move x86 specific codes to architecture directory and export those EFI
runtime service functions. This will be useful for initializing runtime
service on ARM later.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 arch/x86/xen/efi.c    | 112 ++++++++++++++++++++++++++++++++
 drivers/xen/efi.c     | 174 ++++++++++----------------------------------------
 include/xen/xen-ops.h |  30 ++++++---
 3 files changed, 168 insertions(+), 148 deletions(-)

diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index be14cc3..86527f1 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -20,10 +20,122 @@
 #include <linux/init.h>
 #include <linux/string.h>
 
+#include <xen/xen.h>
 #include <xen/xen-ops.h>
+#include <xen/interface/platform.h>
 
 #include <asm/page.h>
 #include <asm/setup.h>
+#include <asm/xen/hypercall.h>
+
+static efi_char16_t vendor[100] __initdata;
+
+static efi_system_table_t efi_systab_xen __initdata = {
+	.hdr = {
+		.signature	= EFI_SYSTEM_TABLE_SIGNATURE,
+		.revision	= 0, /* Initialized later. */
+		.headersize	= 0, /* Ignored by Linux Kernel. */
+		.crc32		= 0, /* Ignored by Linux Kernel. */
+		.reserved	= 0
+	},
+	.fw_vendor	= EFI_INVALID_TABLE_ADDR, /* Initialized later. */
+	.fw_revision	= 0,			  /* Initialized later. */
+	.con_in_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.con_in		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.con_out_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.con_out	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.stderr_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.stderr		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
+	.runtime	= (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR,
+						  /* Not used under Xen. */
+	.boottime	= (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR,
+						  /* Not used under Xen. */
+	.nr_tables	= 0,			  /* Initialized later. */
+	.tables		= EFI_INVALID_TABLE_ADDR  /* Initialized later. */
+};
+
+static const struct efi efi_xen __initconst = {
+	.systab                   = NULL, /* Initialized later. */
+	.runtime_version	  = 0,    /* Initialized later. */
+	.mps                      = EFI_INVALID_TABLE_ADDR,
+	.acpi                     = EFI_INVALID_TABLE_ADDR,
+	.acpi20                   = EFI_INVALID_TABLE_ADDR,
+	.smbios                   = EFI_INVALID_TABLE_ADDR,
+	.smbios3                  = EFI_INVALID_TABLE_ADDR,
+	.sal_systab               = EFI_INVALID_TABLE_ADDR,
+	.boot_info                = EFI_INVALID_TABLE_ADDR,
+	.hcdp                     = EFI_INVALID_TABLE_ADDR,
+	.uga                      = EFI_INVALID_TABLE_ADDR,
+	.uv_systab                = EFI_INVALID_TABLE_ADDR,
+	.fw_vendor                = EFI_INVALID_TABLE_ADDR,
+	.runtime                  = EFI_INVALID_TABLE_ADDR,
+	.config_table             = EFI_INVALID_TABLE_ADDR,
+	.get_time                 = xen_efi_get_time,
+	.set_time                 = xen_efi_set_time,
+	.get_wakeup_time          = xen_efi_get_wakeup_time,
+	.set_wakeup_time          = xen_efi_set_wakeup_time,
+	.get_variable             = xen_efi_get_variable,
+	.get_next_variable        = xen_efi_get_next_variable,
+	.set_variable             = xen_efi_set_variable,
+	.query_variable_info      = xen_efi_query_variable_info,
+	.update_capsule           = xen_efi_update_capsule,
+	.query_capsule_caps       = xen_efi_query_capsule_caps,
+	.get_next_high_mono_count = xen_efi_get_next_high_mono_count,
+	.reset_system             = NULL, /* Functionality provided by Xen. */
+	.set_virtual_address_map  = NULL, /* Not used under Xen. */
+	.memmap                   = NULL, /* Not used under Xen. */
+	.flags			  = 0     /* Initialized later. */
+};
+
+static efi_system_table_t __init *xen_efi_probe(void)
+{
+	struct xen_platform_op op = {
+		.cmd = XENPF_firmware_info,
+		.u.firmware_info = {
+			.type = XEN_FW_EFI_INFO,
+			.index = XEN_FW_EFI_CONFIG_TABLE
+		}
+	};
+	union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info;
+
+	if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0)
+		return NULL;
+
+	/* Here we know that Xen runs on EFI platform. */
+
+	efi = efi_xen;
+
+	efi_systab_xen.tables = info->cfg.addr;
+	efi_systab_xen.nr_tables = info->cfg.nent;
+
+	op.cmd = XENPF_firmware_info;
+	op.u.firmware_info.type = XEN_FW_EFI_INFO;
+	op.u.firmware_info.index = XEN_FW_EFI_VENDOR;
+	info->vendor.bufsz = sizeof(vendor);
+	set_xen_guest_handle(info->vendor.name, vendor);
+
+	if (HYPERVISOR_platform_op(&op) == 0) {
+		efi_systab_xen.fw_vendor = __pa_symbol(vendor);
+		efi_systab_xen.fw_revision = info->vendor.revision;
+	} else
+		efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN");
+
+	op.cmd = XENPF_firmware_info;
+	op.u.firmware_info.type = XEN_FW_EFI_INFO;
+	op.u.firmware_info.index = XEN_FW_EFI_VERSION;
+
+	if (HYPERVISOR_platform_op(&op) == 0)
+		efi_systab_xen.hdr.revision = info->version;
+
+	op.cmd = XENPF_firmware_info;
+	op.u.firmware_info.type = XEN_FW_EFI_INFO;
+	op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION;
+
+	if (HYPERVISOR_platform_op(&op) == 0)
+		efi.runtime_version = info->version;
+
+	return &efi_systab_xen;
+}
 
 void __init xen_efi_init(void)
 {
diff --git a/drivers/xen/efi.c b/drivers/xen/efi.c
index be7e56a..22f71ff 100644
--- a/drivers/xen/efi.c
+++ b/drivers/xen/efi.c
@@ -38,7 +38,7 @@
 
 #define efi_data(op)	(op.u.efi_runtime_call)
 
-static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
+efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
 	struct xen_platform_op op = INIT_EFI_OP(get_time);
 
@@ -59,8 +59,9 @@ static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_get_time);
 
-static efi_status_t xen_efi_set_time(efi_time_t *tm)
+efi_status_t xen_efi_set_time(efi_time_t *tm)
 {
 	struct xen_platform_op op = INIT_EFI_OP(set_time);
 
@@ -72,10 +73,10 @@ static efi_status_t xen_efi_set_time(efi_time_t *tm)
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_set_time);
 
-static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
-					    efi_bool_t *pending,
-					    efi_time_t *tm)
+efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
+				     efi_time_t *tm)
 {
 	struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
 
@@ -95,8 +96,9 @@ static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
 
-static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
+efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
 {
 	struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
 
@@ -113,12 +115,11 @@ static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
 
-static efi_status_t xen_efi_get_variable(efi_char16_t *name,
-					 efi_guid_t *vendor,
-					 u32 *attr,
-					 unsigned long *data_size,
-					 void *data)
+efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
+				  u32 *attr, unsigned long *data_size,
+				  void *data)
 {
 	struct xen_platform_op op = INIT_EFI_OP(get_variable);
 
@@ -138,10 +139,11 @@ static efi_status_t xen_efi_get_variable(efi_char16_t *name,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_get_variable);
 
-static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
-					      efi_char16_t *name,
-					      efi_guid_t *vendor)
+efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
+				       efi_char16_t *name,
+				       efi_guid_t *vendor)
 {
 	struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);
 
@@ -161,12 +163,11 @@ static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
 
-static efi_status_t xen_efi_set_variable(efi_char16_t *name,
-					 efi_guid_t *vendor,
-					 u32 attr,
-					 unsigned long data_size,
-					 void *data)
+efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
+				 u32 attr, unsigned long data_size,
+				 void *data)
 {
 	struct xen_platform_op op = INIT_EFI_OP(set_variable);
 
@@ -183,11 +184,11 @@ static efi_status_t xen_efi_set_variable(efi_char16_t *name,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_set_variable);
 
-static efi_status_t xen_efi_query_variable_info(u32 attr,
-						u64 *storage_space,
-						u64 *remaining_space,
-						u64 *max_variable_size)
+efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
+					 u64 *remaining_space,
+					 u64 *max_variable_size)
 {
 	struct xen_platform_op op = INIT_EFI_OP(query_variable_info);
 
@@ -205,8 +206,9 @@ static efi_status_t xen_efi_query_variable_info(u32 attr,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
 
-static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
+efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
 {
 	struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
 
@@ -217,10 +219,10 @@ static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
 
-static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
-					   unsigned long count,
-					   unsigned long sg_list)
+efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
+				    unsigned long count, unsigned long sg_list)
 {
 	struct xen_platform_op op = INIT_EFI_OP(update_capsule);
 
@@ -237,11 +239,11 @@ static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
 
 	return efi_data(op).status;
 }
+EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
 
-static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
-					       unsigned long count,
-					       u64 *max_size,
-					       int *reset_type)
+efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
+					unsigned long count, u64 *max_size,
+					int *reset_type)
 {
 	struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
 
@@ -260,112 +262,4 @@ static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
 
 	return efi_data(op).status;
 }
-
-static efi_char16_t vendor[100] __initdata;
-
-static efi_system_table_t efi_systab_xen __initdata = {
-	.hdr = {
-		.signature	= EFI_SYSTEM_TABLE_SIGNATURE,
-		.revision	= 0, /* Initialized later. */
-		.headersize	= 0, /* Ignored by Linux Kernel. */
-		.crc32		= 0, /* Ignored by Linux Kernel. */
-		.reserved	= 0
-	},
-	.fw_vendor	= EFI_INVALID_TABLE_ADDR, /* Initialized later. */
-	.fw_revision	= 0,			  /* Initialized later. */
-	.con_in_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.con_in		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.con_out_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.con_out	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.stderr_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.stderr		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
-	.runtime	= (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR,
-						  /* Not used under Xen. */
-	.boottime	= (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR,
-						  /* Not used under Xen. */
-	.nr_tables	= 0,			  /* Initialized later. */
-	.tables		= EFI_INVALID_TABLE_ADDR  /* Initialized later. */
-};
-
-static const struct efi efi_xen __initconst = {
-	.systab                   = NULL, /* Initialized later. */
-	.runtime_version	  = 0,    /* Initialized later. */
-	.mps                      = EFI_INVALID_TABLE_ADDR,
-	.acpi                     = EFI_INVALID_TABLE_ADDR,
-	.acpi20                   = EFI_INVALID_TABLE_ADDR,
-	.smbios                   = EFI_INVALID_TABLE_ADDR,
-	.smbios3                  = EFI_INVALID_TABLE_ADDR,
-	.sal_systab               = EFI_INVALID_TABLE_ADDR,
-	.boot_info                = EFI_INVALID_TABLE_ADDR,
-	.hcdp                     = EFI_INVALID_TABLE_ADDR,
-	.uga                      = EFI_INVALID_TABLE_ADDR,
-	.uv_systab                = EFI_INVALID_TABLE_ADDR,
-	.fw_vendor                = EFI_INVALID_TABLE_ADDR,
-	.runtime                  = EFI_INVALID_TABLE_ADDR,
-	.config_table             = EFI_INVALID_TABLE_ADDR,
-	.get_time                 = xen_efi_get_time,
-	.set_time                 = xen_efi_set_time,
-	.get_wakeup_time          = xen_efi_get_wakeup_time,
-	.set_wakeup_time          = xen_efi_set_wakeup_time,
-	.get_variable             = xen_efi_get_variable,
-	.get_next_variable        = xen_efi_get_next_variable,
-	.set_variable             = xen_efi_set_variable,
-	.query_variable_info      = xen_efi_query_variable_info,
-	.update_capsule           = xen_efi_update_capsule,
-	.query_capsule_caps       = xen_efi_query_capsule_caps,
-	.get_next_high_mono_count = xen_efi_get_next_high_mono_count,
-	.reset_system             = NULL, /* Functionality provided by Xen. */
-	.set_virtual_address_map  = NULL, /* Not used under Xen. */
-	.memmap                   = NULL, /* Not used under Xen. */
-	.flags			  = 0     /* Initialized later. */
-};
-
-efi_system_table_t __init *xen_efi_probe(void)
-{
-	struct xen_platform_op op = {
-		.cmd = XENPF_firmware_info,
-		.u.firmware_info = {
-			.type = XEN_FW_EFI_INFO,
-			.index = XEN_FW_EFI_CONFIG_TABLE
-		}
-	};
-	union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info;
-
-	if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0)
-		return NULL;
-
-	/* Here we know that Xen runs on EFI platform. */
-
-	efi = efi_xen;
-
-	efi_systab_xen.tables = info->cfg.addr;
-	efi_systab_xen.nr_tables = info->cfg.nent;
-
-	op.cmd = XENPF_firmware_info;
-	op.u.firmware_info.type = XEN_FW_EFI_INFO;
-	op.u.firmware_info.index = XEN_FW_EFI_VENDOR;
-	info->vendor.bufsz = sizeof(vendor);
-	set_xen_guest_handle(info->vendor.name, vendor);
-
-	if (HYPERVISOR_platform_op(&op) == 0) {
-		efi_systab_xen.fw_vendor = __pa_symbol(vendor);
-		efi_systab_xen.fw_revision = info->vendor.revision;
-	} else
-		efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN");
-
-	op.cmd = XENPF_firmware_info;
-	op.u.firmware_info.type = XEN_FW_EFI_INFO;
-	op.u.firmware_info.index = XEN_FW_EFI_VERSION;
-
-	if (HYPERVISOR_platform_op(&op) == 0)
-		efi_systab_xen.hdr.revision = info->version;
-
-	op.cmd = XENPF_firmware_info;
-	op.u.firmware_info.type = XEN_FW_EFI_INFO;
-	op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION;
-
-	if (HYPERVISOR_platform_op(&op) == 0)
-		efi.runtime_version = info->version;
-
-	return &efi_systab_xen;
-}
+EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 42be31a..c83a338 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -85,14 +85,28 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
 
 bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
 
-#ifdef CONFIG_XEN_EFI
-extern efi_system_table_t *xen_efi_probe(void);
-#else
-static inline efi_system_table_t __init *xen_efi_probe(void)
-{
-	return NULL;
-}
-#endif
+efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
+efi_status_t xen_efi_set_time(efi_time_t *tm);
+efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
+				     efi_time_t *tm);
+efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
+efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
+				  u32 *attr, unsigned long *data_size,
+				  void *data);
+efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
+				       efi_char16_t *name, efi_guid_t *vendor);
+efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
+				  u32 attr, unsigned long data_size,
+				  void *data);
+efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
+					 u64 *remaining_space,
+					 u64 *max_variable_size);
+efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
+efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
+				    unsigned long count, unsigned long sg_list);
+efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
+					unsigned long count, u64 *max_size,
+					int *reset_type);
 
 #ifdef CONFIG_PREEMPT
 
-- 
2.0.4

[toc] | [prev] | [next] | [standalone]


#1316999 — Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-25 17:50 +0100
SubjectRe: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory
Message-ID<qUSv1-6M7-41@gated-at.bofh.it>
In reply to#1315508

[Multipart message — attachments visible in raw view] — view raw

On Sat, 23 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> Move x86 specific codes to architecture directory and export those EFI
> runtime service functions. This will be useful for initializing runtime
> service on ARM later.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

This patch causes a build breakage on x86:

arch/x86/xen/efi.c: In function ‘xen_efi_probe’:
arch/x86/xen/efi.c:101:2: error: implicit declaration of function ‘HYPERVISOR_platform_op’ [-Werror=implicit-function-declaration]



>  arch/x86/xen/efi.c    | 112 ++++++++++++++++++++++++++++++++
>  drivers/xen/efi.c     | 174 ++++++++++----------------------------------------
>  include/xen/xen-ops.h |  30 ++++++---
>  3 files changed, 168 insertions(+), 148 deletions(-)
> 
> diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
> index be14cc3..86527f1 100644
> --- a/arch/x86/xen/efi.c
> +++ b/arch/x86/xen/efi.c
> @@ -20,10 +20,122 @@
>  #include <linux/init.h>
>  #include <linux/string.h>
>  
> +#include <xen/xen.h>
>  #include <xen/xen-ops.h>
> +#include <xen/interface/platform.h>
>  
>  #include <asm/page.h>
>  #include <asm/setup.h>
> +#include <asm/xen/hypercall.h>
> +
> +static efi_char16_t vendor[100] __initdata;
> +
> +static efi_system_table_t efi_systab_xen __initdata = {
> +	.hdr = {
> +		.signature	= EFI_SYSTEM_TABLE_SIGNATURE,
> +		.revision	= 0, /* Initialized later. */
> +		.headersize	= 0, /* Ignored by Linux Kernel. */
> +		.crc32		= 0, /* Ignored by Linux Kernel. */
> +		.reserved	= 0
> +	},
> +	.fw_vendor	= EFI_INVALID_TABLE_ADDR, /* Initialized later. */
> +	.fw_revision	= 0,			  /* Initialized later. */
> +	.con_in_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.con_in		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.con_out_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.con_out	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.stderr_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.stderr		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> +	.runtime	= (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR,
> +						  /* Not used under Xen. */
> +	.boottime	= (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR,
> +						  /* Not used under Xen. */
> +	.nr_tables	= 0,			  /* Initialized later. */
> +	.tables		= EFI_INVALID_TABLE_ADDR  /* Initialized later. */
> +};
> +
> +static const struct efi efi_xen __initconst = {
> +	.systab                   = NULL, /* Initialized later. */
> +	.runtime_version	  = 0,    /* Initialized later. */
> +	.mps                      = EFI_INVALID_TABLE_ADDR,
> +	.acpi                     = EFI_INVALID_TABLE_ADDR,
> +	.acpi20                   = EFI_INVALID_TABLE_ADDR,
> +	.smbios                   = EFI_INVALID_TABLE_ADDR,
> +	.smbios3                  = EFI_INVALID_TABLE_ADDR,
> +	.sal_systab               = EFI_INVALID_TABLE_ADDR,
> +	.boot_info                = EFI_INVALID_TABLE_ADDR,
> +	.hcdp                     = EFI_INVALID_TABLE_ADDR,
> +	.uga                      = EFI_INVALID_TABLE_ADDR,
> +	.uv_systab                = EFI_INVALID_TABLE_ADDR,
> +	.fw_vendor                = EFI_INVALID_TABLE_ADDR,
> +	.runtime                  = EFI_INVALID_TABLE_ADDR,
> +	.config_table             = EFI_INVALID_TABLE_ADDR,
> +	.get_time                 = xen_efi_get_time,
> +	.set_time                 = xen_efi_set_time,
> +	.get_wakeup_time          = xen_efi_get_wakeup_time,
> +	.set_wakeup_time          = xen_efi_set_wakeup_time,
> +	.get_variable             = xen_efi_get_variable,
> +	.get_next_variable        = xen_efi_get_next_variable,
> +	.set_variable             = xen_efi_set_variable,
> +	.query_variable_info      = xen_efi_query_variable_info,
> +	.update_capsule           = xen_efi_update_capsule,
> +	.query_capsule_caps       = xen_efi_query_capsule_caps,
> +	.get_next_high_mono_count = xen_efi_get_next_high_mono_count,
> +	.reset_system             = NULL, /* Functionality provided by Xen. */
> +	.set_virtual_address_map  = NULL, /* Not used under Xen. */
> +	.memmap                   = NULL, /* Not used under Xen. */
> +	.flags			  = 0     /* Initialized later. */
> +};
> +
> +static efi_system_table_t __init *xen_efi_probe(void)
> +{
> +	struct xen_platform_op op = {
> +		.cmd = XENPF_firmware_info,
> +		.u.firmware_info = {
> +			.type = XEN_FW_EFI_INFO,
> +			.index = XEN_FW_EFI_CONFIG_TABLE
> +		}
> +	};
> +	union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info;
> +
> +	if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0)
> +		return NULL;
> +
> +	/* Here we know that Xen runs on EFI platform. */
> +
> +	efi = efi_xen;
> +
> +	efi_systab_xen.tables = info->cfg.addr;
> +	efi_systab_xen.nr_tables = info->cfg.nent;
> +
> +	op.cmd = XENPF_firmware_info;
> +	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> +	op.u.firmware_info.index = XEN_FW_EFI_VENDOR;
> +	info->vendor.bufsz = sizeof(vendor);
> +	set_xen_guest_handle(info->vendor.name, vendor);
> +
> +	if (HYPERVISOR_platform_op(&op) == 0) {
> +		efi_systab_xen.fw_vendor = __pa_symbol(vendor);
> +		efi_systab_xen.fw_revision = info->vendor.revision;
> +	} else
> +		efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN");
> +
> +	op.cmd = XENPF_firmware_info;
> +	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> +	op.u.firmware_info.index = XEN_FW_EFI_VERSION;
> +
> +	if (HYPERVISOR_platform_op(&op) == 0)
> +		efi_systab_xen.hdr.revision = info->version;
> +
> +	op.cmd = XENPF_firmware_info;
> +	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> +	op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION;
> +
> +	if (HYPERVISOR_platform_op(&op) == 0)
> +		efi.runtime_version = info->version;
> +
> +	return &efi_systab_xen;
> +}
>  
>  void __init xen_efi_init(void)
>  {
> diff --git a/drivers/xen/efi.c b/drivers/xen/efi.c
> index be7e56a..22f71ff 100644
> --- a/drivers/xen/efi.c
> +++ b/drivers/xen/efi.c
> @@ -38,7 +38,7 @@
>  
>  #define efi_data(op)	(op.u.efi_runtime_call)
>  
> -static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
> +efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(get_time);
>  
> @@ -59,8 +59,9 @@ static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_get_time);
>  
> -static efi_status_t xen_efi_set_time(efi_time_t *tm)
> +efi_status_t xen_efi_set_time(efi_time_t *tm)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(set_time);
>  
> @@ -72,10 +73,10 @@ static efi_status_t xen_efi_set_time(efi_time_t *tm)
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_set_time);
>  
> -static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
> -					    efi_bool_t *pending,
> -					    efi_time_t *tm)
> +efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
> +				     efi_time_t *tm)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
>  
> @@ -95,8 +96,9 @@ static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
>  
> -static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
> +efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
>  
> @@ -113,12 +115,11 @@ static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
>  
> -static efi_status_t xen_efi_get_variable(efi_char16_t *name,
> -					 efi_guid_t *vendor,
> -					 u32 *attr,
> -					 unsigned long *data_size,
> -					 void *data)
> +efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
> +				  u32 *attr, unsigned long *data_size,
> +				  void *data)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(get_variable);
>  
> @@ -138,10 +139,11 @@ static efi_status_t xen_efi_get_variable(efi_char16_t *name,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_get_variable);
>  
> -static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
> -					      efi_char16_t *name,
> -					      efi_guid_t *vendor)
> +efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
> +				       efi_char16_t *name,
> +				       efi_guid_t *vendor)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);
>  
> @@ -161,12 +163,11 @@ static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
>  
> -static efi_status_t xen_efi_set_variable(efi_char16_t *name,
> -					 efi_guid_t *vendor,
> -					 u32 attr,
> -					 unsigned long data_size,
> -					 void *data)
> +efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
> +				 u32 attr, unsigned long data_size,
> +				 void *data)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(set_variable);
>  
> @@ -183,11 +184,11 @@ static efi_status_t xen_efi_set_variable(efi_char16_t *name,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_set_variable);
>  
> -static efi_status_t xen_efi_query_variable_info(u32 attr,
> -						u64 *storage_space,
> -						u64 *remaining_space,
> -						u64 *max_variable_size)
> +efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
> +					 u64 *remaining_space,
> +					 u64 *max_variable_size)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(query_variable_info);
>  
> @@ -205,8 +206,9 @@ static efi_status_t xen_efi_query_variable_info(u32 attr,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
>  
> -static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
> +efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
>  
> @@ -217,10 +219,10 @@ static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
>  
> -static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
> -					   unsigned long count,
> -					   unsigned long sg_list)
> +efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
> +				    unsigned long count, unsigned long sg_list)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(update_capsule);
>  
> @@ -237,11 +239,11 @@ static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
>  
>  	return efi_data(op).status;
>  }
> +EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
>  
> -static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
> -					       unsigned long count,
> -					       u64 *max_size,
> -					       int *reset_type)
> +efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
> +					unsigned long count, u64 *max_size,
> +					int *reset_type)
>  {
>  	struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
>  
> @@ -260,112 +262,4 @@ static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
>  
>  	return efi_data(op).status;
>  }
> -
> -static efi_char16_t vendor[100] __initdata;
> -
> -static efi_system_table_t efi_systab_xen __initdata = {
> -	.hdr = {
> -		.signature	= EFI_SYSTEM_TABLE_SIGNATURE,
> -		.revision	= 0, /* Initialized later. */
> -		.headersize	= 0, /* Ignored by Linux Kernel. */
> -		.crc32		= 0, /* Ignored by Linux Kernel. */
> -		.reserved	= 0
> -	},
> -	.fw_vendor	= EFI_INVALID_TABLE_ADDR, /* Initialized later. */
> -	.fw_revision	= 0,			  /* Initialized later. */
> -	.con_in_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.con_in		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.con_out_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.con_out	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.stderr_handle	= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.stderr		= EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */
> -	.runtime	= (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR,
> -						  /* Not used under Xen. */
> -	.boottime	= (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR,
> -						  /* Not used under Xen. */
> -	.nr_tables	= 0,			  /* Initialized later. */
> -	.tables		= EFI_INVALID_TABLE_ADDR  /* Initialized later. */
> -};
> -
> -static const struct efi efi_xen __initconst = {
> -	.systab                   = NULL, /* Initialized later. */
> -	.runtime_version	  = 0,    /* Initialized later. */
> -	.mps                      = EFI_INVALID_TABLE_ADDR,
> -	.acpi                     = EFI_INVALID_TABLE_ADDR,
> -	.acpi20                   = EFI_INVALID_TABLE_ADDR,
> -	.smbios                   = EFI_INVALID_TABLE_ADDR,
> -	.smbios3                  = EFI_INVALID_TABLE_ADDR,
> -	.sal_systab               = EFI_INVALID_TABLE_ADDR,
> -	.boot_info                = EFI_INVALID_TABLE_ADDR,
> -	.hcdp                     = EFI_INVALID_TABLE_ADDR,
> -	.uga                      = EFI_INVALID_TABLE_ADDR,
> -	.uv_systab                = EFI_INVALID_TABLE_ADDR,
> -	.fw_vendor                = EFI_INVALID_TABLE_ADDR,
> -	.runtime                  = EFI_INVALID_TABLE_ADDR,
> -	.config_table             = EFI_INVALID_TABLE_ADDR,
> -	.get_time                 = xen_efi_get_time,
> -	.set_time                 = xen_efi_set_time,
> -	.get_wakeup_time          = xen_efi_get_wakeup_time,
> -	.set_wakeup_time          = xen_efi_set_wakeup_time,
> -	.get_variable             = xen_efi_get_variable,
> -	.get_next_variable        = xen_efi_get_next_variable,
> -	.set_variable             = xen_efi_set_variable,
> -	.query_variable_info      = xen_efi_query_variable_info,
> -	.update_capsule           = xen_efi_update_capsule,
> -	.query_capsule_caps       = xen_efi_query_capsule_caps,
> -	.get_next_high_mono_count = xen_efi_get_next_high_mono_count,
> -	.reset_system             = NULL, /* Functionality provided by Xen. */
> -	.set_virtual_address_map  = NULL, /* Not used under Xen. */
> -	.memmap                   = NULL, /* Not used under Xen. */
> -	.flags			  = 0     /* Initialized later. */
> -};
> -
> -efi_system_table_t __init *xen_efi_probe(void)
> -{
> -	struct xen_platform_op op = {
> -		.cmd = XENPF_firmware_info,
> -		.u.firmware_info = {
> -			.type = XEN_FW_EFI_INFO,
> -			.index = XEN_FW_EFI_CONFIG_TABLE
> -		}
> -	};
> -	union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info;
> -
> -	if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0)
> -		return NULL;
> -
> -	/* Here we know that Xen runs on EFI platform. */
> -
> -	efi = efi_xen;
> -
> -	efi_systab_xen.tables = info->cfg.addr;
> -	efi_systab_xen.nr_tables = info->cfg.nent;
> -
> -	op.cmd = XENPF_firmware_info;
> -	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> -	op.u.firmware_info.index = XEN_FW_EFI_VENDOR;
> -	info->vendor.bufsz = sizeof(vendor);
> -	set_xen_guest_handle(info->vendor.name, vendor);
> -
> -	if (HYPERVISOR_platform_op(&op) == 0) {
> -		efi_systab_xen.fw_vendor = __pa_symbol(vendor);
> -		efi_systab_xen.fw_revision = info->vendor.revision;
> -	} else
> -		efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN");
> -
> -	op.cmd = XENPF_firmware_info;
> -	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> -	op.u.firmware_info.index = XEN_FW_EFI_VERSION;
> -
> -	if (HYPERVISOR_platform_op(&op) == 0)
> -		efi_systab_xen.hdr.revision = info->version;
> -
> -	op.cmd = XENPF_firmware_info;
> -	op.u.firmware_info.type = XEN_FW_EFI_INFO;
> -	op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION;
> -
> -	if (HYPERVISOR_platform_op(&op) == 0)
> -		efi.runtime_version = info->version;
> -
> -	return &efi_systab_xen;
> -}
> +EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
> diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
> index 42be31a..c83a338 100644
> --- a/include/xen/xen-ops.h
> +++ b/include/xen/xen-ops.h
> @@ -85,14 +85,28 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
>  
>  bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
>  
> -#ifdef CONFIG_XEN_EFI
> -extern efi_system_table_t *xen_efi_probe(void);
> -#else
> -static inline efi_system_table_t __init *xen_efi_probe(void)
> -{
> -	return NULL;
> -}
> -#endif
> +efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
> +efi_status_t xen_efi_set_time(efi_time_t *tm);
> +efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
> +				     efi_time_t *tm);
> +efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
> +efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
> +				  u32 *attr, unsigned long *data_size,
> +				  void *data);
> +efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
> +				       efi_char16_t *name, efi_guid_t *vendor);
> +efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
> +				  u32 attr, unsigned long data_size,
> +				  void *data);
> +efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
> +					 u64 *remaining_space,
> +					 u64 *max_variable_size);
> +efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
> +efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
> +				    unsigned long count, unsigned long sg_list);
> +efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
> +					unsigned long count, u64 *max_size,
> +					int *reset_type);
>  
>  #ifdef CONFIG_PREEMPT
>  
> -- 
> 2.0.4
> 
> 

[toc] | [prev] | [next] | [standalone]


#1317605 — Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-26 09:20 +0100
SubjectRe: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory
Message-ID<qV710-1ma-13@gated-at.bofh.it>
In reply to#1316999

On 2016/1/26 0:44, Stefano Stabellini wrote:
> On Sat, 23 Jan 2016, Shannon Zhao wrote:
>> > From: Shannon Zhao <shannon.zhao@linaro.org>
>> > 
>> > Move x86 specific codes to architecture directory and export those EFI
>> > runtime service functions. This will be useful for initializing runtime
>> > service on ARM later.
>> > 
>> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> This patch causes a build breakage on x86:
> 
> arch/x86/xen/efi.c: In function ‘xen_efi_probe’:
> arch/x86/xen/efi.c:101:2: error: implicit declaration of function ‘HYPERVISOR_platform_op’ [-Werror=implicit-function-declaration]
> 
This patch is based on following patch [1]. Maybe you need to update
your branch. :)

[1] xen: rename dom0_op to platform_op
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=cfafae940381207d48b11a73a211142dba5947d3

-- 
Shannon

[toc] | [prev] | [next] | [standalone]


#1317767 — Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-26 12:40 +0100
SubjectRe: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory
Message-ID<qVa8x-3sE-1@gated-at.bofh.it>
In reply to#1317605

[Multipart message — attachments visible in raw view] — view raw

On Tue, 26 Jan 2016, Shannon Zhao wrote:
> On 2016/1/26 0:44, Stefano Stabellini wrote:
> > On Sat, 23 Jan 2016, Shannon Zhao wrote:
> >> > From: Shannon Zhao <shannon.zhao@linaro.org>
> >> > 
> >> > Move x86 specific codes to architecture directory and export those EFI
> >> > runtime service functions. This will be useful for initializing runtime
> >> > service on ARM later.
> >> > 
> >> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> > This patch causes a build breakage on x86:
> > 
> > arch/x86/xen/efi.c: In function ‘xen_efi_probe’:
> > arch/x86/xen/efi.c:101:2: error: implicit declaration of function ‘HYPERVISOR_platform_op’ [-Werror=implicit-function-declaration]
> > 
> This patch is based on following patch [1]. Maybe you need to update
> your branch. :)
> 
> [1] xen: rename dom0_op to platform_op
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=cfafae940381207d48b11a73a211142dba5947d3

Sorry, I made a mistake rebasing the series. It doesn't help that I
couldn't find any Linux RCs on top of which it applies cleanly. As Linus
tags RCs often enough, it is usually helpful to base one's work on a tag
so that it is easier for other people to work on it.

Please add my Reviewed-by to this patch.

[toc] | [prev] | [next] | [standalone]


#1317831 — Re: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-26 13:30 +0100
SubjectRe: [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory
Message-ID<qVaUY-42e-45@gated-at.bofh.it>
In reply to#1317767

On 2016/1/26 19:31, Stefano Stabellini wrote:
> On Tue, 26 Jan 2016, Shannon Zhao wrote:
>> > On 2016/1/26 0:44, Stefano Stabellini wrote:
>>> > > On Sat, 23 Jan 2016, Shannon Zhao wrote:
>>>>> > >> > From: Shannon Zhao <shannon.zhao@linaro.org>
>>>>> > >> > 
>>>>> > >> > Move x86 specific codes to architecture directory and export those EFI
>>>>> > >> > runtime service functions. This will be useful for initializing runtime
>>>>> > >> > service on ARM later.
>>>>> > >> > 
>>>>> > >> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>>> > > This patch causes a build breakage on x86:
>>> > > 
>>> > > arch/x86/xen/efi.c: In function ‘xen_efi_probe’:
>>> > > arch/x86/xen/efi.c:101:2: error: implicit declaration of function ‘HYPERVISOR_platform_op’ [-Werror=implicit-function-declaration]
>>> > > 
>> > This patch is based on following patch [1]. Maybe you need to update
>> > your branch. :)
>> > 
>> > [1] xen: rename dom0_op to platform_op
>> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=cfafae940381207d48b11a73a211142dba5947d3
> Sorry, I made a mistake rebasing the series. It doesn't help that I
> couldn't find any Linux RCs on top of which it applies cleanly. As Linus
> tags RCs often enough, it is usually helpful to base one's work on a tag
> so that it is easier for other people to work on it.
>
Ah, I'll rebase this series on top of the newest master at next version
since the relevant patches are in master.

> Please add my Reviewed-by to this patch.
Thanks a lot!

-- 
Shannon

[toc] | [prev] | [next] | [standalone]


#1315509 — [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-23 04:30 +0100
Subject[PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms
Message-ID<qTX3J-5bz-35@gated-at.bofh.it>
In reply to#1315506
From: Shannon Zhao <shannon.zhao@linaro.org>

Add a "uefi" node under /hypervisor node in FDT, then Linux kernel could
scan this to get the UEFI information.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
---
CC: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/arm/xen.txt | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/xen.txt b/Documentation/devicetree/bindings/arm/xen.txt
index 0f7b9c2..aa69405 100644
--- a/Documentation/devicetree/bindings/arm/xen.txt
+++ b/Documentation/devicetree/bindings/arm/xen.txt
@@ -15,6 +15,26 @@ the following properties:
 - interrupts: the interrupt used by Xen to inject event notifications.
   A GIC node is also required.
 
+To support UEFI on Xen ARM virtual platforms, Xen populates the FDT "uefi" node
+under /hypervisor with following parameters:
+
+________________________________________________________________________________
+Name                      | Size   | Description
+================================================================================
+xen,uefi-system-table     | 64-bit | Guest physical address of the UEFI System
+			  |	   | Table.
+--------------------------------------------------------------------------------
+xen,uefi-mmap-start       | 64-bit | Guest physical address of the UEFI memory
+			  |	   | map.
+--------------------------------------------------------------------------------
+xen,uefi-mmap-size        | 32-bit | Size in bytes of the UEFI memory map
+                          |        | pointed to in previous entry.
+--------------------------------------------------------------------------------
+xen,uefi-mmap-desc-size   | 32-bit | Size in bytes of each entry in the UEFI
+                          |        | memory map.
+--------------------------------------------------------------------------------
+xen,uefi-mmap-desc-ver    | 32-bit | Version of the mmap descriptor format.
+--------------------------------------------------------------------------------
 
 Example (assuming #address-cells = <2> and #size-cells = <2>):
 
@@ -22,4 +42,18 @@ hypervisor {
 	compatible = "xen,xen-4.3", "xen,xen";
 	reg = <0 0xb0000000 0 0x20000>;
 	interrupts = <1 15 0xf08>;
+	uefi {
+		xen,uefi-system-table = <0xXXXXXXXX>;
+		xen,uefi-mmap-start = <0xXXXXXXXX>;
+		xen,uefi-mmap-size = <0xXXXXXXXX>;
+		xen,uefi-mmap-desc-size = <0xXXXXXXXX>;
+		xen,uefi-mmap-desc-ver = <0xXXXXXXXX>;
+        };
 };
+
+The format and meaning of these "xen,uefi-*" parameters are similar to those in
+Documentation/arm/uefi.txt which are used by normal UEFI. But to distinguish
+from normal UEFI, for Xen ARM virtual platforms it needs to introduce a Xen
+specific UEFI which requires Xen hypervisor to provide hypercalls for Dom0 to
+make use of the runtime services. Therefore, it defines these parameters under
+/hypervisor node.
-- 
2.0.4

[toc] | [prev] | [next] | [standalone]


#1316880 — Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-25 17:00 +0100
SubjectRe: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms
Message-ID<qURIC-68y-17@gated-at.bofh.it>
In reply to#1315509
On Sat, 23 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> Add a "uefi" node under /hypervisor node in FDT, then Linux kernel could
> scan this to get the UEFI information.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
> CC: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/arm/xen.txt | 34 +++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/xen.txt b/Documentation/devicetree/bindings/arm/xen.txt
> index 0f7b9c2..aa69405 100644
> --- a/Documentation/devicetree/bindings/arm/xen.txt
> +++ b/Documentation/devicetree/bindings/arm/xen.txt
> @@ -15,6 +15,26 @@ the following properties:
>  - interrupts: the interrupt used by Xen to inject event notifications.
>    A GIC node is also required.
>  
> +To support UEFI on Xen ARM virtual platforms, Xen populates the FDT "uefi" node
> +under /hypervisor with following parameters:
> +
> +________________________________________________________________________________
> +Name                      | Size   | Description
> +================================================================================
> +xen,uefi-system-table     | 64-bit | Guest physical address of the UEFI System
> +			  |	   | Table.
> +--------------------------------------------------------------------------------
> +xen,uefi-mmap-start       | 64-bit | Guest physical address of the UEFI memory
> +			  |	   | map.
> +--------------------------------------------------------------------------------
> +xen,uefi-mmap-size        | 32-bit | Size in bytes of the UEFI memory map
> +                          |        | pointed to in previous entry.
> +--------------------------------------------------------------------------------
> +xen,uefi-mmap-desc-size   | 32-bit | Size in bytes of each entry in the UEFI
> +                          |        | memory map.
> +--------------------------------------------------------------------------------
> +xen,uefi-mmap-desc-ver    | 32-bit | Version of the mmap descriptor format.
> +--------------------------------------------------------------------------------
>  
>  Example (assuming #address-cells = <2> and #size-cells = <2>):
>  
> @@ -22,4 +42,18 @@ hypervisor {
>  	compatible = "xen,xen-4.3", "xen,xen";
>  	reg = <0 0xb0000000 0 0x20000>;
>  	interrupts = <1 15 0xf08>;
> +	uefi {
> +		xen,uefi-system-table = <0xXXXXXXXX>;
> +		xen,uefi-mmap-start = <0xXXXXXXXX>;
> +		xen,uefi-mmap-size = <0xXXXXXXXX>;
> +		xen,uefi-mmap-desc-size = <0xXXXXXXXX>;
> +		xen,uefi-mmap-desc-ver = <0xXXXXXXXX>;
> +        };
>  };
> +
> +The format and meaning of these "xen,uefi-*" parameters are similar to those in
> +Documentation/arm/uefi.txt which are used by normal UEFI. But to distinguish
> +from normal UEFI, for Xen ARM virtual platforms it needs to introduce a Xen
> +specific UEFI which requires Xen hypervisor to provide hypercalls for Dom0 to
> +make use of the runtime services. Therefore, it defines these parameters under
> +/hypervisor node.

Please replace the paragraph with the following which mentions
include/xen/interface/platform.h and improves the wording:

"The format and meaning of the "xen,uefi-*" parameters are similar to
those in Documentation/arm/uefi.txt, which are provided by the regular
UEFI stub. However they differ because they are provided by the Xen
hypervisor, together with a set of UEFI runtime services implemented via
hypercalls, see include/xen/interface/platform.h."

[toc] | [prev] | [next] | [standalone]


#1316909 — Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms

FromMark Rutland <mark.rutland@arm.com>
Date2016-01-25 17:10 +0100
SubjectRe: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms
Message-ID<qURSh-6uy-3@gated-at.bofh.it>
In reply to#1316880
On Mon, Jan 25, 2016 at 03:50:52PM +0000, Stefano Stabellini wrote:
> On Sat, 23 Jan 2016, Shannon Zhao wrote:
> > From: Shannon Zhao <shannon.zhao@linaro.org>
> > 
> > Add a "uefi" node under /hypervisor node in FDT, then Linux kernel could
> > scan this to get the UEFI information.
> > 
> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> > Acked-by: Rob Herring <robh@kernel.org>
> > ---
> > CC: Rob Herring <robh@kernel.org>
> > ---
> >  Documentation/devicetree/bindings/arm/xen.txt | 34 +++++++++++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/xen.txt b/Documentation/devicetree/bindings/arm/xen.txt
> > index 0f7b9c2..aa69405 100644
> > --- a/Documentation/devicetree/bindings/arm/xen.txt
> > +++ b/Documentation/devicetree/bindings/arm/xen.txt
> > @@ -15,6 +15,26 @@ the following properties:
> >  - interrupts: the interrupt used by Xen to inject event notifications.
> >    A GIC node is also required.
> >  
> > +To support UEFI on Xen ARM virtual platforms, Xen populates the FDT "uefi" node
> > +under /hypervisor with following parameters:
> > +
> > +________________________________________________________________________________
> > +Name                      | Size   | Description
> > +================================================================================
> > +xen,uefi-system-table     | 64-bit | Guest physical address of the UEFI System
> > +			  |	   | Table.
> > +--------------------------------------------------------------------------------
> > +xen,uefi-mmap-start       | 64-bit | Guest physical address of the UEFI memory
> > +			  |	   | map.
> > +--------------------------------------------------------------------------------
> > +xen,uefi-mmap-size        | 32-bit | Size in bytes of the UEFI memory map
> > +                          |        | pointed to in previous entry.
> > +--------------------------------------------------------------------------------
> > +xen,uefi-mmap-desc-size   | 32-bit | Size in bytes of each entry in the UEFI
> > +                          |        | memory map.
> > +--------------------------------------------------------------------------------
> > +xen,uefi-mmap-desc-ver    | 32-bit | Version of the mmap descriptor format.
> > +--------------------------------------------------------------------------------
> >  
> >  Example (assuming #address-cells = <2> and #size-cells = <2>):
> >  
> > @@ -22,4 +42,18 @@ hypervisor {
> >  	compatible = "xen,xen-4.3", "xen,xen";
> >  	reg = <0 0xb0000000 0 0x20000>;
> >  	interrupts = <1 15 0xf08>;
> > +	uefi {
> > +		xen,uefi-system-table = <0xXXXXXXXX>;
> > +		xen,uefi-mmap-start = <0xXXXXXXXX>;
> > +		xen,uefi-mmap-size = <0xXXXXXXXX>;
> > +		xen,uefi-mmap-desc-size = <0xXXXXXXXX>;
> > +		xen,uefi-mmap-desc-ver = <0xXXXXXXXX>;
> > +        };
> >  };
> > +
> > +The format and meaning of these "xen,uefi-*" parameters are similar to those in
> > +Documentation/arm/uefi.txt which are used by normal UEFI. But to distinguish
> > +from normal UEFI, for Xen ARM virtual platforms it needs to introduce a Xen
> > +specific UEFI which requires Xen hypervisor to provide hypercalls for Dom0 to
> > +make use of the runtime services. Therefore, it defines these parameters under
> > +/hypervisor node.
> 
> Please replace the paragraph with the following which mentions
> include/xen/interface/platform.h and improves the wording:
> 
> "The format and meaning of the "xen,uefi-*" parameters are similar to
> those in Documentation/arm/uefi.txt, which are provided by the regular
> UEFI stub. However they differ because they are provided by the Xen
> hypervisor, together with a set of UEFI runtime services implemented via
> hypercalls, see include/xen/interface/platform.h."

I would prefer if we didn't refer to Linux paths here, for the usual
rationale of keeping bindings distinct from Linux implementation
details.

Could we either drop the "see include/xen/interface/platform.h" part, or
refer to some Xen documentation?

Thanks,
Mark.

[toc] | [prev] | [next] | [standalone]


#1316921 — Re: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-25 17:10 +0100
SubjectRe: [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms
Message-ID<qURSj-6uy-37@gated-at.bofh.it>
In reply to#1316909
On Mon, 25 Jan 2016, Mark Rutland wrote:
> On Mon, Jan 25, 2016 at 03:50:52PM +0000, Stefano Stabellini wrote:
> > On Sat, 23 Jan 2016, Shannon Zhao wrote:
> > > From: Shannon Zhao <shannon.zhao@linaro.org>
> > > 
> > > Add a "uefi" node under /hypervisor node in FDT, then Linux kernel could
> > > scan this to get the UEFI information.
> > > 
> > > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> > > Acked-by: Rob Herring <robh@kernel.org>
> > > ---
> > > CC: Rob Herring <robh@kernel.org>
> > > ---
> > >  Documentation/devicetree/bindings/arm/xen.txt | 34 +++++++++++++++++++++++++++
> > >  1 file changed, 34 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/arm/xen.txt b/Documentation/devicetree/bindings/arm/xen.txt
> > > index 0f7b9c2..aa69405 100644
> > > --- a/Documentation/devicetree/bindings/arm/xen.txt
> > > +++ b/Documentation/devicetree/bindings/arm/xen.txt
> > > @@ -15,6 +15,26 @@ the following properties:
> > >  - interrupts: the interrupt used by Xen to inject event notifications.
> > >    A GIC node is also required.
> > >  
> > > +To support UEFI on Xen ARM virtual platforms, Xen populates the FDT "uefi" node
> > > +under /hypervisor with following parameters:
> > > +
> > > +________________________________________________________________________________
> > > +Name                      | Size   | Description
> > > +================================================================================
> > > +xen,uefi-system-table     | 64-bit | Guest physical address of the UEFI System
> > > +			  |	   | Table.
> > > +--------------------------------------------------------------------------------
> > > +xen,uefi-mmap-start       | 64-bit | Guest physical address of the UEFI memory
> > > +			  |	   | map.
> > > +--------------------------------------------------------------------------------
> > > +xen,uefi-mmap-size        | 32-bit | Size in bytes of the UEFI memory map
> > > +                          |        | pointed to in previous entry.
> > > +--------------------------------------------------------------------------------
> > > +xen,uefi-mmap-desc-size   | 32-bit | Size in bytes of each entry in the UEFI
> > > +                          |        | memory map.
> > > +--------------------------------------------------------------------------------
> > > +xen,uefi-mmap-desc-ver    | 32-bit | Version of the mmap descriptor format.
> > > +--------------------------------------------------------------------------------
> > >  
> > >  Example (assuming #address-cells = <2> and #size-cells = <2>):
> > >  
> > > @@ -22,4 +42,18 @@ hypervisor {
> > >  	compatible = "xen,xen-4.3", "xen,xen";
> > >  	reg = <0 0xb0000000 0 0x20000>;
> > >  	interrupts = <1 15 0xf08>;
> > > +	uefi {
> > > +		xen,uefi-system-table = <0xXXXXXXXX>;
> > > +		xen,uefi-mmap-start = <0xXXXXXXXX>;
> > > +		xen,uefi-mmap-size = <0xXXXXXXXX>;
> > > +		xen,uefi-mmap-desc-size = <0xXXXXXXXX>;
> > > +		xen,uefi-mmap-desc-ver = <0xXXXXXXXX>;
> > > +        };
> > >  };
> > > +
> > > +The format and meaning of these "xen,uefi-*" parameters are similar to those in
> > > +Documentation/arm/uefi.txt which are used by normal UEFI. But to distinguish
> > > +from normal UEFI, for Xen ARM virtual platforms it needs to introduce a Xen
> > > +specific UEFI which requires Xen hypervisor to provide hypercalls for Dom0 to
> > > +make use of the runtime services. Therefore, it defines these parameters under
> > > +/hypervisor node.
> > 
> > Please replace the paragraph with the following which mentions
> > include/xen/interface/platform.h and improves the wording:
> > 
> > "The format and meaning of the "xen,uefi-*" parameters are similar to
> > those in Documentation/arm/uefi.txt, which are provided by the regular
> > UEFI stub. However they differ because they are provided by the Xen
> > hypervisor, together with a set of UEFI runtime services implemented via
> > hypercalls, see include/xen/interface/platform.h."
> 
> I would prefer if we didn't refer to Linux paths here, for the usual
> rationale of keeping bindings distinct from Linux implementation
> details.
> 
> Could we either drop the "see include/xen/interface/platform.h" part, or
> refer to some Xen documentation?

Sure, in fact the canonical headers are the ones in the Xen tree anyway.
We could use the following instead:

http://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,platform.h.html 

[toc] | [prev] | [next] | [standalone]


#1315510 — [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-23 04:30 +0100
Subject[PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen
Message-ID<qTX3J-5bz-39@gated-at.bofh.it>
In reply to#1315506
From: Shannon Zhao <shannon.zhao@linaro.org>

ACPI 6.0 introduces a new table STAO to list the devices which are used
by Xen and can't be used by Dom0. On Xen virtual platforms, the physical
UART is used by Xen. So here it hides UART from Dom0.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net> (supporter:ACPI)
CC: Len Brown <lenb@kernel.org> (supporter:ACPI)
CC: linux-acpi@vger.kernel.org (open list:ACPI)
---
 drivers/acpi/bus.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index a212cef..7f85b54 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -46,6 +46,7 @@ ACPI_MODULE_NAME("bus");
 struct acpi_device *acpi_root;
 struct proc_dir_entry *acpi_root_dir;
 EXPORT_SYMBOL(acpi_root_dir);
+static u64 spcr_uart_addr;
 
 #ifdef CONFIG_X86
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
@@ -105,6 +106,22 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
 	return status;
 }
 
+static bool acpi_check_device_is_ignored(acpi_handle handle)
+{
+	acpi_status status;
+	u64 addr;
+
+	/* Check if it should ignore the UART device */
+	if (spcr_uart_addr != 0) {
+		status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
+					       &addr);
+		if (ACPI_SUCCESS(status) && addr == spcr_uart_addr)
+			return true;
+	}
+
+	return false;
+}
+
 int acpi_bus_get_status(struct acpi_device *device)
 {
 	acpi_status status;
@@ -114,7 +131,8 @@ int acpi_bus_get_status(struct acpi_device *device)
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
-	acpi_set_device_status(device, sta);
+	if (!acpi_check_device_is_ignored(device->handle))
+		acpi_set_device_status(device, sta);
 
 	if (device->status.functional && !device->status.present) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
@@ -1069,6 +1087,8 @@ EXPORT_SYMBOL_GPL(acpi_kobj);
 static int __init acpi_init(void)
 {
 	int result;
+	acpi_status status;
+	struct acpi_table_stao *stao_ptr;
 
 	if (acpi_disabled) {
 		printk(KERN_INFO PREFIX "Interpreter disabled.\n");
@@ -1081,6 +1101,20 @@ static int __init acpi_init(void)
 		acpi_kobj = NULL;
 	}
 
+	/* If there is STAO table, check whether it needs to ignore the UART
+	 * device in SPCR table.
+	 */
+	status = acpi_get_table(ACPI_SIG_STAO, 0,
+				(struct acpi_table_header **)&stao_ptr);
+	if (ACPI_SUCCESS(status) && stao_ptr->ignore_uart) {
+		struct acpi_table_spcr *spcr_ptr;
+
+		status = acpi_get_table(ACPI_SIG_SPCR, 0,
+					(struct acpi_table_header **)&spcr_ptr);
+		if (ACPI_SUCCESS(status))
+			spcr_uart_addr = spcr_ptr->serial_port.address;
+	}
+
 	init_acpi_device_notify();
 	result = acpi_bus_init();
 	if (result) {
-- 
2.0.4

[toc] | [prev] | [next] | [standalone]


#1316627 — Re: [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-25 13:30 +0100
SubjectRe: [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen
Message-ID<qUOrp-3Og-45@gated-at.bofh.it>
In reply to#1315510
On Sat, 23 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> ACPI 6.0 introduces a new table STAO to list the devices which are used
> by Xen and can't be used by Dom0. On Xen virtual platforms, the physical
> UART is used by Xen. So here it hides UART from Dom0.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net> (supporter:ACPI)
> CC: Len Brown <lenb@kernel.org> (supporter:ACPI)
> CC: linux-acpi@vger.kernel.org (open list:ACPI)
> ---
>  drivers/acpi/bus.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index a212cef..7f85b54 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -46,6 +46,7 @@ ACPI_MODULE_NAME("bus");
>  struct acpi_device *acpi_root;
>  struct proc_dir_entry *acpi_root_dir;
>  EXPORT_SYMBOL(acpi_root_dir);
> +static u64 spcr_uart_addr;
>  
>  #ifdef CONFIG_X86
>  #ifdef CONFIG_ACPI_CUSTOM_DSDT
> @@ -105,6 +106,22 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
>  	return status;
>  }
>  
> +static bool acpi_check_device_is_ignored(acpi_handle handle)
> +{
> +	acpi_status status;
> +	u64 addr;
> +
> +	/* Check if it should ignore the UART device */
> +	if (spcr_uart_addr != 0) {
> +		status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
> +					       &addr);
> +		if (ACPI_SUCCESS(status) && addr == spcr_uart_addr)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  int acpi_bus_get_status(struct acpi_device *device)
>  {
>  	acpi_status status;
> @@ -114,7 +131,8 @@ int acpi_bus_get_status(struct acpi_device *device)
>  	if (ACPI_FAILURE(status))
>  		return -ENODEV;
>  
> -	acpi_set_device_status(device, sta);
> +	if (!acpi_check_device_is_ignored(device->handle))
> +		acpi_set_device_status(device, sta);
>  
>  	if (device->status.functional && !device->status.present) {
>  		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
> @@ -1069,6 +1087,8 @@ EXPORT_SYMBOL_GPL(acpi_kobj);
>  static int __init acpi_init(void)
>  {
>  	int result;
> +	acpi_status status;
> +	struct acpi_table_stao *stao_ptr;
>  
>  	if (acpi_disabled) {
>  		printk(KERN_INFO PREFIX "Interpreter disabled.\n");
> @@ -1081,6 +1101,20 @@ static int __init acpi_init(void)
>  		acpi_kobj = NULL;
>  	}
>  
> +	/* If there is STAO table, check whether it needs to ignore the UART
> +	 * device in SPCR table.
> +	 */
> +	status = acpi_get_table(ACPI_SIG_STAO, 0,
> +				(struct acpi_table_header **)&stao_ptr);
> +	if (ACPI_SUCCESS(status) && stao_ptr->ignore_uart) {
> +		struct acpi_table_spcr *spcr_ptr;
> +
> +		status = acpi_get_table(ACPI_SIG_SPCR, 0,
> +					(struct acpi_table_header **)&spcr_ptr);
> +		if (ACPI_SUCCESS(status))
> +			spcr_uart_addr = spcr_ptr->serial_port.address;

else
    printk(KERN_WARNING "STAO table present, but SPCR is missing.\n");

In any case:

Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


> +	}
> +
>  	init_acpi_device_notify();
>  	result = acpi_bus_init();
>  	if (result) {

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web