[libvirt-ci PATCH 0/4] lcitool: Use more dictionaries in the inventory
by Andrea Bolognani
It's the most sensible way to represent related data in YAML.
Andrea Bolognani (4):
lcitool: Tweak formatting
lcitool: Store OS information a dictionary
lcitool: Store packaging information as a dictionary
lcitool: Store paths information as a dictionary
guests/host_vars/libvirt-centos-7/main.yml | 30 ++--
guests/host_vars/libvirt-centos-8/main.yml | 30 ++--
guests/host_vars/libvirt-debian-10/main.yml | 30 ++--
guests/host_vars/libvirt-debian-9/main.yml | 30 ++--
guests/host_vars/libvirt-debian-sid/main.yml | 30 ++--
guests/host_vars/libvirt-fedora-30/main.yml | 30 ++--
guests/host_vars/libvirt-fedora-31/main.yml | 30 ++--
.../host_vars/libvirt-fedora-rawhide/main.yml | 30 ++--
guests/host_vars/libvirt-freebsd-11/main.yml | 30 ++--
guests/host_vars/libvirt-freebsd-12/main.yml | 30 ++--
.../libvirt-freebsd-current/main.yml | 30 ++--
.../host_vars/libvirt-opensuse-151/main.yml | 30 ++--
guests/host_vars/libvirt-ubuntu-1604/main.yml | 30 ++--
guests/host_vars/libvirt-ubuntu-1804/main.yml | 30 ++--
guests/lcitool | 154 ++++++++----------
guests/playbooks/update/tasks/base.yml | 72 ++++----
guests/playbooks/update/tasks/bootloader.yml | 2 +-
guests/playbooks/update/tasks/bootstrap.yml | 6 +-
guests/playbooks/update/tasks/gitlab.yml | 2 +-
guests/playbooks/update/tasks/global.yml | 4 +-
guests/playbooks/update/tasks/jenkins.yml | 2 +-
guests/playbooks/update/tasks/kludges.yml | 8 +-
guests/playbooks/update/tasks/packages.yml | 24 +--
guests/playbooks/update/tasks/services.yml | 2 +-
guests/playbooks/update/tasks/users.yml | 4 +-
guests/playbooks/update/templates/bashrc.j2 | 12 +-
.../update/templates/jenkins.service.j2 | 2 +-
27 files changed, 380 insertions(+), 334 deletions(-)
--
2.25.4
4 years, 6 months
[PATCH V4 5/5] cpu_map: Introduce ARM cpu models
by Zhenyu Zheng
Introduce vendors and some commonly used models
for ARM arch, these will be used for virConnectionGetCapabilities
for ARM CPUs.
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu_map/Makefile.inc.am | 7 +++++++
src/cpu_map/arm_Falkor.xml | 16 ++++++++++++++++
src/cpu_map/arm_Kunpeng-920.xml | 24 ++++++++++++++++++++++++
src/cpu_map/arm_ThunderX299xx.xml | 16 ++++++++++++++++
src/cpu_map/arm_cortex-a53.xml | 16 ++++++++++++++++
src/cpu_map/arm_cortex-a57.xml | 15 +++++++++++++++
src/cpu_map/arm_cortex-a72.xml | 15 +++++++++++++++
src/cpu_map/arm_vendors.xml | 14 ++++++++++++++
src/cpu_map/index.xml | 15 +++++++++++++++
9 files changed, 138 insertions(+)
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
diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am
index be64c9a0d4..5d9190e27d 100644
--- a/src/cpu_map/Makefile.inc.am
+++ b/src/cpu_map/Makefile.inc.am
@@ -2,7 +2,14 @@
cpumapdir = $(pkgdatadir)/cpu_map
cpumap_DATA = \
+ cpu_map/arm_cortex-a53.xml \
+ cpu_map/arm_cortex-a57.xml \
+ cpu_map/arm_cortex-a72.xml \
cpu_map/arm_features.xml \
+ cpu_map/arm_Kunpeng-920.xml \
+ cpu_map/arm_ThunderX299xx.xml \
+ cpu_map/arm_Falkor.xml \
+ cpu_map/arm_vendors.xml \
cpu_map/index.xml \
cpu_map/ppc64_vendors.xml \
cpu_map/ppc64_POWER7.xml \
diff --git a/src/cpu_map/arm_Falkor.xml b/src/cpu_map/arm_Falkor.xml
new file mode 100644
index 0000000000..902ed2b6ba
--- /dev/null
+++ b/src/cpu_map/arm_Falkor.xml
@@ -0,0 +1,16 @@
+<cpus>
+ <model name='Falkor'>
+ <vendor name='Qualcomm'/>
+ <pvr value='0xc00'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="cpuid"/>
+ <feature name="asimdrdm"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_Kunpeng-920.xml
b/src/cpu_map/arm_Kunpeng-920.xml
new file mode 100644
index 0000000000..668b8b50dc
--- /dev/null
+++ b/src/cpu_map/arm_Kunpeng-920.xml
@@ -0,0 +1,24 @@
+<cpus>
+ <model name='Kunpeng-920'>
+ <vendor name='HiSilicon'/>
+ <pvr value='0xd01'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="atomics"/>
+ <feature name="fphp"/>
+ <feature name="asimdhp"/>
+ <feature name="cpuid"/>
+ <feature name="asimdrdm"/>
+ <feature name="jscvt"/>
+ <feature name="fcma"/>
+ <feature name="dcpop"/>
+ <feature name="asimddp"/>
+ <feature name="asimdfhm"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_ThunderX299xx.xml
b/src/cpu_map/arm_ThunderX299xx.xml
new file mode 100644
index 0000000000..9ab3d939e9
--- /dev/null
+++ b/src/cpu_map/arm_ThunderX299xx.xml
@@ -0,0 +1,16 @@
+<cpus>
+ <model name='ThunderX2 99xx'>
+ <vendor name='Cavium'/>
+ <pvr value='0x0af'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="cpuid"/>
+ <feature name="asimdrdm"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a53.xml b/src/cpu_map/arm_cortex-a53.xml
new file mode 100644
index 0000000000..963d6d36e3
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a53.xml
@@ -0,0 +1,16 @@
+<cpus>
+ <model name='cortex-a53'>
+ <vendor name='ARM'/>
+ <pvr value='0xd03'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="cpuid"/>
+ <feature name="asimdrdm"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a57.xml b/src/cpu_map/arm_cortex-a57.xml
new file mode 100644
index 0000000000..92a044ea92
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a57.xml
@@ -0,0 +1,15 @@
+<cpus>
+ <model name='cortex-a57'>
+ <vendor name='ARM'/>
+ <pvr value='0xd07'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="cpuid"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_cortex-a72.xml b/src/cpu_map/arm_cortex-a72.xml
new file mode 100644
index 0000000000..9664eacd7b
--- /dev/null
+++ b/src/cpu_map/arm_cortex-a72.xml
@@ -0,0 +1,15 @@
+<cpus>
+ <model name='cortex-a72'>
+ <vendor name='ARM'/>
+ <pvr value='0xd08'/>
+ <feature name="fp"/>
+ <feature name="asimd"/>
+ <feature name="evtstrm"/>
+ <feature name="aes"/>
+ <feature name="pmull"/>
+ <feature name="sha1"/>
+ <feature name="sha2"/>
+ <feature name="crc32"/>
+ <feature name="cpuid"/>
+ </model>
+</cpus>
diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml
new file mode 100644
index 0000000000..703c2112b1
--- /dev/null
+++ b/src/cpu_map/arm_vendors.xml
@@ -0,0 +1,14 @@
+<cpus>
+ <vendor name="ARM" value="0x41"/>
+ <vendor name="Broadcom" value="0x42"/>
+ <vendor name="Cavium" value="0x43"/>
+ <vendor name="DigitalEquipment" value="0x44"/>
+ <vendor name="HiSilicon" value="0x48"/>
+ <vendor name="Infineon" value="0x49"/>
+ <vendor name="Freescale" value="0x4D"/>
+ <vendor name="NVIDIA" value="0x4E"/>
+ <vendor name="APM" value="0x50"/>
+ <vendor name="Qualcomm" value="0x51"/>
+ <vendor name="Marvell" value="0x56"/>
+ <vendor name="Intel" value="0x69"/>
+</cpus>
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 50b030de29..20646a031c 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -85,6 +85,21 @@
</arch>
<arch name='arm'>
+ <include filename="arm_vendors.xml"/>
<include filename='arm_features.xml'/>
+
+ <!-- ARM-based CPU models -->
+ <include filename="arm_cortex-a53.xml"/>
+ <include filename="arm_cortex-a57.xml"/>
+ <include filename="arm_cortex-a72.xml"/>
+
+ <!-- Qualcomm-based CPU models -->
+ <include filename='arm_Falkor.xml'/>
+
+ <!-- Cavium-based CPU models -->
+ <include filename='arm_ThunderX299xx.xml'/>
+
+ <!-- Hisilicon-based CPU models -->
+ <include filename="arm_Kunpeng-920.xml"/>
</arch>
</cpus>
--
2.26.2
4 years, 6 months
[PATCH V4 4/5] cpu: Introduce getHost support for ARM CPU driver
by Zhenyu Zheng
Introduce getHost support for ARM CPU driver, read
CPU vendor_id, part_id and flags from registers
directly. These codes will only be compiled on
aarch64 hardwares.
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu/cpu_arm.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 201 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 24404eac2c..887932cc5a 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -21,6 +21,10 @@
*/
#include <config.h>
+#if defined(__aarch64__)
+# include <asm/hwcap.h>
+# include <sys/auxv.h>
+#endif
#include "viralloc.h"
#include "cpu.h"
@@ -31,6 +35,12 @@
#include "virxml.h"
#define VIR_FROM_THIS VIR_FROM_CPU
+#if defined(__aarch64__)
+/* Shift bit mask for parsing cpu flags */
+# define BIT_SHIFTS(n) (1UL << (n))
+/* The current max number of cpu flags on ARM is 32 */
+# define MAX_CPU_FLAGS 32
+#endif
VIR_LOG_INIT("cpu.cpu_arm");
@@ -495,12 +505,203 @@ virCPUarmValidateFeatures(virCPUDefPtr cpu)
return 0;
}
+#if defined(__aarch64__)
+/**
+ * virCPUarmCpuDataFromRegs:
+ *
+ * @data: 64-bit arm CPU specific data
+ *
+ * Fetches CPU vendor_id and part_id from MIDR_EL1 register, parse CPU
+ * flags from AT_HWCAP. There are currently 32 valid flags on ARM arch
+ * represented by each bit.
+ */
+static int
+virCPUarmCpuDataFromRegs(virCPUarmData *data)
+{
+ /* Generate human readable flag list according to the order of */
+ /* AT_HWCAP bit map */
+ const char *flag_list[MAX_CPU_FLAGS] = {
+ "fp", "asimd", "evtstrm", "aes", "pmull", "sha1", "sha2",
+ "crc32", "atomics", "fphp", "asimdhp", "cpuid", "asimdrdm",
+ "jscvt", "fcma", "lrcpc", "dcpop", "sha3", "sm3", "sm4",
+ "asimddp", "sha512", "sve", "asimdfhm", "dit", "uscat",
+ "ilrcpc", "flagm", "ssbs", "sb", "paca", "pacg"};
+ unsigned long cpuid, hwcaps;
+ char **features = NULL;
+ g_autofree char *cpu_feature_str = NULL;
+ int cpu_feature_index = 0;
+ size_t i;
+
+ if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("CPUID registers unavailable"));
+ return -1;
+ }
+
+ /* read the cpuid data from MIDR_EL1 register */
+ asm("mrs %0, MIDR_EL1" : "=r" (cpuid));
+ VIR_DEBUG("CPUID read from register: 0x%016lx", cpuid);
+
+ /* parse the coresponding part_id bits */
+ data->pvr = cpuid>>4&0xFFF;
+ /* parse the coresponding vendor_id bits */
+ data->vendor_id = cpuid>>24&0xFF;
+
+ hwcaps = getauxval(AT_HWCAP);
+ VIR_DEBUG("CPU flags read from register: 0x%016lx", hwcaps);
+
+ if (VIR_ALLOC_N(features, MAX_CPU_FLAGS) < 0)
+ return -1;
+
+ /* shift bit map mask to parse for CPU flags */
+ for (i = 0; i< MAX_CPU_FLAGS; i++) {
+ if (hwcaps & BIT_SHIFTS(i)) {
+ features[cpu_feature_index] = g_strdup(flag_list[i]);
+ cpu_feature_index++;
+ }
+ }
+
+ if (cpu_feature_index > 1) {
+ cpu_feature_str = virStringListJoin((const char **)features, " ");
+ if (!cpu_feature_str)
+ goto error;
+ }
+ data->features = g_strdup(cpu_feature_str);
+
+ return 0;
+
+ error:
+ virStringListFree(features);
+ return -1;
+}
+
+static int
+virCPUarmDataParseFeatures(virCPUDefPtr cpu,
+ const virCPUarmData *cpuData)
+{
+ int ret = -1;
+ size_t i;
+ char **features;
+
+ if (!cpu || !cpuData)
+ return ret;
+
+ if (!(features = virStringSplitCount(cpuData->features, " ",
+ 0, &cpu->nfeatures)))
+ return ret;
+ if (cpu->nfeatures) {
+ if (VIR_ALLOC_N(cpu->features, cpu->nfeatures) < 0)
+ goto error;
+
+ for (i = 0; i < cpu->nfeatures; i++) {
+ cpu->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
+ cpu->features[i].name = g_strdup(features[i]);
+ }
+ }
+
+ ret = 0;
+
+ cleanup:
+ virStringListFree(features);
+ return ret;
+
+ error:
+ for (i = 0; i < cpu->nfeatures; i++)
+ VIR_FREE(cpu->features[i].name);
+ VIR_FREE(cpu->features);
+ cpu->nfeatures = 0;
+ goto cleanup;
+}
+
+static int
+virCPUarmDecode(virCPUDefPtr cpu,
+ const virCPUarmData *cpuData,
+ virDomainCapsCPUModelsPtr models)
+{
+ virCPUarmMapPtr map;
+ virCPUarmModelPtr model;
+ virCPUarmVendorPtr vendor = NULL;
+
+ if (!cpuData || !(map = virCPUarmGetMap()))
+ return -1;
+
+ if (!(model = virCPUarmModelFindByPVR(map, cpuData->pvr))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Cannot find CPU model with PVR 0x%03lx"),
+ cpuData->pvr);
+ return -1;
+ }
+
+ if (!virCPUModelIsAllowed(model->name, models)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("CPU model %s is not supported by hypervisor"),
+ model->name);
+ return -1;
+ }
+
+ cpu->model = g_strdup(model->name);
+
+ if (cpuData->vendor_id &&
+ !(vendor = virCPUarmVendorFindByID(map, cpuData->vendor_id))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Cannot find CPU vendor with vendor id 0x%02lx"),
+ cpuData->vendor_id);
+ return -1;
+ }
+
+ if (vendor)
+ cpu->vendor = g_strdup(vendor->name);
+
+ if (cpuData->features &&
+ virCPUarmDataParseFeatures(cpu, cpuData) < 0)
+ return -1;
+
+ return 0;
+}
+
+static int
+virCPUarmDecodeCPUData(virCPUDefPtr cpu,
+ const virCPUData *data,
+ virDomainCapsCPUModelsPtr models)
+{
+ return virCPUarmDecode(cpu, &data->data.arm, models);
+}
+
+static int
+virCPUarmGetHost(virCPUDefPtr cpu,
+ virDomainCapsCPUModelsPtr models)
+{
+ virCPUDataPtr cpuData = NULL;
+ int ret = -1;
+
+ if (virCPUarmDriverInitialize() < 0)
+ goto cleanup;
+
+ if (!(cpuData = virCPUDataNew(archs[0])))
+ goto cleanup;
+
+ if (virCPUarmCpuDataFromRegs(&cpuData->data.arm) < 0)
+ goto cleanup;
+
+ ret = virCPUarmDecodeCPUData(cpu, cpuData, models);
+
+ cleanup:
+ virCPUarmDataFree(cpuData);
+ return ret;
+}
+#endif
+
struct cpuArchDriver cpuDriverArm = {
.name = "arm",
.arch = archs,
.narch = G_N_ELEMENTS(archs),
.compare = virCPUarmCompare,
+#if defined(__aarch64__)
+ .getHost = virCPUarmGetHost,
+ .decode = virCPUarmDecodeCPUData,
+#else
.decode = NULL,
+#endif
.encode = NULL,
.dataFree = virCPUarmDataFree,
.baseline = virCPUarmBaseline,
--
2.26.2
4 years, 6 months
[PATCH V4 3/5] cpu: Add helper funtions to parse vendor and model
by Zhenyu Zheng
Add helper functions to parse vendor and model from
xml for ARM arch, and use them as callbacks when
load cpu maps.
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu/cpu_arm.c | 171 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 170 insertions(+), 1 deletion(-)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index d8f571cae3..24404eac2c 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -206,6 +206,174 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt
G_GNUC_UNUSED,
return 0;
}
+static virCPUarmVendorPtr
+virCPUarmVendorFindByID(virCPUarmMapPtr map,
+ unsigned long vendor_id)
+{
+ size_t i;
+
+ for (i = 0; i < map->nvendors; i++) {
+ if (map->vendors[i]->value == vendor_id)
+ return map->vendors[i];
+ }
+
+ return NULL;
+}
+
+
+static virCPUarmVendorPtr
+virCPUarmVendorFindByName(virCPUarmMapPtr map,
+ const char *name)
+{
+ size_t i;
+
+ for (i = 0; i < map->nvendors; i++) {
+ if (STREQ(map->vendors[i]->name, name))
+ return map->vendors[i];
+ }
+
+ return NULL;
+}
+
+
+static int
+virCPUarmVendorParse(xmlXPathContextPtr ctxt,
+ const char *name,
+ void *data)
+{
+ virCPUarmMapPtr map = data;
+ virCPUarmVendorPtr vendor = NULL;
+ int ret = -1;
+
+ if (VIR_ALLOC(vendor) < 0)
+ return ret;
+
+ vendor->name = g_strdup(name);
+
+ if (virCPUarmVendorFindByName(map, vendor->name)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU vendor %s already defined"),
+ vendor->name);
+ goto cleanup;
+ }
+
+ if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Missing CPU vendor value"));
+ goto cleanup;
+ }
+
+ if (virCPUarmVendorFindByID(map, vendor->value)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU vendor value 0x%2lx already defined"),
+ vendor->value);
+ goto cleanup;
+ }
+
+ if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ virCPUarmVendorFree(vendor);
+ return ret;
+
+}
+
+static virCPUarmModelPtr
+virCPUarmModelFind(virCPUarmMapPtr map,
+ const char *name)
+{
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++) {
+ if (STREQ(map->models[i]->name, name))
+ return map->models[i];
+ }
+
+ return NULL;
+}
+
+#if defined(__aarch64__)
+static virCPUarmModelPtr
+virCPUarmModelFindByPVR(virCPUarmMapPtr map,
+ unsigned long pvr)
+{
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++) {
+ if (map->models[i]->data.pvr == pvr)
+ return map->models[i];
+ }
+
+ return NULL;
+}
+#endif
+
+static int
+virCPUarmModelParse(xmlXPathContextPtr ctxt,
+ const char *name,
+ void *data)
+{
+ virCPUarmMapPtr map = data;
+ virCPUarmModel *model;
+ g_autofree xmlNodePtr *nodes = NULL;
+ g_autofree char *vendor = NULL;
+
+ if (VIR_ALLOC(model) < 0)
+ goto error;
+
+ model->name = g_strdup(name);
+
+ if (virCPUarmModelFind(map, model->name)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU model %s already defined"),
+ model->name);
+ goto error;
+ }
+
+ if (virXPathBoolean("boolean(./vendor)", ctxt)) {
+ vendor = virXPathString("string(./vendor/@name)", ctxt);
+ if (!vendor) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid vendor element in CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (!(model->vendor = virCPUarmVendorFindByName(map, vendor))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown vendor %s referenced by CPU model
%s"),
+ vendor, model->name);
+ goto error;
+ }
+ }
+
+ if (!virXPathBoolean("boolean(./pvr)", ctxt)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing PVR information for CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (virXPathULongHex("string(./pvr/@value)", ctxt, &model->data.pvr) <
0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing or invalid PVR value in CPU model %s"),
+ model->name);
+ goto error;
+ }
+
+ if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
+ goto error;
+
+ return 0;
+
+ error:
+ virCPUarmModelFree(model);
+ return -1;
+}
+
static virCPUarmMapPtr
virCPUarmLoadMap(void)
{
@@ -213,7 +381,8 @@ virCPUarmLoadMap(void)
map = virCPUarmMapNew();
- if (cpuMapLoad("arm", NULL, virCPUarmMapFeatureParse, NULL, map) < 0)
+ if (cpuMapLoad("arm", virCPUarmVendorParse, virCPUarmMapFeatureParse,
+ virCPUarmModelParse, map) < 0)
return NULL;
return g_steal_pointer(&map);
--
2.26.2
4 years, 6 months
[PATCH V4 2/5] cpu: Introduce ARM related structs
by Zhenyu Zheng
Introduce vendor and model struct and related
cleanup functions for ARM cpu.
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu/cpu_arm.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index ee5802198f..d8f571cae3 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -1,6 +1,7 @@
/*
* cpu_arm.c: CPU driver for arm CPUs
*
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
* Copyright (C) 2013 Red Hat, Inc.
* Copyright (C) Canonical Ltd. 2012
*
@@ -23,12 +24,16 @@
#include "viralloc.h"
#include "cpu.h"
+#include "cpu_arm.h"
#include "cpu_map.h"
+#include "virlog.h"
#include "virstring.h"
#include "virxml.h"
#define VIR_FROM_THIS VIR_FROM_CPU
+VIR_LOG_INIT("cpu.cpu_arm");
+
static const virArch archs[] = {
VIR_ARCH_ARMV6L,
VIR_ARCH_ARMV7B,
@@ -36,6 +41,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,6 +84,10 @@ 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;
};
@@ -81,12 +105,62 @@ virCPUarmMapNew(void)
return map;
}
+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
+virCPUarmModelFree(virCPUarmModelPtr model)
+{
+ if (!model)
+ return;
+
+ virCPUarmDataClear(&model->data);
+ g_free(model->name);
+ g_free(model);
+}
+
+static void
+virCPUarmVendorFree(virCPUarmVendorPtr vendor)
+{
+ if (!vendor)
+ return;
+
+ g_free(vendor->name);
+ g_free(vendor);
+}
+
static void
virCPUarmMapFree(virCPUarmMapPtr map)
{
if (!map)
return;
+ size_t i;
+
+ for (i = 0; i < map->nmodels; i++)
+ virCPUarmModelFree(map->models[i]);
+ g_free(map->models);
+
+ for (i = 0; i < map->nvendors; i++)
+ virCPUarmVendorFree(map->vendors[i]);
+ g_free(map->vendors);
+
g_ptr_array_free(map->features, TRUE);
g_free(map);
@@ -259,6 +333,7 @@ struct cpuArchDriver cpuDriverArm = {
.compare = virCPUarmCompare,
.decode = NULL,
.encode = NULL,
+ .dataFree = virCPUarmDataFree,
.baseline = virCPUarmBaseline,
.update = virCPUarmUpdate,
.validateFeatures = virCPUarmValidateFeatures,
--
2.26.2
4 years, 6 months
[PATCH V4 1/5] cpu: Introduce virCPUarmData to virCPUData
by Zhenyu Zheng
Introduce virCPUarmData to virCPUData
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu/Makefile.inc.am | 1 +
src/cpu/cpu.h | 2 ++
src/cpu/cpu_arm_data.h | 31 +++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
create mode 100644 src/cpu/cpu_arm_data.h
diff --git a/src/cpu/Makefile.inc.am b/src/cpu/Makefile.inc.am
index 0abeee87b6..228112a3c6 100644
--- a/src/cpu/Makefile.inc.am
+++ b/src/cpu/Makefile.inc.am
@@ -9,6 +9,7 @@ CPU_SOURCES = \
cpu/cpu_s390.h \
cpu/cpu_s390.c \
cpu/cpu_arm.h \
+ cpu/cpu_arm_data.h \
cpu/cpu_arm.c \
cpu/cpu_ppc64.h \
cpu/cpu_ppc64.c \
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index f779d2be17..ec22a183a1 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -27,6 +27,7 @@
#include "cpu_conf.h"
#include "cpu_x86_data.h"
#include "cpu_ppc64_data.h"
+#include "cpu_arm_data.h"
typedef struct _virCPUData virCPUData;
@@ -36,6 +37,7 @@ struct _virCPUData {
union {
virCPUx86Data x86;
virCPUppc64Data ppc64;
+ virCPUarmData arm;
/* generic driver needs no data */
} data;
};
diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h
new file mode 100644
index 0000000000..cf12ca8c2e
--- /dev/null
+++ b/src/cpu/cpu_arm_data.h
@@ -0,0 +1,31 @@
+/*
+ * cpu_arm_data.h: 64-bit arm CPU specific data
+ *
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#define VIR_CPU_ARM_DATA_INIT { 0 }
+
+typedef struct _virCPUarmData virCPUarmData;
+struct _virCPUarmData {
+ unsigned long vendor_id;
+ unsigned long pvr;
+ char *features;
+};
--
2.26.2
4 years, 6 months
[PATCH V4 1/5] cpu: Introduce virCPUarmData to virCPUData
by Zhenyu Zheng
Introduce virCPUarmData to virCPUData
Signed-off-by: Zhenyu Zheng <zhengzhenyulixi(a)gmail.com>
---
src/cpu/Makefile.inc.am | 1 +
src/cpu/cpu.h | 2 ++
src/cpu/cpu_arm_data.h | 31 +++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
create mode 100644 src/cpu/cpu_arm_data.h
diff --git a/src/cpu/Makefile.inc.am b/src/cpu/Makefile.inc.am
index 0abeee87b6..228112a3c6 100644
--- a/src/cpu/Makefile.inc.am
+++ b/src/cpu/Makefile.inc.am
@@ -9,6 +9,7 @@ CPU_SOURCES = \
cpu/cpu_s390.h \
cpu/cpu_s390.c \
cpu/cpu_arm.h \
+ cpu/cpu_arm_data.h \
cpu/cpu_arm.c \
cpu/cpu_ppc64.h \
cpu/cpu_ppc64.c \
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index f779d2be17..ec22a183a1 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -27,6 +27,7 @@
#include "cpu_conf.h"
#include "cpu_x86_data.h"
#include "cpu_ppc64_data.h"
+#include "cpu_arm_data.h"
typedef struct _virCPUData virCPUData;
@@ -36,6 +37,7 @@ struct _virCPUData {
union {
virCPUx86Data x86;
virCPUppc64Data ppc64;
+ virCPUarmData arm;
/* generic driver needs no data */
} data;
};
diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h
new file mode 100644
index 0000000000..cf12ca8c2e
--- /dev/null
+++ b/src/cpu/cpu_arm_data.h
@@ -0,0 +1,31 @@
+/*
+ * cpu_arm_data.h: 64-bit arm CPU specific data
+ *
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#define VIR_CPU_ARM_DATA_INIT { 0 }
+
+typedef struct _virCPUarmData virCPUarmData;
+struct _virCPUarmData {
+ unsigned long vendor_id;
+ unsigned long pvr;
+ char *features;
+};
--
2.26.2
4 years, 6 months
[PATCH v2 0/5] qemu: Support rbd namespace attribute
by Han Han
Change from v1:
- Add rbd namespace member to aarch64 capability replies. Add rbd
namespace capability test for aarch64.
- Provide more details in news xml
v1: https://www.redhat.com/archives/libvir-list/2020-April/msg00388.html
git repo: https://github.com/qiankehan/libvirt/tree/rbd-namespace-v2
Han Han (5):
qemu_capabilities: Add QEMU_CAPS_RBD_NAMESPACE
conf: Support to parse rbd namespace attribute
qemu: Implement rbd namespace attribute
doc: rng schemas and html doc for rbd namespace attribute
news: qemu: Support rbd namespace
docs/formatdomain.html.in | 5 +++
docs/news.xml | 10 +++++
docs/schemas/domaincommon.rng | 3 ++
src/conf/domain_conf.c | 4 ++
src/qemu/qemu_block.c | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 14 ++++++-
src/util/virstoragefile.h | 1 +
.../caps_5.0.0.aarch64.replies | 5 +++
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
...k-network-rbd-namespace.x86_64-latest.args | 41 +++++++++++++++++++
.../disk-network-rbd-namespace.xml | 33 +++++++++++++++
tests/qemuxml2argvtest.c | 1 +
...sk-network-rbd-namespace.x86_64-latest.xml | 41 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
18 files changed, 165 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest.xml
--
2.25.0
4 years, 6 months
[libvirt PATCH v4 0/3] QEMU: support QEMU built without TCG
by Tobin Feldman-Fitzthum
Rebased and resent from about a month ago.
Since version 2.10, QEMU can be built without TCG. This patch
adds capabillity QEMU_CAPS_TCG_DISABLED that allows libvirt
to use a QEMU built without TCG.
Rather than create a capability that is set whenever TCG is
enabled (almost always), QEMU_CAPS_TCG_DISABLED is set only
when the TCG is not available. This avoids some issues
with backwards compatability.
For a domain that was created using QEMU >= 2.10 with KVM,
there is no information in the cached XML file that says
whether or not TCG was enabled. Versions of QEMU older
than 2.10 do not have a QMP interface for determining
whether QEMU is available. Since QEMU_CAPS_TCG_DISABLED
is set only when TCG is disabled, we do not have to do any
extra work to infer an appropriate value in either of these
cases.
New in vesion 4:
Move virQEMUCapsProbeQMPTCGState into
virQEMUCapsProbeQMPDevices so that we can reuse the qom call.
Rename, virQEMUCapsProbeQMPDevices to virQEMUProbeQMPTypes.
All patches compile.
Tobin Feldman-Fitzthum (3):
add QEMU_CAPS_TCG_DISABLED and probe conditionally
add virQEMUCapsGetVirtType convenience function
add virQEMUCapsProbeQMPTCGState function to set QEMU_CAPS_TCG_DISABLED
src/qemu/qemu_capabilities.c | 81 +++++++++++++++++++++++++++---------
src/qemu/qemu_capabilities.h | 3 ++
2 files changed, 65 insertions(+), 19 deletions(-)
--
2.20.1 (Apple Git-117)
4 years, 6 months
[libvirt-ci RFC PATCH 00/13] Introduce a new global TOML config file for lcitool
by Erik Skultety
This series is trying to consolidate the number of config files we currently
recognize under ~/.config/lcitool to a single global TOML config file. Thanks
to this effort we can expose more seetings than we previously could which will
come handy in terms of generating cloudinit images for OpenStack.
Patches 1-4 patches are just a little extra - not heavily related to the series
See patch 5/13 why TOML was selected.
Erik Skultety (13):
requirements: Introduce a requirements.txt file
lcitool: Decrease the indent when creating a tempdir for initrd
injection
lcitool: Prefer tempfile's native wrappers over low level primitives
lcitool: Use a temporary JSON file to pass extra variables
config: Introduce a new global config.toml configuration file
lcitool: Introduce methods to load and validate the TOML config
lcitool: Drop the get_flavor() method
lcitool: Drop the get_root_password_file() method
lcitool: Drop the gitlab-related getter methods
lcitool: Use d.update() on extra_vars for options coming from the
config
config: Move the virt-install settings from install.yml to the config
lcitool: Use the config install options rather than install facts
guests: README: Document the existence and usage of config.toml
config.toml | 43 +++++
guests/README.markdown | 19 +-
guests/lcitool | 235 +++++++++++------------
guests/playbooks/update/tasks/gitlab.yml | 2 -
guests/playbooks/update/tasks/users.yml | 2 +-
requirements.txt | 3 +
6 files changed, 175 insertions(+), 129 deletions(-)
create mode 100644 config.toml
create mode 100644 requirements.txt
--
2.25.3
4 years, 6 months