xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback
@ 2012-07-04 11:14 Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 1/5] xen/arm: initialize grant_table on ARM Stefano Stabellini
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:14 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, Stefano Stabellini, Ian Campbell, David Vrabel

Hi all,
this patch series initializes the grant_table and xenbus on ARM.
It also get blkfront and blkback to compile and run properly.

With this patch series and the corresponding xen patch series applied, I
am able to boot a Linux domU with a root filesystem on a xen PV disk.


Stefano Stabellini (5):
      xen/arm: initialize grant_table on ARM
      xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL
      xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree
      xen: allow privcmd for hvm guests
      xen/arm: compile blkfront and blkback

 arch/arm/include/asm/hypervisor.h    |    6 +++++
 arch/arm/xen/enlighten.c             |   39 +++++++++++++++++++++++++++++++++-
 drivers/block/xen-blkback/blkback.c  |    1 +
 drivers/block/xen-blkfront.c         |    1 +
 drivers/xen/grant-table.c            |    2 +-
 drivers/xen/xenfs/privcmd.c          |    7 ------
 include/xen/interface/hvm/params.h   |    4 ++-
 include/xen/interface/io/protocols.h |    3 ++
 8 files changed, 53 insertions(+), 10 deletions(-)


git://xenbits.xen.org/people/sstabellini/linux-pvhvm.git xenarmv7-3

Cheers,

Stefano

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

* [PATCH WIP 1/5] xen/arm: initialize grant_table on ARM
  2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
@ 2012-07-04 11:15 ` Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL Stefano Stabellini
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:15 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, stefano.stabellini, Ian.Campbell, david.vrabel

Initialize the grant table mapping it at HVM_PARAM_GRANT_START_PFN.
After the grant table is initialized, call xenbus_probe (if not dom0).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/enlighten.c           |   18 ++++++++++++++++++
 drivers/xen/grant-table.c          |    2 +-
 include/xen/interface/hvm/params.h |    4 +++-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index ddacecf..6901e37 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -1,9 +1,13 @@
 #include <xen/xen.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/memory.h>
+#include <xen/interface/hvm/params.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
 #include <xen/features.h>
+#include <xen/grant_table.h>
+#include <xen/hvm.h>
+#include <xen/xenbus.h>
 
 #include <linux/module.h>
 
@@ -133,6 +137,7 @@ static void __init xen_hvm_init_shared_info(void)
 	int cpu;
 	struct xen_add_to_physmap xatp;
 	static struct shared_info *shared_info_page = 0;
+	uint64_t val;
 
 	xen_setup_features();
 	if (xen_feature(XENFEAT_dom0))
@@ -171,6 +176,19 @@ static void __init xen_hvm_init_shared_info(void)
 	for_each_online_cpu(cpu) {
 		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
 	}
+
+	if (!xen_hvm_resume_frames) {
+		if (hvm_get_parameter(HVM_PARAM_GRANT_START_PFN, &val) >= 0)
+			xen_hvm_resume_frames = val << PAGE_SHIFT;
+		else {
+			printk(KERN_ERR "error getting "
+					"HVM_PARAM_GRANT_START_PFN");
+			return;
+		}
+	}
+	gnttab_init();
+	if (!xen_initial_domain())
+		xenbus_probe(NULL);
 }
 core_initcall(xen_hvm_init_shared_info);
 
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index db3964b..766fc35 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -58,7 +58,7 @@
 
 static grant_ref_t **gnttab_list;
 static unsigned int nr_grant_frames;
-static unsigned int boot_max_nr_grant_frames;
+static unsigned int boot_max_nr_grant_frames = 1;
 static int gnttab_free_count;
 static grant_ref_t gnttab_free_head;
 static DEFINE_SPINLOCK(gnttab_list_lock);
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
index 1b4f923..e51269b 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -94,6 +94,8 @@
 #define HVM_PARAM_CONSOLE_PFN    17
 #define HVM_PARAM_CONSOLE_EVTCHN 18
 
-#define HVM_NR_PARAMS          19
+#define HVM_PARAM_GRANT_START_PFN 30
+
+#define HVM_NR_PARAMS          31
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
-- 
1.7.2.5

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

* [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL
  2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 1/5] xen/arm: initialize grant_table on ARM Stefano Stabellini
@ 2012-07-04 11:15 ` Stefano Stabellini
  2012-07-04 11:25   ` David Vrabel
  2012-07-04 11:15 ` [PATCH WIP 3/5] xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree Stefano Stabellini
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:15 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, stefano.stabellini, Ian.Campbell, david.vrabel

Set xen_platform_pci_unplug to XEN_UNPLUG_ALL by default to make
blkfront happy. The parameter doesn't make sense on ARM and should be
removed.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/enlighten.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 6901e37..a6dc9eb 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -8,6 +8,7 @@
 #include <xen/grant_table.h>
 #include <xen/hvm.h>
 #include <xen/xenbus.h>
+#include <xen/platform_pci.h>
 
 #include <linux/module.h>
 
