[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH 5/8] xen/mem: handle XENMEM_get_cpu_topology in compat_memory_op



hvmloader needs to get cpu topology to build ACPI and boot APs.

Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
---
 xen/common/compat/memory.c | 21 +++++++++++++++++++++
 xen/include/xlat.lst       |  1 +
 2 files changed, 22 insertions(+)

diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c
index 35bb259..b41f210 100644
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -71,6 +71,7 @@ int compat_memory_op(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) compat)
             struct xen_remove_from_physmap *xrfp;
             struct xen_vnuma_topology_info *vnuma;
             struct xen_mem_access_op *mao;
+            struct xen_cpu_topology_info *cti;
         } nat;
         union {
             struct compat_memory_reservation rsrv;
@@ -79,6 +80,7 @@ int compat_memory_op(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) compat)
             struct compat_add_to_physmap_batch atpb;
             struct compat_vnuma_topology_info vnuma;
             struct compat_mem_access_op mao;
+            struct compat_cpu_topology_info cti;
         } cmp;
 
         set_xen_guest_handle(nat.hnd, COMPAT_ARG_XLAT_VIRT_BASE);
@@ -395,6 +397,21 @@ int compat_memory_op(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) compat)
         }
 #endif
 
+        case XENMEM_get_cpu_topology:
+        {
+            enum XLAT_cpu_topology_info_tid tid = XLAT_cpu_topology_info_tid_h;
+
+            if ( copy_from_guest(&cmp.cti, compat, 1) )
+                return -EFAULT;
+#define XLAT_cpu_topology_info_HNDL_tid_h(_d_, _s_)      \
+            guest_from_compat_handle((_d_)->tid.h, (_s_)->tid.h)
+
+            XLAT_cpu_topology_info(nat.cti, &cmp.cti);
+
+#undef XLAT_cpu_topology_info_HNDL_tid_h
+            break;
+        }
+
         default:
             return compat_arch_memory_op(cmd, compat);
         }
@@ -527,6 +544,10 @@ int compat_memory_op(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) compat)
         case XENMEM_access_op:
             break;
 
+        case XENMEM_get_cpu_topology:
+            printk("finish getting cpu topology\n");
+            break;
+
         case XENMEM_get_vnumainfo:
             cmp.vnuma.nr_vnodes = nat.vnuma->nr_vnodes;
             cmp.vnuma.nr_vcpus = nat.vnuma->nr_vcpus;
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 4346cbe..8380bb7 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -89,6 +89,7 @@
 !      reserved_device_memory_map      memory.h
 ?      vmemrange                       memory.h
 !      vnuma_topology_info             memory.h
+!      cpu_topology_info               memory.h
 ?      physdev_eoi                     physdev.h
 ?      physdev_get_free_pirq           physdev.h
 ?      physdev_irq                     physdev.h
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.