Introduce getHost support for ARM cpus. First add some common
ARM server models to cpu_map, then add some helper methods to
parse and load them. The 'lscpu' command from 'util-linux'
provides very good data for cpu information, we can parse them
directly.
Zhenyu Zheng (5):
cpu_map: Introduce arm CPU models
cpu: Introduce virCPUarmData to virCPUData
cpu: Introduce arm related structs
cpu: Add helper functions to parse vendor and model for ARM
cpu: Introduce getHost supoort for ARM
src/cpu/cpu.h | 2 +
src/cpu/cpu_arm.c | 412 +++++++++++++++++++++++++++++-
src/cpu/cpu_arm_data.h | 32 +++
src/cpu_map/Makefile.inc.am | 7 +
src/cpu_map/arm_Falkor.xml | 15 ++
src/cpu_map/arm_Kunpeng-920.xml | 23 ++
src/cpu_map/arm_ThunderX299xx.xml | 15 ++
src/cpu_map/arm_cortex-a53.xml | 15 ++
src/cpu_map/arm_cortex-a57.xml | 14 +
src/cpu_map/arm_cortex-a72.xml | 14 +
src/cpu_map/arm_vendors.xml | 14 +
src/cpu_map/index.xml | 16 ++
12 files changed, 577 insertions(+), 2 deletions(-)
create mode 100644 src/cpu/cpu_arm_data.h
create mode 100644 src/cpu_map/arm_Falkor.xml
create mode 100644 src/cpu_map/arm_Kunpeng-920.xml
create mode 100644 src/cpu_map/arm_ThunderX299xx.xml
create mode 100644 src/cpu_map/arm_cortex-a53.xml
create mode 100644 src/cpu_map/arm_cortex-a57.xml
create mode 100644 src/cpu_map/arm_cortex-a72.xml
create mode 100644 src/cpu_map/arm_vendors.xml
--
2.26.0.windows.1
Show replies by date
Introduce arm related structs to cpu_arm.c
---
src/cpu/cpu_arm.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index ee5802198f..2a05f43118 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -26,6 +26,8 @@
#include "cpu_map.h"
#include "virstring.h"
#include "virxml.h"
+#include "cpu_map.h"
+#include "cpu_arm.h"
#define VIR_FROM_THIS VIR_FROM_CPU
@@ -36,6 +38,21 @@ static const virArch archs[] = {
VIR_ARCH_AARCH64,
};
+typedef struct _virCPUarmVendor virCPUarmVendor;
+typedef virCPUarmVendor *virCPUarmVendorPtr;
+struct _virCPUarmVendor {
+ char *name;
+ unsigned long value;
+};
+
+typedef struct _virCPUarmModel virCPUarmModel;
+typedef virCPUarmModel *virCPUarmModelPtr;
+struct _virCPUarmModel {
+ char *name;
+ virCPUarmVendorPtr vendor;
+ virCPUarmData data;
+};
+
typedef struct _virCPUarmFeature virCPUarmFeature;
typedef virCPUarmFeature *virCPUarmFeaturePtr;
struct _virCPUarmFeature {
@@ -64,9 +81,53 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmFeature, virCPUarmFeatureFree);
typedef struct _virCPUarmMap virCPUarmMap;
typedef virCPUarmMap *virCPUarmMapPtr;
struct _virCPUarmMap {
+ size_t nvendors;
+ virCPUarmVendorPtr *vendors;
+ size_t nmodels;
+ virCPUarmModelPtr *models;
GPtrArray *features;
};
+static void
+virCPUarmDataClear(virCPUarmData *data)
+{
+ if (!data)
+ return;
+
+ VIR_FREE(data->features);
+}
+
+static void
+virCPUarmDataFree(virCPUDataPtr cpuData)
+{
+ if (!cpuData)
+ return;
+
+ virCPUarmDataClear(&cpuData->data.arm);
+ VIR_FREE(cpuData);
+}
+
+static void
+armModelFree(virCPUarmModelPtr model)
+{
+ if (!model)
+ return;
+
+ virCPUarmDataClear(&model->data);
+ g_free(model->name);
+ g_free(model);
+}
+
+static void
+armVendorFree(virCPUarmVendorPtr vendor)
+{
+ if (!vendor)
+ return;
+
+ g_free(vendor->name);
+ g_free(vendor);
+}
+
static virCPUarmMapPtr
virCPUarmMapNew(void)
{
@@ -86,6 +147,16 @@ virCPUarmMapFree(virCPUarmMapPtr map)
{
if (!map)
return;
+
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++)
+ armModelFree(map->models[i]);
+ g_free(map->models);
+
+ for (i = 0; i < map->nvendors; i++)
+ armVendorFree(map->vendors[i]);
+ g_free(map->vendors);
g_ptr_array_free(map->features, TRUE);
--
2.26.0.windows.1