[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] [PATCH 2/3] [read-only mapping] GNTMAP_readonly support linux part


 2 / 3 
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Node ID fcbf18aa1c7df039f01da6b5aca9343f59b072ac
# Parent  810b3f0491cef6f47496007366daccda57829d7d
add read only mapping support.
PATCHNAME: read_only_mapping_linux

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 810b3f0491ce -r fcbf18aa1c7d linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed May 24 17:25:38 2006 +0900
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed May 24 17:25:39 2006 +0900
@@ -314,12 +314,6 @@ gnttab_map_grant_ref_pre(struct gnttab_m
 	uint32_t flags;
 
 	flags = uop->flags;
-	if (flags & GNTMAP_readonly) {
-#if 0
-		xprintd("GNTMAP_readonly is not supported yet\n");
-#endif
-		flags &= ~GNTMAP_readonly;
-	}
 
 	if (flags & GNTMAP_host_map) {
 		if (flags & GNTMAP_application_map) {
@@ -517,6 +511,7 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
 	int error = 0;
 	struct xen_ia64_privcmd_entry* entry = &privcmd_range->entries[i];
 	unsigned long gpfn;
+	unsigned long flags;
 
 	BUG_ON((addr & ~PAGE_MASK) != 0);
 	BUG_ON(mfn == INVALID_MFN);
@@ -527,8 +522,11 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
 	}
 	gpfn = (privcmd_range->res->start >> PAGE_SHIFT) + i;
 
-	error = HYPERVISOR_add_physmap(gpfn, mfn, 0/* prot:XXX */,
-				       domid);
+	flags = ASSIGN_writable;
+	if (pgprot_val(prot) == PROT_READ) {
+		flags = ASSIGN_readonly;
+	}
+	error = HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
 	if (error != 0) {
 		goto out;
 	}
diff -r 810b3f0491ce -r fcbf18aa1c7d linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Wed May 24 17:25:38 2006 +0900
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Wed May 24 17:25:39 2006 +0900
@@ -494,7 +494,7 @@ HYPERVISOR_zap_physmap(unsigned long gpf
 
 static inline unsigned long
 __HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
-			 unsigned int flags, domid_t domid)
+			 unsigned long flags, domid_t domid)
 {
 	return _hypercall_imm4(unsigned long, ia64_dom0vp_op,
 			       IA64_DOM0VP_add_physmap, gpfn, mfn, flags,
@@ -503,7 +503,7 @@ __HYPERVISOR_add_physmap(unsigned long g
 
 static inline unsigned long
 HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
-		       unsigned int flags, domid_t domid)
+		       unsigned long flags, domid_t domid)
 {
 	unsigned long ret = 0;
 	BUG_ON(!running_on_xen);//XXX
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


This mailing list archive is a service of Copilotco.