[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] handle XENMEM_get_vnumainfo in compat_memory_op
commit 5f6ec28f2c3c3ba17a0b7f2a1d98324665420f46 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Fri Jan 23 15:06:26 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Jan 23 15:06:26 2015 +0100 handle XENMEM_get_vnumainfo in compat_memory_op Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/compat/memory.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ xen/include/xlat.lst | 2 + 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 06c90be..b258138 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,13 +276,50 @@ 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); } rc = do_memory_op(cmd, nat.hnd); if ( rc < 0 ) + { + if ( rc == -ENOBUFS && op == 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; + } cmd = 0; if ( hypercall_xlat_continuation(&cmd, 2, 0x02, nat.hnd, compat) ) @@ -398,6 +438,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 -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |