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


Groups > linux.kernel > #1309909 > unrolled thread

[PATCH v2 00/16] Add ACPI support for Xen Dom0 on ARM64

Started byShannon Zhao <zhaoshenglong@huawei.com>
First post2016-01-15 08:00 +0100
Last post2016-01-19 09:30 +0100
Articles 8 on this page of 28 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 00/16] Add ACPI support for Xen Dom0 on ARM64 Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:00 +0100
    [PATCH v2 01/16] Xen: ACPI: Hide UART used by Xen Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:00 +0100
      Re: [PATCH v2 01/16] Xen: ACPI: Hide UART used by Xen Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-15 16:50 +0100
      Re: [PATCH v2 01/16] Xen: ACPI: Hide UART used by Xen Mark Rutland <mark.rutland@arm.com> - 2016-01-18 11:40 +0100
        Re: [PATCH v2 01/16] Xen: ACPI: Hide UART used by Xen Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-18 12:40 +0100
    [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime services Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:00 +0100
      Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI  runtime services Mark Rutland <mark.rutland@arm.com> - 2016-01-18 12:10 +0100
        Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime  services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-18 18:50 +0100
          Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI  runtime services Mark Rutland <mark.rutland@arm.com> - 2016-01-18 19:30 +0100
            Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime  services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-19 13:10 +0100
              Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI  runtime services Mark Rutland <mark.rutland@arm.com> - 2016-01-19 14:10 +0100
                Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime  services Shannon Zhao <shannon.zhao@linaro.org> - 2016-01-19 14:40 +0100
                  Re: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime  services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-19 15:30 +0100
      Re: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific  UEFI runtime services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-18 18:10 +0100
        Re: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific  UEFI runtime services Shannon Zhao <shannon.zhao@linaro.org> - 2016-01-19 14:20 +0100
          Re: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific  UEFI runtime services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-19 15:30 +0100
        Re: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific  UEFI runtime services Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-22 05:00 +0100
          Re: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific  UEFI runtime services Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-22 12:10 +0100
    [PATCH v2 10/16] ARM: XEN: Move xen_early_init() before efi_init() Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:00 +0100
      Re: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init()  before efi_init() Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-18 16:10 +0100
        Re: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init()  before efi_init() Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-19 09:40 +0100
          Re: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init()  before efi_init() Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-19 13:20 +0100
    [PATCH v2 05/16] xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:10 +0100
    [PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:10 +0100
      Re: [PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to  setup grant table Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-15 18:30 +0100
    [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-15 08:10 +0100
      Re: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq  through HVM_PARAM when booting with ACPI Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2016-01-18 15:40 +0100
        Re: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq through  HVM_PARAM when booting with ACPI Shannon Zhao <zhaoshenglong@huawei.com> - 2016-01-19 09:30 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1312001 — Re: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init() before efi_init()

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-19 09:40 +0100
SubjectRe: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init() before efi_init()
Message-ID<qSzZw-5fh-13@gated-at.bofh.it>
In reply to#1311603

On 2016/1/18 22:59, Stefano Stabellini wrote:
> On Fri, 15 Jan 2016, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> Move xen_early_init() before efi_init(), then when calling efi_init()
>> could initialize Xen specific UEFI.
>>
>> Check if it runs on Xen hypervisor through the flat dts.
>>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>  arch/arm/xen/enlighten.c  | 56 ++++++++++++++++++++++++++++++++++-------------
>>  arch/arm64/kernel/setup.c |  2 +-
>>  2 files changed, 42 insertions(+), 16 deletions(-)
>>
>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>> index 4e78c49..5d0fe68 100644
>> --- a/arch/arm/xen/enlighten.c
>> +++ b/arch/arm/xen/enlighten.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/irqreturn.h>
>>  #include <linux/module.h>
>>  #include <linux/of.h>
>> +#include <linux/of_fdt.h>
>>  #include <linux/of_irq.h>
>>  #include <linux/of_address.h>
>>  #include <linux/cpuidle.h>
>> @@ -52,8 +53,6 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
>>  
>>  static __read_mostly unsigned int xen_events_irq;
>>  
>> -static __initdata struct device_node *xen_node;
>> -
>>  int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
>>  			       unsigned long addr,
>>  			       xen_pfn_t *gfn, int nr,
>> @@ -222,6 +221,33 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
>>  	return IRQ_HANDLED;
>>  }
>>  
>> +static __initdata struct {
>> +	const char *compat;
>> +	const char *prefix;
>> +	const char *version;
>> +	bool found;
>> +} xen_node = {"xen,xen", "xen,xen-", NULL, false};
>> +
>> +static int __init fdt_find_xen_node(unsigned long node, const char *uname,
>> +				    int depth, void *data)
>> +{
>> +	const void *s = NULL;
>> +	int len;
>> +
>> +	if (depth != 1 || strcmp(uname, "hypervisor") != 0)
>> +		return 0;
>> +
>> +	if (of_flat_dt_is_compatible(node, xen_node.compat))
>> +		xen_node.found = true;
>> +
>> +	s = of_get_flat_dt_prop(node, "compatible", &len);
>> +	if (strlen(xen_node.prefix) + 3  < len &&
>> +	    !strncmp(xen_node.prefix, s, strlen(xen_node.prefix)))
>> +		xen_node.version = s + strlen(xen_node.prefix);
>> +
>> +	return 0;
>> +}
>> +
>>  /*
>>   * see Documentation/devicetree/bindings/arm/xen.txt for the
>>   * documentation of the Xen Device Tree format.
>> @@ -229,26 +255,18 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
>>  #define GRANT_TABLE_PHYSADDR 0
>>  void __init xen_early_init(void)
>>  {
>> -	int len;
>> -	const char *s = NULL;
>> -	const char *version = NULL;
>> -	const char *xen_prefix = "xen,xen-";
>> -
>> -	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
>> -	if (!xen_node) {
>> +	of_scan_flat_dt(fdt_find_xen_node, NULL);
>> +	if (!xen_node.found) {
>>  		pr_debug("No Xen support\n");
>>  		return;
>>  	}
>> -	s = of_get_property(xen_node, "compatible", &len);
>> -	if (strlen(xen_prefix) + 3  < len &&
>> -			!strncmp(xen_prefix, s, strlen(xen_prefix)))
>> -		version = s + strlen(xen_prefix);
>> -	if (version == NULL) {
>> +
>> +	if (xen_node.version == NULL) {
>>  		pr_debug("Xen version not found\n");
>>  		return;
>>  	}
> 
> This is going to access data within the fdt, after it has been
> unflattened (by the unflatten_device_tree call). Is that allowed?
> 
> If that's not allowed, then you could copy the version string to
> xen_node.version, rather than just copying the pointer. Otherwise you
> could move the version check entirely within fdt_find_xen_node and
> remove the version field from xen_node.
> 
A little confused. Since here we move xen_early_init before efi_init and
before unflatten_device_tree as well, at this moment in xen_early_init
the fdt is flattened. The xen_node.version is only set in
fdt_find_xen_node and accessed in xen_early_init.

> 
>> -	pr_info("Xen %s support found\n", version);
>> +	pr_info("Xen %s support found\n", xen_node.version);
>>  
>>  	xen_domain_type = XEN_HVM_DOMAIN;
>>  
>> @@ -296,6 +314,14 @@ static int __init xen_guest_init(void)
>>  		}
>>  #endif
>>  	} else {
>> +		struct device_node *xen_node;
>> +
>> +		xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
>> +		if (!xen_node) {
>> +			pr_debug("No Xen support\n");
>> +			return -ENODEV;
>> +		}
> 
> It makes sense to move this into a DT specific init function called from
> xen_guest_init. Also, given that at this point we know that a Xen node
> should be present, it makes sense to return EFAULT on error, instead of
> ENODEV. The error message could be changed to something like: "Xen
> support was detected before, but it has disappeared" and should be
> pr_err.
> 
OK, thanks.
> 
>>  		xen_events_irq = irq_of_parse_and_map(xen_node, 0);
>>  	}
>>  
>> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
>> index 8119479..a4a2878 100644
>> --- a/arch/arm64/kernel/setup.c
>> +++ b/arch/arm64/kernel/setup.c
>> @@ -313,6 +313,7 @@ void __init setup_arch(char **cmdline_p)
>>  	 */
>>  	local_async_enable();
>>  
>> +	xen_early_init();
>>  	efi_init();
>>  	arm64_memblock_init();
>>  
>> @@ -334,7 +335,6 @@ void __init setup_arch(char **cmdline_p)
>>  	} else {
>>  		psci_acpi_init();
>>  	}
>> -	xen_early_init();
>>  
>>  	cpu_read_bootcpu_ops();
>>  	smp_init_cpus();
> 
> .
> 

-- 
Shannon

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


#1312173 — Re: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init() before efi_init()

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-19 13:20 +0100
SubjectRe: [Xen-devel] [PATCH v2 10/16] ARM: XEN: Move xen_early_init() before efi_init()
Message-ID<qSDqq-7IP-9@gated-at.bofh.it>
In reply to#1312001
On Tue, 19 Jan 2016, Shannon Zhao wrote:
> On 2016/1/18 22:59, Stefano Stabellini wrote:
> > On Fri, 15 Jan 2016, Shannon Zhao wrote:
> >> From: Shannon Zhao <shannon.zhao@linaro.org>
> >>
> >> Move xen_early_init() before efi_init(), then when calling efi_init()
> >> could initialize Xen specific UEFI.
> >>
> >> Check if it runs on Xen hypervisor through the flat dts.
> >>
> >> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> >> ---
> >>  arch/arm/xen/enlighten.c  | 56 ++++++++++++++++++++++++++++++++++-------------
> >>  arch/arm64/kernel/setup.c |  2 +-
> >>  2 files changed, 42 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> >> index 4e78c49..5d0fe68 100644
> >> --- a/arch/arm/xen/enlighten.c
> >> +++ b/arch/arm/xen/enlighten.c
> >> @@ -19,6 +19,7 @@
> >>  #include <linux/irqreturn.h>
> >>  #include <linux/module.h>
> >>  #include <linux/of.h>
> >> +#include <linux/of_fdt.h>
> >>  #include <linux/of_irq.h>
> >>  #include <linux/of_address.h>
> >>  #include <linux/cpuidle.h>
> >> @@ -52,8 +53,6 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
> >>  
> >>  static __read_mostly unsigned int xen_events_irq;
> >>  
> >> -static __initdata struct device_node *xen_node;
> >> -
> >>  int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
> >>  			       unsigned long addr,
> >>  			       xen_pfn_t *gfn, int nr,
> >> @@ -222,6 +221,33 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
> >>  	return IRQ_HANDLED;
> >>  }
> >>  
> >> +static __initdata struct {
> >> +	const char *compat;
> >> +	const char *prefix;
> >> +	const char *version;
> >> +	bool found;
> >> +} xen_node = {"xen,xen", "xen,xen-", NULL, false};
> >> +
> >> +static int __init fdt_find_xen_node(unsigned long node, const char *uname,
> >> +				    int depth, void *data)
> >> +{
> >> +	const void *s = NULL;
> >> +	int len;
> >> +
> >> +	if (depth != 1 || strcmp(uname, "hypervisor") != 0)
> >> +		return 0;
> >> +
> >> +	if (of_flat_dt_is_compatible(node, xen_node.compat))
> >> +		xen_node.found = true;
> >> +
> >> +	s = of_get_flat_dt_prop(node, "compatible", &len);
> >> +	if (strlen(xen_node.prefix) + 3  < len &&
> >> +	    !strncmp(xen_node.prefix, s, strlen(xen_node.prefix)))
> >> +		xen_node.version = s + strlen(xen_node.prefix);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >>  /*
> >>   * see Documentation/devicetree/bindings/arm/xen.txt for the
> >>   * documentation of the Xen Device Tree format.
> >> @@ -229,26 +255,18 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
> >>  #define GRANT_TABLE_PHYSADDR 0
> >>  void __init xen_early_init(void)
> >>  {
> >> -	int len;
> >> -	const char *s = NULL;
> >> -	const char *version = NULL;
> >> -	const char *xen_prefix = "xen,xen-";
> >> -
> >> -	xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> >> -	if (!xen_node) {
> >> +	of_scan_flat_dt(fdt_find_xen_node, NULL);
> >> +	if (!xen_node.found) {
> >>  		pr_debug("No Xen support\n");
> >>  		return;
> >>  	}
> >> -	s = of_get_property(xen_node, "compatible", &len);
> >> -	if (strlen(xen_prefix) + 3  < len &&
> >> -			!strncmp(xen_prefix, s, strlen(xen_prefix)))
> >> -		version = s + strlen(xen_prefix);
> >> -	if (version == NULL) {
> >> +
> >> +	if (xen_node.version == NULL) {
> >>  		pr_debug("Xen version not found\n");
> >>  		return;
> >>  	}
> > 
> > This is going to access data within the fdt, after it has been
> > unflattened (by the unflatten_device_tree call). Is that allowed?
> > 
> > If that's not allowed, then you could copy the version string to
> > xen_node.version, rather than just copying the pointer. Otherwise you
> > could move the version check entirely within fdt_find_xen_node and
> > remove the version field from xen_node.
> > 
> A little confused. Since here we move xen_early_init before efi_init and
> before unflatten_device_tree as well, at this moment in xen_early_init
> the fdt is flattened. The xen_node.version is only set in
> fdt_find_xen_node and accessed in xen_early_init.

You are right, sorry, I must have been confused. It might be good to
rename the xen_node variable that this patch introduced in xen_guest_init.



> >> -	pr_info("Xen %s support found\n", version);
> >> +	pr_info("Xen %s support found\n", xen_node.version);
> >>  
> >>  	xen_domain_type = XEN_HVM_DOMAIN;
> >>  
> >> @@ -296,6 +314,14 @@ static int __init xen_guest_init(void)
> >>  		}
> >>  #endif
> >>  	} else {
> >> +		struct device_node *xen_node;
> >> +
> >> +		xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
> >> +		if (!xen_node) {
> >> +			pr_debug("No Xen support\n");
> >> +			return -ENODEV;
> >> +		}
> > 
> > It makes sense to move this into a DT specific init function called from
> > xen_guest_init. Also, given that at this point we know that a Xen node
> > should be present, it makes sense to return EFAULT on error, instead of
> > ENODEV. The error message could be changed to something like: "Xen
> > support was detected before, but it has disappeared" and should be
> > pr_err.
> > 
> OK, thanks.

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


#1309916 — [PATCH v2 05/16] xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-15 08:10 +0100
Subject[PATCH v2 05/16] xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio
Message-ID<qR6Gd-2DL-13@gated-at.bofh.it>
In reply to#1309909
From: Shannon Zhao <shannon.zhao@linaro.org>

Add a new type of Xen map space for Dom0 to map device's MMIO region.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 include/xen/interface/memory.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index 2ecfe4f..9aa8988 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -160,6 +160,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
 #define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
 				    * XENMEM_add_to_physmap_range only.
 				    */
+#define XENMAPSPACE_dev_mmio     5 /* device mmio region */
 
 /*
  * Sets the GPFN at which a particular page appears in the specified guest's
-- 
2.0.4

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


#1309923 — [PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-15 08:10 +0100
Subject[PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table
Message-ID<qR6Ge-2DL-33@gated-at.bofh.it>
In reply to#1309909
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>
---
 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]


#1310303 — Re: [PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-15 18:30 +0100
SubjectRe: [PATCH v2 04/16] arm/xen: Use xen_xlate_map_ballooned_pages to setup grant table
Message-ID<qRgmf-OC-19@gated-at.bofh.it>
In reply to#1309923
On Fri, 15 Jan 2016, Shannon Zhao wrote:
> 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]


#1309924 — [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-15 08:10 +0100
Subject[PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI
Message-ID<qR6Ge-2DL-31@gated-at.bofh.it>
In reply to#1309909
From: Shannon Zhao <shannon.zhao@linaro.org>

When booting with ACPI, it could get the event-channel irq through
HVM_PARAM_CALLBACK_IRQ.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 arch/arm/xen/enlighten.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 6d90a62..4e78c49 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -29,6 +29,7 @@
 #include <linux/time64.h>
 #include <linux/timekeeping.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/acpi.h>
 
 #include <linux/mm.h>
 
@@ -270,7 +271,34 @@ static int __init xen_guest_init(void)
 	if (!xen_domain())
 		return 0;
 
-	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
+	if (!acpi_disabled) {
+#ifdef CONFIG_ACPI
+		struct xen_hvm_param a;
+		int interrupt, trigger, polarity;
+
+		a.domid = DOMID_SELF;
+		a.index = HVM_PARAM_CALLBACK_IRQ;
+		xen_events_irq = 0;
+		if (!HYPERVISOR_hvm_op(HVMOP_get_param, &a)) {
+			if ((a.value >> 56) == 3) {
+				interrupt = a.value & 0xff;
+				trigger = ((a.value >> 8) & 0x1)
+					  ? ACPI_EDGE_SENSITIVE
+					  : ACPI_LEVEL_SENSITIVE;
+				polarity = ((a.value >> 8) & 0x2)
+					  ? ACPI_ACTIVE_LOW
+					  : ACPI_ACTIVE_HIGH;
+				xen_events_irq = acpi_register_gsi(NULL,
+								   interrupt,
+								   trigger,
+								   polarity);
+			}
+		}
+#endif
+	} else {
+		xen_events_irq = irq_of_parse_and_map(xen_node, 0);
+	}
+
 	if (!xen_events_irq) {
 		pr_err("Xen event channel interrupt not found\n");
 		return -ENODEV;
-- 
2.0.4

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


#1311587 — Re: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2016-01-18 15:40 +0100
SubjectRe: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI
Message-ID<qSj8m-1Wu-37@gated-at.bofh.it>
In reply to#1309924
On Fri, 15 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> When booting with ACPI, it could get the event-channel irq through
> HVM_PARAM_CALLBACK_IRQ.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  arch/arm/xen/enlighten.c | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 6d90a62..4e78c49 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -29,6 +29,7 @@
>  #include <linux/time64.h>
>  #include <linux/timekeeping.h>
>  #include <linux/timekeeper_internal.h>
> +#include <linux/acpi.h>
>  
>  #include <linux/mm.h>
>  
> @@ -270,7 +271,34 @@ static int __init xen_guest_init(void)
>  	if (!xen_domain())
>  		return 0;
>  
> -	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> +	if (!acpi_disabled) {
> +#ifdef CONFIG_ACPI

I think it would be best to move the acpi specific and DT specific
initializations out of xen_guest_init. Then at the beginning of
xen_guest_init, call only the one that applies.  The acpi init function
could be ifdef'ed CONFIG_ACPI. Making sure that acpi_disabled is 1 when
!CONFIG_ACPI, we could even avoid all ifdef's from xen_guest_init.

The rest is good, thanks.


> +		struct xen_hvm_param a;
> +		int interrupt, trigger, polarity;
> +
> +		a.domid = DOMID_SELF;
> +		a.index = HVM_PARAM_CALLBACK_IRQ;
> +		xen_events_irq = 0;
> +		if (!HYPERVISOR_hvm_op(HVMOP_get_param, &a)) {
> +			if ((a.value >> 56) == 3) {
> +				interrupt = a.value & 0xff;
> +				trigger = ((a.value >> 8) & 0x1)
> +					  ? ACPI_EDGE_SENSITIVE
> +					  : ACPI_LEVEL_SENSITIVE;
> +				polarity = ((a.value >> 8) & 0x2)
> +					  ? ACPI_ACTIVE_LOW
> +					  : ACPI_ACTIVE_HIGH;
> +				xen_events_irq = acpi_register_gsi(NULL,
> +								   interrupt,
> +								   trigger,
> +								   polarity);
> +			}
> +		}
> +
> +#endif
> +	} else {
> +		xen_events_irq = irq_of_parse_and_map(xen_node, 0);
> +	}
> +
>  	if (!xen_events_irq) {
>  		pr_err("Xen event channel interrupt not found\n");
>  		return -ENODEV;

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


#1311994 — Re: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI

FromShannon Zhao <zhaoshenglong@huawei.com>
Date2016-01-19 09:30 +0100
SubjectRe: [Xen-devel] [PATCH v2 09/16] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI
Message-ID<qSzPP-5c2-3@gated-at.bofh.it>
In reply to#1311587

On 2016/1/18 22:38, Stefano Stabellini wrote:
> On Fri, 15 Jan 2016, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> When booting with ACPI, it could get the event-channel irq through
>> HVM_PARAM_CALLBACK_IRQ.
>>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>  arch/arm/xen/enlighten.c | 30 +++++++++++++++++++++++++++++-
>>  1 file changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>> index 6d90a62..4e78c49 100644
>> --- a/arch/arm/xen/enlighten.c
>> +++ b/arch/arm/xen/enlighten.c
>> @@ -29,6 +29,7 @@
>>  #include <linux/time64.h>
>>  #include <linux/timekeeping.h>
>>  #include <linux/timekeeper_internal.h>
>> +#include <linux/acpi.h>
>>  
>>  #include <linux/mm.h>
>>  
>> @@ -270,7 +271,34 @@ static int __init xen_guest_init(void)
>>  	if (!xen_domain())
>>  		return 0;
>>  
>> -	xen_events_irq = irq_of_parse_and_map(xen_node, 0);
>> +	if (!acpi_disabled) {
>> +#ifdef CONFIG_ACPI
> 
> I think it would be best to move the acpi specific and DT specific
> initializations out of xen_guest_init. Then at the beginning of
> xen_guest_init, call only the one that applies.  The acpi init function
> could be ifdef'ed CONFIG_ACPI. Making sure that acpi_disabled is 1 when
> !CONFIG_ACPI, we could even avoid all ifdef's from xen_guest_init.
> 
Sure, will fix. Thanks.

> The rest is good, thanks.
> 
> 
>> +		struct xen_hvm_param a;
>> +		int interrupt, trigger, polarity;
>> +
>> +		a.domid = DOMID_SELF;
>> +		a.index = HVM_PARAM_CALLBACK_IRQ;
>> +		xen_events_irq = 0;
>> +		if (!HYPERVISOR_hvm_op(HVMOP_get_param, &a)) {
>> +			if ((a.value >> 56) == 3) {
>> +				interrupt = a.value & 0xff;
>> +				trigger = ((a.value >> 8) & 0x1)
>> +					  ? ACPI_EDGE_SENSITIVE
>> +					  : ACPI_LEVEL_SENSITIVE;
>> +				polarity = ((a.value >> 8) & 0x2)
>> +					  ? ACPI_ACTIVE_LOW
>> +					  : ACPI_ACTIVE_HIGH;
>> +				xen_events_irq = acpi_register_gsi(NULL,
>> +								   interrupt,
>> +								   trigger,
>> +								   polarity);
>> +			}
>> +		}
>> +
>> +#endif
>> +	} else {
>> +		xen_events_irq = irq_of_parse_and_map(xen_node, 0);
>> +	}
>> +
>>  	if (!xen_events_irq) {
>>  		pr_err("Xen event channel interrupt not found\n");
>>  		return -ENODEV;
> 
> .
> 

-- 
Shannon

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web