* [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU
@ 2017-10-18 14:03 Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
` (4 more replies)
0 siblings, 5 replies; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel; +Cc: Ross Lagerwall, Paul Durrant, Ian Jackson
The recently added support for restricting QEMU prevents use of the VGA
console. This series addresses that by adding a couple of new dmops.
A corresponding patch for QEMU is needed to make use of the new dmops.
Ross Lagerwall (5):
xen/mm: Make xenmem_add_to_physmap public
xen: Provide XEN_DMOP_add_to_physmap
xen: Provide XEN_DMOP_pin_memory_cacheattr
tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr
tools/libs/devicemodel/Makefile | 2 +-
tools/libs/devicemodel/core.c | 36 +++++++++++++++++++++++++
tools/libs/devicemodel/include/xendevicemodel.h | 27 +++++++++++++++++++
tools/libs/devicemodel/libxendevicemodel.map | 5 ++++
xen/arch/x86/hvm/dm.c | 29 ++++++++++++++++++++
xen/common/memory.c | 5 ++--
xen/include/public/hvm/dm_op.h | 28 +++++++++++++++++++
xen/include/xen/mm.h | 3 +++
xen/include/xlat.lst | 2 ++
9 files changed, 133 insertions(+), 4 deletions(-)
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
@ 2017-10-18 14:03 ` Ross Lagerwall
2017-10-20 9:09 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap Ross Lagerwall
` (3 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Ross Lagerwall, Jan Beulich
Make it global in preparation to be called by a new dmop.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
xen/common/memory.c | 5 ++---
xen/include/xen/mm.h | 3 +++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index ad987e0..c4f05c7 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -741,9 +741,8 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
return rc;
}
-static int xenmem_add_to_physmap(struct domain *d,
- struct xen_add_to_physmap *xatp,
- unsigned int start)
+int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
+ unsigned int start)
{
unsigned int done = 0;
long rc = 0;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index e813c07..0e0e511 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -579,6 +579,9 @@ int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
union xen_add_to_physmap_batch_extra extra,
unsigned long idx, gfn_t gfn);
+int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
+ unsigned int start);
+
/* Return 0 on success, or negative on error. */
int __must_check guest_remove_page(struct domain *d, unsigned long gmfn);
int __must_check steal_page(struct domain *d, struct page_info *page,
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
@ 2017-10-18 14:03 ` Ross Lagerwall
2017-10-20 9:15 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
` (2 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Ross Lagerwall, Jan Beulich
Provide XEN_DMOP_add_to_physmap, a limited version of
XENMEM_add_to_physmap to allow a deprivileged QEMU to move VRAM when a
guest programs its BAR. It is equivalent to XENMEM_add_to_physmap with
space == XENMAPSPACE_gmfn.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
xen/arch/x86/hvm/dm.c | 17 +++++++++++++++++
xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
xen/include/xlat.lst | 1 +
3 files changed, 32 insertions(+)
diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 32ade95..432a863 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -640,6 +640,22 @@ static int dm_op(const struct dmop_args *op_args)
break;
}
+ case XEN_DMOP_add_to_physmap:
+ {
+ const struct xen_dm_op_add_to_physmap *data =
+ &op.u.add_to_physmap;
+ struct xen_add_to_physmap xatp = {
+ .domid = op_args->domid,
+ .space = XENMAPSPACE_gmfn,
+ .idx = data->idx,
+ .gpfn = data->gpfn,
+ };
+
+ rc = xenmem_add_to_physmap(d, &xatp,
+ XENMEM_add_to_physmap >> MEMOP_EXTENT_SHIFT);
+ break;
+ }
+
default:
rc = -EOPNOTSUPP;
break;
@@ -669,6 +685,7 @@ CHECK_dm_op_set_mem_type;
CHECK_dm_op_inject_event;
CHECK_dm_op_inject_msi;
CHECK_dm_op_remote_shutdown;
+CHECK_dm_op_add_to_physmap;
int compat_dm_op(domid_t domid,
unsigned int nr_bufs,
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index e173085..88aace7 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -368,6 +368,19 @@ struct xen_dm_op_remote_shutdown {
/* (Other reason values are not blocked) */
};
+/*
+ * XEN_DMOP_add_to_physmap : Sets the GPFN at which a particular page appears
+ * in the specified guest's pseudophysical address
+ * space. Identical to XENMEM_add_to_physmap with
+ * space == XENMAPSPACE_gmfn.
+ */
+#define XEN_DMOP_add_to_physmap 17
+
+struct xen_dm_op_add_to_physmap {
+ uint64_aligned_t idx; /* Index into GMFN space. */
+ uint64_aligned_t gpfn; /* GPFN in domid where the GMFN should appear. */
+};
+
struct xen_dm_op {
uint32_t op;
uint32_t pad;
@@ -389,6 +402,7 @@ struct xen_dm_op {
struct xen_dm_op_map_mem_type_to_ioreq_server
map_mem_type_to_ioreq_server;
struct xen_dm_op_remote_shutdown remote_shutdown;
+ struct xen_dm_op_add_to_physmap add_to_physmap;
} u;
};
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 4346cbe..d40bac6 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -57,6 +57,7 @@
? grant_entry_v2 grant_table.h
? gnttab_swap_grant_ref grant_table.h
! dm_op_buf hvm/dm_op.h
+? dm_op_add_to_physmap hvm/dm_op.h
? dm_op_create_ioreq_server hvm/dm_op.h
? dm_op_destroy_ioreq_server hvm/dm_op.h
? dm_op_get_ioreq_server_info hvm/dm_op.h
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap Ross Lagerwall
@ 2017-10-18 14:03 ` Ross Lagerwall
2017-10-20 9:19 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
4 siblings, 1 reply; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
Ross Lagerwall, Jan Beulich
Provide XEN_DMOP_pin_memory_cacheattr to allow a deprivileged QEMU to
pin the caching type of RAM after moving the VRAM. It is equivalent to
XEN_DOMCTL_pin_memory_cacheattr.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
xen/arch/x86/hvm/dm.c | 12 ++++++++++++
xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
xen/include/xlat.lst | 1 +
3 files changed, 27 insertions(+)
diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 432a863..eebcbcc 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -21,6 +21,7 @@
#include <asm/hap.h>
#include <asm/hvm/ioreq.h>
+#include <asm/hvm/cacheattr.h>
#include <asm/shadow.h>
#include <xsm/xsm.h>
@@ -656,6 +657,16 @@ static int dm_op(const struct dmop_args *op_args)
break;
}
+ case XEN_DMOP_pin_memory_cacheattr:
+ {
+ const struct xen_dm_op_pin_memory_cacheattr *data =
+ &op.u.pin_memory_cacheattr;
+
+ rc = hvm_set_mem_pinned_cacheattr(d, data->start, data->end,
+ data->type);
+ break;
+ }
+
default:
rc = -EOPNOTSUPP;
break;
@@ -686,6 +697,7 @@ CHECK_dm_op_inject_event;
CHECK_dm_op_inject_msi;
CHECK_dm_op_remote_shutdown;
CHECK_dm_op_add_to_physmap;
+CHECK_dm_op_pin_memory_cacheattr;
int compat_dm_op(domid_t domid,
unsigned int nr_bufs,
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index 88aace7..11bb386 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -381,6 +381,19 @@ struct xen_dm_op_add_to_physmap {
uint64_aligned_t gpfn; /* GPFN in domid where the GMFN should appear. */
};
+/*
+ * XEN_DMOP_pin_memory_cacheattr : Pin caching type of RAM space.
+ * Identical to XEN_DOMCTL_pin_mem_cacheattr.
+ */
+#define XEN_DMOP_pin_memory_cacheattr 18
+
+struct xen_dm_op_pin_memory_cacheattr {
+ uint64_aligned_t start; /* Start gfn. */
+ uint64_aligned_t end; /* End gfn. */
+ uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
+ uint32_t pad;
+};
+
struct xen_dm_op {
uint32_t op;
uint32_t pad;
@@ -403,6 +416,7 @@ struct xen_dm_op {
map_mem_type_to_ioreq_server;
struct xen_dm_op_remote_shutdown remote_shutdown;
struct xen_dm_op_add_to_physmap add_to_physmap;
+ struct xen_dm_op_pin_memory_cacheattr pin_memory_cacheattr;
} u;
};
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index d40bac6..fffb308 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -65,6 +65,7 @@
? dm_op_inject_msi hvm/dm_op.h
? dm_op_ioreq_server_range hvm/dm_op.h
? dm_op_modified_memory hvm/dm_op.h
+? dm_op_pin_memory_cacheattr hvm/dm_op.h
? dm_op_remote_shutdown hvm/dm_op.h
? dm_op_set_ioreq_server_state hvm/dm_op.h
? dm_op_set_isa_irq_level hvm/dm_op.h
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
` (2 preceding siblings ...)
2017-10-18 14:03 ` [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
@ 2017-10-18 14:03 ` Ross Lagerwall
2017-10-19 15:00 ` Ian Jackson
2017-10-20 9:22 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
4 siblings, 2 replies; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel; +Cc: Ross Lagerwall, Ian Jackson, Wei Liu
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
tools/libs/devicemodel/Makefile | 2 +-
tools/libs/devicemodel/core.c | 17 +++++++++++++++++
tools/libs/devicemodel/include/xendevicemodel.h | 13 +++++++++++++
tools/libs/devicemodel/libxendevicemodel.map | 5 +++++
4 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 342371a..5b2df7a 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
MAJOR = 1
-MINOR = 1
+MINOR = 2
SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
CFLAGS += -Werror -Wmissing-prototypes
diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index b66d4f9..2a23077 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -564,6 +564,23 @@ int xendevicemodel_shutdown(
return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
}
+int xendevicemodel_add_to_physmap(
+ xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t gpfn)
+{
+ struct xen_dm_op op;
+ struct xen_dm_op_add_to_physmap *data;
+
+ memset(&op, 0, sizeof(op));
+
+ op.op = XEN_DMOP_add_to_physmap;
+ data = &op.u.add_to_physmap;
+
+ data->idx = idx;
+ data->gpfn = gpfn;
+
+ 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 dda0bc7..2c4e392 100644
--- a/tools/libs/devicemodel/include/xendevicemodel.h
+++ b/tools/libs/devicemodel/include/xendevicemodel.h
@@ -326,6 +326,19 @@ int xendevicemodel_shutdown(
xendevicemodel_handle *dmod, domid_t domid, unsigned int reason);
/**
+ * Sets the GPFN at which a particular page appears in the domain's
+ * pseudophysical address space.
+ *
+ * @parm dmod a handle to an open devicemodel interface.
+ * @parm domid the domain id to be serviced
+ * @parm idx Index into GMFN space
+ * @parm gpfn GPFN in domid where the GMFN should appear
+ * @return 0 on success, -1 on failure.
+ */
+int xendevicemodel_add_to_physmap(
+ xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t gpfn);
+
+/**
* 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 cefd32b..4a19ecb 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -27,3 +27,8 @@ VERS_1.1 {
global:
xendevicemodel_shutdown;
} VERS_1.0;
+
+VERS_1.2 {
+ global:
+ xendevicemodel_add_to_physmap;
+} VERS_1.1;
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
` (3 preceding siblings ...)
2017-10-18 14:03 ` [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap Ross Lagerwall
@ 2017-10-18 14:03 ` Ross Lagerwall
2017-10-19 15:01 ` Ian Jackson
2017-10-20 9:23 ` Paul Durrant
4 siblings, 2 replies; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-18 14:03 UTC (permalink / raw)
To: Xen-devel; +Cc: Ross Lagerwall, Ian Jackson, Wei Liu
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(+)
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
2017-10-18 14:03 ` [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap Ross Lagerwall
@ 2017-10-19 15:00 ` Ian Jackson
2017-10-20 9:22 ` Paul Durrant
1 sibling, 0 replies; 18+ messages in thread
From: Ian Jackson @ 2017-10-19 15:00 UTC (permalink / raw)
To: Ross Lagerwall; +Cc: Wei Liu, Xen-devel
Ross Lagerwall writes ("[PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap"):
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
I have looked at the hypervisor patches but I am not qualified to
assess the security properties of the new DMOPs.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr
2017-10-18 14:03 ` [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
@ 2017-10-19 15:01 ` Ian Jackson
2017-10-20 9:23 ` Paul Durrant
1 sibling, 0 replies; 18+ messages in thread
From: Ian Jackson @ 2017-10-19 15:01 UTC (permalink / raw)
To: Ross Lagerwall; +Cc: Wei Liu, Xen-devel
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>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global
2017-10-18 14:03 ` [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
@ 2017-10-20 9:09 ` Paul Durrant
0 siblings, 0 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:09 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Ross Lagerwall, Jan Beulich, Ian Jackson
> -----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: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> George Dunlap <George.Dunlap@citrix.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim
> (Xen.org) <tim@xen.org>; Ross Lagerwall <ross.lagerwall@citrix.com>; Jan
> Beulich <jbeulich@suse.com>
> Subject: [Xen-devel] [PATCH v1 1/5] xen/mm: Make
> xenmem_add_to_physmap global
>
> Make it global in preparation to be called by a new dmop.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> xen/common/memory.c | 5 ++---
> xen/include/xen/mm.h | 3 +++
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index ad987e0..c4f05c7 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -741,9 +741,8 @@ static long
> memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange
> _t) arg)
> return rc;
> }
>
> -static int xenmem_add_to_physmap(struct domain *d,
> - struct xen_add_to_physmap *xatp,
> - unsigned int start)
> +int xenmem_add_to_physmap(struct domain *d, struct
> xen_add_to_physmap *xatp,
> + unsigned int start)
> {
> unsigned int done = 0;
> long rc = 0;
> diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
> index e813c07..0e0e511 100644
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -579,6 +579,9 @@ int xenmem_add_to_physmap_one(struct domain
> *d, unsigned int space,
> union xen_add_to_physmap_batch_extra extra,
> unsigned long idx, gfn_t gfn);
>
> +int xenmem_add_to_physmap(struct domain *d, struct
> xen_add_to_physmap *xatp,
> + unsigned int start);
> +
> /* Return 0 on success, or negative on error. */
> int __must_check guest_remove_page(struct domain *d, unsigned long
> gmfn);
> int __must_check steal_page(struct domain *d, struct page_info *page,
> --
> 2.9.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap
2017-10-18 14:03 ` [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap Ross Lagerwall
@ 2017-10-20 9:15 ` Paul Durrant
2017-10-20 9:20 ` Paul Durrant
2017-10-20 9:36 ` Ross Lagerwall
0 siblings, 2 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:15 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Ross Lagerwall, Jan Beulich, Ian Jackson
> -----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: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> George Dunlap <George.Dunlap@citrix.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim
> (Xen.org) <tim@xen.org>; Ross Lagerwall <ross.lagerwall@citrix.com>; Jan
> Beulich <jbeulich@suse.com>
> Subject: [Xen-devel] [PATCH v1 2/5] xen: Provide
> XEN_DMOP_add_to_physmap
>
> Provide XEN_DMOP_add_to_physmap, a limited version of
> XENMEM_add_to_physmap to allow a deprivileged QEMU to move VRAM
> when a
> guest programs its BAR. It is equivalent to XENMEM_add_to_physmap with
> space == XENMAPSPACE_gmfn.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> xen/arch/x86/hvm/dm.c | 17 +++++++++++++++++
> xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
> xen/include/xlat.lst | 1 +
> 3 files changed, 32 insertions(+)
>
> diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
> index 32ade95..432a863 100644
> --- a/xen/arch/x86/hvm/dm.c
> +++ b/xen/arch/x86/hvm/dm.c
> @@ -640,6 +640,22 @@ static int dm_op(const struct dmop_args *op_args)
> break;
> }
>
> + case XEN_DMOP_add_to_physmap:
> + {
> + const struct xen_dm_op_add_to_physmap *data =
> + &op.u.add_to_physmap;
> + struct xen_add_to_physmap xatp = {
> + .domid = op_args->domid,
> + .space = XENMAPSPACE_gmfn,
> + .idx = data->idx,
> + .gpfn = data->gpfn,
> + };
> +
Where does xatp.size get set? Looks like you're missing a parameter.
Paul
> + rc = xenmem_add_to_physmap(d, &xatp,
> + XENMEM_add_to_physmap >> MEMOP_EXTENT_SHIFT);
> + break;
> + }
> +
> default:
> rc = -EOPNOTSUPP;
> break;
> @@ -669,6 +685,7 @@ CHECK_dm_op_set_mem_type;
> CHECK_dm_op_inject_event;
> CHECK_dm_op_inject_msi;
> CHECK_dm_op_remote_shutdown;
> +CHECK_dm_op_add_to_physmap;
>
> int compat_dm_op(domid_t domid,
> unsigned int nr_bufs,
> diff --git a/xen/include/public/hvm/dm_op.h
> b/xen/include/public/hvm/dm_op.h
> index e173085..88aace7 100644
> --- a/xen/include/public/hvm/dm_op.h
> +++ b/xen/include/public/hvm/dm_op.h
> @@ -368,6 +368,19 @@ struct xen_dm_op_remote_shutdown {
> /* (Other reason values are not blocked) */
> };
>
> +/*
> + * XEN_DMOP_add_to_physmap : Sets the GPFN at which a particular page
> appears
> + * in the specified guest's pseudophysical address
> + * space. Identical to XENMEM_add_to_physmap with
> + * space == XENMAPSPACE_gmfn.
> + */
> +#define XEN_DMOP_add_to_physmap 17
> +
> +struct xen_dm_op_add_to_physmap {
> + uint64_aligned_t idx; /* Index into GMFN space. */
> + uint64_aligned_t gpfn; /* GPFN in domid where the GMFN should
> appear. */
> +};
> +
> struct xen_dm_op {
> uint32_t op;
> uint32_t pad;
> @@ -389,6 +402,7 @@ struct xen_dm_op {
> struct xen_dm_op_map_mem_type_to_ioreq_server
> map_mem_type_to_ioreq_server;
> struct xen_dm_op_remote_shutdown remote_shutdown;
> + struct xen_dm_op_add_to_physmap add_to_physmap;
> } u;
> };
>
> diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
> index 4346cbe..d40bac6 100644
> --- a/xen/include/xlat.lst
> +++ b/xen/include/xlat.lst
> @@ -57,6 +57,7 @@
> ? grant_entry_v2 grant_table.h
> ? gnttab_swap_grant_ref grant_table.h
> ! dm_op_buf hvm/dm_op.h
> +? dm_op_add_to_physmap hvm/dm_op.h
> ? dm_op_create_ioreq_server hvm/dm_op.h
> ? dm_op_destroy_ioreq_server hvm/dm_op.h
> ? dm_op_get_ioreq_server_info hvm/dm_op.h
> --
> 2.9.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr
2017-10-18 14:03 ` [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
@ 2017-10-20 9:19 ` Paul Durrant
0 siblings, 0 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:19 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Ross Lagerwall, Jan Beulich, Ian Jackson
> -----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: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> George Dunlap <George.Dunlap@citrix.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim
> (Xen.org) <tim@xen.org>; Ross Lagerwall <ross.lagerwall@citrix.com>; Jan
> Beulich <jbeulich@suse.com>
> Subject: [Xen-devel] [PATCH v1 3/5] xen: Provide
> XEN_DMOP_pin_memory_cacheattr
>
> Provide XEN_DMOP_pin_memory_cacheattr to allow a deprivileged QEMU
> to
> pin the caching type of RAM after moving the VRAM. It is equivalent to
> XEN_DOMCTL_pin_memory_cacheattr.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> xen/arch/x86/hvm/dm.c | 12 ++++++++++++
> xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
> xen/include/xlat.lst | 1 +
> 3 files changed, 27 insertions(+)
>
> diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
> index 432a863..eebcbcc 100644
> --- a/xen/arch/x86/hvm/dm.c
> +++ b/xen/arch/x86/hvm/dm.c
> @@ -21,6 +21,7 @@
>
> #include <asm/hap.h>
> #include <asm/hvm/ioreq.h>
> +#include <asm/hvm/cacheattr.h>
> #include <asm/shadow.h>
>
> #include <xsm/xsm.h>
> @@ -656,6 +657,16 @@ static int dm_op(const struct dmop_args *op_args)
> break;
> }
>
> + case XEN_DMOP_pin_memory_cacheattr:
> + {
> + const struct xen_dm_op_pin_memory_cacheattr *data =
> + &op.u.pin_memory_cacheattr;
> +
You need to check data->pad is 0 here.
Paul
> + rc = hvm_set_mem_pinned_cacheattr(d, data->start, data->end,
> + data->type);
> + break;
> + }
> +
> default:
> rc = -EOPNOTSUPP;
> break;
> @@ -686,6 +697,7 @@ CHECK_dm_op_inject_event;
> CHECK_dm_op_inject_msi;
> CHECK_dm_op_remote_shutdown;
> CHECK_dm_op_add_to_physmap;
> +CHECK_dm_op_pin_memory_cacheattr;
>
> int compat_dm_op(domid_t domid,
> unsigned int nr_bufs,
> diff --git a/xen/include/public/hvm/dm_op.h
> b/xen/include/public/hvm/dm_op.h
> index 88aace7..11bb386 100644
> --- a/xen/include/public/hvm/dm_op.h
> +++ b/xen/include/public/hvm/dm_op.h
> @@ -381,6 +381,19 @@ struct xen_dm_op_add_to_physmap {
> uint64_aligned_t gpfn; /* GPFN in domid where the GMFN should appear.
> */
> };
>
> +/*
> + * XEN_DMOP_pin_memory_cacheattr : Pin caching type of RAM space.
> + * Identical to XEN_DOMCTL_pin_mem_cacheattr.
> + */
> +#define XEN_DMOP_pin_memory_cacheattr 18
> +
> +struct xen_dm_op_pin_memory_cacheattr {
> + uint64_aligned_t start; /* Start gfn. */
> + uint64_aligned_t end; /* End gfn. */
> + uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
> + uint32_t pad;
> +};
> +
> struct xen_dm_op {
> uint32_t op;
> uint32_t pad;
> @@ -403,6 +416,7 @@ struct xen_dm_op {
> map_mem_type_to_ioreq_server;
> struct xen_dm_op_remote_shutdown remote_shutdown;
> struct xen_dm_op_add_to_physmap add_to_physmap;
> + struct xen_dm_op_pin_memory_cacheattr pin_memory_cacheattr;
> } u;
> };
>
> diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
> index d40bac6..fffb308 100644
> --- a/xen/include/xlat.lst
> +++ b/xen/include/xlat.lst
> @@ -65,6 +65,7 @@
> ? dm_op_inject_msi hvm/dm_op.h
> ? dm_op_ioreq_server_range hvm/dm_op.h
> ? dm_op_modified_memory hvm/dm_op.h
> +? dm_op_pin_memory_cacheattr hvm/dm_op.h
> ? dm_op_remote_shutdown hvm/dm_op.h
> ? dm_op_set_ioreq_server_state hvm/dm_op.h
> ? dm_op_set_isa_irq_level hvm/dm_op.h
> --
> 2.9.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap
2017-10-20 9:15 ` Paul Durrant
@ 2017-10-20 9:20 ` Paul Durrant
2017-10-20 9:36 ` Ross Lagerwall
1 sibling, 0 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:20 UTC (permalink / raw)
To: Paul Durrant, Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Ross Lagerwall, Jan Beulich, Ian Jackson
> -----Original Message-----
> From: Xen-devel [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of
> Paul Durrant
> Sent: 20 October 2017 10:16
> To: Ross Lagerwall <ross.lagerwall@citrix.com>; Xen-devel <xen-
> devel@lists.xen.org>
> Cc: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> Andrew Cooper <Andrew.Cooper3@citrix.com>; Tim (Xen.org)
> <tim@xen.org>; George Dunlap <George.Dunlap@citrix.com>; Ross
> Lagerwall <ross.lagerwall@citrix.com>; Jan Beulich <jbeulich@suse.com>; Ian
> Jackson <Ian.Jackson@citrix.com>
> Subject: Re: [Xen-devel] [PATCH v1 2/5] xen: Provide
> XEN_DMOP_add_to_physmap
>
> > -----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: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> > <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> > George Dunlap <George.Dunlap@citrix.com>; Andrew Cooper
> > <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim
> > (Xen.org) <tim@xen.org>; Ross Lagerwall <ross.lagerwall@citrix.com>; Jan
> > Beulich <jbeulich@suse.com>
> > Subject: [Xen-devel] [PATCH v1 2/5] xen: Provide
> > XEN_DMOP_add_to_physmap
> >
> > Provide XEN_DMOP_add_to_physmap, a limited version of
> > XENMEM_add_to_physmap to allow a deprivileged QEMU to move VRAM
> > when a
> > guest programs its BAR. It is equivalent to XENMEM_add_to_physmap with
> > space == XENMAPSPACE_gmfn.
> >
> > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> > ---
> > xen/arch/x86/hvm/dm.c | 17 +++++++++++++++++
> > xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
> > xen/include/xlat.lst | 1 +
> > 3 files changed, 32 insertions(+)
> >
> > diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
> > index 32ade95..432a863 100644
> > --- a/xen/arch/x86/hvm/dm.c
> > +++ b/xen/arch/x86/hvm/dm.c
> > @@ -640,6 +640,22 @@ static int dm_op(const struct dmop_args *op_args)
> > break;
> > }
> >
> > + case XEN_DMOP_add_to_physmap:
> > + {
> > + const struct xen_dm_op_add_to_physmap *data =
> > + &op.u.add_to_physmap;
> > + struct xen_add_to_physmap xatp = {
> > + .domid = op_args->domid,
> > + .space = XENMAPSPACE_gmfn,
> > + .idx = data->idx,
> > + .gpfn = data->gpfn,
> > + };
> > +
>
> Where does xatp.size get set? Looks like you're missing a parameter.
>
> Paul
>
> > + rc = xenmem_add_to_physmap(d, &xatp,
> > + XENMEM_add_to_physmap >>
> MEMOP_EXTENT_SHIFT);
... Also looking at this slightly odd argument, assuming that the additional size parameter could be arbitrarily large, you're going to need to handle continuations.
Paul
> > + break;
> > + }
> > +
> > default:
> > rc = -EOPNOTSUPP;
> > break;
> > @@ -669,6 +685,7 @@ CHECK_dm_op_set_mem_type;
> > CHECK_dm_op_inject_event;
> > CHECK_dm_op_inject_msi;
> > CHECK_dm_op_remote_shutdown;
> > +CHECK_dm_op_add_to_physmap;
> >
> > int compat_dm_op(domid_t domid,
> > unsigned int nr_bufs,
> > diff --git a/xen/include/public/hvm/dm_op.h
> > b/xen/include/public/hvm/dm_op.h
> > index e173085..88aace7 100644
> > --- a/xen/include/public/hvm/dm_op.h
> > +++ b/xen/include/public/hvm/dm_op.h
> > @@ -368,6 +368,19 @@ struct xen_dm_op_remote_shutdown {
> > /* (Other reason values are not blocked) */
> > };
> >
> > +/*
> > + * XEN_DMOP_add_to_physmap : Sets the GPFN at which a particular
> page
> > appears
> > + * in the specified guest's pseudophysical address
> > + * space. Identical to XENMEM_add_to_physmap with
> > + * space == XENMAPSPACE_gmfn.
> > + */
> > +#define XEN_DMOP_add_to_physmap 17
> > +
> > +struct xen_dm_op_add_to_physmap {
> > + uint64_aligned_t idx; /* Index into GMFN space. */
> > + uint64_aligned_t gpfn; /* GPFN in domid where the GMFN should
> > appear. */
> > +};
> > +
> > struct xen_dm_op {
> > uint32_t op;
> > uint32_t pad;
> > @@ -389,6 +402,7 @@ struct xen_dm_op {
> > struct xen_dm_op_map_mem_type_to_ioreq_server
> > map_mem_type_to_ioreq_server;
> > struct xen_dm_op_remote_shutdown remote_shutdown;
> > + struct xen_dm_op_add_to_physmap add_to_physmap;
> > } u;
> > };
> >
> > diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
> > index 4346cbe..d40bac6 100644
> > --- a/xen/include/xlat.lst
> > +++ b/xen/include/xlat.lst
> > @@ -57,6 +57,7 @@
> > ? grant_entry_v2 grant_table.h
> > ? gnttab_swap_grant_ref grant_table.h
> > ! dm_op_buf hvm/dm_op.h
> > +? dm_op_add_to_physmap hvm/dm_op.h
> > ? dm_op_create_ioreq_server hvm/dm_op.h
> > ? dm_op_destroy_ioreq_server hvm/dm_op.h
> > ? dm_op_get_ioreq_server_info hvm/dm_op.h
> > --
> > 2.9.5
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > https://lists.xen.org/xen-devel
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
2017-10-18 14:03 ` [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap Ross Lagerwall
2017-10-19 15:00 ` Ian Jackson
@ 2017-10-20 9:22 ` Paul Durrant
2017-10-27 11:45 ` Wei Liu
1 sibling, 1 reply; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:22 UTC (permalink / raw)
To: Xen-devel; +Cc: Ross Lagerwall, Wei Liu, Ian Jackson
> -----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 4/5] tools: libxendevicemodel: Provide
> xendevicemodel_add_to_physmap
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> tools/libs/devicemodel/Makefile | 2 +-
> tools/libs/devicemodel/core.c | 17 +++++++++++++++++
> tools/libs/devicemodel/include/xendevicemodel.h | 13 +++++++++++++
> tools/libs/devicemodel/libxendevicemodel.map | 5 +++++
> 4 files changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libs/devicemodel/Makefile
> b/tools/libs/devicemodel/Makefile
> index 342371a..5b2df7a 100644
> --- a/tools/libs/devicemodel/Makefile
> +++ b/tools/libs/devicemodel/Makefile
> @@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
> include $(XEN_ROOT)/tools/Rules.mk
>
> MAJOR = 1
> -MINOR = 1
> +MINOR = 2
> SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
>
> CFLAGS += -Werror -Wmissing-prototypes
> diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
> index b66d4f9..2a23077 100644
> --- a/tools/libs/devicemodel/core.c
> +++ b/tools/libs/devicemodel/core.c
> @@ -564,6 +564,23 @@ int xendevicemodel_shutdown(
> return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
> }
>
> +int xendevicemodel_add_to_physmap(
> + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t
> gpfn)
Do you really want this to be single page? Populating VRAM is not going to be fast if you need to make 16MB / 4K hypercalls to do it.
Paul
> +{
> + struct xen_dm_op op;
> + struct xen_dm_op_add_to_physmap *data;
> +
> + memset(&op, 0, sizeof(op));
> +
> + op.op = XEN_DMOP_add_to_physmap;
> + data = &op.u.add_to_physmap;
> +
> + data->idx = idx;
> + data->gpfn = gpfn;
> +
> + 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 dda0bc7..2c4e392 100644
> --- a/tools/libs/devicemodel/include/xendevicemodel.h
> +++ b/tools/libs/devicemodel/include/xendevicemodel.h
> @@ -326,6 +326,19 @@ int xendevicemodel_shutdown(
> xendevicemodel_handle *dmod, domid_t domid, unsigned int reason);
>
> /**
> + * Sets the GPFN at which a particular page appears in the domain's
> + * pseudophysical address space.
> + *
> + * @parm dmod a handle to an open devicemodel interface.
> + * @parm domid the domain id to be serviced
> + * @parm idx Index into GMFN space
> + * @parm gpfn GPFN in domid where the GMFN should appear
> + * @return 0 on success, -1 on failure.
> + */
> +int xendevicemodel_add_to_physmap(
> + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t
> gpfn);
> +
> +/**
> * 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 cefd32b..4a19ecb 100644
> --- a/tools/libs/devicemodel/libxendevicemodel.map
> +++ b/tools/libs/devicemodel/libxendevicemodel.map
> @@ -27,3 +27,8 @@ VERS_1.1 {
> global:
> xendevicemodel_shutdown;
> } VERS_1.0;
> +
> +VERS_1.2 {
> + global:
> + xendevicemodel_add_to_physmap;
> +} VERS_1.1;
> --
> 2.9.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr
2017-10-18 14:03 ` [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
2017-10-19 15:01 ` Ian Jackson
@ 2017-10-20 9:23 ` Paul Durrant
1 sibling, 0 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 9:23 UTC (permalink / raw)
To: Xen-devel; +Cc: Ross Lagerwall, Wei Liu, Ian Jackson
> -----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
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap
2017-10-20 9:15 ` Paul Durrant
2017-10-20 9:20 ` Paul Durrant
@ 2017-10-20 9:36 ` Ross Lagerwall
2017-10-20 10:04 ` Paul Durrant
1 sibling, 1 reply; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-20 9:36 UTC (permalink / raw)
To: Paul Durrant, Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Jan Beulich, Ian Jackson
On 10/20/2017 10:15 AM, Paul Durrant wrote:
>> -----Original Message-----
snip>> diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
>> index 32ade95..432a863 100644
>> --- a/xen/arch/x86/hvm/dm.c
>> +++ b/xen/arch/x86/hvm/dm.c
>> @@ -640,6 +640,22 @@ static int dm_op(const struct dmop_args *op_args)
>> break;
>> }
>>
>> + case XEN_DMOP_add_to_physmap:
>> + {
>> + const struct xen_dm_op_add_to_physmap *data =
>> + &op.u.add_to_physmap;
>> + struct xen_add_to_physmap xatp = {
>> + .domid = op_args->domid,
>> + .space = XENMAPSPACE_gmfn,
>> + .idx = data->idx,
>> + .gpfn = data->gpfn,
>> + };
>> +
>
> Where does xatp.size get set? Looks like you're missing a parameter.
>
xatp.size is only used for XENMAPSPACE_gmfn_range which is not supported
by this interface. size gets set to 0 by the C99 designated initializer.
Based on your other comments, would it make sense to instead use
XENMAPSPACE_gmfn_range and have the caller set the size?
As it is currently, QEMU does only populate VRAM one page at a time
(using xen_xc_domain_add_to_physmap) so it is already slow but it could
be improved.
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap
2017-10-20 9:36 ` Ross Lagerwall
@ 2017-10-20 10:04 ` Paul Durrant
0 siblings, 0 replies; 18+ messages in thread
From: Paul Durrant @ 2017-10-20 10:04 UTC (permalink / raw)
To: Ross Lagerwall, Xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
Andrew Cooper, Tim (Xen.org),
George Dunlap, Jan Beulich, Ian Jackson
> -----Original Message-----
> From: Ross Lagerwall [mailto:ross.lagerwall@citrix.com]
> Sent: 20 October 2017 10:37
> To: Paul Durrant <Paul.Durrant@citrix.com>; Xen-devel <xen-
> devel@lists.xen.org>
> Cc: Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wei.liu2@citrix.com>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>;
> George Dunlap <George.Dunlap@citrix.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim
> (Xen.org) <tim@xen.org>; Jan Beulich <jbeulich@suse.com>
> Subject: Re: [Xen-devel] [PATCH v1 2/5] xen: Provide
> XEN_DMOP_add_to_physmap
>
> On 10/20/2017 10:15 AM, Paul Durrant wrote:
> >> -----Original Message-----
> snip>> diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
> >> index 32ade95..432a863 100644
> >> --- a/xen/arch/x86/hvm/dm.c
> >> +++ b/xen/arch/x86/hvm/dm.c
> >> @@ -640,6 +640,22 @@ static int dm_op(const struct dmop_args
> *op_args)
> >> break;
> >> }
> >>
> >> + case XEN_DMOP_add_to_physmap:
> >> + {
> >> + const struct xen_dm_op_add_to_physmap *data =
> >> + &op.u.add_to_physmap;
> >> + struct xen_add_to_physmap xatp = {
> >> + .domid = op_args->domid,
> >> + .space = XENMAPSPACE_gmfn,
> >> + .idx = data->idx,
> >> + .gpfn = data->gpfn,
> >> + };
> >> +
> >
> > Where does xatp.size get set? Looks like you're missing a parameter.
> >
> xatp.size is only used for XENMAPSPACE_gmfn_range which is not
> supported
> by this interface. size gets set to 0 by the C99 designated initializer.
>
> Based on your other comments, would it make sense to instead use
> XENMAPSPACE_gmfn_range and have the caller set the size?
Yes... my eyes had read XENMAPSPACE_gmfn_range in the first place, hence my confusion over the size parameter.
>
> As it is currently, QEMU does only populate VRAM one page at a time
> (using xen_xc_domain_add_to_physmap)
Ouch, yes, I'd forgotten that.
> so it is already slow but it could
> be improved.
Indeed. I think we should shoot for a better semantic given that it's a new op.
Paul
>
> --
> Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
2017-10-20 9:22 ` Paul Durrant
@ 2017-10-27 11:45 ` Wei Liu
2017-10-27 12:06 ` Ross Lagerwall
0 siblings, 1 reply; 18+ messages in thread
From: Wei Liu @ 2017-10-27 11:45 UTC (permalink / raw)
To: Paul Durrant; +Cc: Ross Lagerwall, Ian Jackson, Wei Liu, Xen-devel
On Fri, Oct 20, 2017 at 10:22:55AM +0100, Paul Durrant wrote:
> > -----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 4/5] tools: libxendevicemodel: Provide
> > xendevicemodel_add_to_physmap
> >
> > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> > ---
> > tools/libs/devicemodel/Makefile | 2 +-
> > tools/libs/devicemodel/core.c | 17 +++++++++++++++++
> > tools/libs/devicemodel/include/xendevicemodel.h | 13 +++++++++++++
> > tools/libs/devicemodel/libxendevicemodel.map | 5 +++++
> > 4 files changed, 36 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/libs/devicemodel/Makefile
> > b/tools/libs/devicemodel/Makefile
> > index 342371a..5b2df7a 100644
> > --- a/tools/libs/devicemodel/Makefile
> > +++ b/tools/libs/devicemodel/Makefile
> > @@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
> > include $(XEN_ROOT)/tools/Rules.mk
> >
> > MAJOR = 1
> > -MINOR = 1
> > +MINOR = 2
> > SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
> >
> > CFLAGS += -Werror -Wmissing-prototypes
> > diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
> > index b66d4f9..2a23077 100644
> > --- a/tools/libs/devicemodel/core.c
> > +++ b/tools/libs/devicemodel/core.c
> > @@ -564,6 +564,23 @@ int xendevicemodel_shutdown(
> > return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
> > }
> >
> > +int xendevicemodel_add_to_physmap(
> > + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t
> > gpfn)
>
> Do you really want this to be single page? Populating VRAM is not going to be fast if you need to make 16MB / 4K hypercalls to do it.
This. Since we're introducing a new interface please consider giving it
the ability to batch.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
2017-10-27 11:45 ` Wei Liu
@ 2017-10-27 12:06 ` Ross Lagerwall
0 siblings, 0 replies; 18+ messages in thread
From: Ross Lagerwall @ 2017-10-27 12:06 UTC (permalink / raw)
To: Wei Liu, Paul Durrant; +Cc: Ian Jackson, Xen-devel
On 10/27/2017 12:45 PM, Wei Liu wrote:
> On Fri, Oct 20, 2017 at 10:22:55AM +0100, Paul Durrant wrote:
...
>>> CFLAGS += -Werror -Wmissing-prototypes
>>> diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
>>> index b66d4f9..2a23077 100644
>>> --- a/tools/libs/devicemodel/core.c
>>> +++ b/tools/libs/devicemodel/core.c
>>> @@ -564,6 +564,23 @@ int xendevicemodel_shutdown(
>>> return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
>>> }
>>>
>>> +int xendevicemodel_add_to_physmap(
>>> + xendevicemodel_handle *dmod, domid_t domid, uint64_t idx, uint64_t
>>> gpfn)
>>
>> Do you really want this to be single page? Populating VRAM is not going to be fast if you need to make 16MB / 4K hypercalls to do it.
>
> This. Since we're introducing a new interface please consider giving it
> the ability to batch.
>
Yes indeed. I sent a v2 of this patch series a few days ago which
changes it to operate on a range.
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2017-10-27 12:06 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18 14:03 [PATCH v1 0/5] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 1/5] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
2017-10-20 9:09 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 2/5] xen: Provide XEN_DMOP_add_to_physmap Ross Lagerwall
2017-10-20 9:15 ` Paul Durrant
2017-10-20 9:20 ` Paul Durrant
2017-10-20 9:36 ` Ross Lagerwall
2017-10-20 10:04 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 3/5] xen: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
2017-10-20 9:19 ` Paul Durrant
2017-10-18 14:03 ` [PATCH v1 4/5] tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap Ross Lagerwall
2017-10-19 15:00 ` Ian Jackson
2017-10-20 9:22 ` Paul Durrant
2017-10-27 11:45 ` Wei Liu
2017-10-27 12:06 ` Ross Lagerwall
2017-10-18 14:03 ` [PATCH v1 5/5] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
2017-10-19 15:01 ` Ian Jackson
2017-10-20 9:23 ` Paul Durrant
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.