Skip to contentSkip to conversation

(xen) stable/gntdev for 2.6.38

GIT PULL Konrad Rzeszutek Wilk 1 participant 1 message Jan 14, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello Linus,

Please git pull the following git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/gntdev

which has patches since git commit 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5:
Linus Torvalds (1):

      Linux 2.6.37

This patchset includes a driver (/dev/xen/gntdev) and infrastructure changes to allow pages in one guest to be shared with another. In the past this page accounting was done through some horrible hacks in the generic code. This patchset presents a much cleaner approach where we keep track of ownership in Xen MMU code. The drivers/xen/gntdev.c is the main driver for user-space programs (QEMU) to orchestra this. The benefits of this driver is that users can start VM guest with QEMU, or use userspace backends in QEMU.

Daniel De Graaf (1):
xen/gntdev: Fix circular locking dependency

Gerd Hoffmann (1):
xen/gntdev: allow usermode to map granted pages

Ian Campbell (2):
xen: define gnttab_set_map_op/unmap_op
xen: gntdev: move use of GNTMAP_contains_pte next to the map_op

Jeremy Fitzhardinge (5):
xen/gntdev: add VM_PFNMAP to vma
xen: move p2m handling to separate file
xen: add m2p override mechanism
xen/gntdev: stop using "token" argument
xen p2m: clear the old pte when adding a page to m2p_override

Konrad Rzeszutek Wilk (1):
xen/p2m: Fix module linking error.

Stefano Stabellini (3):
xen p2m: transparently change the p2m mappings in the m2p override
xen: introduce gnttab_map_refs and gnttab_unmap_refs xen gntdev: use gnttab_map_refs and gnttab_unmap_refs

 arch/x86/include/asm/xen/page.h |   16 +-
 arch/x86/xen/Makefile           |    3 +-
 arch/x86/xen/mmu.c              |  365 ---------------------
 arch/x86/xen/p2m.c              |  510 ++++++++++++++++++++++++++++++
 drivers/xen/Kconfig             |    7 +
 drivers/xen/Makefile            |    2 +
 drivers/xen/gntdev.c            |  665 +++++++++++++++++++++++++++++++++++++++
 drivers/xen/grant-table.c       |   46 +++
 include/xen/gntdev.h            |  119 +++++++
 include/xen/grant_table.h       |   44 +++-
 10 files changed, 1407 insertions(+), 370 deletions(-)
arch/x86/include/asm/xen/page.h +13 -3
index 8760cc6..f25bdf2 100644
@@ -42,6 +42,11 @@ extern unsigned int   machine_to_phys_order;
 extern unsigned long get_phys_to_machine(unsigned long pfn);
 extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
 
+extern int m2p_add_override(unsigned long mfn, struct page *page);
+extern int m2p_remove_override(struct page *page);
+extern struct page *m2p_find_override(unsigned long mfn);
+extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
+
 static inline unsigned long pfn_to_mfn(unsigned long pfn)
 {
 	unsigned long mfn;
@@ -72,9 +77,6 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
 	if (xen_feature(XENFEAT_auto_translated_physmap))
 		return mfn;
 
-	if (unlikely((mfn >> machine_to_phys_order) != 0))
-		return ~0;
-
 	pfn = 0;
 	/*
 	 * The array access can fail (e.g., device space beyond end of RAM).
@@ -83,6 +85,14 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
 	 */
 	__get_user(pfn, &machine_to_phys_mapping[mfn]);
 
+	/*
+	 * If this appears to be a foreign mfn (because the pfn
+	 * doesn't map back to the mfn), then check the local override
+	 * table to see if there's a better pfn to use.
+	 */
+	if (get_phys_to_machine(pfn) != mfn)
+		pfn = m2p_find_override_pfn(mfn, pfn);
+
 	return pfn;
 }
 
arch/x86/xen/Makefile +2 -1
index 7793851..17c565d 100644
@@ -12,7 +12,8 @@ CFLAGS_mmu.o			:= $(nostackp)
 
 obj-y		:= enlighten.o setup.o multicalls.o mmu.o irq.o \
 			time.o xen-asm.o xen-asm_$(BITS).o \
-			grant-table.o suspend.o platform-pci-unplug.o
+			grant-table.o suspend.o platform-pci-unplug.o \
+			p2m.o
 
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
arch/x86/xen/mmu.c +0 -365

371 lines not on this page · raw message

arch/x86/xen/p2m.c new file +510 -0

510 lines not on this page · raw message

drivers/xen/Kconfig +7 -0
index 6e6180c..bd3095f 100644
@@ -62,6 +62,13 @@ config XEN_SYS_HYPERVISOR
 	 virtual environment, /sys/hypervisor will still be present,
 	 but will have no xen contents.
 
+config XEN_GNTDEV
+	tristate "userspace grant access device driver"
+	depends on XEN
+	select MMU_NOTIFIER
+	help
+	  Allows userspace processes to use grants.
+
 config XEN_PLATFORM_PCI
 	tristate "xen platform pci device driver"
 	depends on XEN_PVHVM
drivers/xen/Makefile +2 -0
index 533a199..674fdb5 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_HOTPLUG_CPU)	+= cpu_hotplug.o
 obj-$(CONFIG_XEN_XENCOMM)	+= xencomm.o
 obj-$(CONFIG_XEN_BALLOON)	+= balloon.o
 obj-$(CONFIG_XEN_DEV_EVTCHN)	+= xen-evtchn.o
+obj-$(CONFIG_XEN_GNTDEV)	+= xen-gntdev.o
 obj-$(CONFIG_XENFS)		+= xenfs/
 obj-$(CONFIG_XEN_SYS_HYPERVISOR)	+= sys-hypervisor.o
 obj-$(CONFIG_XEN_PLATFORM_PCI)	+= platform-pci.o
@@ -16,4 +17,5 @@ obj-$(CONFIG_SWIOTLB_XEN)	+= swiotlb-xen.o
 obj-$(CONFIG_XEN_DOM0)		+= pci.o
 
 xen-evtchn-y			:= evtchn.o
+xen-gntdev-y				:= gntdev.o
 
drivers/xen/gntdev.c new file +665 -0

665 lines not on this page · raw message

drivers/xen/grant-table.c +46 -0

52 lines not on this page · raw message

include/xen/gntdev.h new file +119 -0

119 lines not on this page · raw message

include/xen/grant_table.h +43 -1

63 lines not on this page · raw message