All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	linux-efi@vger.kernel.org, ian.campbell@citrix.com,
	ard.biesheuvel@linaro.org,
	Matt Fleming <matt@codeblueprint.co.uk>,
	catalin.marinas@arm.com, will.deacon@arm.com,
	linux-kernel@vger.kernel.org, xen-devel@lists.xen.org,
	julien.grall@citrix.com, stefano.stabellini@citrix.com,
	david.vrabel@citrix.com, peter.huangpeng@huawei.com,
	linux-arm-kernel@lists.infradead.org, shannon.zhao@linaro.org
Subject: Re: [PATCH v3 17/17] Xen: EFI: Parse DT parameters for Xen specific UEFI
Date: Tue, 26 Jan 2016 11:41:54 +0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1601261141130.3619__30386.2442415722$1453808608$gmane$org@kaball.uk.xensource.com> (raw)
In-Reply-To: <1453519184-11908-18-git-send-email-zhaoshenglong@huawei.com>

On Sat, 23 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> Add a new function to parse DT parameters for Xen specific UEFI just
> like the way for normal UEFI. Then it could reuse the existing codes.
> 
> If Xen supports EFI, initialize runtime services.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

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


> CC: Matt Fleming <matt@codeblueprint.co.uk>
> ---
>  arch/arm/xen/enlighten.c   |  6 ++++++
>  arch/arm64/kernel/efi.c    | 17 ++++++++++++-----
>  drivers/firmware/efi/efi.c | 45 ++++++++++++++++++++++++++++++++++++++-------
>  3 files changed, 56 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index cdc0bd2..608d735 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -245,6 +245,12 @@ static int __init fdt_find_hyper_node(unsigned long node, const char *uname,
>  	    !strncmp(hyper_node.prefix, s, strlen(hyper_node.prefix)))
>  		hyper_node.version = s + strlen(hyper_node.prefix);
>  
> +	if (IS_ENABLED(CONFIG_XEN_EFI)) {
> +		/* Check if Xen supports EFI */
> +		if (of_get_flat_dt_subnode_by_name(node, "uefi") > 0)
> +			set_bit(EFI_PARAVIRT, &efi.flags);
> +	}
> +
>  	return 0;
>  }
>  
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index 4eeb171..3c46129 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -33,6 +33,7 @@
>  #include <asm/mmu_context.h>
>  #include <asm/mmu.h>
>  #include <asm/pgtable.h>
> +#include <asm/xen/xen-ops.h>
>  
>  struct efi_memory_map memmap;
>  
> @@ -308,13 +309,19 @@ static int __init arm64_enable_runtime_services(void)
>  	}
>  	set_bit(EFI_SYSTEM_TABLES, &efi.flags);
>  
> -	if (!efi_virtmap_init()) {
> -		pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n");
> -		return -ENOMEM;
> +	if (IS_ENABLED(CONFIG_XEN_EFI) && efi_enabled(EFI_PARAVIRT)) {
> +		/* Set up runtime services function pointers for Xen Dom0 */
> +		xen_efi_runtime_setup();
> +	} else {
> +		if (!efi_virtmap_init()) {
> +			pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n");
> +			return -ENOMEM;
> +		}
> +
> +		/* Set up runtime services function pointers */
> +		efi_native_runtime_setup();
>  	}
>  
> -	/* Set up runtime services function pointers */
> -	efi_native_runtime_setup();
>  	set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
>  
>  	efi.runtime_version = efi.systab->hdr.revision;
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 027ca21..bdcf6d7 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -498,12 +498,14 @@ device_initcall(efi_load_efivars);
>  		FIELD_SIZEOF(struct efi_fdt_params, field) \
>  	}
>  
> -static __initdata struct {
> +struct params {
>  	const char name[32];
>  	const char propname[32];
>  	int offset;
>  	int size;
> -} dt_params[] = {
> +};
> +
> +static struct params fdt_params[] __initdata = {
>  	UEFI_PARAM("System Table", "linux,uefi-system-table", system_table),
>  	UEFI_PARAM("MemMap Address", "linux,uefi-mmap-start", mmap),
>  	UEFI_PARAM("MemMap Size", "linux,uefi-mmap-size", mmap_size),
> @@ -511,24 +513,45 @@ static __initdata struct {
>  	UEFI_PARAM("MemMap Desc. Version", "linux,uefi-mmap-desc-ver", desc_ver)
>  };
>  
> +static struct params xen_fdt_params[] __initdata = {
> +	UEFI_PARAM("System Table", "xen,uefi-system-table", system_table),
> +	UEFI_PARAM("MemMap Address", "xen,uefi-mmap-start", mmap),
> +	UEFI_PARAM("MemMap Size", "xen,uefi-mmap-size", mmap_size),
> +	UEFI_PARAM("MemMap Desc. Size", "xen,uefi-mmap-desc-size", desc_size),
> +	UEFI_PARAM("MemMap Desc. Version", "xen,uefi-mmap-desc-ver", desc_ver)
> +};
> +
>  struct param_info {
>  	int found;
>  	void *params;
> +	struct params *dt_params;
> +	int size;
>  };
>  
>  static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
>  				       int depth, void *data)
>  {
>  	struct param_info *info = data;
> +	struct params *dt_params = info->dt_params;
>  	const void *prop;
>  	void *dest;
>  	u64 val;
> -	int i, len;
> +	int i, len, offset;
>  
> -	if (depth != 1 || strcmp(uname, "chosen") != 0)
> -		return 0;
> +	if (efi_enabled(EFI_PARAVIRT)) {
> +		if (depth != 1 || strcmp(uname, "hypervisor") != 0)
> +			return 0;
>  
> -	for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
> +		offset = of_get_flat_dt_subnode_by_name(node, "uefi");
> +		if (offset < 0)
> +			return 0;
> +		node = offset;
> +	} else {
> +		if (depth != 1 || strcmp(uname, "chosen") != 0)
> +			return 0;
> +	}
> +
> +	for (i = 0; i < info->size; i++) {
>  		prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len);
>  		if (!prop)
>  			return 0;
> @@ -559,12 +582,20 @@ int __init efi_get_fdt_params(struct efi_fdt_params *params)
>  	info.found = 0;
>  	info.params = params;
>  
> +	if (efi_enabled(EFI_PARAVIRT)) {
> +		info.dt_params = xen_fdt_params;
> +		info.size = ARRAY_SIZE(xen_fdt_params);
> +	} else {
> +		info.dt_params = fdt_params;
> +		info.size = ARRAY_SIZE(fdt_params);
> +	}
> +
>  	ret = of_scan_flat_dt(fdt_find_uefi_params, &info);
>  	if (!info.found)
>  		pr_info("UEFI not found.\n");
>  	else if (!ret)
>  		pr_err("Can't find '%s' in device tree!\n",
> -		       dt_params[info.found].name);
> +		       info.dt_params[info.found].name);
>  
>  	return ret;
>  }
> -- 
> 2.0.4
> 
> 

  parent reply	other threads:[~2016-01-26 11:41 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23  3:19 [PATCH v3 00/17] Add ACPI support for Xen Dom0 on ARM64 Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 01/17] Xen: ACPI: Hide UART used by Xen Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 12:20   ` Stefano Stabellini
2016-01-25 12:20     ` Stefano Stabellini
2016-01-25 12:20     ` Stefano Stabellini
2016-01-25 12:20   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 02/17] xen/grant-table: Move xlated_setup_gnttab_pages to common place Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 03/17] Xen: xlate: Use page_to_xen_pfn instead of page_to_pfn Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 13:55   ` Stefano Stabellini
2016-01-25 13:55   ` Stefano Stabellini
2016-01-25 13:55     ` Stefano Stabellini
2016-01-25 13:55     ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 04/17] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 05/17] xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 06/17] Xen: ARM: Add support for mapping platform device mmio Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 07/17] Xen: ARM: Add support for mapping AMBA " Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 08/17] Xen: public/hvm: sync changes of HVM_PARAM_CALLBACK_VIA ABI from Xen Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:06   ` Stefano Stabellini
2016-01-25 15:06     ` Stefano Stabellini
2016-01-25 15:06     ` Stefano Stabellini
2016-01-25 15:06   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 09/17] xen/hvm/params: Add a new delivery type for event-channel in HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:08   ` Stefano Stabellini
2016-01-25 15:08   ` Stefano Stabellini
2016-01-25 15:08     ` Stefano Stabellini
2016-01-25 15:08     ` Stefano Stabellini
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19 ` [PATCH v3 10/17] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:19   ` Stefano Stabellini
2016-01-25 15:19   ` Stefano Stabellini
2016-01-25 15:19     ` Stefano Stabellini
2016-01-25 15:19     ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 11/17] ARM: XEN: Move xen_early_init() before efi_init() Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:25   ` Stefano Stabellini
2016-01-25 15:25     ` Stefano Stabellini
2016-01-25 15:25     ` Stefano Stabellini
2016-01-25 15:25   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 12/17] ARM64: ACPI: Check if it runs on Xen to enable or disable ACPI Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:32   ` Stefano Stabellini
2016-01-25 15:32     ` Stefano Stabellini
2016-01-25 15:32     ` Stefano Stabellini
2016-01-25 15:32   ` Stefano Stabellini
2016-01-27  8:27   ` Hanjun Guo
2016-01-27  8:27     ` Hanjun Guo
2016-01-27  8:57     ` Shannon Zhao
2016-01-27  8:57       ` Shannon Zhao
2016-01-27  8:57       ` Shannon Zhao
2016-01-27  8:57     ` Shannon Zhao
2016-01-27  8:27   ` Hanjun Guo
2016-01-23  3:19 ` [PATCH v3 13/17] ARM: Xen: Document UEFI support on Xen ARM virtual platforms Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 15:50   ` Stefano Stabellini
2016-01-25 15:50     ` Stefano Stabellini
2016-01-25 15:50     ` Stefano Stabellini
2016-01-25 15:59     ` Mark Rutland
2016-01-25 15:59       ` Mark Rutland
2016-01-25 15:59       ` Mark Rutland
2016-01-25 16:06       ` Stefano Stabellini
2016-01-25 16:06       ` Stefano Stabellini
2016-01-25 16:06         ` Stefano Stabellini
2016-01-25 16:06         ` Stefano Stabellini
2016-01-25 15:50   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 14/17] XEN: EFI: Move x86 specific codes to architecture directory Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 16:44   ` Stefano Stabellini
2016-01-25 16:44     ` Stefano Stabellini
2016-01-25 16:44     ` Stefano Stabellini
2016-01-26  8:16     ` Shannon Zhao
2016-01-26  8:16     ` Shannon Zhao
2016-01-26  8:16       ` Shannon Zhao
2016-01-26  8:16       ` Shannon Zhao
2016-01-26 11:31       ` Stefano Stabellini
2016-01-26 11:31         ` Stefano Stabellini
2016-01-26 11:31         ` Stefano Stabellini
2016-01-26 12:26         ` Shannon Zhao
2016-01-26 12:26         ` Shannon Zhao
2016-01-26 12:26           ` Shannon Zhao
2016-01-26 12:26           ` Shannon Zhao
2016-01-26 11:31       ` Stefano Stabellini
2016-01-25 16:44   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 15/17] ARM64: XEN: Add a function to initialize Xen specific UEFI runtime services Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-25 16:47   ` Stefano Stabellini
2016-01-25 16:47   ` Stefano Stabellini
2016-01-25 16:47     ` Stefano Stabellini
2016-01-25 16:47     ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 16/17] FDT: Add a helper to get specified name subnode Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-26 12:11   ` Stefano Stabellini
2016-01-26 12:11     ` Stefano Stabellini
2016-01-26 12:11     ` Stefano Stabellini
2016-01-26 12:27     ` Shannon Zhao
2016-01-26 12:27     ` Shannon Zhao
2016-01-26 12:27       ` Shannon Zhao
2016-01-26 12:27       ` Shannon Zhao
2016-01-26 12:11   ` Stefano Stabellini
2016-01-23  3:19 ` [PATCH v3 17/17] Xen: EFI: Parse DT parameters for Xen specific UEFI Shannon Zhao
2016-01-23  3:19 ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-23  3:19   ` Shannon Zhao
2016-01-26 11:41   ` Stefano Stabellini
2016-01-26 11:41     ` Stefano Stabellini
2016-01-26 11:41     ` Stefano Stabellini
2016-01-26 11:41   ` Stefano Stabellini [this message]
2016-01-26 12:05   ` Matt Fleming
2016-01-26 12:05     ` Matt Fleming
2016-01-26 12:05   ` Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='alpine.DEB.2.02.1601261141130.3619__30386.2442415722$1453808608$gmane$org@kaball.uk.xensource.com' \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=david.vrabel@citrix.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=will.deacon@arm.com \
    --cc=xen-devel@lists.xen.org \
    --cc=zhaoshenglong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.