[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 11/19] xen: handle XENMEMF_get_vnumainfo in compat_memory_op
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/compat/memory.c | 38 ++++++++++++++++++++++++++++++++++++++ xen/include/xlat.lst | 2 ++ 2 files changed, 40 insertions(+) diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 06c90be..58cb847 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -15,6 +15,7 @@ CHECK_TYPE(domid); #undef xen_domid_t CHECK_mem_access_op; +CHECK_vmemrange; int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) { @@ -32,12 +33,14 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) struct xen_add_to_physmap *atp; struct xen_add_to_physmap_batch *atpb; struct xen_remove_from_physmap *xrfp; + struct xen_vnuma_topology_info *vnuma; } nat; union { struct compat_memory_reservation rsrv; struct compat_memory_exchange xchg; struct compat_add_to_physmap atp; struct compat_add_to_physmap_batch atpb; + struct compat_vnuma_topology_info vnuma; } cmp; set_xen_guest_handle(nat.hnd, COMPAT_ARG_XLAT_VIRT_BASE); @@ -273,6 +276,33 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) break; } + case XENMEM_get_vnumainfo: + { + enum XLAT_vnuma_topology_info_vdistance vdistance = + XLAT_vnuma_topology_info_vdistance_h; + enum XLAT_vnuma_topology_info_vcpu_to_vnode vcpu_to_vnode = + XLAT_vnuma_topology_info_vcpu_to_vnode_h; + enum XLAT_vnuma_topology_info_vmemrange vmemrange = + XLAT_vnuma_topology_info_vmemrange_h; + + if ( copy_from_guest(&cmp.vnuma, compat, 1) ) + return -EFAULT; + +#define XLAT_vnuma_topology_info_HNDL_vdistance_h(_d_, _s_) \ + guest_from_compat_handle((_d_)->vdistance.h, (_s_)->vdistance.h) +#define XLAT_vnuma_topology_info_HNDL_vcpu_to_vnode_h(_d_, _s_) \ + guest_from_compat_handle((_d_)->vcpu_to_vnode.h, (_s_)->vcpu_to_vnode.h) +#define XLAT_vnuma_topology_info_HNDL_vmemrange_h(_d_, _s_) \ + guest_from_compat_handle((_d_)->vmemrange.h, (_s_)->vmemrange.h) + + XLAT_vnuma_topology_info(nat.vnuma, &cmp.vnuma); + +#undef XLAT_vnuma_topology_info_HNDL_vdistance_h +#undef XLAT_vnuma_topology_info_HNDL_vcpu_to_vnode_h +#undef XLAT_vnuma_topology_info_HNDL_vmemrange_h + break; + } + default: return compat_arch_memory_op(cmd, compat); } @@ -398,6 +428,14 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) case XENMEM_remove_from_physmap: break; + case XENMEM_get_vnumainfo: + cmp.vnuma.nr_vnodes = nat.vnuma->nr_vnodes; + cmp.vnuma.nr_vcpus = nat.vnuma->nr_vcpus; + cmp.vnuma.nr_vmemranges = nat.vnuma->nr_vmemranges; + if ( __copy_to_guest(compat, &cmp.vnuma, 1) ) + rc = -EFAULT; + break; + default: domain_crash(current->domain); split = 0; diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst index 41b3e35..9c9fd9a 100644 --- a/xen/include/xlat.lst +++ b/xen/include/xlat.lst @@ -64,6 +64,8 @@ ? mem_access_op memory.h ! pod_target memory.h ! remove_from_physmap memory.h +? vmemrange memory.h +! vnuma_topology_info memory.h ? physdev_eoi physdev.h ? physdev_get_free_pirq physdev.h ? physdev_irq physdev.h -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |