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>,
Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: [PATCH v4 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
Date: Tue, 23 Jan 2018 15:22:46 +0000 [thread overview]
Message-ID: <20180123152246.22031-7-ross.lagerwall@citrix.com> (raw)
In-Reply-To: <20180123152246.22031-1-ross.lagerwall@citrix.com>
Remove the implementation of XEN_DOMCTL_pin_mem_cacheattr since it has
been replaced by a dmop. Change xc_domain_pin_memory_cacheattr() so
that it is only defined when XC_WANT_COMPAT_DEVICEMODEL_API is set and
have it call the new dmop. Leave the definitions of
XEN_DOMCTL_MEM_CACHEATTR_* since they are still used by QEMU.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
Changed in v4:
* Bump interface version.
* Clarified comment.
New in v3.
tools/flask/policy/modules/xen.if | 4 ++--
tools/libs/devicemodel/include/xendevicemodel.h | 2 +-
tools/libxc/include/xenctrl.h | 6 ------
tools/libxc/include/xenctrl_compat.h | 3 +++
tools/libxc/xc_devicemodel_compat.c | 8 ++++++++
tools/libxc/xc_domain.c | 15 ---------------
xen/arch/x86/domctl.c | 8 --------
xen/include/public/domctl.h | 9 ++-------
xen/include/public/hvm/dm_op.h | 10 +++++++++-
xen/xsm/flask/hooks.c | 3 ---
xen/xsm/flask/policy/access_vectors | 2 --
11 files changed, 25 insertions(+), 45 deletions(-)
diff --git a/tools/flask/policy/modules/xen.if b/tools/flask/policy/modules/xen.if
index cb48a6c..459880b 100644
--- a/tools/flask/policy/modules/xen.if
+++ b/tools/flask/policy/modules/xen.if
@@ -57,7 +57,7 @@ define(`create_domain_common', `
allow $1 $2:shadow enable;
allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp };
allow $1 $2:grant setup;
- allow $1 $2:hvm { cacheattr getparam hvmctl sethvmc
+ allow $1 $2:hvm { getparam hvmctl sethvmc
setparam nested altp2mhvm altp2mhvm_op dm };
')
@@ -151,7 +151,7 @@ define(`device_model', `
allow $1 $2_target:domain { getdomaininfo shutdown };
allow $1 $2_target:mmu { map_read map_write adjust physmap target_hack };
- allow $1 $2_target:hvm { getparam setparam hvmctl cacheattr dm };
+ allow $1 $2_target:hvm { getparam setparam hvmctl dm };
')
# make_device_model(priv, dm_dom, hvm_dom)
diff --git a/tools/libs/devicemodel/include/xendevicemodel.h b/tools/libs/devicemodel/include/xendevicemodel.h
index 9b89f32..7629c35 100644
--- a/tools/libs/devicemodel/include/xendevicemodel.h
+++ b/tools/libs/devicemodel/include/xendevicemodel.h
@@ -346,7 +346,7 @@ int xendevicemodel_relocate_memory(
* @parm domid the domain id to be serviced
* @parm start Start gfn
* @parm end End gfn
- * @parm type XEN_DOMCTL_MEM_CACHEATTR_*
+ * @parm type XEN_DMOP_MEM_CACHEATTR_*
* @return 0 on success, -1 on failure.
*/
int xendevicemodel_pin_memory_cacheattr(
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index ecb0312..6a4347e 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1473,12 +1473,6 @@ int xc_domain_iomem_permission(xc_interface *xch,
unsigned long nr_mfns,
uint8_t allow_access);
-int xc_domain_pin_memory_cacheattr(xc_interface *xch,
- uint32_t domid,
- uint64_t start,
- uint64_t end,
- uint32_t type);
-
unsigned long xc_make_page_below_4G(xc_interface *xch, uint32_t domid,
unsigned long mfn);
diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h
index a655e47..464f645 100644
--- a/tools/libxc/include/xenctrl_compat.h
+++ b/tools/libxc/include/xenctrl_compat.h
@@ -164,6 +164,9 @@ int xc_hvm_set_mem_type(
int xc_hvm_inject_trap(
xc_interface *xch, uint32_t domid, int vcpu, uint8_t vector,
uint8_t type, uint32_t error_code, uint8_t insn_len, uint64_t cr2);
+int xc_domain_pin_memory_cacheattr(
+ xc_interface *xch, uint32_t domid, uint64_t start, uint64_t end,
+ uint32_t type);
#endif /* XC_WANT_COMPAT_DEVICEMODEL_API */
diff --git a/tools/libxc/xc_devicemodel_compat.c b/tools/libxc/xc_devicemodel_compat.c
index dbd1785..a46011c 100644
--- a/tools/libxc/xc_devicemodel_compat.c
+++ b/tools/libxc/xc_devicemodel_compat.c
@@ -128,6 +128,14 @@ int xc_hvm_inject_trap(
type, error_code, insn_len, cr2);
}
+int xc_domain_pin_memory_cacheattr(
+ xc_interface *xch, uint32_t domid, uint64_t start, uint64_t end,
+ uint32_t type)
+{
+ return xendevicemodel_pin_memory_cacheattr(xch->dmod, domid, start, end,
+ type);
+}
+
/*
* Local variables:
* mode: C
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 8169284..da0aa2f 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -720,21 +720,6 @@ int xc_domain_setmaxmem(xc_interface *xch,
return do_domctl(xch, &domctl);
}
-int xc_domain_pin_memory_cacheattr(xc_interface *xch,
- uint32_t domid,
- uint64_t start,
- uint64_t end,
- uint32_t type)
-{
- DECLARE_DOMCTL;
- domctl.cmd = XEN_DOMCTL_pin_mem_cacheattr;
- domctl.domain = domid;
- domctl.u.pin_mem_cacheattr.start = start;
- domctl.u.pin_mem_cacheattr.end = end;
- domctl.u.pin_mem_cacheattr.type = type;
- return do_domctl(xch, &domctl);
-}
-
#if defined(__i386__) || defined(__x86_64__)
int xc_domain_set_memory_map(xc_interface *xch,
uint32_t domid,
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2585d4e..e68c7be 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -23,7 +23,6 @@
#include <asm/irq.h>
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
-#include <asm/hvm/cacheattr.h>
#include <asm/processor.h>
#include <asm/acpi.h> /* for hvm_acpi_power_button */
#include <xen/hypercall.h> /* for arch_do_domctl */
@@ -859,13 +858,6 @@ long arch_do_domctl(
break;
}
- case XEN_DOMCTL_pin_mem_cacheattr:
- ret = hvm_set_mem_pinned_cacheattr(
- d, domctl->u.pin_mem_cacheattr.start,
- domctl->u.pin_mem_cacheattr.end,
- domctl->u.pin_mem_cacheattr.type);
- break;
-
case XEN_DOMCTL_set_ext_vcpucontext:
case XEN_DOMCTL_get_ext_vcpucontext:
{
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index a8921dd..30674d6 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -38,7 +38,7 @@
#include "hvm/save.h"
#include "memory.h"
-#define XEN_DOMCTL_INTERFACE_VERSION 0x0000000f
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000010
/*
* NB. xen_domctl.domain is an IN/OUT parameter for this operation.
@@ -598,10 +598,6 @@ struct xen_domctl_ioport_mapping {
#define XEN_DOMCTL_MEM_CACHEATTR_WB 6
#define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
#define XEN_DOMCTL_DELETE_MEM_CACHEATTR (~(uint32_t)0)
-struct xen_domctl_pin_mem_cacheattr {
- uint64_aligned_t start, end;
- uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
-};
/* XEN_DOMCTL_set_ext_vcpucontext */
@@ -1149,7 +1145,7 @@ struct xen_domctl {
#define XEN_DOMCTL_bind_pt_irq 38
#define XEN_DOMCTL_memory_mapping 39
#define XEN_DOMCTL_ioport_mapping 40
-#define XEN_DOMCTL_pin_mem_cacheattr 41
+/* #define XEN_DOMCTL_pin_mem_cacheattr 41 Removed - use dmop */
#define XEN_DOMCTL_set_ext_vcpucontext 42
#define XEN_DOMCTL_get_ext_vcpucontext 43
#define XEN_DOMCTL_set_opt_feature 44 /* Obsolete IA64 only */
@@ -1226,7 +1222,6 @@ struct xen_domctl {
struct xen_domctl_bind_pt_irq bind_pt_irq;
struct xen_domctl_memory_mapping memory_mapping;
struct xen_domctl_ioport_mapping ioport_mapping;
- struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
struct xen_domctl_ext_vcpucontext ext_vcpucontext;
struct xen_domctl_set_target set_target;
struct xen_domctl_subscribe subscribe;
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index 5c10ec3..3c6ebb5 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -394,7 +394,15 @@ struct xen_dm_op_relocate_memory {
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_* */
+/* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
+#define XEN_DMOP_MEM_CACHEATTR_UC 0
+#define XEN_DMOP_MEM_CACHEATTR_WC 1
+#define XEN_DMOP_MEM_CACHEATTR_WT 4
+#define XEN_DMOP_MEM_CACHEATTR_WP 5
+#define XEN_DMOP_MEM_CACHEATTR_WB 6
+#define XEN_DMOP_MEM_CACHEATTR_UCM 7
+#define XEN_DMOP_DELETE_MEM_CACHEATTR (~(uint32_t)0)
+ uint32_t type; /* XEN_DMOP_MEM_CACHEATTR_* */
uint32_t pad;
};
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 19ceacf..835b3d1 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -693,9 +693,6 @@ static int flask_domctl(struct domain *d, int cmd)
case XEN_DOMCTL_mem_sharing_op:
return current_has_perm(d, SECCLASS_HVM, HVM__MEM_SHARING);
- case XEN_DOMCTL_pin_mem_cacheattr:
- return current_has_perm(d, SECCLASS_HVM, HVM__CACHEATTR);
-
case XEN_DOMCTL_sendtrigger:
return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__TRIGGER);
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index d0a1ec5..50dfc36 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -264,8 +264,6 @@ class hvm
# HVMOP_get_param
getparam
bind_irq
-# XEN_DOMCTL_pin_mem_cacheattr
- cacheattr
# HVMOP_get_mem_type,
# HVMOP_set_mem_access, HVMOP_get_mem_access, HVMOP_pagetable_dying
hvmctl
--
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 ` [PATCH v4 3/6] x86/hvm: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
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 ` Ross Lagerwall [this message]
2018-01-23 15:44 ` [PATCH v4 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr 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-7-ross.lagerwall@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--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).