|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 1/6] xen: improve changes to xen_add_to_physmap
On Wed, 2012-09-19 at 14:20 +0100, Stefano Stabellini wrote:
> On Wed, 19 Sep 2012, Ian Campbell wrote:
> > On Wed, 2012-09-19 at 14:03 +0100, Ian Campbell wrote:
> >
> > > > It the final version. I think it should go in, unless we want to drop it
> > > > entirely in favor of xen_add_to_physmap_range.
> > >
> > > Here is what I came up with on the ARM side. I'd image the X86 version
> > > would not be that different.
> >
> > Here the (obvious) Linux side, for reference. No actual use of batching
> > just yet. It's based on top of a somewhat bastardized version of
> > Mukesh's PVH patches for privcmd.
> >
>
> we also need the xen_remap_domain_mfn_range arm implementation
I have that, it calls this pvh_add_to_xen_p2m. I just didn't include it
here since I was just illustrating the change of the API.
I have a set of patches to reimplement the hacky foreign mapping stuff
on top of Mukesh's PVH privmd stuff, I'm just waiting for him to repost
so I can rebase and post.
> >
> > diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> > index 43277f8..f01120a 100644
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -88,13 +88,20 @@ static int pvh_add_to_xen_p2m(unsigned long lpfn,
> > unsigned long fgmfn,
> > unsigned int domid)
> > {
> > int rc;
> > - struct xen_add_to_physmap pmb = {.foreign_domid = domid};
> > -
> > - pmb.gpfn = lpfn;
> > - pmb.idx = fgmfn;
> > - pmb.space = XENMAPSPACE_gmfn_foreign;
> > -
> > - rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap, &pmb);
> > + struct xen_add_to_physmap_range xatp = {
> > + .domid = DOMID_SELF,
> > + .foreign_domid = domid,
> > + .size = 1,
> > + .space = XENMAPSPACE_gmfn_foreign,
> > + };
> > + unsigned long idx = fgmfn;
> > + xen_pfn_t gpfn = lpfn;
> > +
> > + set_xen_guest_handle(xatp.idxs, &idx);
> > + set_xen_guest_handle(xatp.gpfns, &gpfn);
> > + domid, fgmfn, lpfn);
> > +
> > + rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp);
> > if (rc) {
> > pr_warn("Failed to map pfn to mfn rc:%d pfn:%lx mfn:%lx\n",
> > rc, lpfn, fgmfn);
> > diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
> > index 8728330..64cabbb 100644
> > --- a/include/xen/interface/memory.h
> > +++ b/include/xen/interface/memory.h
> > @@ -183,6 +183,24 @@ struct xen_add_to_physmap {
> > };
> > DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
> >
> > +#define XENMEM_add_to_physmap_range 23
> > +struct xen_add_to_physmap_range {
> > + /* Which domain to change the mapping for. */
> > + domid_t domid;
> > + uint16_t space; /* => enum phys_map_space */
> > +
> > + /* Number of pages to go through */
> > + uint16_t size;
> > + domid_t foreign_domid; /* IFF gmfn_foreign */
> > +
> > + /* Indexes into space being mapped. */
> > + GUEST_HANDLE(ulong) idxs;
> > +
> > + /* GPFN in domdwhere the source mapping page should appear. */
> > + GUEST_HANDLE(xen_pfn_t) gpfns;
> > +};
> > +DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range);
> > +
> > /*
> > * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve
> > error
> > * code on failure. This call only works for auto-translated guests.
> >
> >
> >
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |