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

Re: [Xen-devel] [PATCH 34/38] HACK: arm: initial XENMAPSPACE_gmfn_foreign



On Fri, 1 Jun 2012, Ian Campbell wrote:
> Should use same interface as hybrid x86.
> ---
>  xen/arch/arm/mm.c             |   32 ++++++++++++++++++++++++++------
>  xen/arch/x86/mm.c             |    2 ++
>  xen/include/public/arch-arm.h |    1 +
>  xen/include/public/memory.h   |   12 +++++++-----
>  4 files changed, 36 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index ab52171..1832e7f 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -480,12 +480,32 @@ static int xenmem_add_to_physmap_once(
>  
>      switch ( xatp->space )
>      {
> -        case XENMAPSPACE_shared_info:
> -            if ( xatp->idx == 0 )
> -                mfn = virt_to_mfn(d->shared_info);
> -            break;
> -        default:
> -            return -ENOSYS;
> +    case XENMAPSPACE_shared_info:
> +        if ( xatp->idx == 0 )
> +            mfn = virt_to_mfn(d->shared_info);
> +        break;
> +    case XENMAPSPACE_gmfn_foreign:
> +    {
> +        paddr_t maddr;
> +        struct domain *od;
> +
> +        rc = rcu_lock_target_domain_by_id(xatp->foreign_domid, &od);
> +        if ( rc < 0 )
> +            return rc;
> +        maddr = p2m_lookup(od, xatp->idx << PAGE_SHIFT);
> +        if ( maddr == INVALID_PADDR )
> +        {
> +            printk("bad p2m lookup\n");
> +            dump_p2m_lookup(od, xatp->idx << PAGE_SHIFT);
> +            rcu_unlock_domain(od);
> +            return -EINVAL;
> +        }
> +        mfn = maddr >> PAGE_SHIFT;
> +        rcu_unlock_domain(od);
> +        break;
> +    }

It is probably a good idea at least to test xatp->size and WARN if it is
not 1 page.


> +    default:
> +        return -ENOSYS;
>      }
>  
>      domain_lock(d);
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 876e1ef..d6c90f9 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4572,6 +4572,8 @@ static int xenmem_add_to_physmap_once(
>              mfn = idx;
>              page = mfn_to_page(mfn);
>              break;
> +        case XENMAPSPACE_gmfn_foreign:
> +            return -ENOSYS;
>          }
>          default:
>              break;
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index e915cbf..b52bfc7 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -121,6 +121,7 @@ typedef uint64_t xen_pfn_t;
>  #define XEN_LEGACY_MAX_VCPUS 1
>  
>  typedef uint32_t xen_ulong_t;
> +#define PRI_xen_ulong PRIx32
>  
>  struct vcpu_guest_context {
>      struct cpu_user_regs user_regs;         /* User-level CPU registers     
> */

Why did you need to define this here?

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.