@@ -33,7 +34,7 @@ __read_mostly int xen_have_vector_callback;
 EXPORT_SYMBOL_GPL(xen_have_vector_callback);
 
 /* XXX: to be removed */
-int xen_platform_pci_unplug;
+int xen_platform_pci_unplug = XEN_UNPLUG_ALL;
 EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
 
 #define FOREIGN_MAP_BUFFER 0x90000000UL
-- 
1.7.2.5

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

* [PATCH WIP 3/5] xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree
  2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 1/5] xen/arm: initialize grant_table on ARM Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL Stefano Stabellini
@ 2012-07-04 11:15 ` Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 4/5] xen: allow privcmd for hvm guests Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 5/5] xen/arm: compile blkfront and blkback Stefano Stabellini
  4 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:15 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, stefano.stabellini, Ian.Campbell, david.vrabel

Only until we get the balloon driver to work.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/enlighten.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index a6dc9eb..924c9aa 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -199,3 +199,21 @@ int __init xen_guest_init(void)
 	return 0;
 }
 EXPORT_SYMBOL(xen_guest_init);
+
+/* XXX: only until balloon is properly working */
+int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem)
+{
+	*pages = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL,
+			get_order(nr_pages));
+	if (*pages == NULL)
+		return -ENOMEM;
+	return 0;
+}
+EXPORT_SYMBOL(alloc_xenballooned_pages);
+
+void free_xenballooned_pages(int nr_pages, struct page **pages)
+{
+	kfree(*pages);
+	*pages = NULL;
+}
+EXPORT_SYMBOL(free_xenballooned_pages);
-- 
1.7.2.5

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

* [PATCH WIP 4/5] xen: allow privcmd for hvm guests
  2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
                   ` (2 preceding siblings ...)
  2012-07-04 11:15 ` [PATCH WIP 3/5] xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree Stefano Stabellini
@ 2012-07-04 11:15 ` Stefano Stabellini
  2012-07-04 11:15 ` [PATCH WIP 5/5] xen/arm: compile blkfront and blkback Stefano Stabellini
  4 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:15 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, stefano.stabellini, Ian.Campbell, david.vrabel

Ian's initial XENMAPSPACE_gmfn_foreign implementation is enough to get
privcmd mmap to work for XENFEAT_auto_translated_physmap guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 drivers/xen/xenfs/privcmd.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c
index c200b49..5c2b9e9 100644
--- a/drivers/xen/xenfs/privcmd.c
+++ b/drivers/xen/xenfs/privcmd.c
@@ -387,13 +387,6 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	//printk(KERN_CRIT "privcmd_mmap\n");
 
-	/* Unsupported for auto-translate guests. */
-	if (xen_feature(XENFEAT_auto_translated_physmap))
-	{
-		printk(KERN_CRIT "privcmd_mmap -- no auto translated..\n");
-		return -ENOSYS;
-	}
-
 	/* DONTCOPY is essential for Xen because copy_page_range doesn't know
 	 * how to recreate these mappings */
 	vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
-- 
1.7.2.5

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

* [PATCH WIP 5/5] xen/arm: compile blkfront and blkback
  2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
                   ` (3 preceding siblings ...)
  2012-07-04 11:15 ` [PATCH WIP 4/5] xen: allow privcmd for hvm guests Stefano Stabellini
@ 2012-07-04 11:15 ` Stefano Stabellini
  4 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:15 UTC (permalink / raw)
  To: xen-devel; +Cc: linux-kernel, stefano.stabellini, Ian.Campbell, david.vrabel

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/include/asm/hypervisor.h    |    6 ++++++
 drivers/block/xen-blkback/blkback.c  |    1 +
 drivers/block/xen-blkfront.c         |    1 +
 include/xen/interface/io/protocols.h |    3 +++
 4 files changed, 11 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/hypervisor.h

diff --git a/arch/arm/include/asm/hypervisor.h b/arch/arm/include/asm/hypervisor.h
new file mode 100644
index 0000000..b90d9e5
--- /dev/null
+++ b/arch/arm/include/asm/hypervisor.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_ARM_HYPERVISOR_H
+#define _ASM_ARM_HYPERVISOR_H
+
+#include <asm/xen/hypervisor.h>
+
+#endif
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index fbffdf0..78ce4c0 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -45,6 +45,7 @@
 
 #include <xen/events.h>
 #include <xen/page.h>
+#include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
 #include "common.h"
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9fd3ee2..dd1589e 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -56,6 +56,7 @@
 #include <xen/interface/io/protocols.h>
 
 #include <asm/xen/hypervisor.h>
