ia64/xen-unstable

changeset 10153:5674e4fe8f02

[IA64] GNTMAP_readonly support linux part

add read only mapping support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Wed May 24 10:59:28 2006 -0600 (2006-05-24)
parents 40959bc0a269
children c7e8d1673140
files linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed May 24 10:56:47 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed May 24 10:59:28 2006 -0600
     1.3 @@ -314,12 +314,6 @@ gnttab_map_grant_ref_pre(struct gnttab_m
     1.4  	uint32_t flags;
     1.5  
     1.6  	flags = uop->flags;
     1.7 -	if (flags & GNTMAP_readonly) {
     1.8 -#if 0
     1.9 -		xprintd("GNTMAP_readonly is not supported yet\n");
    1.10 -#endif
    1.11 -		flags &= ~GNTMAP_readonly;
    1.12 -	}
    1.13  
    1.14  	if (flags & GNTMAP_host_map) {
    1.15  		if (flags & GNTMAP_application_map) {
    1.16 @@ -517,6 +511,7 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
    1.17  	int error = 0;
    1.18  	struct xen_ia64_privcmd_entry* entry = &privcmd_range->entries[i];
    1.19  	unsigned long gpfn;
    1.20 +	unsigned long flags;
    1.21  
    1.22  	BUG_ON((addr & ~PAGE_MASK) != 0);
    1.23  	BUG_ON(mfn == INVALID_MFN);
    1.24 @@ -527,8 +522,11 @@ xen_ia64_privcmd_entry_mmap(struct vm_ar
    1.25  	}
    1.26  	gpfn = (privcmd_range->res->start >> PAGE_SHIFT) + i;
    1.27  
    1.28 -	error = HYPERVISOR_add_physmap(gpfn, mfn, 0/* prot:XXX */,
    1.29 -				       domid);
    1.30 +	flags = ASSIGN_writable;
    1.31 +	if (pgprot_val(prot) == PROT_READ) {
    1.32 +		flags = ASSIGN_readonly;
    1.33 +	}
    1.34 +	error = HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
    1.35  	if (error != 0) {
    1.36  		goto out;
    1.37  	}
     2.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Wed May 24 10:56:47 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Wed May 24 10:59:28 2006 -0600
     2.3 @@ -494,7 +494,7 @@ HYPERVISOR_zap_physmap(unsigned long gpf
     2.4  
     2.5  static inline unsigned long
     2.6  __HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
     2.7 -			 unsigned int flags, domid_t domid)
     2.8 +			 unsigned long flags, domid_t domid)
     2.9  {
    2.10  	return _hypercall_imm4(unsigned long, ia64_dom0vp_op,
    2.11  			       IA64_DOM0VP_add_physmap, gpfn, mfn, flags,
    2.12 @@ -503,7 +503,7 @@ static inline unsigned long
    2.13  
    2.14  static inline unsigned long
    2.15  HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
    2.16 -		       unsigned int flags, domid_t domid)
    2.17 +		       unsigned long flags, domid_t domid)
    2.18  {
    2.19  	unsigned long ret = 0;
    2.20  	BUG_ON(!running_on_xen);//XXX