WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 09/11] xen: introduce gnttab_map_refs and gnttab_

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 09/11] xen: introduce gnttab_map_refs and gnttab_unmap_refs
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Mon, 10 Jan 2011 10:32:19 +0000
Cc: Fitzhardinge <Jeremy.Fitzhardinge@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jeremy, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Mon, 10 Jan 2011 02:31:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110105202355.GB29993@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1012151259510.2390@kaball-desktop> <1292420446-3348-9-git-send-email-stefano.stabellini@xxxxxxxxxxxxx> <20110105202355.GB29993@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 5 Jan 2011, Konrad Rzeszutek Wilk wrote:
> > +
> > +   ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map_ops, count);
> > +
> > +   for (i = 0; i < count; i++) {
> > +           pfn = mfn_to_pfn(map_ops[i].host_addr >> PAGE_SHIFT);
> 
> Shouldn't you be checking the flag to see if this a bus address? You could
> also use the PFN_DOWN macro here..

Yes, actually I should be checking for GNTMAP_contains_pte.

> > +           pte = (pte_t *) __va((pfn << PAGE_SHIFT) +
> > +                           (map_ops[i].host_addr & ~PAGE_MASK));
> 
> PFN_PHYS(pfn)? Or better You could use the mfn_to_virt macro here:
> 
>               pte = (pte_t *) mfn_to_virt(PFN_DOWN(map_ops[i].ost_addr));
>               pte += (map_ops[i].host_addr & _PAGE_MASK);
> 

Good suggestion, I have applied it (plus a small change to the pointer
arithmetic).

> > +           val = *pte;
> > +           mfn = (native_pte_val(val) & PTE_PFN_MASK) >> PAGE_SHIFT;
> 
> mfn = pte_mfn(pte) ?
> 

yep, done that.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>