+#include <asm/xen/mmu.h>
 
 enum blkif_state {
 	BLKIF_STATE_DISCONNECTED,
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
index 01fc8ae..e85cc64 100644
--- a/include/xen/interface/io/protocols.h
+++ b/include/xen/interface/io/protocols.h
@@ -5,6 +5,7 @@
 #define XEN_IO_PROTO_ABI_X86_64     "x86_64-abi"
 #define XEN_IO_PROTO_ABI_IA64       "ia64-abi"
 #define XEN_IO_PROTO_ABI_POWERPC64  "powerpc64-abi"
+#define XEN_IO_PROTO_ABI_ARM	    "arm-abi"
 
 #if defined(__i386__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -14,6 +15,8 @@
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
 #elif defined(__powerpc64__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
+#elif defined(__arm__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
 #else
 # error arch fixup needed here
 #endif
-- 
1.7.2.5

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

* Re: [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL
  2012-07-04 11:15 ` [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL Stefano Stabellini
@ 2012-07-04 11:25   ` David Vrabel
  2012-07-04 11:27     ` Stefano Stabellini
  0 siblings, 1 reply; 9+ messages in thread
From: David Vrabel @ 2012-07-04 11:25 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
	Ian Campbell

On 04/07/12 12:15, Stefano Stabellini wrote:
> Set xen_platform_pci_unplug to XEN_UNPLUG_ALL by default to make
> blkfront happy. The parameter doesn't make sense on ARM and should be
> removed.

Why is this parameter nonsensical on ARM?  ARM systems can have PCI devices.

David

> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>  arch/arm/xen/enlighten.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 6901e37..a6dc9eb 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -8,6 +8,7 @@
>  #include <xen/grant_table.h>
>  #include <xen/hvm.h>
>  #include <xen/xenbus.h>
> +#include <xen/platform_pci.h>
>  
>  #include <linux/module.h>
>  
> @@ -33,7 +34,7 @@ __read_mostly int xen_have_vector_callback;
>  EXPORT_SYMBOL_GPL(xen_have_vector_callback);
>  
>  /* XXX: to be removed */
> -int xen_platform_pci_unplug;
> +int xen_platform_pci_unplug = XEN_UNPLUG_ALL;
>  EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
>  
>  #define FOREIGN_MAP_BUFFER 0x90000000UL

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

* Re: [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL
  2012-07-04 11:25   ` David Vrabel
@ 2012-07-04 11:27     ` Stefano Stabellini
  2012-07-04 11:49       ` Ian Campbell
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2012-07-04 11:27 UTC (permalink / raw)
  To: David Vrabel
  Cc: Stefano Stabellini, xen-devel@lists.xensource.com,
	linux-kernel@vger.kernel.org, Ian Campbell

On Wed, 4 Jul 2012, David Vrabel wrote:
> On 04/07/12 12:15, Stefano Stabellini wrote:
> > Set xen_platform_pci_unplug to XEN_UNPLUG_ALL by default to make
> > blkfront happy. The parameter doesn't make sense on ARM and should be
> > removed.
> 
> Why is this parameter nonsensical on ARM?  ARM systems can have PCI devices.

Because we shouldn't assume the presence of a PCI bus on ARM. Moreover
it would be nice to avoid the ugly unplug protocol entirely if we can.

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

* Re: [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL
  2012-07-04 11:27     ` Stefano Stabellini
@ 2012-07-04 11:49       ` Ian Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Campbell @ 2012-07-04 11:49 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: David Vrabel, xen-devel@lists.xensource.com,
	linux-kernel@vger.kernel.org

On Wed, 2012-07-04 at 12:27 +0100, Stefano Stabellini wrote:
> On Wed, 4 Jul 2012, David Vrabel wrote:
> > On 04/07/12 12:15, Stefano Stabellini wrote:
> > > Set xen_platform_pci_unplug to XEN_UNPLUG_ALL by default to make
> > > blkfront happy. The parameter doesn't make sense on ARM and should be
> > > removed.
> > 
> > Why is this parameter nonsensical on ARM?  ARM systems can have PCI devices.
> 
> Because we shouldn't assume the presence of a PCI bus on ARM. Moreover
> it would be nice to avoid the ugly unplug protocol entirely if we can.

Also "pci" here refers to the "platform_pci" device not to PCI devices
in general.

SO I think this option is indeed nonsensical at least until such a time
as we have HVM like ARM guests (i.e. ones with a DM emulating specific
platforms) which require a PCI device which serves as the "you are
running under Xen" hook intp to the non-PV aware OSes driver subsystem.
And it's not clear that when we have such guests that a platform pci
device will be the correct solution on ARM anyway.

Ian.

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

end of thread, other threads:[~2012-07-04 11:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04 11:14 [PATCH WIP 0/5] xen/arm: grant_table, blkfront and blkback Stefano Stabellini
2012-07-04 11:15 ` [PATCH WIP 1/5] xen/arm: initialize grant_table on ARM Stefano Stabellini
2012-07-04 11:15 ` [PATCH WIP 2/5] xen/arm: set xen_platform_pci_unplug to XEN_UNPLUG_ALL Stefano Stabellini
2012-07-04 11:25   ` David Vrabel
2012-07-04 11:27     ` Stefano Stabellini
2012-07-04 11:49       ` Ian Campbell
2012-07-04 11:15 ` [PATCH WIP 3/5] xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree Stefano Stabellini
2012-07-04 11:15 ` [PATCH WIP 4/5] xen: allow privcmd for hvm guests Stefano Stabellini
2012-07-04 11:15 ` [PATCH WIP 5/5] xen/arm: compile blkfront and blkback Stefano Stabellini

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