mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools: add physinfo arch_capabilities handling for Arm
On Arm, the SVE vector length is encoded in arch_capabilities field of struct xen_sysctl_physinfo, make use of this field in the tools when building for arm. Create header arm-arch-capabilities.h to handle the arch_capabilities field of physinfo for Arm. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Acked-by: George Dunlap <george.dunlap@citrix.com> Acked-by: Christian Lindig <christian.lindig@cloud.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
1 parent
9392bf6a3a
commit
56a7aaa16b
13 files changed
+87
-21
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#include <xen/hvm/hvm_info_table.h>
|
||||
#include <xen/hvm/params.h>
|
||||
|
||||
#include <xen-tools/arm-arch-capabilities.h>
|
||||
#include <xen-tools/common-macros.h>
|
||||
|
||||
/* Needed for Python versions earlier than 2.3. */
|
||||
@@ -871,6 +872,7 @@ static PyObject *pyxc_physinfo(XcObject *self)
|
||||
const char *virtcap_names[] = { "hvm", "pv" };
|
||||
const unsigned virtcaps_bits[] = { XEN_SYSCTL_PHYSCAP_hvm,
|
||||
XEN_SYSCTL_PHYSCAP_pv };
|
||||
PyObject *objret;
|
||||
|
||||
if ( xc_physinfo(self->xc_handle, &pinfo) != 0 )
|
||||
return pyxc_error_to_exception(self->xc_handle);
|
||||
@@ -897,17 +899,35 @@ static PyObject *pyxc_physinfo(XcObject *self)
|
||||
if ( p != virt_caps )
|
||||
*(p-1) = '\0';
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s,s:s}",
|
||||
"nr_nodes", pinfo.nr_nodes,
|
||||
"threads_per_core", pinfo.threads_per_core,
|
||||
"cores_per_socket", pinfo.cores_per_socket,
|
||||
"nr_cpus", pinfo.nr_cpus,
|
||||
"total_memory", pages_to_kib(pinfo.total_pages),
|
||||
"free_memory", pages_to_kib(pinfo.free_pages),
|
||||
"scrub_memory", pages_to_kib(pinfo.scrub_pages),
|
||||
"cpu_khz", pinfo.cpu_khz,
|
||||
"hw_caps", cpu_cap,
|
||||
"virt_caps", virt_caps);
|
||||
objret = Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s,s:s}",
|
||||
"nr_nodes", pinfo.nr_nodes,
|
||||
"threads_per_core", pinfo.threads_per_core,
|
||||
"cores_per_socket", pinfo.cores_per_socket,
|
||||
"nr_cpus", pinfo.nr_cpus,
|
||||
"total_memory", pages_to_kib(pinfo.total_pages),
|
||||
"free_memory", pages_to_kib(pinfo.free_pages),
|
||||
"scrub_memory", pages_to_kib(pinfo.scrub_pages),
|
||||
"cpu_khz", pinfo.cpu_khz,
|
||||
"hw_caps", cpu_cap,
|
||||
"virt_caps", virt_caps);
|
||||
|
||||
#if defined(__aarch64__)
|
||||
if ( objret ) {
|
||||
unsigned int sve_vl_bits;
|
||||
PyObject *py_arm_sve_vl;
|
||||
|
||||
sve_vl_bits = arch_capabilities_arm_sve(pinfo.arch_capabilities);
|
||||
py_arm_sve_vl = PyLong_FromUnsignedLong(sve_vl_bits);
|
||||
|
||||
if ( !py_arm_sve_vl )
|
||||
return NULL;
|
||||
|
||||
if( PyDict_SetItemString(objret, "arm_sve_vl", py_arm_sve_vl) )
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return objret;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_getcpuinfo(XcObject *self, PyObject *args, PyObject *kwds)
|
||||
|
||||