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

Re: [Xen-devel] [PATCH 11/38] arm: implement p2m lookup



At 15:39 +0000 on 01 Jun (1338565180), Ian Campbell wrote:
> +/*
> + * Lookup the MFN corresponding to a domain's PFN.
> + *
> + * There are no processor functions to do a stage 2 only lookup therefore we
> + * do a a software walk.
> + */
> +paddr_t p2m_lookup(struct domain *d, paddr_t paddr)
> +{
> +    struct p2m_domain *p2m = &d->arch.p2m;
> +    lpae_t pte, *first = NULL, *second = NULL, *third = NULL;
> +    paddr_t maddr = INVALID_PADDR;
> +
> +    spin_lock(&p2m->lock);
> +
> +    first = __map_domain_page(p2m->first_level);
> +    if ( !first[first_table_offset(paddr)].p2m.valid )
> +        goto done_err;
> +    if ( !first[first_table_offset(paddr)].p2m.table )
> +    {
> +        pte = first[first_table_offset(paddr)];
> +        goto done;
> +    }

This would be neater as: 
       pte = first[first_table_offset(paddr)];
       if ( !pte.p2m.valid || !pte.p2m.table )
           goto done;

and test for pte.valid at 'done'.

It would be nice to do the three levels in a loop as well, but the weird
way the table bit behaves in third-level entries might make that more
confusing than the straight-line version.

Tim.

_______________________________________________
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®.