From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: xen-devel@lists.xen.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Ross Lagerwall <ross.lagerwall@citrix.com>,
Paul Durrant <paul.durrant@citrix.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v4 3/6] x86/hvm: Provide XEN_DMOP_pin_memory_cacheattr
Date: Tue, 23 Jan 2018 15:22:43 +0000 [thread overview]
Message-ID: <20180123152246.22031-4-ross.lagerwall@citrix.com> (raw)
In-Reply-To: <20180123152246.22031-1-ross.lagerwall@citrix.com>
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>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Changed in v2:
* Check pad is 0.
xen/arch/x86/hvm/dm.c | 18 ++++++++++++++++++
xen/include/public/hvm/dm_op.h | 14 ++++++++++++++
xen/include/xlat.lst | 1 +
3 files changed, 33 insertions(+)
diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index a5773e3..8083ded 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -20,6 +20,7 @@
#include <xen/sched.h>
#include <asm/hap.h>
+#include <asm/hvm/cacheattr.h>
#include <asm/hvm/ioreq.h>
#include <asm/shadow.h>
@@ -671,6 +672,22 @@ 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;
+
+ if ( data->pad )
+ {
+ rc = -EINVAL;
+ break;
+ }
+
+ rc = hvm_set_mem_pinned_cacheattr(d, data->start, data->end,
+ data->type);
+ break;
+ }
+
default:
rc = -EOPNOTSUPP;
break;
@@ -701,6 +718,7 @@ CHECK_dm_op_inject_event;
CHECK_dm_op_inject_msi;
CHECK_dm_op_remote_shutdown;
CHECK_dm_op_relocate_memory;
+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 35d1346..5c10ec3 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -385,6 +385,19 @@ struct xen_dm_op_relocate_memory {
uint64_aligned_t dst_gfn;
};
+/*
+ * 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;
@@ -407,6 +420,7 @@ struct xen_dm_op {
map_mem_type_to_ioreq_server;
struct xen_dm_op_remote_shutdown remote_shutdown;
struct xen_dm_op_relocate_memory relocate_memory;
+ struct xen_dm_op_pin_memory_cacheattr pin_memory_cacheattr;
} u;
};
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index b3d00b7..3690b97 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.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-01-23 15:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 15:22 [PATCH v4 0/6] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
2018-01-23 15:22 ` [PATCH v4 1/6] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
2018-01-23 15:49 ` Wei Liu
2018-01-23 15:22 ` [PATCH v4 2/6] x86/hvm: Provide XEN_DMOP_relocate_memory Ross Lagerwall
2018-01-24 8:09 ` Jan Beulich
2018-01-24 9:20 ` Paul Durrant
2018-01-23 15:22 ` Ross Lagerwall [this message]
2018-01-23 15:22 ` [PATCH v4 4/6] tools: libxendevicemodel: Provide xendevicemodel_relocate_memory Ross Lagerwall
2018-01-23 15:22 ` [PATCH v4 5/6] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
2018-01-23 15:22 ` [PATCH v4 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr Ross Lagerwall
2018-01-23 15:44 ` Wei Liu
2018-01-23 15:47 ` Ross Lagerwall
2018-01-23 15:49 ` Wei Liu
2018-01-23 17:16 ` Jan Beulich
2018-01-23 17:49 ` Wei Liu
2018-01-24 8:00 ` Jan Beulich
2018-03-05 14:40 ` [PATCH v4 0/6] Add dmops to allow use of VGA with restricted QEMU Anthony PERARD
2018-03-05 15:13 ` Ross Lagerwall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180123152246.22031-4-ross.lagerwall@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=paul.durrant@citrix.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).