Message ID | 20171018140339.13888-6-ross.lagerwall@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Ross Lagerwall writes ("[PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr"): > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> -----Original Message----- > From: Xen-devel [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of > Ross Lagerwall > Sent: 18 October 2017 15:04 > To: Xen-devel <xen-devel@lists.xen.org> > Cc: Ross Lagerwall <ross.lagerwall@citrix.com>; Ian Jackson > <Ian.Jackson@citrix.com>; Wei Liu <wei.liu2@citrix.com> > Subject: [Xen-devel] [PATCH v1 5/5] tools: libxendevicemodel: Provide > xendevicemodel_pin_memory_cacheattr > > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Reviewed-by: Paul Durrant <paul.durrant@citrix.com> > --- > tools/libs/devicemodel/core.c | 19 +++++++++++++++++++ > tools/libs/devicemodel/include/xendevicemodel.h | 14 ++++++++++++++ > tools/libs/devicemodel/libxendevicemodel.map | 1 + > 3 files changed, 34 insertions(+) > > diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c > index 2a23077..dada57e 100644 > --- a/tools/libs/devicemodel/core.c > +++ b/tools/libs/devicemodel/core.c > @@ -581,6 +581,25 @@ int xendevicemodel_add_to_physmap( > return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); > } > > +int xendevicemodel_pin_memory_cacheattr( > + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t > end, > + uint32_t type) > +{ > + struct xen_dm_op op; > + struct xen_dm_op_pin_memory_cacheattr *data; > + > + memset(&op, 0, sizeof(op)); > + > + op.op = XEN_DMOP_pin_memory_cacheattr; > + data = &op.u.pin_memory_cacheattr; > + > + data->start = start; > + data->end = end; > + data->type = type; > + > + return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); > +} > + > int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t > domid) > { > return osdep_xendevicemodel_restrict(dmod, domid); > diff --git a/tools/libs/devicemodel/include/xendevicemodel.h > b/tools/libs/devicemodel/include/xendevicemodel.h > index 2c4e392..9de6d46 100644 > --- a/tools/libs/devicemodel/include/xendevicemodel.h > +++ b/tools/libs/devicemodel/include/xendevicemodel.h > @@ -339,6 +339,20 @@ int xendevicemodel_add_to_physmap( > xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t > gpfn); > > /** > + * Pins caching type of RAM space. > + * > + * @parm dmod a handle to an open devicemodel interface. > + * @parm domid the domain id to be serviced > + * @parm start Start gfn > + * @parm end End gfn > + * @parm type XEN_DOMCTL_MEM_CACHEATTR_* > + * @return 0 on success, -1 on failure. > + */ > +int xendevicemodel_pin_memory_cacheattr( > + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t > end, > + uint32_t type); > + > +/** > * This function restricts the use of this handle to the specified > * domain. > * > diff --git a/tools/libs/devicemodel/libxendevicemodel.map > b/tools/libs/devicemodel/libxendevicemodel.map > index 4a19ecb..e820b77 100644 > --- a/tools/libs/devicemodel/libxendevicemodel.map > +++ b/tools/libs/devicemodel/libxendevicemodel.map > @@ -31,4 +31,5 @@ VERS_1.1 { > VERS_1.2 { > global: > xendevicemodel_add_to_physmap; > + xendevicemodel_pin_memory_cacheattr; > } VERS_1.1; > -- > 2.9.5 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > https://lists.xen.org/xen-devel
diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c index 2a23077..dada57e 100644 --- a/tools/libs/devicemodel/core.c +++ b/tools/libs/devicemodel/core.c @@ -581,6 +581,25 @@ int xendevicemodel_add_to_physmap( return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); } +int xendevicemodel_pin_memory_cacheattr( + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end, + uint32_t type) +{ + struct xen_dm_op op; + struct xen_dm_op_pin_memory_cacheattr *data; + + memset(&op, 0, sizeof(op)); + + op.op = XEN_DMOP_pin_memory_cacheattr; + data = &op.u.pin_memory_cacheattr; + + data->start = start; + data->end = end; + data->type = type; + + return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op)); +} + int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid) { return osdep_xendevicemodel_restrict(dmod, domid); diff --git a/tools/libs/devicemodel/include/xendevicemodel.h b/tools/libs/devicemodel/include/xendevicemodel.h index 2c4e392..9de6d46 100644 --- a/tools/libs/devicemodel/include/xendevicemodel.h +++ b/tools/libs/devicemodel/include/xendevicemodel.h @@ -339,6 +339,20 @@ int xendevicemodel_add_to_physmap( xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t gpfn); /** + * Pins caching type of RAM space. + * + * @parm dmod a handle to an open devicemodel interface. + * @parm domid the domain id to be serviced + * @parm start Start gfn + * @parm end End gfn + * @parm type XEN_DOMCTL_MEM_CACHEATTR_* + * @return 0 on success, -1 on failure. + */ +int xendevicemodel_pin_memory_cacheattr( + xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end, + uint32_t type); + +/** * This function restricts the use of this handle to the specified * domain. * diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map index 4a19ecb..e820b77 100644 --- a/tools/libs/devicemodel/libxendevicemodel.map +++ b/tools/libs/devicemodel/libxendevicemodel.map @@ -31,4 +31,5 @@ VERS_1.1 { VERS_1.2 { global: xendevicemodel_add_to_physmap; + xendevicemodel_pin_memory_cacheattr; } VERS_1.1;
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> --- tools/libs/devicemodel/core.c | 19 +++++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 14 ++++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 1 + 3 files changed, 34 insertions(+)