Add dmops to allow use of VGA with restricted QEMU
v3 cover Add dmops to allow use of VGA with restricted QEMU
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.
Changes in v3:
* Address Jan's comments - primarily adding a new patch to remove the existing pin_mem_cacheattr domctl.
Changes in v2:
* Address Paul's comments - mainly making add_to_physmap operate on a range.
Ross Lagerwall (6):
xen/mm: Make xenmem_add_to_physmap global
x86/hvm: Provide XEN_DMOP_add_to_physmap
x86/hvm: Provide XEN_DMOP_pin_memory_cacheattr
tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
tools/flask/policy/modules/xen.if | 4 +- tools/libs/devicemodel/Makefile | 2 +- tools/libs/devicemodel/core.c | 39 ++++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 29 +++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 6 +++ 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/arch/x86/hvm/dm.c | 55 +++++++++++++++++++++++++ xen/common/memory.c | 5 +-- xen/include/public/domctl.h | 7 +--- xen/include/public/hvm/dm_op.h | 41 ++++++++++++++++++ xen/include/xen/mm.h | 3 ++ xen/include/xlat.lst | 2 + xen/xsm/flask/hooks.c | 3 -- xen/xsm/flask/policy/access_vectors | 2 - 18 files changed, 192 insertions(+), 46 deletions(-)
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 1/6 xen/mm: Make xenmem_add_to_physmap global
Make it global in preparation to be called by a new dmop.
--- xen/common/memory.c | 5 ++--- xen/include/xen/mm.h | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-)
xen/common/memory.c +2 -3
@@ -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 ;
xen/include/xen/mm.h +3 -0
@@ -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,
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 2/6 x86/hvm: Provide XEN_DMOP_add_to_physmap
In reply to Ross LagerwallProvide 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_range.
---
Changed in v3:
* Renamed idx -> src_gfn and gpfn -> dst_gfn.
* Increase the width of size and add an overflow check.
* Rework some of the descriptions.
* Dropped Paul's reviewed-by due to the above changes.
Changed in v2:
* Make it operate on a range.
xen/arch/x86/hvm/dm.c | 37 +++++++++++++++++++++++++++++++++++++ xen/include/public/hvm/dm_op.h | 19 +++++++++++++++++++ xen/include/xlat.lst | 1 + 3 files changed, 57 insertions(+)
xen/arch/x86/hvm/dm.c +37 -0
@@ -640,6 +640,42 @@ static int dm_op(const struct dmop_args *op_args)break ; } +case XEN_DMOP_add_to_physmap: + { +struct xen_dm_op_add_to_physmap *data = + &op.u.add_to_physmap; +struct xen_add_to_physmap xatp = { + .domid = op_args->domid, + .size = data->size, + .space = XENMAPSPACE_gmfn_range, + .idx = data->src_gfn, + .gpfn = data->dst_gfn, + }; + +if ( data->pad ) + { + rc = -EINVAL ; +break ; + } + +if ( xatp.size != data->size ) + { + rc = -EOVERFLOW ; +break ; + } + + rc =xenmem_add_to_physmap (d, &xatp,0 ); +if ( rc >0 ) + { + data->size -= rc; + data->src_gfn += rc; + data->dst_gfn += rc; + const_op = false; + rc = -ERESTART ; + } +break ; + } +default : rc = -EOPNOTSUPP ;break ;
@@ -669,6 +705,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,
xen/include/public/hvm/dm_op.h +19 -0
@@ -368,6 +368,24 @@ struct xen_dm_op_remote_shutdown {/* (Other reason values are not blocked) */ }; +/* +* XEN_DMOP_add_to_physmap : Sets the GFNs at which a page range appears in +* the specified guest's address space. Identical to +* XENMEM_add_to_physmap with +* space == XENMAPSPACE_gmfn_range. +*/ +#define XEN_DMOP_add_to_physmap 17 + +struct xen_dm_op_add_to_physmap { +/* Number of GFNs to process. */ +uint32_t size; +uint32_t pad; +/* Starting GFN of the source mapping page(s). */ +uint64_aligned_t src_gfn; +/* Starting GFN where the source mapping page(s) should appear. */ +uint64_aligned_t dst_gfn; +}; +struct xen_dm_op {uint32_t op;uint32_t pad;
@@ -389,6 +407,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; };
xen/include/xlat.lst +1 -0
@@ -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
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/6 x86/hvm: Provide XEN_DMOP_pin_memory_cacheattr
In reply to Ross LagerwallProvide 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.
---
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(+)
xen/arch/x86/hvm/dm.c +18 -0
@@ -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>
@@ -676,6 +677,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 ;
@@ -706,6 +723,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,
xen/include/public/hvm/dm_op.h +14 -0
@@ -386,6 +386,19 @@ struct xen_dm_op_add_to_physmap {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;
@@ -408,6 +421,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; };
xen/include/xlat.lst +1 -0
@@ -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
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 4/6 tools: libxendevicemodel: Provide xendevicemodel_add_to_physmap
In reply to Ross Lagerwall---
Changed in v3:
* Match width of size with updated hypervisor interface.
* Match description with the one for the hypervisor interface.
Changed in v2:
* Make it operate on a range.
tools/libs/devicemodel/Makefile | 2 +- tools/libs/devicemodel/core.c | 20 ++++++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 15 +++++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 5 +++++ 4 files changed, 41 insertions(+), 1 deletion(-)
tools/libs/devicemodel/Makefile +1 -1
@@ -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
tools/libs/devicemodel/core.c +20 -0
@@ -564,6 +564,26 @@ int xendevicemodel_shutdown(return xendevicemodel_op (dmod, domid,1 , &op,sizeof (op)); } +int xendevicemodel_add_to_physmap ( +xendevicemodel_handle *dmod,domid_t domid,uint32_t size,uint64_t src_gfn, +uint64_t dst_gfn) +{ +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->size = size; + data->pad =0 ; + data->src_gfn = src_gfn; + data->dst_gfn = dst_gfn; + +return xendevicemodel_op (dmod, domid,1 , &op,sizeof (op)); +} +int xendevicemodel_restrict (xendevicemodel_handle *dmod,domid_t domid) {return osdep_xendevicemodel_restrict (dmod, domid);
tools/libs/devicemodel/include/xendevicemodel.h +15 -0
@@ -325,6 +325,21 @@ int xendevicemodel_inject_event(int xendevicemodel_shutdown (xendevicemodel_handle *dmod,domid_t domid,unsigned int reason); +/* +* Sets the GFNs at which a page range appears in the domain's address +* space. +* +* @parm dmod a handle to an open devicemodel interface. +* @parm domid the domain id to be serviced +* @parm size Number of GFNs to process +* @parm src_gfn Starting GFN of the source mapping page(s) +* @parm dst_gfn Starting GFN where the source mapping page(s) should appear. +* @return 0 on success, -1 on failure. +*/ +int xendevicemodel_add_to_physmap ( +xendevicemodel_handle *dmod,domid_t domid,uint32_t size,uint64_t src_gfn, +uint64_t dst_gfn); +/** * This function restricts the use of this handle to the specified * domain.
tools/libs/devicemodel/libxendevicemodel.map +5 -0
@@ -27,3 +27,8 @@ VERS_1.1 { global: xendevicemodel_shutdown; } VERS_1.0; + +VERS_1.2 { + global: + xendevicemodel_add_to_physmap; +} VERS_1.1;
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 5/6 tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr
In reply to Ross Lagerwall--- tools/libs/devicemodel/core.c | 19 +++++++++++++++++++ tools/libs/devicemodel/include/xendevicemodel.h | 14 ++++++++++++++ tools/libs/devicemodel/libxendevicemodel.map | 1 + 3 files changed, 34 insertions(+)
tools/libs/devicemodel/core.c +19 -0
@@ -584,6 +584,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);
tools/libs/devicemodel/include/xendevicemodel.h +14 -0
@@ -341,6 +341,20 @@ int xendevicemodel_add_to_physmap( uint64_t dst_gfn);/** +* 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. *
tools/libs/devicemodel/libxendevicemodel.map +1 -0
@@ -31,4 +31,5 @@ VERS_1.1 { VERS_1.2 { global: xendevicemodel_add_to_physmap; + xendevicemodel_pin_memory_cacheattr; } VERS_1.1;
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 6/6 x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
In reply to Ross LagerwallRemove 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.
---
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 | 7 +------ xen/include/public/hvm/dm_op.h | 10 +++++++++- xen/xsm/flask/hooks.c | 3 --- xen/xsm/flask/policy/access_vectors | 2 -- 11 files changed, 24 insertions(+), 44 deletions(-)
tools/flask/policy/modules/xen.if +2 -2
@@ -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)
tools/libs/devicemodel/include/xendevicemodel.h +1 -1
@@ -347,7 +347,7 @@ int xendevicemodel_add_to_physmap(* @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(
tools/libxc/include/xenctrl.h +0 -6
@@ -1472,12 +1472,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);
tools/libxc/include/xenctrl_compat.h +3 -0
@@ -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 */
tools/libxc/xc_devicemodel_compat.c +8 -0
@@ -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
tools/libxc/xc_domain.c +0 -15
@@ -719,21 +719,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,
xen/arch/x86/domctl.c +0 -8
@@ -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 */
@@ -857,13 +856,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: {
xen/include/public/domctl.h +1 -6
@@ -597,10 +597,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 */
@@ -1148,7 +1144,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 Obsolete - 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 */
@@ -1225,7 +1221,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;
xen/include/public/hvm/dm_op.h +9 -1
@@ -395,7 +395,15 @@ struct xen_dm_op_add_to_physmap {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; };
xen/xsm/flask/hooks.c +0 -3
@@ -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 );
xen/xsm/flask/policy/access_vectors +0 -2
@@ -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
Signature · 7 lines
2.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/6] x86/hvm: Provide XEN_DMOP_add_to_physmap
In reply to Ross LagerwallQuoted 13 lines
-----Original Message-----
From: Ross Lagerwall [mailto:[email protected]]
Sent: 12 January 2018 12:45
To: [email protected]
Cc: Ross Lagerwall <[email protected]>; Paul Durrant <[email protected]>; Jan Beulich <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Ian Jackson <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Stefano Stabellini <[email protected]>; Tim (Xen.org) <[email protected]>; Wei Liu <[email protected]>
Subject: [PATCH v3 2/6] x86/hvm: ProvideXEN_DMOP_add_to_physmap
Quoted 7 lines
Provide
XEN_DMOP_add_to_physmap, a limited version ofXENMEM_add_to_physmapto allow a deprivileged QEMU to move VRAM when a
guest programs its BAR. It is equivalent toXENMEM_add_to_physmapwith space ==XENMAPSPACE_gmfn_range.Signed-off-by Ross Lagerwall <[email protected]>
Quoted 124 lines
---
Changed in v3:
* Renamed idx ->src_gfnand gpfn ->dst_gfn.
* Increase the width of size and add an overflow check.
* Rework some of the descriptions.
* Dropped Paul's reviewed-by due to the above changes.Changed in v2:
* Make it operate on a range.xen/arch/x86/hvm/dm.c | 37 +++++++++++++++++++++++++++++++++++++ xen/include/public/hvm/dm_op.h | 19 +++++++++++++++++++ xen/include/xlat.lst | 1 + 3 files changed, 57 insertions(+)xen/arch/x86/hvm/dm.c +37
-0@@ -640,6 +640,42 @@ static int dm_op(const struct dmop_args *op_args)break ; } +case XEN_DMOP_add_to_physmap: + { +struct xen_dm_op_add_to_physmap *data = + &op.u.add_to_physmap; +struct xen_add_to_physmap xatp = { + .domid = op_args->domid, + .size = data->size, + .space = XENMAPSPACE_gmfn_range, + .idx = data->src_gfn, + .gpfn = data->dst_gfn, + }; + +if ( data->pad ) + { + rc = -EINVAL ; +break ; + } + +if ( xatp.size != data->size ) + { + rc = -EOVERFLOW ; +break ; + } + + rc =xenmem_add_to_physmap (d, &xatp,0 ); +if ( rc >0 ) + { + data->size -= rc; + data->src_gfn += rc; + data->dst_gfn += rc; + const_op = false; + rc = -ERESTART ; + } +break ; + } +default : rc = -EOPNOTSUPP ;break ;@@ -669,6 +705,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,xen/include/public/hvm/dm_op.h +2
-0@@ -368,6 +368,24 @@ struct xen_dm_op_remote_shutdown {/* (Other reason values are not blocked) */ }; +/* +* XEN_DMOP_add_to_physmap : Sets the GFNs at which a page range appears in
+ * the specified guest's address space. Identical to + * XENMEM_add_to_physmap with + * space == XENMAPSPACE_gmfn_range.+ */
xen/include/public/hvm/dm_op.h +13
-0+#define XEN_DMOP_add_to_physmap 17 + +struct xen_dm_op_add_to_physmap { +/* Number of GFNs to process. */ +uint32_t size; +uint32_t pad; +/* Starting GFN of the source mapping page(s). */ +uint64_aligned_t src_gfn; +/* Starting GFN where the source mapping page(s) should appear. */ +uint64_aligned_t dst_gfn; +}; +struct xen_dm_op {uint32_t op;uint32_t pad;@@ -389,6 +407,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; };xen/include/xlat.lst +1
-1@@ -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 --
Quoted 1 line
2.9.5
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
In reply to Ross LagerwallQuoted 22 lines
-----Original Message-----
From: Ross Lagerwall [mailto:[email protected]]
Sent: 12 January 2018 12:45
To: [email protected]
Cc: Ross Lagerwall <[email protected]>; Paul Durrant <[email protected]>; Daniel De Graaf <[email protected]>; Ian Jackson <[email protected]>; Wei Liu <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Stefano Stabellini <[email protected]>; Tim (Xen.org) <[email protected]>
Subject: [PATCH v3 6/6] x86/domctl: RemoveXEN_DOMCTL_pin_mem_cacheattrRemove the implementation of
XEN_DOMCTL_pin_mem_cacheattrsince it has
been replaced by a dmop. Changexc_domain_pin_memory_cacheattr()so that it is only defined whenXC_WANT_COMPAT_DEVICEMODEL_APIis set and
have it call the new dmop. Leave the definitions of XEN_DOMCTL_MEM_CACHEATTR_* since they are still used by QEMU.
Quoted 1 line
Signed-off-by Ross Lagerwall <[email protected]>
Quoted 246 lines
---
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 | 7 +------ xen/include/public/hvm/dm_op.h | 10 +++++++++- xen/xsm/flask/hooks.c | 3 --- xen/xsm/flask/policy/access_vectors | 2 -- 11 files changed, 24 insertions(+), 44 deletions(-)tools/flask/policy/modules/xen.if +2
-2@@ -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)tools/libs/devicemodel/include/xendevicemodel.h +1
-1@@ -347,7 +347,7 @@ int xendevicemodel_add_to_physmap(* @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(tools/libxc/include/xenctrl.h +0
-6@@ -1472,12 +1472,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);tools/libxc/include/xenctrl_compat.h +3
-0@@ -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 */ tools/libxc/xc_devicemodel_compat.c +8
-0@@ -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
tools/libxc/xc_domain.c +0
-15@@ -719,21 +719,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,xen/arch/x86/domctl.c +0
-8@@ -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 */ @@ -857,13 +856,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: {xen/include/public/domctl.h +1
-5@@ -597,10 +597,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 */ @@ -1148,7 +1144,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 Obsolete - use dmop */ #define XEN_DOMCTL_set_ext_vcpucontext 42#define XEN_DOMCTL_get_ext_vcpucontext 43#define
XEN_DOMCTL_set_opt_feature44 /* Obsolete IA64 only */xen/include/public/domctl.h +0
-1@@ -1225,7 +1221,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;xen/include/public/hvm/dm_op.h +1
-1@@ -395,7 +395,15 @@ struct xen_dm_op_add_to_physmap {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. */
xen/include/public/hvm/dm_op.h +8
-0+#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; };xen/xsm/flask/hooks.c +0
-3@@ -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 );xen/xsm/flask/policy/access_vectors +0
-2@@ -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,
Quoted 4 lines
HVMOP_pagetable_dying
hvmctl
--
2.9.5
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
In reply to Ross LagerwallQuoted 7 lines · Ross Lagerwall
Remove the implementation of
XEN_DOMCTL_pin_mem_cacheattrsince it has been replaced by a dmop. Changexc_domain_pin_memory_cacheattr()so that it is only defined whenXC_WANT_COMPAT_DEVICEMODEL_APIis 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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/6] x86/hvm: Provide XEN_DMOP_add_to_physmap
In reply to Ross LagerwallQuoted 19 lines
Quoted 1 line
Quoted 1 line · On 12.01.18 at 13:45, <[email protected]> wrote:
xen/arch/x86/hvm/dm.c +12
-0@@ -640,6 +640,42 @@ static int dm_op(const struct dmop_args *op_args)break ; } +case XEN_DMOP_add_to_physmap: + { +struct xen_dm_op_add_to_physmap *data = + &op.u.add_to_physmap; +struct xen_add_to_physmap xatp = { + .domid = op_args->domid, + .size = data->size, + .space = XENMAPSPACE_gmfn_range, + .idx = data->src_gfn, + .gpfn = data->dst_gfn, + }; +
xen/arch/x86/hvm/dm.c static int dm_op(const struct dmop_args *op_args) · line 664
Quoted 10 lines
xen/arch/x86/hvm/dm.c +10
-0+if ( data->pad ) + { + rc = -EINVAL ; +break ; + } + +if ( xatp.size != data->size ) + { + rc = -EOVERFLOW ; +break ;
I guess this is fine for now, but clearly not really necessary, as the continuation logic could take care of the situation. Please add a comment to this effect.
Quoted 13 lines
xen/include/public/hvm/dm_op.h +7
-0@@ -368,6 +368,24 @@ struct xen_dm_op_remote_shutdown {/* (Other reason values are not blocked) */ }; +/* +* XEN_DMOP_add_to_physmap : Sets the GFNs at which a page range appears in +* the specified guest's address space. Identical to +* XENMEM_add_to_physmap with +* space == XENMAPSPACE_gmfn_range. +*/ +#define XEN_DMOP_add_to_physmap 17
xen/include/public/hvm/dm_op.h struct xen_dm_op_remote_shutdown { · line 387
Quoted 10 lines
xen/include/public/hvm/dm_op.h +10
-0+ +struct xen_dm_op_add_to_physmap { +/* Number of GFNs to process. */ +uint32_t size; +uint32_t pad; +/* Starting GFN of the source mapping page(s). */ +uint64_aligned_t src_gfn; +/* Starting GFN where the source mapping page(s) should appear. */ +uint64_aligned_t dst_gfn; +};
So why again is this "add-to-physmap"? It's moving memory around, isn't it? The comment also could be more clear in this regard. Everything else looks fine to me now.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr
In reply to Ross LagerwallQuoted 15 lines
Quoted 1 line
Quoted 1 line · On 12.01.18 at 13:45, <[email protected]> wrote:
xen/include/public/domctl.h +0
-4@@ -597,10 +597,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 */
xen/include/public/domctl.h struct xen_domctl { · line 1147
Quoted 5 lines
xen/include/public/domctl.h +1
-1@@ -1148,7 +1144,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 Obsolete - use dmop */
"Obsolete" is wrong imo if the implementation is gone. Also I think you need to bump the interface version when you remove something here.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/6] x86/hvm: Provide XEN_DMOP_add_to_physmap
In reply to Jan BeulichQuoted 25 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 12.01.18 at 13:45, <[email protected]> wrote:
xen/arch/x86/hvm/dm.c +18
-0@@ -640,6 +640,42 @@ static int dm_op(const struct dmop_args *op_args)break ; } +case XEN_DMOP_add_to_physmap: + { +struct xen_dm_op_add_to_physmap *data = + &op.u.add_to_physmap; +struct xen_add_to_physmap xatp = { + .domid = op_args->domid, + .size = data->size, + .space = XENMAPSPACE_gmfn_range, + .idx = data->src_gfn, + .gpfn = data->dst_gfn, + }; + +if ( data->pad ) + { + rc = -EINVAL ; +break ; + } +
Quoted 8 lines
xen/arch/x86/hvm/dm.c static int dm_op(const struct dmop_args *op_args) · line 664
Quoted 4 lines
xen/arch/x86/hvm/dm.c +4
-0+if ( xatp.size != data->size ) + { + rc = -EOVERFLOW ; +break ;I guess this is fine for now, but clearly not really necessary, as the continuation logic could take care of the situation. Please add a comment to this effect.
Oh, I didn't think of using the continuation logic for that. I'll use it then.
Quoted 20 lines
Quoted 20 lines
xen/include/public/hvm/dm_op.h +13
-0@@ -368,6 +368,24 @@ struct xen_dm_op_remote_shutdown {/* (Other reason values are not blocked) */ }; +/* +* XEN_DMOP_add_to_physmap : Sets the GFNs at which a page range appears in +* the specified guest's address space. Identical to +* XENMEM_add_to_physmap with +* space == XENMAPSPACE_gmfn_range. +*/ +#define XEN_DMOP_add_to_physmap 17 + +struct xen_dm_op_add_to_physmap { +/* Number of GFNs to process. */ +uint32_t size; +uint32_t pad; +/* Starting GFN of the source mapping page(s). */
Quoted 9 lines
xen/include/public/hvm/dm_op.h struct xen_dm_op_remote_shutdown { · line 387
Quoted 4 lines
xen/include/public/hvm/dm_op.h +4
-0+uint64_aligned_t src_gfn; +/* Starting GFN where the source mapping page(s) should appear. */ +uint64_aligned_t dst_gfn; +};So why again is this "add-to-physmap"? It's moving memory around, isn't it? The comment also could be more clear in this regard. Everything else looks fine to me now.
Do you have a preference for what to call it?
Signature · 6 lines
Ross Lagerwall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/6] x86/hvm: Provide XEN_DMOP_add_to_physmap
Quoted 31 lines
Quoted 1 line
Quoted 1 line · On 18.01.18 at 10:32, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 12.01.18 at 13:45, <[email protected]> wrote:
xen/include/public/hvm/dm_op.h +13
-0@@ -368,6 +368,24 @@ struct xen_dm_op_remote_shutdown {/* (Other reason values are not blocked) */ }; +/* +* XEN_DMOP_add_to_physmap : Sets the GFNs at which a page range appears in +* the specified guest's address space. Identical to +* XENMEM_add_to_physmap with +* space == XENMAPSPACE_gmfn_range. +*/ +#define XEN_DMOP_add_to_physmap 17 + +struct xen_dm_op_add_to_physmap { +/* Number of GFNs to process. */ +uint32_t size; +uint32_t pad; +/* Starting GFN of the source mapping page(s). */ Quoted 8 lines
xen/include/public/hvm/dm_op.h struct xen_dm_op_remote_shutdown { · line 387
Quoted 4 lines
xen/include/public/hvm/dm_op.h +4
-0+uint64_aligned_t src_gfn; +/* Starting GFN where the source mapping page(s) should appear. */ +uint64_aligned_t dst_gfn; +};So why again is this "add-to-physmap"? It's moving memory around, isn't it? The comment also could be more clear in this regard. Everything else looks fine to me now.
Quoted 1 line
Do you have a preference for what to call it?
Best I can think of is XEN_DMOP_move_gfns, but I don't like it very much, hence I didn't suggest it in my earlier reply.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel