diff --git a/Add-loongarch-cpu-model-and-vendor-info.patch b/Add-loongarch-cpu-model-and-vendor-info.patch deleted file mode 100644 index e4e66514b9cdd4945bc8da1cf492d8ecf00ebc5a..0000000000000000000000000000000000000000 --- a/Add-loongarch-cpu-model-and-vendor-info.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 55c7dc34b8ff1a75bb011ca783b6cd3c7f1a5643 Mon Sep 17 00:00:00 2001 -From: zhaotianrui -Date: Wed, 11 Jan 2023 11:41:55 -0500 -Subject: [PATCH 2/4] Add loongarch cpu model and vendor info - -Define loongarch cpu model type and vendor id in -cpu_map/loongarch.xml - -Signed-off-by: zhaotianrui ---- - src/cpu_map/Makefile.inc.am | 2 ++ - src/cpu_map/index.xml | 5 +++++ - src/cpu_map/loongarch_3a5000.xml | 6 ++++++ - src/cpu_map/loongarch_vendors.xml | 3 +++ - 4 files changed, 16 insertions(+) - create mode 100644 src/cpu_map/loongarch_3a5000.xml - create mode 100644 src/cpu_map/loongarch_vendors.xml - -diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am -index 8eb818706a..3c674dea40 100644 ---- a/src/cpu_map/Makefile.inc.am -+++ b/src/cpu_map/Makefile.inc.am -@@ -68,6 +68,8 @@ cpumap_DATA = \ - cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \ - cpu_map/x86_Westmere.xml \ - cpu_map/x86_Westmere-IBRS.xml \ -+ cpu_map/loongarch_vendors.xml \ -+ cpu_map/loongarch_3a5000.xml \ - cpu_map/arm_vendors.xml \ - cpu_map/arm_cortex-a53.xml \ - cpu_map/arm_cortex-a57.xml \ -diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml -index 3ccc76b9ed..1c05dd814d 100644 ---- a/src/cpu_map/index.xml -+++ b/src/cpu_map/index.xml -@@ -101,4 +101,9 @@ - - - -+ -+ -+ -+ -+ - -diff --git a/src/cpu_map/loongarch_3a5000.xml b/src/cpu_map/loongarch_3a5000.xml -new file mode 100644 -index 0000000000..f6fe3386f7 ---- /dev/null -+++ b/src/cpu_map/loongarch_3a5000.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/loongarch_vendors.xml b/src/cpu_map/loongarch_vendors.xml -new file mode 100644 -index 0000000000..c744654617 ---- /dev/null -+++ b/src/cpu_map/loongarch_vendors.xml -@@ -0,0 +1,3 @@ -+ -+ -+ --- -2.25.1 - diff --git a/Add-loongarch-cpu-support.patch b/Add-loongarch-cpu-support.patch deleted file mode 100644 index 7d057551d10b01957c84916bc6ad4921cf2aa1d7..0000000000000000000000000000000000000000 --- a/Add-loongarch-cpu-support.patch +++ /dev/null @@ -1,994 +0,0 @@ -From c0b26612cf12d5f0594a9dfa5bd97fcf7acfe9da Mon Sep 17 00:00:00 2001 -From: zhaotianrui -Date: Wed, 11 Jan 2023 10:53:08 -0500 -Subject: [PATCH 1/4] Add loongarch cpu support - -Add loongarch cpu support: Define new cpu type 'loongarch64' -and implement it's driver functions. - -Signed-off-by: zhaotianrui ---- - docs/schemas/basictypes.rng | 1 + - po/POTFILES.in | 1 + - src/cpu/Makefile.inc.am | 3 + - src/cpu/cpu.c | 2 + - src/cpu/cpu.h | 3 +- - src/cpu/cpu_loongarch.c | 739 +++++++++++++++++++++++++++++++++++ - src/cpu/cpu_loongarch.h | 28 ++ - src/cpu/cpu_loongarch_data.h | 40 ++ - src/qemu/qemu_capabilities.c | 1 + - src/qemu/qemu_domain.c | 4 + - src/util/virarch.c | 1 + - src/util/virarch.h | 3 + - 12 files changed, 825 insertions(+), 1 deletion(-) - create mode 100644 src/cpu/cpu_loongarch.c - create mode 100644 src/cpu/cpu_loongarch.h - create mode 100644 src/cpu/cpu_loongarch_data.h - -diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng -index 81465273c8..34d285db48 100644 ---- a/docs/schemas/basictypes.rng -+++ b/docs/schemas/basictypes.rng -@@ -444,6 +444,7 @@ - x86_64 - xtensa - xtensaeb -+ loongarch64 - - - -diff --git a/po/POTFILES.in b/po/POTFILES.in -index 197ff2f3d3..24dc8087d6 100644 ---- a/po/POTFILES.in -+++ b/po/POTFILES.in -@@ -60,6 +60,7 @@ - @SRCDIR@/src/cpu/cpu_arm.c - @SRCDIR@/src/cpu/cpu_map.c - @SRCDIR@/src/cpu/cpu_ppc64.c -+@SRCDIR@/src/cpu/cpu_loongarch.c - @SRCDIR@/src/cpu/cpu_s390.c - @SRCDIR@/src/cpu/cpu_x86.c - @SRCDIR@/src/datatypes.c -diff --git a/src/cpu/Makefile.inc.am b/src/cpu/Makefile.inc.am -index 1ee1290c2d..e2219bbc1c 100644 ---- a/src/cpu/Makefile.inc.am -+++ b/src/cpu/Makefile.inc.am -@@ -15,6 +15,9 @@ CPU_SOURCES = \ - cpu/cpu_ppc64.h \ - cpu/cpu_ppc64.c \ - cpu/cpu_ppc64_data.h \ -+ cpu/cpu_loongarch.h \ -+ cpu/cpu_loongarch.c \ -+ cpu/cpu_loongarch_data.h \ - cpu/cpu_map.h \ - cpu/cpu_map.c \ - $(NULL) -diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index 89c06aceeb..df78a0d33f 100644 ---- a/src/cpu/cpu.c -+++ b/src/cpu/cpu.c -@@ -30,6 +30,7 @@ - #include "cpu_s390.h" - #include "cpu_arm.h" - #include "cpu_sw64.h" -+#include "cpu_loongarch.h" - #include "capabilities.h" - #include "virstring.h" - -@@ -44,6 +45,7 @@ static struct cpuArchDriver *drivers[] = { - &cpuDriverS390, - &cpuDriverArm, - &cpuDriverSW64, -+ &cpuDriverLoongArch, - }; - - -diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h -index ec22a183a1..307c85fb61 100644 ---- a/src/cpu/cpu.h -+++ b/src/cpu/cpu.h -@@ -28,7 +28,7 @@ - #include "cpu_x86_data.h" - #include "cpu_ppc64_data.h" - #include "cpu_arm_data.h" -- -+#include "cpu_loongarch_data.h" - - typedef struct _virCPUData virCPUData; - typedef virCPUData *virCPUDataPtr; -@@ -38,6 +38,7 @@ struct _virCPUData { - virCPUx86Data x86; - virCPUppc64Data ppc64; - virCPUarmData arm; -+ virCPULoongArchData loongarch; - /* generic driver needs no data */ - } data; - }; -diff --git a/src/cpu/cpu_loongarch.c b/src/cpu/cpu_loongarch.c -new file mode 100644 -index 0000000000..953316bf78 ---- /dev/null -+++ b/src/cpu/cpu_loongarch.c -@@ -0,0 +1,739 @@ -+/* -+ * cpu_loongarch.c: CPU driver for 64-bit LOONGARCH CPUs -+ * -+ * Copyright (C) 2023 Loongson Technology. -+ * -+ * 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 -+ * . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "virlog.h" -+#include "viralloc.h" -+#include "cpu.h" -+#include "virstring.h" -+#include "cpu_map.h" -+#include "virbuffer.h" -+ -+#define VIR_FROM_THIS VIR_FROM_CPU -+ -+VIR_LOG_INIT("cpu.cpu_loongarch"); -+ -+static const virArch archs[] = { VIR_ARCH_LOONGARCH64 }; -+ -+typedef struct { -+ char *name; -+} LoongArch_vendor; -+ -+typedef struct { -+ char *name; -+ const LoongArch_vendor *vendor; -+ virCPULoongArchData data; -+} LoongArch_model; -+ -+typedef struct { -+ size_t nvendors; -+ LoongArch_vendor **vendors; -+ size_t nmodels; -+ LoongArch_model **models; -+} LoongArch_map; -+ -+static void -+LoongArchDataClear(virCPULoongArchData *data) -+{ -+ if (!data) -+ return; -+ -+ VIR_FREE(data->prid); -+} -+ -+static int -+LoongArchDataCopy(virCPULoongArchData *dst, const virCPULoongArchData *src) -+{ -+ size_t i; -+ -+ if (VIR_ALLOC_N(dst->prid, src->len) < 0) -+ return -1; -+ -+ dst->len = src->len; -+ -+ for (i = 0; i < src->len; i++) { -+ dst->prid[i].value = src->prid[i].value; -+ dst->prid[i].mask = src->prid[i].mask; -+ } -+ -+ return 0; -+} -+ -+static void -+LoongArchVendorFree(LoongArch_vendor *vendor) -+{ -+ if (!vendor) -+ return; -+ -+ VIR_FREE(vendor->name); -+ VIR_FREE(vendor); -+} -+ -+static LoongArch_vendor * -+LoongArchVendorFind(const LoongArch_map *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 void -+LoongArchModelFree(LoongArch_model *model) -+{ -+ if (!model) -+ return; -+ -+ LoongArchDataClear(&model->data); -+ VIR_FREE(model->name); -+ VIR_FREE(model); -+} -+ -+static LoongArch_model * -+LoongArchModelCopy(const LoongArch_model *model) -+{ -+ LoongArch_model *copy; -+ -+ if (VIR_ALLOC(copy) < 0) -+ goto cleanup; -+ -+ copy->name = g_strdup(model->name); -+ -+ if (LoongArchDataCopy(©->data, &model->data) < 0) -+ goto cleanup; -+ -+ copy->vendor = model->vendor; -+ -+ return copy; -+ -+ cleanup: -+ LoongArchModelFree(copy); -+ return NULL; -+} -+ -+static LoongArch_model * -+LoongArchModelFind(const LoongArch_map *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; -+} -+ -+static LoongArch_model * -+LoongArchModelFindPrid(const LoongArch_map *map, -+ uint32_t prid) -+{ -+ size_t i; -+ size_t j; -+ -+ for (i = 0; i < map->nmodels; i++) { -+ LoongArch_model *model = map->models[i]; -+ for (j = 0; j < model->data.len; j++) { -+ if ((prid & model->data.prid[j].mask) == model->data.prid[j].value) -+ return model; -+ } -+ } -+ -+ return NULL; -+} -+ -+static LoongArch_model * -+LoongArchModelFromCPU(const virCPUDef *cpu, -+ const LoongArch_map *map) -+{ -+ LoongArch_model *model; -+ -+ if (!cpu->model) { -+ virReportError(VIR_ERR_INVALID_ARG, "%s", -+ _("no CPU model specified")); -+ return NULL; -+ } -+ -+ if (!(model = LoongArchModelFind(map, cpu->model))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown CPU model %s"), cpu->model); -+ return NULL; -+ } -+ -+ return LoongArchModelCopy(model); -+} -+ -+static void -+LoongArchMapFree(LoongArch_map *map) -+{ -+ size_t i; -+ -+ if (!map) -+ return; -+ -+ for (i = 0; i < map->nmodels; i++) -+ LoongArchModelFree(map->models[i]); -+ VIR_FREE(map->models); -+ -+ for (i = 0; i < map->nvendors; i++) -+ LoongArchVendorFree(map->vendors[i]); -+ VIR_FREE(map->vendors); -+ -+ VIR_FREE(map); -+} -+ -+static int -+LoongArchVendorParse(xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED, -+ const char *name, -+ void *data) -+{ -+ LoongArch_map *map = data; -+ LoongArch_vendor *vendor; -+ int ret = -1; -+ -+ if (VIR_ALLOC(vendor) < 0) -+ return ret; -+ vendor->name = g_strdup(name); -+ -+ if (LoongArchVendorFind(map, vendor->name)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU vendor %s already defined"), vendor->name); -+ goto cleanup; -+ } -+ -+ if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0) -+ goto cleanup; -+ -+ ret = 0; -+ -+ cleanup: -+ LoongArchVendorFree(vendor); -+ return ret; -+} -+ -+static int -+LoongArchModelParse(xmlXPathContextPtr ctxt, -+ const char *name, -+ void *data) -+{ -+ LoongArch_map *map = data; -+ LoongArch_model *model; -+ xmlNodePtr *nodes = NULL; -+ char *vendor = NULL; -+ unsigned long prid; -+ size_t i; -+ int n; -+ int ret = -1; -+ -+ if (VIR_ALLOC(model) < 0) -+ goto cleanup; -+ -+ model->name = g_strdup(name); -+ -+ if (LoongArchModelFind(map, model->name)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU model %s already defined"), model->name); -+ goto cleanup; -+ } -+ -+ 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 cleanup; -+ } -+ -+ if (!(model->vendor = LoongArchVendorFind(map, vendor))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown vendor %s referenced by CPU model %s"), -+ vendor, model->name); -+ goto cleanup; -+ } -+ } -+ -+ if ((n = virXPathNodeSet("./prid", ctxt, &nodes)) <= 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Missing Prid information for CPU model %s"), -+ model->name); -+ goto cleanup; -+ } -+ -+ if (VIR_ALLOC_N(model->data.prid, n) < 0) -+ goto cleanup; -+ -+ model->data.len = n; -+ -+ for (i = 0; i < n; i++) { -+ ctxt->node = nodes[i]; -+ -+ if (virXPathULongHex("string(./@value)", ctxt, &prid) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Missing or invalid Prid value in CPU model %s"), -+ model->name); -+ goto cleanup; -+ } -+ model->data.prid[i].value = prid; -+ -+ if (virXPathULongHex("string(./@mask)", ctxt, &prid) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Missing or invalid PVR mask in CPU model %s"), -+ model->name); -+ goto cleanup; -+ } -+ model->data.prid[i].mask = prid; -+ } -+ -+ if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0) -+ goto cleanup; -+ -+ ret = 0; -+ -+ cleanup: -+ LoongArchModelFree(model); -+ VIR_FREE(vendor); -+ VIR_FREE(nodes); -+ return ret; -+} -+ -+static LoongArch_map * -+LoongArchLoadMap(void) -+{ -+ LoongArch_map *map; -+ -+ if (VIR_ALLOC(map) < 0) -+ goto cleanup; -+ -+ if (cpuMapLoad("loongarch64", LoongArchVendorParse, NULL, LoongArchModelParse, map) < 0) -+ goto cleanup; -+ -+ return map; -+ -+ cleanup: -+ LoongArchMapFree(map); -+ return NULL; -+} -+ -+static virCPUDataPtr -+LoongArchMakeCPUData(virArch arch, -+ virCPULoongArchData *data) -+{ -+ virCPUDataPtr cpuData; -+ -+ if (VIR_ALLOC(cpuData) < 0) -+ return NULL; -+ -+ cpuData->arch = arch; -+ -+ if (LoongArchDataCopy(&cpuData->data.loongarch, data) < 0) -+ VIR_FREE(cpuData); -+ -+ return cpuData; -+} -+ -+static virCPUCompareResult -+LoongArchCompute(virCPUDefPtr host, -+ const virCPUDef *other, -+ virCPUDataPtr *guestData, -+ char **message) -+{ -+ LoongArch_map *map = NULL; -+ LoongArch_model *host_model = NULL; -+ LoongArch_model *guest_model = NULL; -+ virCPUDefPtr cpu = NULL; -+ virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; -+ virArch arch; -+ size_t i; -+ -+ /* Ensure existing configurations are handled correctly */ -+ if (!(cpu = virCPUDefCopy(other))) -+ goto cleanup; -+ -+ if (cpu->arch != VIR_ARCH_NONE) { -+ bool found = false; -+ -+ for (i = 0; i < G_N_ELEMENTS(archs); i++) { -+ if (archs[i] == cpu->arch) { -+ found = true; -+ break; -+ } -+ } -+ -+ if (!found) { -+ VIR_DEBUG("CPU arch %s does not match host arch", -+ virArchToString(cpu->arch)); -+ if (message) { -+ *message = g_strdup_printf(_("CPU arch %s does not match host arch"), -+ virArchToString(cpu->arch)); -+ } -+ ret = VIR_CPU_COMPARE_INCOMPATIBLE; -+ goto cleanup; -+ } -+ arch = cpu->arch; -+ } else { -+ arch = host->arch; -+ } -+ -+ if (cpu->vendor && -+ (!host->vendor || STRNEQ(cpu->vendor, host->vendor))) { -+ VIR_DEBUG("host CPU vendor does not match required CPU vendor %s", -+ cpu->vendor); -+ if (message) { -+ *message = g_strdup_printf(_("host CPU vendor does not match required " -+ "CPU vendor %s"), cpu->vendor); -+ } -+ ret = VIR_CPU_COMPARE_INCOMPATIBLE; -+ goto cleanup; -+ } -+ -+ if (!(map = LoongArchLoadMap())) -+ goto cleanup; -+ -+ /* Host CPU information */ -+ if (!(host_model = LoongArchModelFromCPU(host, map))) -+ goto cleanup; -+ -+ if (cpu->type == VIR_CPU_TYPE_GUEST) { -+ /* Guest CPU information */ -+ switch (cpu->mode) { -+ case VIR_CPU_MODE_HOST_MODEL: -+ case VIR_CPU_MODE_HOST_PASSTHROUGH: -+ /* host-model and host-passthrough: -+ * the guest CPU is the same as the host */ -+ guest_model = LoongArchModelCopy(host_model); -+ break; -+ -+ case VIR_CPU_MODE_CUSTOM: -+ /* custom: -+ * look up guest CPU information */ -+ guest_model = LoongArchModelFromCPU(cpu, map); -+ break; -+ } -+ } else { -+ /* Other host CPU information */ -+ guest_model = LoongArchModelFromCPU(cpu, map); -+ } -+ -+ if (!guest_model) -+ goto cleanup; -+ -+ if (STRNEQ(guest_model->name, host_model->name)) { -+ VIR_DEBUG("host CPU model does not match required CPU model %s", -+ guest_model->name); -+ if (message) { -+ *message = g_strdup_printf(_("host CPU model does not match required " -+ "CPU model %s"),guest_model->name); -+ } -+ ret = VIR_CPU_COMPARE_INCOMPATIBLE; -+ goto cleanup; -+ } -+ -+ if (guestData) -+ if (!(*guestData = LoongArchMakeCPUData(arch, &guest_model->data))) -+ goto cleanup; -+ -+ ret = VIR_CPU_COMPARE_IDENTICAL; -+ -+ cleanup: -+ virCPUDefFree(cpu); -+ LoongArchMapFree(map); -+ LoongArchModelFree(host_model); -+ LoongArchModelFree(guest_model); -+ return ret; -+} -+ -+static virCPUCompareResult -+virCPULoongArchCompare(virCPUDefPtr host, -+ virCPUDefPtr cpu, -+ bool failIncompatible) -+{ -+ virCPUCompareResult ret; -+ char *message = NULL; -+ -+ if (!host || !host->model) { -+ if (failIncompatible) { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", -+ _("unknown host CPU")); -+ } else { -+ VIR_WARN("unknown host CPU"); -+ ret = VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ return -1; -+ } -+ -+ ret = LoongArchCompute(host, cpu, NULL, &message); -+ -+ if (failIncompatible && ret == VIR_CPU_COMPARE_INCOMPATIBLE) { -+ ret = VIR_CPU_COMPARE_ERROR; -+ if (message) { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); -+ } else { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); -+ } -+ } -+ VIR_FREE(message); -+ -+ return ret; -+} -+ -+static int -+LoongArchDriverDecode(virCPUDefPtr cpu, -+ const virCPUData *data, -+ virDomainCapsCPUModelsPtr models) -+{ -+ int ret = -1; -+ LoongArch_map *map; -+ const LoongArch_model *model; -+ -+ if (!data || !(map = LoongArchLoadMap())) -+ return -1; -+ -+ if (!(model = LoongArchModelFindPrid(map, data->data.loongarch.prid[0].value))) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ _("Cannot find CPU model with Prid 0x%08x"), -+ data->data.loongarch.prid[0].value); -+ goto cleanup; -+ } -+ -+ if (!virCPUModelIsAllowed(model->name, models)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("CPU model %s is not supported by hypervisor"), -+ model->name); -+ goto cleanup; -+ } -+ -+ cpu->model = g_strdup(model->name); -+ if (model->vendor) { -+ cpu->vendor = g_strdup(model->vendor->name); -+ } -+ ret = 0; -+ -+ cleanup: -+ LoongArchMapFree(map); -+ -+ return ret; -+} -+ -+static void -+virCPULoongArchDataFree(virCPUDataPtr data) -+{ -+ if (!data) -+ return; -+ -+ LoongArchDataClear(&data->data.loongarch); -+ VIR_FREE(data); -+} -+ -+static int -+virCPULoongArchGetHostPRID(void) -+{ -+ return 0x14c010; -+} -+ -+static int -+virCPULoongArchGetHost(virCPUDefPtr cpu, -+ virDomainCapsCPUModelsPtr models) -+{ -+ virCPUDataPtr cpuData = NULL; -+ virCPULoongArchData *data; -+ int ret = -1; -+ -+ if (!(cpuData = virCPUDataNew(archs[0]))) -+ goto cleanup; -+ -+ data = &cpuData->data.loongarch; -+ if (VIR_ALLOC(data->prid) < 0) -+ goto cleanup; -+ -+ -+ data->len = 1; -+ -+ data->prid[0].value = virCPULoongArchGetHostPRID(); -+ data->prid[0].mask = 0xffff00ul; -+ -+ ret = LoongArchDriverDecode(cpu, cpuData, models); -+ -+ cleanup: -+ virCPULoongArchDataFree(cpuData); -+ return ret; -+} -+ -+ -+static int -+virCPULoongArchUpdate(virCPUDefPtr guest, -+ const virCPUDef *host ATTRIBUTE_UNUSED) -+{ -+ /* -+ * - host-passthrough doesn't even get here -+ * - host-model is used for host CPU running in a compatibility mode and -+ * it needs to remain unchanged -+ * - custom doesn't support any optional features, there's nothing to -+ * update -+ */ -+ -+ if (guest->mode == VIR_CPU_MODE_CUSTOM) -+ guest->match = VIR_CPU_MATCH_EXACT; -+ -+ return 0; -+} -+ -+static virCPUDefPtr -+LoongArchDriverBaseline(virCPUDefPtr *cpus, -+ unsigned int ncpus, -+ virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED, -+ const char **features ATTRIBUTE_UNUSED, -+ bool migratable ATTRIBUTE_UNUSED) -+{ -+ LoongArch_map *map; -+ const LoongArch_model *model; -+ const LoongArch_vendor *vendor = NULL; -+ virCPUDefPtr cpu = NULL; -+ size_t i; -+ -+ if (!(map = LoongArchLoadMap())) -+ goto error; -+ -+ if (!(model = LoongArchModelFind(map, cpus[0]->model))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown CPU model %s"), cpus[0]->model); -+ goto error; -+ } -+ -+ for (i = 0; i < ncpus; i++) { -+ const LoongArch_vendor *vnd; -+ -+ if (STRNEQ(cpus[i]->model, model->name)) { -+ virReportError(VIR_ERR_OPERATION_FAILED, "%s", -+ _("CPUs are incompatible")); -+ goto error; -+ } -+ -+ if (!cpus[i]->vendor) -+ continue; -+ -+ if (!(vnd = LoongArchVendorFind(map, cpus[i]->vendor))) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ _("Unknown CPU vendor %s"), cpus[i]->vendor); -+ goto error; -+ } -+ -+ if (model->vendor) { -+ if (model->vendor != vnd) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ _("CPU vendor %s of model %s differs from " -+ "vendor %s"), -+ model->vendor->name, model->name, -+ vnd->name); -+ goto error; -+ } -+ } else if (vendor) { -+ if (vendor != vnd) { -+ virReportError(VIR_ERR_OPERATION_FAILED, "%s", -+ _("CPU vendors do not match")); -+ goto error; -+ } -+ } else { -+ vendor = vnd; -+ } -+ } -+ -+ cpu = virCPUDefNew(); -+ cpu->model = g_strdup(model->name); -+ if (vendor) { -+ cpu->vendor = g_strdup(vendor->name); -+ } -+ cpu->type = VIR_CPU_TYPE_GUEST; -+ cpu->match = VIR_CPU_MATCH_EXACT; -+ cpu->fallback = VIR_CPU_FALLBACK_FORBID; -+ -+ cleanup: -+ LoongArchMapFree(map); -+ return cpu; -+ -+ error: -+ virCPUDefFree(cpu); -+ cpu = NULL; -+ goto cleanup; -+} -+ -+static int -+virCPULoongArchDriverGetModels(char ***models) -+{ -+ LoongArch_map *map; -+ size_t i; -+ int ret = -1; -+ -+ if (!(map = LoongArchLoadMap())) { -+ goto error; -+ } -+ -+ if (models) { -+ if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) -+ goto error; -+ -+ for (i = 0; i < map->nmodels; i++) { -+ (*models)[i] = g_strdup(map->models[i]->name); -+ } -+ } -+ -+ ret = map->nmodels; -+ -+ cleanup: -+ LoongArchMapFree(map); -+ return ret; -+ -+ error: -+ if (models) { -+ virStringListFree(*models); -+ *models = NULL; -+ } -+ goto cleanup; -+} -+ -+struct cpuArchDriver cpuDriverLoongArch = { -+ .name = "LoongArch", -+ .arch = archs, -+ .narch = G_N_ELEMENTS(archs), -+ .compare = virCPULoongArchCompare, -+ .decode = LoongArchDriverDecode, -+ .encode = NULL, -+ .dataFree = virCPULoongArchDataFree, -+ .getHost = virCPULoongArchGetHost, -+ .baseline = LoongArchDriverBaseline, -+ .update = virCPULoongArchUpdate, -+ .getModels = virCPULoongArchDriverGetModels, -+}; -diff --git a/src/cpu/cpu_loongarch.h b/src/cpu/cpu_loongarch.h -new file mode 100644 -index 0000000000..304af628d4 ---- /dev/null -+++ b/src/cpu/cpu_loongarch.h -@@ -0,0 +1,28 @@ -+/* -+ * cpu_loongarch.h: CPU driver for 64-bit LOONGARCH CPUs -+ * -+ * Copyright (C) 2023 Loongson Technology. -+ * -+ * 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 -+ * . -+ */ -+ -+#ifndef __VIR_CPU_LOONGARCH_H__ -+# define __VIR_CPU_LOONGARCH_H__ -+ -+# include "cpu.h" -+ -+extern struct cpuArchDriver cpuDriverLoongArch; -+ -+#endif /* __VIR_CPU_LOONGARCH_H__ */ -diff --git a/src/cpu/cpu_loongarch_data.h b/src/cpu/cpu_loongarch_data.h -new file mode 100644 -index 0000000000..c640a0c6b4 ---- /dev/null -+++ b/src/cpu/cpu_loongarch_data.h -@@ -0,0 +1,40 @@ -+/* -+ * cpu_loongarch_data.h: 64-bit LOONGARCH CPU specific data -+ * -+ * Copyright (C) 2023 Loongson Technology. -+ * -+ * 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 -+ * . -+ */ -+ -+#ifndef __VIR_CPU_LOONGARCH_DATA_H__ -+# define __VIR_CPU_LOONGARCH_DATA_H__ -+ -+# include -+ -+typedef struct _virCPULoongArchPrid virCPULoongArchPrid; -+struct _virCPULoongArchPrid { -+ uint32_t value; -+ uint32_t mask; -+}; -+ -+# define VIR_CPU_LOONGARCH_DATA_INIT { 0 } -+ -+typedef struct _virCPULoongArchData virCPULoongArchData; -+struct _virCPULoongArchData { -+ size_t len; -+ virCPULoongArchPrid *prid; -+}; -+ -+#endif /* __VIR_CPU_MIPS64_DATA_H__ */ -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 2e9f2025ba..0c3eb148b2 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -2692,6 +2692,7 @@ static const char *preferredMachines[] = - "sim", /* VIR_ARCH_XTENSAEB */ - - "core3", /* VIR_ARCH_SW_64 */ -+ "loongson7a", /* VIR_ARCH_LOONGARCH64 */ - }; - G_STATIC_ASSERT(G_N_ELEMENTS(preferredMachines) == VIR_ARCH_LAST); - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 70835e4efd..37dac3694b 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -4361,6 +4361,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, - addPCIeRoot = true; - break; - -+ case VIR_ARCH_LOONGARCH64: -+ addPCIeRoot = true; -+ break; -+ - case VIR_ARCH_ARMV7B: - case VIR_ARCH_CRIS: - case VIR_ARCH_ITANIUM: -diff --git a/src/util/virarch.c b/src/util/virarch.c -index 653136cc73..decdbdd7ac 100644 ---- a/src/util/virarch.c -+++ b/src/util/virarch.c -@@ -85,6 +85,7 @@ static const struct virArchData { - { "xtensaeb", 32, VIR_ARCH_BIG_ENDIAN }, - - { "sw_64", 64, VIR_ARCH_LITTLE_ENDIAN}, -+ { "loongarch64", 64, VIR_ARCH_LITTLE_ENDIAN }, - }; - - G_STATIC_ASSERT(G_N_ELEMENTS(virArchData) == VIR_ARCH_LAST); -diff --git a/src/util/virarch.h b/src/util/virarch.h -index 5eb146eb1b..a7834ae799 100644 ---- a/src/util/virarch.h -+++ b/src/util/virarch.h -@@ -70,6 +70,7 @@ typedef enum { - VIR_ARCH_XTENSAEB, /* XTensa 32 BE http://en.wikipedia.org/wiki/Xtensa#Processor_Cores */ - - VIR_ARCH_SW_64, /* SW64 64 LE XHB*/ -+ VIR_ARCH_LOONGARCH64, /* LoongArch 64 LE */ - - VIR_ARCH_LAST, - } virArch; -@@ -99,6 +100,8 @@ typedef enum { - - #define ARCH_IS_SW64(arch) ((arch) == VIR_ARCH_SW_64) - -+#define ARCH_IS_LOONGARCH(arch) ((arch) == VIR_ARCH_LOONGARCH64) -+ - typedef enum { - VIR_ARCH_LITTLE_ENDIAN, - VIR_ARCH_BIG_ENDIAN, --- -2.25.1 - diff --git a/CVE-2024-4418.patch b/CVE-2024-4418.patch new file mode 100644 index 0000000000000000000000000000000000000000..65ed38bd59286bdd49f2a876b281706cb4aea12f --- /dev/null +++ b/CVE-2024-4418.patch @@ -0,0 +1,99 @@ +From 8074d64dc2eca846d6a61efe1a9b7428a0ce1dd1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 30 Apr 2024 11:51:15 +0100 +Subject: [PATCH] rpc: ensure temporary GSource is removed from client event + loop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Users are seeing periodic segfaults from libvirt client apps, +especially thread heavy ones like virt-manager. A typical +stack trace would end up in the virNetClientIOEventFD method, +with illegal access to stale stack data. eg + +==238721==ERROR: AddressSanitizer: stack-use-after-return on address 0x75cd18709788 at pc 0x75cd3111f907 bp 0x75cd181ff550 sp 0x75cd181ff548 +WRITE of size 4 at 0x75cd18709788 thread T11 + #0 0x75cd3111f906 in virNetClientIOEventFD /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1634:15 + #1 0x75cd3210d198 (/usr/lib/libglib-2.0.so.0+0x5a198) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2) + #2 0x75cd3216c3be (/usr/lib/libglib-2.0.so.0+0xb93be) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2) + #3 0x75cd3210ddc6 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x5adc6) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2) + #4 0x75cd3111a47c in virNetClientIOEventLoop /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1722:9 + #5 0x75cd3111a47c in virNetClientIO /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2002:10 + #6 0x75cd3111a47c in virNetClientSendInternal /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2170:11 + #7 0x75cd311198a8 in virNetClientSendWithReply /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2198:11 + #8 0x75cd31111653 in virNetClientProgramCall /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclientprogram.c:318:9 + #9 0x75cd31241c8f in callFull /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6054:10 + #10 0x75cd31241c8f in call /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6076:12 + #11 0x75cd31241c8f in remoteNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/src/remote/remote_client_bodies.h:5959:9 + #12 0x75cd31410ff7 in virNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/libvirt-network.c:952:15 + +The root cause is a bad assumption in the virNetClientIOEventLoop +method. This method is run by whichever thread currently owns the +buck, and is responsible for handling I/O. Inside a for(;;) loop, +this method creates a temporary GSource, adds it to the event loop +and runs g_main_loop_run(). When I/O is ready, the GSource callback +(virNetClientIOEventFD) will fire and call g_main_loop_quit(), and +return G_SOURCE_REMOVE which results in the temporary GSource being +destroyed. A g_autoptr() will then remove the last reference. + +What was overlooked, is that a second thread can come along and +while it can't enter virNetClientIOEventLoop, it will register an +idle source that uses virNetClientIOWakeup to interrupt the +original thread's 'g_main_loop_run' call. When this happens the +virNetClientIOEventFD callback never runs, and so the temporary +GSource is not destroyed. The g_autoptr() will remove a reference, +but by virtue of still being attached to the event context, there +is an extra reference held causing GSource to be leaked. The +next time 'g_main_loop_run' is called, the original GSource will +trigger its callback, and access data that was allocated on the +stack by the previous thread, and likely SEGV. + +To solve this, the thread calling 'g_main_loop_run' must call +g_source_destroy, immediately upon return, to guarantee that +the temporary GSource is removed. + +CVE-2024-4418 +Reviewed-by: Ján Tomko +Reported-by: Martin Shirokov +Tested-by: Martin Shirokov +Signed-off-by: Daniel P. Berrangé +--- + src/rpc/virnetclient.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c +index 68098b1c8d..147b0d661a 100644 +--- a/src/rpc/virnetclient.c ++++ b/src/rpc/virnetclient.c +@@ -1657,7 +1657,7 @@ static int virNetClientIOEventLoop(virNetClient *client, + #endif /* !WIN32 */ + int timeout = -1; + virNetMessage *msg = NULL; +- g_autoptr(GSource) G_GNUC_UNUSED source = NULL; ++ g_autoptr(GSource) source = NULL; + GIOCondition ev = 0; + struct virNetClientIOEventData data = { + .client = client, +@@ -1721,6 +1721,18 @@ static int virNetClientIOEventLoop(virNetClient *client, + + g_main_loop_run(client->eventLoop); + ++ /* ++ * If virNetClientIOEventFD ran, this GSource will already be ++ * destroyed due to G_SOURCE_REMOVE. It is harmless to re-destroy ++ * it, since we still own a reference. ++ * ++ * If virNetClientIOWakeup ran, it will have interrupted the ++ * g_main_loop_run call, before virNetClientIOEventFD could ++ * run, and thus the GSource is still registered, and we need ++ * to destroy it since it is referencing stack memory for 'data' ++ */ ++ g_source_destroy(source); ++ + #ifndef WIN32 + ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL)); + #endif /* !WIN32 */ +-- +GitLab + diff --git a/Config-some-capabilities-for-loongarch-virt-machine.patch b/Config-some-capabilities-for-loongarch-virt-machine.patch deleted file mode 100644 index add6100b2102ae429fe06d273b0ce121dbd2157c..0000000000000000000000000000000000000000 --- a/Config-some-capabilities-for-loongarch-virt-machine.patch +++ /dev/null @@ -1,263 +0,0 @@ -From 4b7f6284eaa3e3b15360e25848fc68b37ee6c768 Mon Sep 17 00:00:00 2001 -From: zhaotianrui -Date: Wed, 11 Jan 2023 11:56:03 -0500 -Subject: [PATCH 3/4] Config some capabilities for loongarch virt machine - -Config some capabilities for loongarch virt machine such as -PCI multi bus and the path of loongarch uefi binary. - -Signed-off-by: zhaotianrui ---- - src/qemu/qemu.conf | 3 +- - src/qemu/qemu_capabilities.c | 4 ++ - src/qemu/qemu_conf.c | 3 +- - src/qemu/qemu_domain.c | 31 ++++++++++- - src/qemu/qemu_domain.h | 1 + - src/qemu/qemu_domain_address.c | 86 ++++++++++++++++++++++++++++++ - src/qemu/test_libvirtd_qemu.aug.in | 1 + - 7 files changed, 125 insertions(+), 4 deletions(-) - -diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf -index abdbf07fec..3856087248 100644 ---- a/src/qemu/qemu.conf -+++ b/src/qemu/qemu.conf -@@ -771,7 +771,8 @@ - # "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd", - # "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd", - # "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd", --# "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd" -+# "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd", -+# "/usr/share/qemu/loongarch_bios.bin:/usr/share/qemu/loongarch_vars.bin" - #] - - # The backend to use for handling stdout/stderr output from -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 0c3eb148b2..21b477cd4d 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -1983,6 +1983,10 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, - * since forever */ - if (ARCH_IS_SW64(def->os.arch)) - return true; -+ /* loongarch64 support PCI-multibus on all machine types -+ * since forever */ -+ if (ARCH_IS_LOONGARCH(def->os.arch)) -+ return true; - - if (def->os.arch == VIR_ARCH_PPC || - ARCH_IS_PPC64(def->os.arch)) { -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 28319a1baf..3253875d6e 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -98,7 +98,8 @@ qemuDriverUnlock(virQEMUDriverPtr driver) - "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd:" \ - "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd:" \ - "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd:" \ -- "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd" -+ "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd:" \ -+ "/usr/share/qemu/loongarch_bios.bin:/usr/share/qemu/loongarch_vars.bin" - #endif - - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 37dac3694b..152c8615d5 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -5186,7 +5186,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, - switch ((virDomainFeature) i) { - case VIR_DOMAIN_FEATURE_IOAPIC: - if (def->features[i] != VIR_DOMAIN_IOAPIC_NONE) { -- if (!ARCH_IS_X86(def->os.arch)) { -+ if (!ARCH_IS_X86(def->os.arch) && !ARCH_IS_LOONGARCH(def->os.arch)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The '%s' feature is not supported for " - "architecture '%s' or machine type '%s'"), -@@ -9089,6 +9089,11 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, - cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; - else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) - cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; -+ } else if (ARCH_IS_LOONGARCH(def->os.arch)) { -+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) -+ cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI; -+ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) -+ cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI; - } - } - /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr */ -@@ -12985,6 +12990,20 @@ qemuDomainMachineIsPSeries(const char *machine, - return false; - } - -+static bool -+qemuDomainMachineIsLoongson(const char *machine, -+ const virArch arch) -+{ -+ if (!ARCH_IS_LOONGARCH(arch)) -+ return false; -+ -+ if (STREQ(machine, "loongson7a") || -+ STRPREFIX(machine, "loongson7a-")) { -+ return true; -+ } -+ -+ return false; -+} - - /* You should normally avoid this function and use - * qemuDomainHasBuiltinIDE() instead. */ -@@ -12996,7 +13015,8 @@ qemuDomainMachineHasBuiltinIDE(const char *machine, - STREQ(machine, "malta") || - STREQ(machine, "sun4u") || - STREQ(machine, "core3") || -- STREQ(machine, "g3beige"); -+ STREQ(machine, "g3beige") || -+ STREQ(machine, "loongson7a"); - } - - -@@ -13066,6 +13086,13 @@ qemuDomainIsPSeries(const virDomainDef *def) - } - - -+bool -+qemuDomainIsLoongson(const virDomainDef *def) -+{ -+ return qemuDomainMachineIsLoongson(def->os.machine, def->os.arch); -+} -+ -+ - bool - qemuDomainHasPCIRoot(const virDomainDef *def) - { -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index 7603724ccd..368fc4030f 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -999,6 +999,7 @@ bool qemuDomainIsS390CCW(const virDomainDef *def); - bool qemuDomainIsARMVirt(const virDomainDef *def); - bool qemuDomainIsRISCVVirt(const virDomainDef *def); - bool qemuDomainIsPSeries(const virDomainDef *def); -+bool qemuDomainIsLoongson(const virDomainDef *def); - bool qemuDomainHasPCIRoot(const virDomainDef *def); - bool qemuDomainHasPCIeRoot(const virDomainDef *def); - bool qemuDomainHasBuiltinIDE(const virDomainDef *def); -diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c -index ab6bce19f4..7f48773832 100644 ---- a/src/qemu/qemu_domain_address.c -+++ b/src/qemu/qemu_domain_address.c -@@ -2078,6 +2078,87 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def, - return 0; - } - -+static int -+qemuDomainValidateDevicePCISlotsLoongson(virDomainDefPtr def, -+ virQEMUCapsPtr qemuCaps, -+ virDomainPCIAddressSetPtr addrs) -+{ -+ int ret = -1; -+ virPCIDeviceAddress tmp_addr; -+ bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); -+ g_autofree char *addrStr = NULL; -+ virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE; -+ -+ if (addrs->nbuses) { -+ memset(&tmp_addr, 0, sizeof(tmp_addr)); -+ tmp_addr.slot = 1; -+ /* pci-ohci at 00:01.0 */ -+ if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) -+ return -1; -+ } -+ -+ if (def->nvideos > 0 && -+ def->videos[0]->type != VIR_DOMAIN_VIDEO_TYPE_NONE && -+ def->videos[0]->type != VIR_DOMAIN_VIDEO_TYPE_RAMFB) { -+ /* reserve slot 2 for vga device */ -+ virDomainVideoDefPtr primaryVideo = def->videos[0]; -+ -+ if (virDeviceInfoPCIAddressIsWanted(&primaryVideo->info)) { -+ memset(&tmp_addr, 0, sizeof(tmp_addr)); -+ tmp_addr.slot = 2; -+ -+ if (!(addrStr = virPCIDeviceAddressAsString(&tmp_addr))) -+ return -1; -+ if (!virDomainPCIAddressValidate(addrs, &tmp_addr, -+ addrStr, flags, true)) -+ return ret; -+ -+ if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) { -+ if (qemuDeviceVideoUsable) { -+ if (qemuDomainPCIAddressReserveNextAddr(addrs, -+ &primaryVideo->info) < 0) { -+ return ret; -+ } -+ } else { -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("PCI address 0:0:2.0 is in use, " -+ "QEMU needs it for primary video")); -+ return ret; -+ } -+ } else { -+ if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) -+ return ret; -+ primaryVideo->info.addr.pci = tmp_addr; -+ primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; -+ } -+ } else if (!qemuDeviceVideoUsable) { -+ if (primaryVideo->info.addr.pci.domain != 0 || -+ primaryVideo->info.addr.pci.bus != 0 || -+ primaryVideo->info.addr.pci.slot != 2 || -+ primaryVideo->info.addr.pci.function != 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("Primary video card must have PCI address 0:0:2.0")); -+ return ret; -+ } -+ /* If TYPE == PCI, then qemuDomainCollectPCIAddress() function -+ * has already reserved the address, so we must skip */ -+ } -+ } else if (addrs->nbuses && !qemuDeviceVideoUsable) { -+ memset(&tmp_addr, 0, sizeof(tmp_addr)); -+ tmp_addr.slot = 2; -+ -+ if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) { -+ VIR_DEBUG("PCI address 0:0:2.0 in use, future addition of a video" -+ " device will not be possible without manual" -+ " intervention"); -+ } else if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) { -+ return ret; -+ } -+ } -+ -+ ret = 0; -+ return ret; -+} - - static int - qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def, -@@ -2094,6 +2175,11 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def, - return -1; - } - -+ if (qemuDomainIsLoongson(def) && -+ qemuDomainValidateDevicePCISlotsLoongson(def, qemuCaps, addrs) < 0) { -+ return -1; -+ } -+ - return 0; - } - -diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in -index 19da591aae..caa06a45cb 100644 ---- a/src/qemu/test_libvirtd_qemu.aug.in -+++ b/src/qemu/test_libvirtd_qemu.aug.in -@@ -95,6 +95,7 @@ module Test_libvirtd_qemu = - { "2" = "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd" } - { "3" = "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd" } - { "4" = "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd" } -+ { "5" = "/usr/share/qemu/loongarch_bios.bin:/usr/share/qemu/loongarch_vars.bin" } - } - { "stdio_handler" = "logd" } - { "gluster_debug_level" = "9" } --- -2.25.1 - diff --git a/Don-t-cache-device-mapper-major.patch b/Don-t-cache-device-mapper-major.patch deleted file mode 100644 index a4ef223b619bb067509bdf026cb2442429aa7996..0000000000000000000000000000000000000000 --- a/Don-t-cache-device-mapper-major.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 1c5804926a289882ff4a84f1c6ca6df1dd117215 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 31 Aug 2021 08:22:41 -0400 -Subject: [PATCH] Don't cache device-mapper major - ---- - src/util/virdevmapper.c | 19 +++++-------------- - 1 file changed, 5 insertions(+), 14 deletions(-) - -diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c -index a471504..2b9e689 100644 ---- a/src/util/virdevmapper.c -+++ b/src/util/virdevmapper.c -@@ -46,11 +46,8 @@ - - G_STATIC_ASSERT(BUF_SIZE > sizeof(struct dm_ioctl)); - --static unsigned int virDMMajor; -- -- - static int --virDevMapperOnceInit(void) -+virDevMapperGetMajor(unsigned int *major) - { - g_autofree char *buf = NULL; - VIR_AUTOSTRINGLIST lines = NULL; -@@ -69,7 +66,7 @@ virDevMapperOnceInit(void) - - if (sscanf(lines[i], "%u %ms\n", &maj, &dev) == 2 && - STREQ(dev, DM_NAME)) { -- virDMMajor = maj; -+ *major = maj; - break; - } - } -@@ -84,10 +81,6 @@ virDevMapperOnceInit(void) - return 0; - } - -- --VIR_ONCE_GLOBAL_INIT(virDevMapper); -- -- - static void * - virDMIoctl(int controlFD, int cmd, struct dm_ioctl *dm, char **buf) - { -@@ -305,9 +298,6 @@ virDevMapperGetTargets(const char *path, - * consist of devices or yet another targets. If that's the - * case, we have to stop recursion somewhere. */ - -- if (virDevMapperInitialize() < 0) -- return -1; -- - if ((controlFD = virDMOpen()) < 0) - return -1; - -@@ -319,13 +309,14 @@ bool - virIsDevMapperDevice(const char *dev_name) - { - struct stat buf; -+ unsigned int major; - -- if (virDevMapperInitialize() < 0) -+ if (virDevMapperGetMajor(&major) < 0) - return false; - - if (!stat(dev_name, &buf) && - S_ISBLK(buf.st_mode) && -- major(buf.st_rdev) == virDMMajor) -+ major(buf.st_rdev) == major) - return true; - - return false; --- -2.18.2 - diff --git a/Don-t-call-qsort-over-NULL.patch b/Don-t-call-qsort-over-NULL.patch deleted file mode 100644 index 6e866a207d51fc316f522cfaabf099d597698a19..0000000000000000000000000000000000000000 --- a/Don-t-call-qsort-over-NULL.patch +++ /dev/null @@ -1,68 +0,0 @@ -From bfcbf70e99b9fb06468de8135d3a251ef22e0cd3 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 14 Jun 2021 12:46:02 +0200 -Subject: [PATCH 094/108] Don't call qsort() over NULL - -In a few places it may happen that the array we want to sort is -still NULL (e.g. because there were no leases found, no paths for -secdriver to lock or no cache banks). However, passing NULL to -qsort() is undefined and even though glibc plays nicely we -shouldn't rely on undefined behaviour. - -Signed-off-by: Michal Privoznik -Reviewed-by: Tim Wiederhake -(cherry picked from commit 1ab5a37c4a70434a1dacebbdababb91baaa29ef1) ---- - src/conf/capabilities.c | 6 ++++-- - src/security/security_manager.c | 3 ++- - tools/nss/libvirt_nss.c | 3 ++- - 3 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c -index d6ec1f12f4..deb99cecd3 100644 ---- a/src/conf/capabilities.c -+++ b/src/conf/capabilities.c -@@ -1982,8 +1982,10 @@ virCapabilitiesInitCaches(virCapsPtr caps) - /* Sort the array in order for the tests to be predictable. This way we can - * still traverse the directory instead of guessing names (in case there is - * 'index1' and 'index3' but no 'index2'). */ -- qsort(caps->host.cache.banks, caps->host.cache.nbanks, -- sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter); -+ if (caps->host.cache.banks) { -+ qsort(caps->host.cache.banks, caps->host.cache.nbanks, -+ sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter); -+ } - - if (virCapabilitiesInitResctrlMemory(caps) < 0) - goto cleanup; -diff --git a/src/security/security_manager.c b/src/security/security_manager.c -index 9d5dfec12b..a74b663685 100644 ---- a/src/security/security_manager.c -+++ b/src/security/security_manager.c -@@ -1302,7 +1302,8 @@ virSecurityManagerMetadataLock(virSecurityManagerPtr mgr G_GNUC_UNUSED, - * paths in the same order and thus no deadlock can occur. - * Lastly, it makes searching for duplicate paths below - * simpler. */ -- qsort(paths, npaths, sizeof(*paths), cmpstringp); -+ if (paths) -+ qsort(paths, npaths, sizeof(*paths), cmpstringp); - - for (i = 0; i < npaths; i++) { - const char *p = paths[i]; -diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c -index 3b89f72742..265ef236cc 100644 ---- a/tools/nss/libvirt_nss.c -+++ b/tools/nss/libvirt_nss.c -@@ -69,7 +69,8 @@ static void - sortAddr(leaseAddress *tmpAddress, - size_t ntmpAddress) - { -- qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter); -+ if (tmpAddress) -+ qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter); - } - - --- -2.33.0 - diff --git a/Fix-allocation-of-virDomainFSDef.patch b/Fix-allocation-of-virDomainFSDef.patch deleted file mode 100644 index fb55fd57c7faf6d8286bd9461ca409712c1a4f08..0000000000000000000000000000000000000000 --- a/Fix-allocation-of-virDomainFSDef.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 805efc1e0446e84c4b9bf9984c92b9e05b6ced62 Mon Sep 17 00:00:00 2001 -From: tangbin -Date: Wed, 23 Nov 2022 16:00:29 +0200 -Subject: [PATCH 09/23] Fix allocation of virDomainFSDef -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some less commonly used drivers were omitted when we switched -the allocator from a plain VIR_ALLOC to virDomainFSDefNew. - -https://bugzilla.redhat.com/show_bug.cgi?id=1846450 - -Fixes: da665fbd4858890fbb3bbf5da2a7b6ca37bb3220 -Signed-off-by: Ján Tomko -Reviewed-by: Andrea Bolognani - -Signed-off-by: tangbin -(cherry-pick from ea3320048897f5279bc49cb49d26f8099706a834) ---- - src/openvz/openvz_conf.c | 2 +- - src/vbox/vbox_common.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c -index 78547b8b28..15e1e2ae9f 100644 ---- a/src/openvz/openvz_conf.c -+++ b/src/openvz/openvz_conf.c -@@ -357,7 +357,7 @@ openvzReadFSConf(virDomainDefPtr def, - goto error; - } - -- if (VIR_ALLOC(fs) < 0) -+ if (!(fs = virDomainFSDefNew(NULL))) - goto error; - - veid_str = g_strdup_printf("%d", veid); -diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c -index e98ae04ec0..d06a5f79ab 100644 ---- a/src/vbox/vbox_common.c -+++ b/src/vbox/vbox_common.c -@@ -3620,7 +3620,7 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine - char *hostPath = NULL; - PRBool writable = PR_FALSE; - -- if (VIR_ALLOC(def->fss[i]) < 0) -+ if (!(def->fss[i] = virDomainFSDefNew(data->xmlopt))) - goto cleanup; - - def->fss[i]->type = VIR_DOMAIN_FS_TYPE_MOUNT; --- -2.27.0 - diff --git a/Fix-off-by-one-error-in-udevListInterfacesByStatus.patch b/Fix-off-by-one-error-in-udevListInterfacesByStatus.patch new file mode 100644 index 0000000000000000000000000000000000000000..7cf445b866ff4754b385df956f584707a7f4e281 --- /dev/null +++ b/Fix-off-by-one-error-in-udevListInterfacesByStatus.patch @@ -0,0 +1,39 @@ +From 0f082f9d3df0b1c2b63c2b5ad3201e08d1ffe449 Mon Sep 17 00:00:00 2001 +From: Martin Kletzander +Date: Tue, 27 Feb 2024 16:20:12 +0100 +Subject: [PATCH] Fix off-by-one error in udevListInterfacesByStatus +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Ever since this function was introduced in 2012 it could've tried +filling in an extra interface name. That was made worse in 2019 when +the caller functions started accepting NULL arrays of size 0. + +This is assigned CVE-2024-1441. + +Signed-off-by: Martin Kletzander +Reported-by: Alexander Kuznetsov +Fixes: 5a33366f5c0b18c93d161bd144f9f079de4ac8ca +Fixes: d6064e2759a24e0802f363e3a810dc5a7d7ebb15 +Reviewed-by: Ján Tomko +--- + src/interface/interface_backend_udev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c +index fb6799ed94..4091483060 100644 +--- a/src/interface/interface_backend_udev.c ++++ b/src/interface/interface_backend_udev.c +@@ -222,7 +222,7 @@ udevListInterfacesByStatus(virConnectPtr conn, + g_autoptr(virInterfaceDef) def = NULL; + + /* Ensure we won't exceed the size of our array */ +- if (count > names_len) ++ if (count >= names_len) + break; + + path = udev_list_entry_get_name(dev_entry); +-- +2.27.0 + diff --git a/Fix-potential-crash-during-driver-cleanup.patch b/Fix-potential-crash-during-driver-cleanup.patch deleted file mode 100644 index ed8ec7d658029272c1e1a56b2f6a74f5ae880be5..0000000000000000000000000000000000000000 --- a/Fix-potential-crash-during-driver-cleanup.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Jim Fehlig -Date: Tue, 11 Apr 2023 09:15:43 -0600 -Subject: [PATCH] qemu: Fix potential crash during driver cleanup - -During qemu driver shutdown, objects are freed in qemuStateCleanup that -could still be used by active worker threads, resulting in crashes. E.g. -a worker thread could be processing a monitor EOF event after the -security manager is already disposed - -Program terminated with signal SIGSEGV, Segmentation fault. -#0 0x00007fd9a9a1e1fe in virSecurityManagerMoveImageMetadata (mgr=0x7fd948012160, pid=-1, src=src@entry=0x7fd98c072c90, dst=dst@entry=0x0) - at ../../src/security/security_manager.c:468 -#1 0x00007fd9646ff0f0 in qemuSecurityMoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, src=src@entry=0x7fd98c072c90, - dst=dst@entry=0x0) at ../../src/qemu/qemu_security.c:182 -#2 0x00007fd96462c7b0 in qemuBlockRemoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, diskTarget=0x7fd98c072530 "vda", - src=) at ../../src/qemu/qemu_block.c:2628 -#3 0x00007fd9646929d6 in qemuProcessStop (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN, - asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=) at ../../src/qemu/qemu_process.c:7585 -#4 0x00007fd9646fc842 in processMonitorEOFEvent (vm=0x7fd98c066db0, driver=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4794 -#5 qemuProcessEventHandler (data=0x561a93febb60, opaque=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4900 -#6 0x00007fd9a9971a31 in virThreadPoolWorker (opaque=opaque@entry=0x561a93fb58e0) at ../../src/util/virthreadpool.c:163 -(gdb) p mgr->drv -$2 = (virSecurityDriverPtr) 0x0 - -Prior to commit 7cf76d4e3ab, the worker thread pool was freed before -disposing any driver objects. Let's return to that pattern, but leave -the other changes made by 7cf76d4e3ab. - -Signed-off-by: Tamara Schmitz -Signed-off-by: Jim Fehlig -Reviewed-by: Martin Kletzander ---- - src/qemu/qemu_driver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 32b3ef3..7a70d6c 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -1120,6 +1120,7 @@ qemuStateCleanup(void) - if (!qemu_driver) - return -1; - -+ virThreadPoolFree(qemu_driver->workerPool); - virObjectUnref(qemu_driver->migrationErrors); - virObjectUnref(qemu_driver->closeCallbacks); - virLockManagerPluginUnref(qemu_driver->lockManager); -@@ -1139,7 +1140,6 @@ qemuStateCleanup(void) - ebtablesContextFree(qemu_driver->ebtables); - VIR_FREE(qemu_driver->qemuImgBinary); - virObjectUnref(qemu_driver->domains); -- virThreadPoolFree(qemu_driver->workerPool); - - if (qemu_driver->lockFD != -1) - virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD); --- -2.33.0 - diff --git a/bugfix-fix-warnings-found-by-clang.patch b/Fix-warnings-found-by-clang.patch similarity index 68% rename from bugfix-fix-warnings-found-by-clang.patch rename to Fix-warnings-found-by-clang.patch index 378bc20903f0ee18a437e9f758baa9fdf65eface..dd2e7b4ee3e3bf801459fc8f4939fbc2f8eb8e94 100644 --- a/bugfix-fix-warnings-found-by-clang.patch +++ b/Fix-warnings-found-by-clang.patch @@ -1,7 +1,7 @@ -From 0559dfd4d4fa74484dae487711a986cc9acdfbfc Mon Sep 17 00:00:00 2001 +From f3bee7ca84e0e7f915ad425935e6279b227a00a6 Mon Sep 17 00:00:00 2001 From: Chenxi Mao Date: Tue, 4 Apr 2023 14:25:17 +0800 -Subject: [PATCH 4/4] Fix warnings found by clang +Subject: [PATCH] Fix warnings found by clang Warnings found if build with clang 15: @@ -14,17 +14,17 @@ Signed-off-by: Chenxi Mao 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c -index 02f511cc38..64aac9bb4c 100644 +index 0259ae76c8..29d13db030 100644 --- a/src/qemu/qemu_hotpatch.c +++ b/src/qemu/qemu_hotpatch.c -@@ -214,7 +214,6 @@ qemuDomainHotpatchAutoload(virDomainObjPtr vm, char *hotpatch_path) - VIR_AUTOSTRINGLIST applied_patches = NULL; - VIR_AUTOSTRINGLIST lines = NULL; +@@ -214,7 +214,6 @@ qemuDomainHotpatchAutoload(virDomainObj *vm, char *hotpatch_path) + g_auto(GStrv) applied_patches = NULL; + g_auto(GStrv) lines = NULL; g_autofree char *applied_patch = NULL; - g_autofree char *libvirtd_conf = NULL; g_autofree char *patch_conf = NULL; g_autofree char *buf = NULL; char *ret = NULL; -- -2.33.0 +2.27.0 diff --git a/Hotpatch-introduce-DomainHotpatchManage-API.patch b/Hotpatch-introduce-DomainHotpatchManage-API.patch index 26b643df70cca5662374893a66f4fc9de10350d0..640f180406a76837de7a601d2d8e7baf9996b7fd 100644 --- a/Hotpatch-introduce-DomainHotpatchManage-API.patch +++ b/Hotpatch-introduce-DomainHotpatchManage-API.patch @@ -1,4 +1,4 @@ -From 9a12606bb5caf3e213ce1564445d88325592e642 Mon Sep 17 00:00:00 2001 +From dd9b8be8f47638f9149f3b577f1c38e36cd3e0db Mon Sep 17 00:00:00 2001 From: AlexChen Date: Tue, 19 Oct 2021 14:50:32 +0800 Subject: [PATCH] Hotpatch: introduce DomainHotpatchManage API @@ -7,23 +7,28 @@ Signed-off-by: Hao Wang Signed-off-by: Bihong Yu Signed-off-by: AlexChen --- - include/libvirt/libvirt-domain.h | 18 ++++++++++ + include/libvirt/libvirt-domain.h | 23 +++++++++++++ scripts/check-aclrules.py | 1 + src/driver-hypervisor.h | 8 +++++ - src/libvirt-domain.c | 58 ++++++++++++++++++++++++++++++++ - src/libvirt_public.syms | 4 +++ + src/libvirt-domain.c | 59 ++++++++++++++++++++++++++++++++ + src/libvirt_public.syms | 5 +++ src/remote/remote_driver.c | 1 + - src/remote/remote_protocol.x | 20 ++++++++++- - 7 files changed, 109 insertions(+), 1 deletion(-) + src/remote/remote_protocol.x | 19 +++++++++- + 7 files changed, 115 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index 90cb652db1..f91061724b 100644 +index a1902546bb..f8def59032 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h -@@ -4991,4 +4991,22 @@ int virDomainBackupBegin(virDomainPtr domain, - char *virDomainBackupGetXMLDesc(virDomainPtr domain, - unsigned int flags); +@@ -6416,6 +6416,29 @@ int virDomainAuthorizedSSHKeysGet(virDomainPtr domain, + char ***keys, + unsigned int flags); ++/** ++ * virDomainHotpatchAction: ++ * ++ * Since: 6.2.0 ++ */ +typedef enum { + VIR_DOMAIN_HOTPATCH_NONE = 0, /* No action */ + VIR_DOMAIN_HOTPATCH_APPLY, /* Apply hotpatch */ @@ -42,12 +47,14 @@ index 90cb652db1..f91061724b 100644 + const char *id, + unsigned int flags); + - #endif /* LIBVIRT_DOMAIN_H */ + /** + * virDomainAuthorizedSSHKeysSetFlags: + * diff --git a/scripts/check-aclrules.py b/scripts/check-aclrules.py -index a1fa473174..e196f81de9 100755 +index ed6805058b..e39dbd2ba8 100755 --- a/scripts/check-aclrules.py +++ b/scripts/check-aclrules.py -@@ -53,6 +53,7 @@ whitelist = { +@@ -53,6 +53,7 @@ permitted = { "connectURIProbe": True, "localOnly": True, "domainQemuAttach": True, @@ -56,12 +63,12 @@ index a1fa473174..e196f81de9 100755 # XXX this vzDomainMigrateConfirm3Params looks diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h -index bce023017d..afc21a0b3f 100644 +index 5219344b72..e54af0515f 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h -@@ -1387,6 +1387,13 @@ typedef char * - (*virDrvDomainBackupGetXMLDesc)(virDomainPtr domain, - unsigned int flags); +@@ -1448,6 +1448,13 @@ typedef int + int *fds, + unsigned int flags); +typedef char * +(*virDrvDomainHotpatchManage)(virDomainPtr domain, @@ -71,23 +78,22 @@ index bce023017d..afc21a0b3f 100644 + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; - typedef virHypervisorDriver *virHypervisorDriverPtr; -@@ -1650,4 +1657,5 @@ struct _virHypervisorDriver { - virDrvDomainAgentSetResponseTimeout domainAgentSetResponseTimeout; - virDrvDomainBackupBegin domainBackupBegin; - virDrvDomainBackupGetXMLDesc domainBackupGetXMLDesc; + /** +@@ -1720,4 +1727,5 @@ struct _virHypervisorDriver { + virDrvDomainGetMessages domainGetMessages; + virDrvDomainStartDirtyRateCalc domainStartDirtyRateCalc; + virDrvDomainFDAssociate domainFDAssociate; + virDrvDomainHotpatchManage domainHotpatchManage; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index a12809c2d5..068ab52f54 100644 +index 77a9682ecb..26833efd0e 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c -@@ -12733,3 +12733,61 @@ virDomainBackupGetXMLDesc(virDomainPtr domain, - virDispatchError(conn); +@@ -13784,6 +13784,65 @@ virDomainBackupGetXMLDesc(virDomainPtr domain, return NULL; } -+ + +/** + * virDomainHotpatchManage: + * @domain: a domain object @@ -108,6 +114,8 @@ index a12809c2d5..068ab52f54 100644 + * of the applied hotpatch of the current domain. + * + * Returns success messages in case of success, NULL otherwise. ++ * ++ * Since: 6.10.0 + */ +char * +virDomainHotpatchManage(virDomainPtr domain, @@ -145,11 +153,14 @@ index a12809c2d5..068ab52f54 100644 + virDispatchError(conn); + return NULL; +} + + /** + * virDomainAuthorizedSSHKeysGet: diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms -index 539d2e3943..0ad0b9e489 100644 +index bd1e916d2a..52a5d03240 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms -@@ -873,4 +873,8 @@ LIBVIRT_6.0.0 { +@@ -873,6 +873,11 @@ LIBVIRT_6.0.0 { virDomainBackupGetXMLDesc; } LIBVIRT_5.10.0; @@ -157,25 +168,28 @@ index 539d2e3943..0ad0b9e489 100644 + global: + virDomainHotpatchManage; +} LIBVIRT_6.0.0; - # .... define new API here using predicted next version number .... ++ + LIBVIRT_6.10.0 { + global: + virDomainAuthorizedSSHKeysGet; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c -index 7bae0c2514..1202d44017 100644 +index c4831db6cd..25fae1cad6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c -@@ -8684,6 +8684,7 @@ static virHypervisorDriver hypervisor_driver = { +@@ -7842,6 +7842,7 @@ static virHypervisorDriver hypervisor_driver = { .domainAgentSetResponseTimeout = remoteDomainAgentSetResponseTimeout, /* 5.10.0 */ .domainBackupBegin = remoteDomainBackupBegin, /* 6.0.0 */ .domainBackupGetXMLDesc = remoteDomainBackupGetXMLDesc, /* 6.0.0 */ + .domainHotpatchManage = remoteDomainHotpatchManage, /* 6.2.0 */ - }; - - static virNetworkDriver network_driver = { + .domainAuthorizedSSHKeysGet = remoteDomainAuthorizedSSHKeysGet, /* 6.10.0 */ + .domainAuthorizedSSHKeysSet = remoteDomainAuthorizedSSHKeysSet, /* 6.10.0 */ + .domainGetMessages = remoteDomainGetMessages, /* 7.1.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x -index 8b05082b61..ee13075ce1 100644 +index e295b0acc3..eea11df2ea 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x -@@ -3771,6 +3771,18 @@ struct remote_domain_backup_get_xml_desc_ret { - remote_nonnull_string xml; +@@ -3956,6 +3956,17 @@ struct remote_domain_event_memory_device_size_change_msg { + unsigned hyper size; }; +struct remote_domain_hotpatch_manage_args { @@ -189,16 +203,15 @@ index 8b05082b61..ee13075ce1 100644 +struct remote_domain_hotpatch_manage_ret { + remote_string info; +}; -+ - /*----- Protocol. -----*/ - /* Define the program number, protocol version and procedure numbers here. */ -@@ -6668,5 +6680,11 @@ enum remote_procedure { - * @priority: high - * @acl: domain:read + struct remote_domain_fd_associate_args { + remote_nonnull_domain dom; +@@ -7021,5 +7032,11 @@ enum remote_procedure { + * @generate: both + * @acl: none */ -- REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC = 422 -+ REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC = 422, +- REMOTE_PROC_NETWORK_EVENT_CALLBACK_METADATA_CHANGE = 446 ++ REMOTE_PROC_NETWORK_EVENT_CALLBACK_METADATA_CHANGE = 446, + + /** + * @generate: both diff --git a/Implement-the-method-of-getting-host-info-for-loonga.patch b/Implement-the-method-of-getting-host-info-for-loonga.patch deleted file mode 100644 index d386a0ca84450d0571d28dd3ef0e2ab8bf86f954..0000000000000000000000000000000000000000 --- a/Implement-the-method-of-getting-host-info-for-loonga.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 4123437e633f05af0ae8091d5db440597394ba36 Mon Sep 17 00:00:00 2001 -From: zhaotianrui -Date: Wed, 11 Jan 2023 14:09:41 -0500 -Subject: [PATCH 4/4] Implement the method of getting host info for loongarch - -Implement method for loongarch to get host info, such as -cpu frequency, system info, etc. - -Signed-off-by: zhaotianrui ---- - src/util/virarch.c | 2 ++ - src/util/virhostcpu.c | 2 +- - src/util/virsysinfo.c | 3 ++- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/util/virarch.c b/src/util/virarch.c -index decdbdd7ac..0520a1c80b 100644 ---- a/src/util/virarch.c -+++ b/src/util/virarch.c -@@ -227,6 +227,8 @@ virArch virArchFromHost(void) - arch = VIR_ARCH_X86_64; - } else if (STREQ(ut.machine, "sw_64")) { - arch = VIR_ARCH_SW_64; -+ } else if (STREQ(ut.machine, "loongarch64")) { -+ arch = VIR_ARCH_LOONGARCH64; - } else { - /* Otherwise assume the canonical name */ - if ((arch = virArchFromString(ut.machine)) == VIR_ARCH_NONE) { -diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c -index 5ec98d6016..ce3da7e6ec 100644 ---- a/src/util/virhostcpu.c -+++ b/src/util/virhostcpu.c -@@ -577,7 +577,7 @@ virHostCPUParseFrequency(FILE *cpuinfo, - char line[1024]; - - /* No sensible way to retrieve CPU frequency */ -- if (ARCH_IS_ARM(arch)) -+ if (ARCH_IS_ARM(arch) || ARCH_IS_LOONGARCH(arch)) - return 0; - - if (ARCH_IS_X86(arch)) -diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c -index 8a53702224..6d4778fed7 100644 ---- a/src/util/virsysinfo.c -+++ b/src/util/virsysinfo.c -@@ -1190,7 +1190,7 @@ virSysinfoRead(void) - { - #if defined(__powerpc__) - return virSysinfoReadPPC(); --#elif defined(__arm__) || defined(__aarch64__) -+#elif defined(__arm__) || defined(__aarch64__) || defined(__loongarch__) - return virSysinfoReadARM(); - #elif defined(__s390__) || defined(__s390x__) - return virSysinfoReadS390(); -@@ -1198,6 +1198,7 @@ virSysinfoRead(void) - (defined(__x86_64__) || \ - defined(__i386__) || \ - defined(__amd64__) || \ -+ defined(__loongarch__) || \ - defined(__sw_64__)) - return virSysinfoReadDMI(); - #else /* WIN32 || not supported arch */ --- -2.25.1 - diff --git a/Include-vdpa-devices-in-node-device-list.patch b/Include-vdpa-devices-in-node-device-list.patch deleted file mode 100644 index 9fb06749c17fa92eab51a9296bc6efdc7dd6e61b..0000000000000000000000000000000000000000 --- a/Include-vdpa-devices-in-node-device-list.patch +++ /dev/null @@ -1,322 +0,0 @@ -From e8597e64126a5cf77fbb9422977268878a6376b6 Mon Sep 17 00:00:00 2001 -From: AlexChen -Date: Wed, 14 Oct 2020 12:08:30 -0500 -Subject: [PATCH] Include vdpa devices in node device list - -The current udev node device driver ignores all events related to vdpa -devices. Since libvirt now supports vDPA network devices, include these -devices in the device list. - -Example output: - -virsh # nodedev-list -[...ommitted long list of nodedevs...] -vdpa_vdpa0 - -virsh # nodedev-dumpxml vdpa_vdpa0 - - vdpa_vdpa0 - /sys/devices/vdpa0 - computer - - vhost_vdpa - - - /dev/vhost-vdpa-0 - - - -NOTE: normally the 'parent' would be a PCI device instead of 'computer', -but this example output is from the vdpa_sim kernel module, so it -doesn't have a normal parent device. - -Signed-off-by: Jonathon Jongsma -Signed-off-by: AlexChen ---- - docs/formatnode.html.in | 9 ++++++ - docs/schemas/nodedev.rng | 10 ++++++ - include/libvirt/libvirt-nodedev.h | 1 + - src/conf/node_device_conf.c | 13 ++++++++ - src/conf/node_device_conf.h | 11 ++++++- - src/conf/virnodedeviceobj.c | 4 ++- - src/node_device/node_device_udev.c | 51 ++++++++++++++++++++++++++++++ - tools/virsh-nodedev.c | 3 ++ - 8 files changed, 100 insertions(+), 2 deletions(-) - -diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in -index c2a8f8fb7a..573391ef0f 100644 ---- a/docs/formatnode.html.in -+++ b/docs/formatnode.html.in -@@ -341,6 +341,15 @@ -
The device number.
- - -+
vdpa
-+
Describes a virtual datapath acceleration (vDPA) network device. -+ Since 6.9.0. Sub-elements include: -+
-+
chardev
-+
The path to the character device that is used to access the -+ device.
-+
-+
- - - -diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng -index fe6ffa0b53..4f197b327a 100644 ---- a/docs/schemas/nodedev.rng -+++ b/docs/schemas/nodedev.rng -@@ -85,6 +85,7 @@ - - - -+ - - - -@@ -651,6 +652,15 @@ - - - -+ -+ -+ vdpa -+ -+ -+ -+ -+ -+ - - - -diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h -index a2ad61ac6d..4129f1afed 100644 ---- a/include/libvirt/libvirt-nodedev.h -+++ b/include/libvirt/libvirt-nodedev.h -@@ -81,6 +81,7 @@ typedef enum { - VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = 1 << 13, /* Capable of mediated devices */ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV = 1 << 14, /* Mediated device */ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = 1 << 15, /* CCW device */ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA = 1 << 17, /* vDPA device */ - } virConnectListAllNodeDeviceFlags; - - int virConnectListAllNodeDevices (virConnectPtr conn, -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index d64f6d3986..41d7c7d12e 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -65,6 +65,7 @@ VIR_ENUM_IMPL(virNodeDevCap, - "mdev_types", - "mdev", - "ccw", -+ "vdpa", - ); - - VIR_ENUM_IMPL(virNodeDevNetCap, -@@ -500,6 +501,12 @@ virNodeDeviceCapStorageDefFormat(virBufferPtr buf, - virBufferAddLit(buf, "\n"); - } - -+static void -+virNodeDeviceCapVDPADefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferEscapeString(buf, "%s\n", data->vdpa.chardev); -+} - - char * - virNodeDeviceDefFormat(const virNodeDeviceDef *def) -@@ -595,6 +602,9 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) - virBufferAsprintf(&buf, "0x%04x\n", - data->ccw_dev.devno); - break; -+ case VIR_NODE_DEV_CAP_VDPA: -+ virNodeDeviceCapVDPADefFormat(&buf, data); -+ break; - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: -@@ -1897,6 +1907,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: - case VIR_NODE_DEV_CAP_SCSI_GENERIC: -+ case VIR_NODE_DEV_CAP_VDPA: - case VIR_NODE_DEV_CAP_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown capability type '%d' for '%s'"), -@@ -2209,6 +2220,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: - case VIR_NODE_DEV_CAP_CCW_DEV: -+ case VIR_NODE_DEV_CAP_VDPA: - case VIR_NODE_DEV_CAP_LAST: - /* This case is here to shutup the compiler */ - break; -@@ -2262,6 +2274,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_MDEV: - case VIR_NODE_DEV_CAP_CCW_DEV: -+ case VIR_NODE_DEV_CAP_VDPA: - case VIR_NODE_DEV_CAP_LAST: - break; - } -diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h -index 9e4b0847fb..a14eaef742 100644 ---- a/src/conf/node_device_conf.h -+++ b/src/conf/node_device_conf.h -@@ -64,6 +64,7 @@ typedef enum { - VIR_NODE_DEV_CAP_MDEV_TYPES, /* Device capable of mediated devices */ - VIR_NODE_DEV_CAP_MDEV, /* Mediated device */ - VIR_NODE_DEV_CAP_CCW_DEV, /* s390 CCW device */ -+ VIR_NODE_DEV_CAP_VDPA, /* vDPA device */ - - VIR_NODE_DEV_CAP_LAST - } virNodeDevCapType; -@@ -271,6 +272,12 @@ struct _virNodeDevCapCCW { - unsigned int devno; - }; - -+typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA; -+typedef virNodeDevCapVDPA *virNodeDevCapVDPAPtr; -+struct _virNodeDevCapVDPA { -+ char *chardev; -+}; -+ - typedef struct _virNodeDevCapData virNodeDevCapData; - typedef virNodeDevCapData *virNodeDevCapDataPtr; - struct _virNodeDevCapData { -@@ -289,6 +296,7 @@ struct _virNodeDevCapData { - virNodeDevCapDRM drm; - virNodeDevCapMdev mdev; - virNodeDevCapCCW ccw_dev; -+ virNodeDevCapVDPA vdpa; - }; - }; - -@@ -364,7 +372,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); - VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV | \ -- VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV) -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV | \ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA) - - int - virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); -diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c -index 3a34a324ca..be111741bf 100644 ---- a/src/conf/virnodedeviceobj.c -+++ b/src/conf/virnodedeviceobj.c -@@ -676,6 +676,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_MDEV: - case VIR_NODE_DEV_CAP_CCW_DEV: -+ case VIR_NODE_DEV_CAP_VDPA: - case VIR_NODE_DEV_CAP_LAST: - break; - } -@@ -826,7 +827,8 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj, - MATCH(DRM) || - MATCH(MDEV_TYPES) || - MATCH(MDEV) || -- MATCH(CCW_DEV))) -+ MATCH(CCW_DEV) || -+ MATCH(VDPA))) - return false; - } - -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index 0d8a7db5c6..2764315325 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -1089,6 +1089,53 @@ udevProcessCCW(struct udev_device *device, - return 0; - } - -+static int -+udevGetVDPACharDev(const char *sysfs_path, -+ virNodeDevCapDataPtr data) -+{ -+ struct dirent *entry; -+ DIR *dir = NULL; -+ int direrr; -+ -+ if (virDirOpenIfExists(&dir, sysfs_path) <= 0) -+ return -1; -+ -+ while ((direrr = virDirRead(dir, &entry, NULL)) > 0) { -+ if (g_str_has_prefix(entry->d_name, "vhost-vdpa")) { -+ g_autofree char *chardev = g_strdup_printf("/dev/%s", entry->d_name); -+ -+ if (!virFileExists(chardev)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("vDPA chardev path '%s' does not exist"), -+ chardev); -+ return -1; -+ } -+ VIR_DEBUG("vDPA chardev is at '%s'", chardev); -+ -+ data->vdpa.chardev = g_steal_pointer(&chardev); -+ break; -+ } -+ } -+ -+ if (direrr < 0) -+ return -1; -+ -+ return 0; -+} -+ -+static int -+udevProcessVDPA(struct udev_device *device, -+ virNodeDeviceDefPtr def) -+{ -+ if (udevGenerateDeviceName(device, def, NULL) != 0) -+ return -1; -+ -+ if (udevGetVDPACharDev(def->sysfs_path, &def->caps->data) < 0) -+ return -1; -+ -+ return 0; -+} -+ - - static int - udevGetDeviceNodes(struct udev_device *device, -@@ -1168,6 +1215,8 @@ udevGetDeviceType(struct udev_device *device, - *type = VIR_NODE_DEV_CAP_MDEV; - else if (STREQ_NULLABLE(subsystem, "ccw")) - *type = VIR_NODE_DEV_CAP_CCW_DEV; -+ else if (STREQ_NULLABLE(subsystem, "vdpa")) -+ *type = VIR_NODE_DEV_CAP_VDPA; - - VIR_FREE(subsystem); - } -@@ -1212,6 +1261,8 @@ udevGetDeviceDetails(struct udev_device *device, - return udevProcessMediatedDevice(device, def); - case VIR_NODE_DEV_CAP_CCW_DEV: - return udevProcessCCW(device, def); -+ case VIR_NODE_DEV_CAP_VDPA: -+ return udevProcessVDPA(device, def); - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_SYSTEM: - case VIR_NODE_DEV_CAP_FC_HOST: -diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c -index 7f091d7cf8..f831b36054 100644 ---- a/tools/virsh-nodedev.c -+++ b/tools/virsh-nodedev.c -@@ -462,6 +462,9 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) - case VIR_NODE_DEV_CAP_CCW_DEV: - flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV; - break; -+ case VIR_NODE_DEV_CAP_VDPA: -+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA; -+ break; - case VIR_NODE_DEV_CAP_LAST: - break; - } --- -2.27.0 - diff --git a/Revert-libvirt-support-aarch64-vtpm-with-parameter-t.patch b/Revert-libvirt-support-aarch64-vtpm-with-parameter-t.patch deleted file mode 100644 index a26b4ce3c8380774b7e25e2cbac11fd95046097a..0000000000000000000000000000000000000000 --- a/Revert-libvirt-support-aarch64-vtpm-with-parameter-t.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 78c25600daf2a2822e7ecec2af9e7458b9f44eff Mon Sep 17 00:00:00 2001 -From: yezengruan -Date: Sat, 12 Mar 2022 09:35:07 +0800 -Subject: [PATCH 1/6] Revert libvirt: support aarch64 vtpm with parameter - tpm-tis-device - -Before backport the patch support aarch64 vtpm, let's -revert it first. - -Signed-off-by: yezengruan ---- - src/conf/domain_conf.c | 1 - - src/conf/domain_conf.h | 1 - - src/qemu/qemu_capabilities.c | 9 +-------- - src/qemu/qemu_capabilities.h | 4 +--- - src/qemu/qemu_domain.c | 3 --- - 5 files changed, 2 insertions(+), 16 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 4e3bcf479c..54228a2151 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1141,7 +1141,6 @@ VIR_ENUM_IMPL(virDomainTPMModel, - "tpm-tis", - "tpm-crb", - "tpm-spapr", -- "tpm-tis-device", - ); - - VIR_ENUM_IMPL(virDomainTPMBackend, -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index ccee986849..e057c384c6 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -1280,7 +1280,6 @@ typedef enum { - VIR_DOMAIN_TPM_MODEL_TIS, - VIR_DOMAIN_TPM_MODEL_CRB, - VIR_DOMAIN_TPM_MODEL_SPAPR, -- VIR_DOMAIN_TPM_MODEL_TIS_DEVICE, - - VIR_DOMAIN_TPM_MODEL_LAST - } virDomainTPMModel; -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 6013be9d05..0fb3e74c77 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -568,9 +568,7 @@ VIR_ENUM_IMPL(virQEMUCaps, - "blockdev-snapshot.allow-write-only-overlay", - "blockdev-reopen", - "storage.werror", -- -- /* 360 */ -- "tpm-tis-device", -+ - "migration-param.bandwidth", - "migration-param.downtime", - "migration-param.xbzrle-cache-size", -@@ -1292,7 +1290,6 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { - { "rng-builtin", QEMU_CAPS_OBJECT_RNG_BUILTIN }, - { "tpm-spapr", QEMU_CAPS_DEVICE_TPM_SPAPR }, - { "vhost-user-fs-device", QEMU_CAPS_DEVICE_VHOST_USER_FS }, -- { "tpm-tis-device", QEMU_CAPS_DEVICE_TPM_TIS_DEVICE }, - }; - - static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { -@@ -3100,10 +3097,6 @@ const struct tpmTypeToCaps virQEMUCapsTPMModelsToCaps[] = { - .type = VIR_DOMAIN_TPM_MODEL_SPAPR, - .caps = QEMU_CAPS_DEVICE_TPM_SPAPR, - }, -- { -- .type = VIR_DOMAIN_TPM_MODEL_TIS_DEVICE, -- .caps = QEMU_CAPS_DEVICE_TPM_TIS_DEVICE, -- }, - }; - - static int -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index 5f28006b48..10a6ce50e7 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -549,9 +549,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ - QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY, /* blockdev-snapshot has the 'allow-write-only-overlay' feature */ - QEMU_CAPS_BLOCKDEV_REOPEN, /* 'blockdev-reopen' qmp command is supported */ - QEMU_CAPS_STORAGE_WERROR, /* virtio-blk,scsi-hd.werror */ -- -- /* 360 */ -- QEMU_CAPS_DEVICE_TPM_TIS_DEVICE, /* -device tpm-tis-device */ -+ - QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH, /* max-bandwidth field in migrate-set-parameters */ - QEMU_CAPS_MIGRATION_PARAM_DOWNTIME, /* downtime-limit field in migrate-set-parameters */ - QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, /* xbzrle-cache-size field in migrate-set-parameters */ -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 2351cac120..cb2fbdc179 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -8130,9 +8130,6 @@ qemuDomainDeviceDefValidateTPM(virDomainTPMDef *tpm, - case VIR_DOMAIN_TPM_MODEL_SPAPR: - flag = QEMU_CAPS_DEVICE_TPM_SPAPR; - break; -- case VIR_DOMAIN_TPM_MODEL_TIS_DEVICE: -- flag = QEMU_CAPS_DEVICE_TPM_TIS_DEVICE; -- break; - case VIR_DOMAIN_TPM_MODEL_LAST: - default: - virReportEnumRangeError(virDomainTPMModel, tpm->model); --- -2.27.0 - diff --git a/Revert-selinux-adapt-to-libselinux.patch b/Revert-selinux-adapt-to-libselinux.patch deleted file mode 100644 index 9f5e6ae08c3ac34b2866c85573fe8c331e96df77..0000000000000000000000000000000000000000 --- a/Revert-selinux-adapt-to-libselinux.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 3dc1e0f37c013c317f3e868d1e4a6668d8f18a03 Mon Sep 17 00:00:00 2001 -From: mayunlong -Date: Wed, 9 Aug 2023 20:51:37 +0800 -Subject: [PATCH] Revert "selinux: adapt to libselinux" - -use the solution modified by the upstream community torevert this patch -This reverts commit 20fd0fb6b915363efecd2d108363995d8dea8e1a. ---- - src/security/security_selinux.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c -index cb4dc3e101..c91c7ca484 100644 ---- a/src/security/security_selinux.c -+++ b/src/security/security_selinux.c -@@ -541,7 +541,7 @@ static char * - virSecuritySELinuxContextAddRange(char *src, - char *dst) - { -- const char *str = NULL; -+ char *str = NULL; - char *ret = NULL; - context_t srccon = NULL; - context_t dstcon = NULL; -@@ -582,7 +582,7 @@ virSecuritySELinuxGenNewContext(const char *basecontext, - { - context_t context = NULL; - char *ret = NULL; -- const char *str; -+ char *str; - char *ourSecContext = NULL; - context_t ourContext = NULL; - --- -2.41.0.windows.1 - diff --git a/Revert-tests-disabale-storage-tests.patch b/Revert-tests-disabale-storage-tests.patch deleted file mode 100644 index 78cab82e0161e24adad840d3ec43207ca73ed793..0000000000000000000000000000000000000000 --- a/Revert-tests-disabale-storage-tests.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 8629a253113a019215b38f7206db03892157a370 Mon Sep 17 00:00:00 2001 -From: imxcc -Date: Sat, 29 Jan 2022 17:14:59 +0800 -Subject: [PATCH] Revert tests: disabale storage tests - -Signed-off-by: imxcc ---- - tests/Makefile.am | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index abb261e..ada5b8f 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -363,10 +363,16 @@ endif WITH_NWFILTER - - if WITH_STORAGE - test_programs += storagevolxml2argvtest -+test_programs += storagepoolxml2argvtest - test_programs += virstorageutiltest -+test_programs += storagepoolxml2xmltest - test_programs += storagepoolcapstest - endif WITH_STORAGE - -+if WITH_STORAGE_FS -+test_programs += virstoragetest -+endif WITH_STORAGE_FS -+ - if WITH_LINUX - test_programs += virscsitest - endif WITH_LINUX -@@ -424,6 +430,7 @@ test_scripts += $(libvirtd_test_scripts) - - test_programs += \ - eventtest \ -+ virdrivermoduletest \ - virdriverconnvalidatetest - else ! WITH_LIBVIRTD - EXTRA_DIST += $(libvirtd_test_scripts) --- -2.27.0 - diff --git a/Use-un-signed-printf-specifiers-correctly.patch b/Use-un-signed-printf-specifiers-correctly.patch deleted file mode 100644 index 04f90f4bb9030ee122f79aee0ea0aa82202a926d..0000000000000000000000000000000000000000 --- a/Use-un-signed-printf-specifiers-correctly.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 37a05df2eb7e880c1bde301adf2b2eb32fc9a891 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 22 Sep 2020 22:17:03 +0200 -Subject: [PATCH] Use (un)signed printf specifiers correctly -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Various places reported by cppcheck's invalidPrintfArgType_sint -and invalidPrintfArgType_uint. - -Signed-off-by: Ján Tomko -Reviewed-by: Peter Krempa -Signed-off-by: zhujun2 -(cherry-pick from 8b80d9f0f924ddf900b726871916f8ba5ae29243) ---- - examples/c/domain/domtop.c | 2 +- - examples/c/domain/suspend.c | 2 +- - tests/qemusecuritymock.c | 2 +- - tests/virhashtest.c | 4 ++-- - tests/virpcimock.c | 2 +- - 5 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/examples/c/domain/domtop.c b/examples/c/domain/domtop.c -index 15611c586d..5228445b7c 100644 ---- a/examples/c/domain/domtop.c -+++ b/examples/c/domain/domtop.c -@@ -115,7 +115,7 @@ parse_argv(int argc, char *argv[], - } - *milliseconds = val; - if (*milliseconds != val) { -- ERROR("Integer overflow: %ld", val); -+ ERROR("Integer overflow: %lu", val); - exit(EXIT_FAILURE); - } - break; -diff --git a/examples/c/domain/suspend.c b/examples/c/domain/suspend.c -index 980c4584c7..3ff24f6861 100644 ---- a/examples/c/domain/suspend.c -+++ b/examples/c/domain/suspend.c -@@ -105,7 +105,7 @@ parse_argv(int argc, char *argv[], - } - *seconds = val; - if (*seconds != val) { -- ERROR("Integer overflow: %ld", val); -+ ERROR("Integer overflow: %lu", val); - return -1; - } - break; -diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c -index ad182c7bf7..e1057bef7b 100644 ---- a/tests/qemusecuritymock.c -+++ b/tests/qemusecuritymock.c -@@ -269,7 +269,7 @@ mock_chown(const char *path, - int ret = -1; - - if (gid >> 16 || uid >> 16) { -- fprintf(stderr, "Attempt to set too high UID or GID: %lld %lld", -+ fprintf(stderr, "Attempt to set too high UID or GID: %llu %llu", - (unsigned long long) uid, (unsigned long long) gid); - abort(); - } -diff --git a/tests/virhashtest.c b/tests/virhashtest.c -index 4d05cbb0f8..af30791241 100644 ---- a/tests/virhashtest.c -+++ b/tests/virhashtest.c -@@ -34,7 +34,7 @@ testHashInit(int size) - } - - if (virHashTableSize(hash) != oldsize) { -- VIR_TEST_DEBUG("hash grown from %zd to %zd", -+ VIR_TEST_DEBUG("hash grown from %zu to %zu", - (size_t)oldsize, (size_t)virHashTableSize(hash)); - } - } -@@ -313,7 +313,7 @@ testHashRemoveSet(const void *data G_GNUC_UNUSED) - - if (count != rcount) { - VIR_TEST_VERBOSE("\nvirHashRemoveSet didn't remove expected number of" -- " entries, %d != %u", -+ " entries, %d != %d", - rcount, count); - goto cleanup; - } -diff --git a/tests/virpcimock.c b/tests/virpcimock.c -index 92b6f810d8..d0fe11e5f1 100644 ---- a/tests/virpcimock.c -+++ b/tests/virpcimock.c -@@ -120,7 +120,7 @@ struct pciDeviceAddress { - unsigned int device; - unsigned int function; - }; --# define ADDR_STR_FMT "%04x:%02x:%02x.%d" -+# define ADDR_STR_FMT "%04x:%02x:%02x.%u" - - struct pciDevice { - struct pciDeviceAddress addr; --- -2.27.0 - diff --git a/add-phytium-2000plus-and-s2500-support-on-arm-archit.patch b/add-phytium-2000plus-and-s2500-support-on-arm-archit.patch deleted file mode 100644 index 0501e10bf35c1b8449a7440817f0ef853751b29f..0000000000000000000000000000000000000000 --- a/add-phytium-2000plus-and-s2500-support-on-arm-archit.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0ef9a886d3d8bd468800ee3d6aadac2231359501 Mon Sep 17 00:00:00 2001 -From: root -Date: Thu, 4 Feb 2021 17:35:46 +0800 -Subject: [PATCH] add phytium 2000plus and s2500 support on arm architecture - for capability - ---- - src/cpu_map/Makefile.inc.am | 2 ++ - src/cpu_map/arm_FT-2000plus.xml | 6 ++++++ - src/cpu_map/arm_Tengyun-S2500.xml | 6 ++++++ - src/cpu_map/arm_vendors.xml | 1 + - src/cpu_map/index.xml | 4 ++++ - 5 files changed, 19 insertions(+) - create mode 100644 src/cpu_map/arm_FT-2000plus.xml - create mode 100644 src/cpu_map/arm_Tengyun-S2500.xml - -diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am -index 8663877b97..ab5268d94f 100644 ---- a/src/cpu_map/Makefile.inc.am -+++ b/src/cpu_map/Makefile.inc.am -@@ -72,6 +72,8 @@ cpumap_DATA = \ - cpu_map/arm_cortex-a57.xml \ - cpu_map/arm_cortex-a72.xml \ - cpu_map/arm_Kunpeng-920.xml \ -+ cpu_map/arm_FT-2000plus.xml \ -+ cpu_map/arm_Tengyun-S2500.xml \ - $(NULL) - - EXTRA_DIST += $(cpumap_DATA) -diff --git a/src/cpu_map/arm_FT-2000plus.xml b/src/cpu_map/arm_FT-2000plus.xml -new file mode 100644 -index 0000000000..b532f65f68 ---- /dev/null -+++ b/src/cpu_map/arm_FT-2000plus.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_Tengyun-S2500.xml b/src/cpu_map/arm_Tengyun-S2500.xml -new file mode 100644 -index 0000000000..22b865e368 ---- /dev/null -+++ b/src/cpu_map/arm_Tengyun-S2500.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml -index 840bf9a2f8..05175495a0 100644 ---- a/src/cpu_map/arm_vendors.xml -+++ b/src/cpu_map/arm_vendors.xml -@@ -11,4 +11,5 @@ - - - -+ - -diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml -index 985af86ba2..672d0a3c92 100644 ---- a/src/cpu_map/index.xml -+++ b/src/cpu_map/index.xml -@@ -95,5 +95,9 @@ - - - -+ -+ -+ -+ - - --- -2.27.0 - diff --git a/admin-fix-leak-of-typed-parameters-on-error.patch b/admin-fix-leak-of-typed-parameters-on-error.patch deleted file mode 100644 index 66b0adf94726c1a1fae0519abc6fdc170cb46fe4..0000000000000000000000000000000000000000 --- a/admin-fix-leak-of-typed-parameters-on-error.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 90b8168fd93490f3a0fadadb38030163712a0e85 Mon Sep 17 00:00:00 2001 -From: wangmeiyang -Date: Fri, 21 Apr 2023 14:43:45 +0800 -Subject: [PATCH] admin: fix leak of typed parameters on error -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A few admin client methods had the xdr_free call the wrong -side of the cleanup label, so typed parameters would not -be freed on error. - -origin commit: https://gitlab.com/libvirt/libvirt/-/commit/0edf44664e9f2f75c7ba5faab91e2e190b5626af -Reviewed-by: Martin Kletzander -Signed-off-by: Daniel P. Berrangé -Signed-off-by: Meiyang Wang ---- - src/admin/admin_remote.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c -index ca5e0c9fe4..2499fb8b0f 100644 ---- a/src/admin/admin_remote.c -+++ b/src/admin/admin_remote.c -@@ -271,9 +271,9 @@ remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv, - goto cleanup; - - rv = 0; -- xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret); - - cleanup: -+ xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret); - virObjectUnlock(priv); - return rv; - } -@@ -344,9 +344,9 @@ remoteAdminClientGetInfo(virAdmClientPtr client, - goto cleanup; - - rv = 0; -- xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret); - - cleanup: -+ xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret); - virObjectUnlock(priv); - return rv; - } -@@ -382,10 +382,10 @@ remoteAdminServerGetClientLimits(virAdmServerPtr srv, - goto cleanup; - - rv = 0; -- xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret, -- (char *) &ret); - - cleanup: -+ xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret, -+ (char *) &ret); - virObjectUnlock(priv); - return rv; - } --- -2.27.0 - diff --git a/apibuild-Fix-self.waring-method-call.patch b/apibuild-Fix-self.waring-method-call.patch deleted file mode 100644 index 97ccecc7ad2cd614150792d2c8f25f3eb304ff56..0000000000000000000000000000000000000000 --- a/apibuild-Fix-self.waring-method-call.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 58d0830491d3be2fedec55f42f6f832d32783a73 Mon Sep 17 00:00:00 2001 -From: luzhipeng -Date: Sat, 7 May 2022 09:17:31 +0800 -Subject: [PATCH] apibuild: Fix self.waring method call - -The parameters of self.warning is inconsistent with its definition, So -fix it. - -Signed-off-by: dinglimin -Signed-off-by: luzhipeng -Reviewed-by: Martin Kletzander ---- - scripts/apibuild.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/apibuild.py b/scripts/apibuild.py -index 05a169c30d..c98bcf6091 100755 ---- a/scripts/apibuild.py -+++ b/scripts/apibuild.py -@@ -315,7 +315,7 @@ class index: - if type in type_map: - type_map[type][name] = d - else: -- self.warning("Unable to register type ", type) -+ self.warning("Unable to register type %s" % type) - - if name == debugsym and not quiet: - print("New symbol: %s" % (d)) --- -2.27.0 - diff --git a/apparmor-Permit-new-capabilities-required-by-libvirt.patch b/apparmor-Permit-new-capabilities-required-by-libvirt.patch deleted file mode 100644 index 9efd2e6fd35f759f2168b6eb0d4998c81f5eb680..0000000000000000000000000000000000000000 --- a/apparmor-Permit-new-capabilities-required-by-libvirt.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 9abebfb36b2380829be4a901d7c9785a7a8f5f6a Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Mon, 7 Jun 2021 16:21:28 -0600 -Subject: [PATCH] apparmor: Permit new capabilities required by libvirtd - -The audit log contains the following denials from libvirtd - -apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="daemon-init" capability=17 capname="sys_rawio" -apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="rpc-worker" capability=39 capname="bpf" -apparmor="DENIED" operation="capable" profile="libvirtd" pid=6012 comm="rpc-worker" capability=38 capname="perfmon" - -Squelch the denials and allow the capabilities in the libvirtd -apparmor profile. - -Signed-off-by: Jim Fehlig -Reviewed-by: Neal Gompa -Reviewed-by: Michal Privoznik ---- - src/security/apparmor/usr.sbin.libvirtd.in | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/security/apparmor/usr.sbin.libvirtd.in b/src/security/apparmor/usr.sbin.libvirtd.in -index 1e137039e9..49266743f5 100644 ---- a/src/security/apparmor/usr.sbin.libvirtd.in -+++ b/src/security/apparmor/usr.sbin.libvirtd.in -@@ -25,6 +25,9 @@ profile libvirtd @sbindir@/libvirtd flags=(attach_disconnected) { - capability fsetid, - capability audit_write, - capability ipc_lock, -+ capability sys_rawio, -+ capability bpf, -+ capability perfmon, - - # Needed for vfio - capability sys_resource, --- -2.27.0 - diff --git a/backport-meson-drop-debug_logs-configure-argument.patch b/backport-meson-drop-debug_logs-configure-argument.patch deleted file mode 100644 index fac1c12e8d21d2e888162dd1cc4d512aa365daf2..0000000000000000000000000000000000000000 --- a/backport-meson-drop-debug_logs-configure-argument.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 2b3bbbc1b7f8723c4947c6d1e4fb43cabc25fb2e Mon Sep 17 00:00:00 2001 -From: Pavel Hrdina -Date: Fri, 24 Jul 2020 16:30:06 +0200 -Subject: [PATCH 2/4] meson: drop debug_logs configure argument - -There is no point of having this option in libvirt because the debug -logs can be configured using log filters. - -origin commit: https://gitlab.com/libvirt/libvirt/-/commit/da6d644ea7b49500680a3d4a403571234fecefad -Signed-off-by: Pavel Hrdina -Reviewed-by: Peter Krempa -Reviewed-by: Neal Gompa -Signed-off-by: Chenxi Mao ---- - configure.ac | 3 --- - m4/virt-debug.m4 | 33 --------------------------------- - src/util/virlog.h | 23 +---------------------- - tools/virsh.c | 2 -- - tools/virt-admin.c | 2 -- - 5 files changed, 1 insertion(+), 62 deletions(-) - delete mode 100644 m4/virt-debug.m4 - -diff --git a/configure.ac b/configure.ac -index cb62e5aac8..93d13496f3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -496,7 +496,6 @@ dnl - dnl Miscellaneous checks - dnl - --LIBVIRT_ARG_DEBUG - LIBVIRT_ARG_DTRACE - LIBVIRT_ARG_NUMAD - LIBVIRT_ARG_INIT_SCRIPT -@@ -509,7 +508,6 @@ LIBVIRT_ARG_TLS_PRIORITY - LIBVIRT_ARG_SYSCTL_CONFIG - - --LIBVIRT_CHECK_DEBUG - LIBVIRT_CHECK_DTRACE - LIBVIRT_CHECK_NUMAD - LIBVIRT_CHECK_INIT_SCRIPT -@@ -1038,7 +1036,6 @@ LIBVIRT_RESULT([Coverage], [$enable_test_coverage]) - AC_MSG_NOTICE([]) - AC_MSG_NOTICE([Miscellaneous]) - AC_MSG_NOTICE([]) --LIBVIRT_RESULT_DEBUG - LIBVIRT_RESULT([Use -Werror], [$enable_werror]) - LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS]) - LIBVIRT_RESULT_DTRACE -diff --git a/m4/virt-debug.m4 b/m4/virt-debug.m4 -deleted file mode 100644 -index d3ac0564f2..0000000000 ---- a/m4/virt-debug.m4 -+++ /dev/null -@@ -1,33 +0,0 @@ --dnl The debug check --dnl --dnl Copyright (C) 2016 Red Hat, Inc. --dnl --dnl This library is free software; you can redistribute it and/or --dnl modify it under the terms of the GNU Lesser General Public --dnl License as published by the Free Software Foundation; either --dnl version 2.1 of the License, or (at your option) any later version. --dnl --dnl This library is distributed in the hope that it will be useful, --dnl but WITHOUT ANY WARRANTY; without even the implied warranty of --dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --dnl Lesser General Public License for more details. --dnl --dnl You should have received a copy of the GNU Lesser General Public --dnl License along with this library. If not, see --dnl . --dnl -- --AC_DEFUN([LIBVIRT_ARG_DEBUG], [ -- LIBVIRT_ARG_ENABLE([DEBUG], [enable debugging output], [yes]) --]) -- --AC_DEFUN([LIBVIRT_CHECK_DEBUG], [ -- AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes") -- if test x"$enable_debug" = x"yes"; then -- AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled]) -- fi --]) -- --AC_DEFUN([LIBVIRT_RESULT_DEBUG], [ -- LIBVIRT_RESULT([Debug], [$enable_debug]) --]) -diff --git a/src/util/virlog.h b/src/util/virlog.h -index feb2f85904..716fb9a378 100644 ---- a/src/util/virlog.h -+++ b/src/util/virlog.h -@@ -78,29 +78,8 @@ struct _virLogSource { - .serial = 0, \ - } - --/* -- * If configured with --enable-debug=yes then library calls -- * are printed to stderr for debugging or to an appropriate channel -- * defined at runtime from the libvirt daemon configuration file -- */ --#ifdef ENABLE_DEBUG --# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ -+#define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ - virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__) --#else --/** -- * virLogEatParams: -- * -- * Do nothing but eat parameters. -- */ --static inline void virLogEatParams(virLogSourcePtr unused, ...) --{ -- /* Silence gcc */ -- unused = unused; --} --# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ -- virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__) --#endif /* !ENABLE_DEBUG */ -- - #define VIR_INFO_INT(src, filename, linenr, funcname, ...) \ - virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__) - #define VIR_WARN_INT(src, filename, linenr, funcname, ...) \ -diff --git a/tools/virsh.c b/tools/virsh.c -index 197a90636d..06ff5e8336 100644 ---- a/tools/virsh.c -+++ b/tools/virsh.c -@@ -614,9 +614,7 @@ virshShowVersion(vshControl *ctl G_GNUC_UNUSED) - #ifdef WITH_SECRETS - vshPrint(ctl, " Secrets"); - #endif --#ifdef ENABLE_DEBUG - vshPrint(ctl, " Debug"); --#endif - #ifdef WITH_DTRACE_PROBES - vshPrint(ctl, " DTrace"); - #endif -diff --git a/tools/virt-admin.c b/tools/virt-admin.c -index a8e5e0a5af..df23330ee1 100644 ---- a/tools/virt-admin.c -+++ b/tools/virt-admin.c -@@ -1277,9 +1277,7 @@ vshAdmShowVersion(vshControl *ctl G_GNUC_UNUSED) - #ifdef WITH_LIBVIRTD - vshPrint(ctl, " Daemon"); - #endif --#ifdef ENABLE_DEBUG - vshPrint(ctl, " Debug"); --#endif - #if WITH_READLINE - vshPrint(ctl, " Readline"); - #endif --- -2.33.0 - diff --git a/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch b/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch deleted file mode 100644 index 42211ca39f41e11ad09c403505cf546aceea4eae..0000000000000000000000000000000000000000 --- a/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch +++ /dev/null @@ -1,67 +0,0 @@ -From f6c9bb6adbee8f74172707845dcdf221e79e35d4 Mon Sep 17 00:00:00 2001 -From: Peter Krempa -Date: Tue, 23 Aug 2022 15:29:43 +0200 -Subject: [PATCH 1/4] virhostcpu: Fix build with clang and newest kernel - headers - -The most recent environment e.g. present in our Fedora Rawhide builds -fail to build the tree with clang with the following error: - -../src/util/virhostcpu.c:1291:25: error: field 'header' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] - struct kvm_msrs header; - ^ - -The problem seems to be that clang doesn't like the new way the -'entries' field in struct kvm_msrs is declared. - -To work around the issue we can simply allocate the variable dynamically -and use the 'entries' member as it was intended to to access the -members. - -origin commit: https://gitlab.com/libvirt/libvirt/-/commit/56b3ee743916c8951a32a1650616621d78afe8c7 -Signed-off-by: Peter Krempa -Reviewed-by: Jiri Denemark -Signed-off-by: Chenxi Mao ---- - src/util/virhostcpu.c | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c -index ce3da7e6ec..8c8fc3a476 100644 ---- a/src/util/virhostcpu.c -+++ b/src/util/virhostcpu.c -@@ -1275,25 +1275,22 @@ virHostCPUGetMSRFromKVM(unsigned long index, - uint64_t *result) - { - VIR_AUTOCLOSE fd = -1; -- struct { -- struct kvm_msrs header; -- struct kvm_msr_entry entry; -- } msr = { -- .header = { .nmsrs = 1 }, -- .entry = { .index = index }, -- }; -+ g_autofree struct kvm_msrs *msr = g_malloc0(sizeof(struct kvm_msrs) + -+ sizeof(struct kvm_msr_entry)); -+ msr->nmsrs = 1; -+ msr->entries[0].index = index; - - if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) { - virReportSystemError(errno, _("Unable to open %s"), KVM_DEVICE); - return -1; - } - -- if (ioctl(fd, KVM_GET_MSRS, &msr) < 0) { -+ if (ioctl(fd, KVM_GET_MSRS, msr) < 0) { - VIR_DEBUG("Cannot get MSR 0x%lx from KVM", index); - return 1; - } - -- *result = msr.entry.data; -+ *result = msr->entries[0].data; - return 0; - } - --- -2.33.0 - diff --git a/backport-vshCommandStringGetArg-Drop-sz.patch b/backport-vshCommandStringGetArg-Drop-sz.patch deleted file mode 100644 index 0f19fcb82098b2bc735e835d4db5a95c5c137088..0000000000000000000000000000000000000000 --- a/backport-vshCommandStringGetArg-Drop-sz.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 6d3c4b49c08d5fcf42f324af0d04551619e4109f Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Thu, 7 Jan 2021 17:59:55 +0100 -Subject: [PATCH 3/4] vshCommandStringGetArg: Drop @sz -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This variable is unused since introduction of the function in -v0.8.5~150. - -origin commit: https://gitlab.com/libvirt/libvirt/-/commit/9b9542586cc047075469053606d1e12cb017b5ca -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -Signed-off-by: Chenxi Mao ---- - tools/vsh.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/tools/vsh.c b/tools/vsh.c -index 3646f37cea..f5fa7b6f6f 100644 ---- a/tools/vsh.c -+++ b/tools/vsh.c -@@ -1641,7 +1641,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res, - { - bool single_quote = false; - bool double_quote = false; -- int sz = 0; - char *p = parser->pos; - char *q = g_strdup(p); - -@@ -1695,7 +1694,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res, - } - - *q++ = *p++; -- sz++; - } - if (double_quote) { - if (report) --- -2.33.0 - diff --git a/bash-completion-fix-variable-leaks-of-word.patch b/bash-completion-fix-variable-leaks-of-word.patch deleted file mode 100644 index 07ec5d3d673c3bd0e84af975b1ebb47cff06bd98..0000000000000000000000000000000000000000 --- a/bash-completion-fix-variable-leaks-of-word.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4bdf8aeb2e907b53cc71c07b3c6be8f82e3f1e4a Mon Sep 17 00:00:00 2001 -From: Xu Zheng -Date: Thu, 24 Nov 2022 17:58:28 +0800 -Subject: [PATCH 20/23] bash-completion: fix variable leaks of "word" - -cherry-pick from 097296c30b72f472bcf4e72cf8ab2aeb55903c49 - -Signed-off-by: Koichi Murase -Signed-off-by: Michal Privoznik -Reviewed-by: Michal Privoznik -Signed-off-by: Xu Zheng ---- - tools/bash-completion/vsh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh -index 8493cad28b..363097c601 100644 ---- a/tools/bash-completion/vsh -+++ b/tools/bash-completion/vsh -@@ -21,7 +21,7 @@ _vsh_complete() - # See what URI is user trying to connect to and if they are - # connecting RO. Honour that. - while [ $c -le $COMP_CWORD ]; do -- word="${COMP_WORDS[c]}" -+ local word="${COMP_WORDS[c]}" - case "$word" in - -r|--readonly) RO=1 ;; - -c|--connect) c=$((++c)); URI=${COMP_WORDS[c]} ;; --- -2.27.0 - diff --git a/bugfix-move-the-check-function-qemuDomainDiskBlockIo.patch b/bugfix-move-the-check-function-qemuDomainDiskBlockIo.patch deleted file mode 100644 index d5a1166e84a7f96694ac073475b87e9aa4cad477..0000000000000000000000000000000000000000 --- a/bugfix-move-the-check-function-qemuDomainDiskBlockIo.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 35de7404370eb24089b6160d109f6fe559a91864 Mon Sep 17 00:00:00 2001 -From: mayunlong -Date: Fri, 24 Mar 2023 11:31:49 +0800 -Subject: [PATCH] bugfix: move the check function - qemuDomainDiskBlockIoTuneIsSupported to currect place. - -move the check function qemuDomainDiskBlockIoTuneIsSupported for -conf_disk to currect place in function: qemuDomainSetBlockIotTune. - -fix commit: e07709c7275349eac376660c08bacc6d18f28ff8 -origin commit: https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=d763466edc6e8d4965fb42092c6e8f4296acf6c6 -Signed-off-by:mayunlong ---- - src/qemu/qemu_driver.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 32b3ef3cf1..c7545a7a98 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -19301,9 +19301,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, - goto endjob; - } - -- if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk->src)) -- goto endjob; -- - cur_info = qemuDomainFindGroupBlockIoTune(def, disk, &info); - - if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info, -@@ -19386,6 +19383,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, - goto endjob; - } - -+ if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk->src)) -+ goto endjob; -+ - conf_cur_info = qemuDomainFindGroupBlockIoTune(persistentDef, conf_disk, &info); - - if (qemuDomainSetBlockIoTuneDefaults(&conf_info, conf_cur_info, --- -2.25.1 - diff --git a/check-for-NULL-before-calling-g_regex_unref.patch b/check-for-NULL-before-calling-g_regex_unref.patch deleted file mode 100644 index bbb2212a8ff4714c859ee046ca6ad6ea931b4db0..0000000000000000000000000000000000000000 --- a/check-for-NULL-before-calling-g_regex_unref.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 61de276ed3cd5692b99ebc6d5b700a21b16ab5e8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 8 Sep 2020 14:57:14 +0200 -Subject: [PATCH 014/108] check for NULL before calling g_regex_unref -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -g_regex_unref reports an error if called with a NULL argument. - -We have two cases in the code where we (possibly) call it on a NULL -argument. The interesting one is in virDomainQemuMonitorEventCleanup. - -Based on VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX, we unref -data->regex, which has two problems: - -* On the client side, flags is -1 so the comparison is true even if no - regex was used, reproducible by: - $ virsh qemu-monitor-event --timeout 1 - which results in an ugly error: -(process:1289846): GLib-CRITICAL **: 14:58:42.631: g_regex_unref: assertion 'regex != NULL' failed -* On the server side, we only create the regex if both the flag and the - string are present, so it's possible to trigger this message by: - $ virsh qemu-monitor-event --regex --timeout 1 - -Use a non-NULL comparison instead of the flag to decide whether we need -to unref the regex. And add a non-NULL check to the unref in the -VirtualBox test too. - -Signed-off-by: Ján Tomko -Fixes: 71efb59a4de7c51b1bc889a316f1796ebf55738f -https://bugzilla.redhat.com/show_bug.cgi?id=1876907 -Reviewed-by: Peter Krempa -Reviewed-by: Martin Kletzander -(cherry picked from commit 92b252456ee6d6ffc6e39e62ce1ce6c50113e00e) ---- - src/conf/domain_event.c | 2 +- - tests/vboxsnapshotxmltest.c | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c -index 33fbf10406..d3acde0236 100644 ---- a/src/conf/domain_event.c -+++ b/src/conf/domain_event.c -@@ -2194,7 +2194,7 @@ virDomainQemuMonitorEventCleanup(void *opaque) - virDomainQemuMonitorEventData *data = opaque; - - VIR_FREE(data->event); -- if (data->flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX) -+ if (data->regex) - g_regex_unref(data->regex); - if (data->freecb) - (data->freecb)(data->opaque); -diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c -index 2ea460d8bd..853d930865 100644 ---- a/tests/vboxsnapshotxmltest.c -+++ b/tests/vboxsnapshotxmltest.c -@@ -136,7 +136,8 @@ mymain(void) - DO_TEST("2disks-3snap-brother"); - - cleanup: -- g_regex_unref(testSnapshotXMLVariableLineRegex); -+ if (testSnapshotXMLVariableLineRegex) -+ g_regex_unref(testSnapshotXMLVariableLineRegex); - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; - } - --- -2.33.0 - diff --git a/checkpoint-Fix-a-typo-of-comments.patch b/checkpoint-Fix-a-typo-of-comments.patch deleted file mode 100644 index 31e7b36f9a8baa55f2938e0a811410c295df56e8..0000000000000000000000000000000000000000 --- a/checkpoint-Fix-a-typo-of-comments.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 5d84740e04d99a8503f20b2281f3fd70fa1f69ab Mon Sep 17 00:00:00 2001 -From: jipengfei -Date: Thu, 24 Nov 2022 16:43:51 +0800 -Subject: [PATCH 16/23] checkpoint: Fix a typo of comments -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -cherry-pick from 75134a3a7d1ca6976dfc2af7cd53461cb0aee529 - -Signed-off-by: Han Han -Signed-off-by: jipengfei -Reviewed-by: Ján Tomko -Signed-off-by: Ján Tomko ---- - src/libvirt-domain-checkpoint.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libvirt-domain-checkpoint.c b/src/libvirt-domain-checkpoint.c -index 432c2d5a52..58668c391c 100644 ---- a/src/libvirt-domain-checkpoint.c -+++ b/src/libvirt-domain-checkpoint.c -@@ -236,7 +236,7 @@ virDomainCheckpointGetXMLDesc(virDomainCheckpointPtr checkpoint, - * @checkpoints: pointer to variable to store the array containing checkpoint - * object, or NULL if the list is not required (just returns - * number of checkpoints) -- * @flags: bitwise-OR of supported virDomainCheckpoinListFlags -+ * @flags: bitwise-OR of supported virDomainCheckpointListFlags - * - * Collect the list of domain checkpoints for the given domain and allocate - * an array to store those objects. --- -2.27.0 - diff --git a/client-fix-memory-leak-in-client-msg.patch b/client-fix-memory-leak-in-client-msg.patch deleted file mode 100644 index cda543842c61c04dd0a283a5beec6eec816af20c..0000000000000000000000000000000000000000 --- a/client-fix-memory-leak-in-client-msg.patch +++ /dev/null @@ -1,47 +0,0 @@ -From ea9860d9f89252f0890dae01c6b92af2a82227f4 Mon Sep 17 00:00:00 2001 -From: tangbinzy -Date: Tue, 29 Nov 2022 08:19:29 +0000 -Subject: [PATCH 02/24] client: fix memory leak in client msg When closing - client->waitDispatch in virNetClientIOEventLoopRemoveAll or - virNetClientIOEventLoopRemoveDone, VIR_FREE() is called to free call->msg - directly, resulting in leak of the memory call->msg->buffer points to. Use - virNetMessageFree(call->msg) instead of VIR_FREE(call->msg). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Hao Wang -Reviewed-by: Ján Tomko -Signed-off-by: Ján Tomko - -Signed-off-by: tangbin -(cherry-pick from 0011ec3191a5bffff14fc2c53fbdf457a805cfb1) ---- - src/rpc/virnetclient.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c -index 1c5bef86a1..70ace5d0e8 100644 ---- a/src/rpc/virnetclient.c -+++ b/src/rpc/virnetclient.c -@@ -1519,7 +1519,7 @@ static bool virNetClientIOEventLoopRemoveDone(virNetClientCallPtr call, - if (call->expectReply) - VIR_WARN("Got a call expecting a reply but without a waiting thread"); - virCondDestroy(&call->cond); -- VIR_FREE(call->msg); -+ virNetMessageFree(call->msg); - VIR_FREE(call); - } - -@@ -1546,7 +1546,7 @@ virNetClientIOEventLoopRemoveAll(virNetClientCallPtr call, - - VIR_DEBUG("Removing call %p", call); - virCondDestroy(&call->cond); -- VIR_FREE(call->msg); -+ virNetMessageFree(call->msg); - VIR_FREE(call); - return true; - } --- -2.27.0 - diff --git a/cmdCheckpointList-Fix-memory-leak.patch b/cmdCheckpointList-Fix-memory-leak.patch deleted file mode 100644 index 89bae2606b58071c557a1fa79e65d0d5493fb135..0000000000000000000000000000000000000000 --- a/cmdCheckpointList-Fix-memory-leak.patch +++ /dev/null @@ -1,36 +0,0 @@ -From dd54dd905f334ee31ebd9d667dc0fd2db9ddeaf0 Mon Sep 17 00:00:00 2001 -From: Tim Wiederhake -Date: Mon, 19 Apr 2021 13:54:13 +0200 -Subject: [PATCH 061/108] cmdCheckpointList: Fix memory leak - -Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2 -Signed-off-by: Tim Wiederhake -Reviewed-by: Laine Stump -(cherry picked from commit 8b8c91f487592c6c067847ca59dde405ca17573f) ---- - tools/virsh-checkpoint.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c -index e82a67f075..1a3a74b2d5 100644 ---- a/tools/virsh-checkpoint.c -+++ b/tools/virsh-checkpoint.c -@@ -720,7 +720,6 @@ cmdCheckpointList(vshControl *ctl, - virDomainCheckpointPtr checkpoint = NULL; - long long creation_longlong; - g_autoptr(GDateTime) then = NULL; -- g_autofree gchar *thenstr = NULL; - bool tree = vshCommandOptBool(cmd, "tree"); - bool name = vshCommandOptBool(cmd, "name"); - bool from = vshCommandOptBool(cmd, "from"); -@@ -803,6 +802,7 @@ cmdCheckpointList(vshControl *ctl, - } - - for (i = 0; i < checkpointlist->nchks; i++) { -+ g_autofree gchar *thenstr = NULL; - const char *chk_name; - - /* free up memory from previous iterations of the loop */ --- -2.33.0 - diff --git a/cmdSnapshotList-Fix-memory-leak.patch b/cmdSnapshotList-Fix-memory-leak.patch deleted file mode 100644 index 05e9f4ee029f986ab6cc2c2b61f01438794ee669..0000000000000000000000000000000000000000 --- a/cmdSnapshotList-Fix-memory-leak.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 4732cb4a9306ea9b8487b66fa14316caa05428ed Mon Sep 17 00:00:00 2001 -From: Tim Wiederhake -Date: Mon, 19 Apr 2021 13:54:14 +0200 -Subject: [PATCH 062/108] cmdSnapshotList: Fix memory leak - -Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2 -Signed-off-by: Tim Wiederhake -Reviewed-by: Laine Stump -(cherry picked from commit 89ce1ef86b0c8b0e039ae770221376497354f085) ---- - tools/virsh-snapshot.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c -index d5e68e4b18..376290d468 100644 ---- a/tools/virsh-snapshot.c -+++ b/tools/virsh-snapshot.c -@@ -1493,7 +1493,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) - char *state = NULL; - long long creation_longlong; - g_autoptr(GDateTime) then = NULL; -- g_autofree gchar *thenstr = NULL; - bool tree = vshCommandOptBool(cmd, "tree"); - bool name = vshCommandOptBool(cmd, "name"); - bool from = vshCommandOptBool(cmd, "from"); -@@ -1588,6 +1587,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) - } - - for (i = 0; i < snaplist->nsnaps; i++) { -+ g_autofree gchar *thenstr = NULL; - const char *snap_name; - - /* free up memory from previous iterations of the loop */ --- -2.33.0 - diff --git a/cpu_topo-support-for-cpu_topo-clusters-in-conf.patch b/conf-Allow-specifying-CPU-clusters.patch similarity index 49% rename from cpu_topo-support-for-cpu_topo-clusters-in-conf.patch rename to conf-Allow-specifying-CPU-clusters.patch index c8a96f7574f3a2ab14dcd361142cb026dd9f059c..bb950ddfaff86fc8aa0d2041f57d479708f42ef1 100644 --- a/cpu_topo-support-for-cpu_topo-clusters-in-conf.patch +++ b/conf-Allow-specifying-CPU-clusters.patch @@ -1,178 +1,102 @@ -From 576236efe092a457cd3c33fef139fb21985713c6 Mon Sep 17 00:00:00 2001 -From: zhangxinhao -Date: Tue, 9 May 2023 15:23:48 +0800 -Subject: cpu_topo: support for cpu_topo "clusters” in conf +From 3b90700f9e72cf98c5f6b943dfb82e2c06e6f15c Mon Sep 17 00:00:00 2001 +From: Andrea Bolognani +Date: Fri, 5 Jan 2024 18:20:14 +0100 +Subject: [PATCH] conf: Allow specifying CPU clusters -Kunpeng920 support a new structure "cluster" in cpu topology. Support -"clusters" in XML parser. +The default number of CPU clusters is 1, and values other than +that one are currently rejected by all hypervisor drivers. -Signed-off-by: zhangxinhao +Signed-off-by: Andrea Bolognani +Reviewed-by: Peter Krempa --- - docs/formatcaps.html.in | 2 +- - docs/formatdomain.html.in | 23 +++++++++-------- - docs/schemas/cputypes.rng | 5 ++++ - src/conf/cpu_conf.c | 25 +++++++++++++++++-- - src/conf/cpu_conf.h | 1 + - src/conf/domain_conf.c | 1 + - src/cpu/cpu.c | 1 + - src/qemu/qemu_command.c | 5 ++++ - src/vmx/vmx.c | 7 ++++++ - .../x86_64-host+guest,model486-result.xml | 2 +- - .../x86_64-host+guest,models-result.xml | 2 +- - .../cputestdata/x86_64-host+guest-result.xml | 2 +- - tests/cputestdata/x86_64-host+guest.xml | 2 +- - .../x86_64-host+host-model-nofallback.xml | 2 +- - ...t-Haswell-noTSX+Haswell,haswell-result.xml | 2 +- - ...ell-noTSX+Haswell-noTSX,haswell-result.xml | 2 +- - ...ost-Haswell-noTSX+Haswell-noTSX-result.xml | 2 +- - .../x86_64-host-worse+guest-result.xml | 2 +- - .../ppc64-modern-bulk-result-conf.xml | 2 +- - .../ppc64-modern-bulk-result-live.xml | 2 +- - .../ppc64-modern-individual-result-conf.xml | 2 +- - .../ppc64-modern-individual-result-live.xml | 2 +- - .../x86-modern-bulk-result-conf.xml | 2 +- - .../x86-modern-bulk-result-live.xml | 2 +- - .../x86-modern-individual-add-result-conf.xml | 2 +- - .../x86-modern-individual-add-result-live.xml | 2 +- - .../x86-old-bulk-result-conf.xml | 2 +- - .../x86-old-bulk-result-live.xml | 2 +- - .../fd-memory-no-numa-topology.xml | 2 +- - .../fd-memory-numa-topology.xml | 2 +- - .../fd-memory-numa-topology2.xml | 2 +- - .../fd-memory-numa-topology3.xml | 2 +- - tests/qemuxml2argvdata/hugepages-nvdimm.xml | 2 +- - .../memfd-memory-default-hugepage.xml | 2 +- - tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +- - .../memory-hotplug-nvdimm-access.xml | 2 +- - .../memory-hotplug-nvdimm-align.xml | 2 +- - .../memory-hotplug-nvdimm-label.xml | 2 +- - .../memory-hotplug-nvdimm-pmem.xml | 2 +- - .../memory-hotplug-nvdimm-readonly.xml | 2 +- - .../memory-hotplug-nvdimm.xml | 2 +- - .../qemuxml2xmloutdata/cpu-numa-disjoint.xml | 2 +- - .../cpu-numa-disordered.xml | 2 +- - .../qemuxml2xmloutdata/cpu-numa-memshared.xml | 2 +- - .../cpu-numa-no-memory-element.xml | 2 +- - tests/qemuxml2xmloutdata/cpu-numa1.xml | 2 +- - tests/qemuxml2xmloutdata/cpu-numa2.xml | 2 +- - .../fd-memory-no-numa-topology.xml | 2 +- - .../fd-memory-numa-topology.xml | 2 +- - .../fd-memory-numa-topology2.xml | 2 +- - .../fd-memory-numa-topology3.xml | 2 +- - .../graphics-spice-timeout.xml | 2 +- - tests/qemuxml2xmloutdata/hugepages-nvdimm.xml | 2 +- - .../memfd-memory-default-hugepage.xml | 2 +- - .../qemuxml2xmloutdata/memfd-memory-numa.xml | 2 +- - .../memory-hotplug-dimm.xml | 2 +- - .../memory-hotplug-nvdimm-access.xml | 2 +- - .../memory-hotplug-nvdimm-align.xml | 2 +- - .../memory-hotplug-nvdimm-label.xml | 2 +- - .../memory-hotplug-nvdimm-pmem.xml | 2 +- - .../memory-hotplug-nvdimm-ppc64.xml | 2 +- - .../memory-hotplug-nvdimm-readonly.xml | 2 +- - .../memory-hotplug-nvdimm.xml | 2 +- - tests/qemuxml2xmloutdata/memory-hotplug.xml | 2 +- - .../numad-auto-memory-vcpu-cpuset.xml | 2 +- - ...to-memory-vcpu-no-cpuset-and-placement.xml | 2 +- - .../numad-auto-vcpu-no-numatune.xml | 2 +- - .../numad-static-vcpu-no-numatune.xml | 2 +- - tests/qemuxml2xmloutdata/pci-expander-bus.xml | 2 +- - .../qemuxml2xmloutdata/pcie-expander-bus.xml | 2 +- - .../pseries-phb-numa-node.xml | 2 +- - tests/qemuxml2xmloutdata/smp.xml | 2 +- - .../vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml | 2 +- - .../vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml | 2 +- - 74 files changed, 121 insertions(+), 79 deletions(-) + src/bhyve/bhyve_command.c | 5 +++++ + src/conf/cpu_conf.c | 16 +++++++++++++++- + src/conf/cpu_conf.h | 1 + + src/conf/domain_conf.c | 1 + + src/conf/schemas/cputypes.rng | 5 +++++ + src/cpu/cpu.c | 1 + + src/libxl/libxl_capabilities.c | 1 + + src/qemu/qemu_command.c | 5 +++++ + src/vmx/vmx.c | 7 +++++++ + .../x86_64-host+guest,model486-result.xml | 2 +- + .../x86_64-host+guest,models-result.xml | 2 +- + tests/cputestdata/x86_64-host+guest-result.xml | 2 +- + tests/cputestdata/x86_64-host+guest.xml | 2 +- + .../x86_64-host+host-model-nofallback.xml | 2 +- + ...host-Haswell-noTSX+Haswell,haswell-result.xml | 2 +- + ...aswell-noTSX+Haswell-noTSX,haswell-result.xml | 2 +- + ...4-host-Haswell-noTSX+Haswell-noTSX-result.xml | 2 +- + .../x86_64-host-worse+guest-result.xml | 2 +- + .../ppc64-modern-bulk-result-conf.xml | 2 +- + .../ppc64-modern-bulk-result-live.xml | 2 +- + .../ppc64-modern-individual-result-conf.xml | 2 +- + .../ppc64-modern-individual-result-live.xml | 2 +- + .../x86-modern-bulk-result-conf.xml | 2 +- + .../x86-modern-bulk-result-live.xml | 2 +- + .../x86-modern-individual-add-result-conf.xml | 2 +- + .../x86-modern-individual-add-result-live.xml | 2 +- + ...e-timeout+graphics-spice-timeout-password.xml | 2 +- + .../qemuhotplug-graphics-spice-timeout.xml | 2 +- + .../fd-memory-no-numa-topology.xml | 2 +- + .../qemuxml2argvdata/fd-memory-numa-topology.xml | 2 +- + .../fd-memory-numa-topology2.xml | 2 +- + .../fd-memory-numa-topology3.xml | 2 +- + tests/qemuxml2argvdata/hugepages-nvdimm.xml | 2 +- + .../memfd-memory-default-hugepage.xml | 2 +- + tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +- + .../memory-hotplug-nvdimm-access.xml | 2 +- + .../memory-hotplug-nvdimm-align.xml | 2 +- + .../memory-hotplug-nvdimm-label.xml | 2 +- + .../memory-hotplug-nvdimm-pmem.xml | 2 +- + .../memory-hotplug-nvdimm-readonly.xml | 2 +- + tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml | 2 +- + .../memory-hotplug-virtio-mem.xml | 2 +- + .../memory-hotplug-virtio-pmem.xml | 2 +- + .../cpu-numa-disjoint.x86_64-latest.xml | 2 +- + .../cpu-numa-disordered.x86_64-latest.xml | 2 +- + .../cpu-numa-memshared.x86_64-latest.xml | 2 +- + .../cpu-numa-no-memory-element.x86_64-latest.xml | 2 +- + .../cpu-numa1.x86_64-latest.xml | 2 +- + .../cpu-numa2.x86_64-latest.xml | 2 +- + .../memory-hotplug-dimm-addr.x86_64-latest.xml | 2 +- + .../memory-hotplug-dimm.x86_64-latest.xml | 2 +- + .../memory-hotplug-multiple.x86_64-latest.xml | 2 +- + ...plug-nvdimm-ppc64-abi-update.ppc64-latest.xml | 2 +- + .../memory-hotplug-nvdimm-ppc64.ppc64-latest.xml | 2 +- + .../memory-hotplug.x86_64-latest.xml | 2 +- + ...mad-auto-memory-vcpu-cpuset.x86_64-latest.xml | 2 +- + ...cpu-no-cpuset-and-placement.x86_64-latest.xml | 2 +- + ...numad-auto-vcpu-no-numatune.x86_64-latest.xml | 2 +- + ...mad-static-vcpu-no-numatune.x86_64-latest.xml | 2 +- + .../pci-expander-bus.x86_64-latest.xml | 2 +- + .../pcie-expander-bus.x86_64-latest.xml | 2 +- + .../pseries-phb-numa-node.ppc64-latest.xml | 2 +- + tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +- + tests/vmx2xmldata/esx-in-the-wild-8.xml | 2 +- + tests/vmx2xmldata/esx-in-the-wild-9.xml | 2 +- + 65 files changed, 97 insertions(+), 57 deletions(-) -diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in -index 59d21a7..ff40f06 100644 ---- a/docs/formatcaps.html.in -+++ b/docs/formatcaps.html.in -@@ -173,7 +173,7 @@ - </features> - <model>core2duo</model> - <vendor>Intel</vendor> -- <topology sockets="1" dies="1" cores="2" threads="1"/> -+ <topology sockets="1" dies="1" clusters="1" cores="2" threads="1"/> - <feature name="lahf_lm"/> - <feature name='xtpr'/> - ... -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 5860ec9..6e51c3b 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -1470,7 +1470,7 @@ - <cpu match='exact'> - <model fallback='allow'>core2duo</model> - <vendor>Intel</vendor> -- <topology sockets='1' dies='1' cores='2' threads='1'/> -+ <topology sockets='1' dies='1' clusters="1" cores='2' threads='1'/> - <cache level='3' mode='emulate'/> - <feature policy='disable' name='lahf_lm'/> - </cpu> -@@ -1479,7 +1479,7 @@ -
- <cpu mode='host-model'>
-   <model fallback='forbid'/>
--  <topology sockets='1' dies='1' cores='2' threads='1'/>
-+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
- </cpu>
- ...
- -@@ -1498,7 +1498,7 @@ -
- ...
- <cpu>
--  <topology sockets='1' dies='1' cores='2' threads='1'/>
-+  <topology sockets='1' dies='1' clusters='1' cores='2' threads='1'/>
- </cpu>
- ...
- -@@ -1674,14 +1674,15 @@ -
topology
-
The topology element specifies requested topology of - virtual CPU provided to the guest. Four attributes, sockets, -- dies, cores, and threads, -- accept non-zero positive integer values. They refer to the total number -- of CPU sockets, number of dies per socket, number of cores per die, and -- number of threads per core, respectively. The dies -- attribute is optional and will default to 1 if omitted, while the other -- attributes are all mandatory. Hypervisors may require that the maximum -- number of vCPUs specified by the cpus element equals to -- the number of vcpus resulting from the topology.
-+ dies, dies, cores, -+ and threads, accept non-zero positive integer values. They -+ refer to the total number of CPU sockets, number of dies per socket, -+ number of clusters per die, number of cores per cluster, and number of -+ threads per core, respectively. The attribute dies and -+ clusters are optional and will default to 1 if omitted, -+ while the other attributes are all mandatory. Hypervisors may require -+ that the maximum number of vCPUs specified by the cpus -+ element equals to the number of vcpus resulting from the topology. - -
feature
-
The cpu element can contain zero or more -diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng -index e2744ac..699fd05 100644 ---- a/docs/schemas/cputypes.rng -+++ b/docs/schemas/cputypes.rng -@@ -91,6 +91,11 @@ - - - -+ -+ -+ -+ -+ - - - +diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c +index 5b388c7a8f..d05b01ae5d 100644 +--- a/src/bhyve/bhyve_command.c ++++ b/src/bhyve/bhyve_command.c +@@ -672,6 +672,11 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def, + _("Only 1 die per socket is supported")); + return NULL; + } ++ if (def->cpu->clusters != 1) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("Only 1 cluster per die is supported")); ++ return NULL; ++ } + if (nvcpus != def->cpu->sockets * def->cpu->cores * def->cpu->threads) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid CPU topology: total number of vCPUs must equal the product of sockets, cores, and threads")); diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index 989306b..3c2ee73 100644 +index 7abe489733..6e6e1b9a89 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c -@@ -240,6 +240,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) +@@ -241,6 +241,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) copy->fallback = cpu->fallback; copy->sockets = cpu->sockets; copy->dies = cpu->dies; @@ -180,41 +104,25 @@ index 989306b..3c2ee73 100644 copy->cores = cpu->cores; copy->threads = cpu->threads; copy->arch = cpu->arch; -@@ -547,6 +548,17 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, - def->dies = 1; +@@ -572,6 +573,12 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, + return -1; } -+ if (virXPathNode("./topology[1]/@clusters", ctxt)) { -+ if (virXPathULong("string(./topology[1]/@clusters)", ctxt, &ul) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("Malformed 'clusters' attribute in CPU topology")); -+ goto cleanup; -+ } -+ def->clusters = (unsigned int) ul; -+ } else { -+ def->clusters = 1; ++ if (virXMLPropUIntDefault(topology, "clusters", 10, ++ VIR_XML_PROP_NONZERO, ++ &def->clusters, 1) < 0) { ++ return -1; + } + - if (virXPathULong("string(./topology[1]/@cores)", ctxt, &ul) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'cores' attribute in CPU topology")); -@@ -561,7 +573,8 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, - } - def->threads = (unsigned int) ul; - -- if (!def->sockets || !def->cores || !def->threads || !def->dies) { -+ if (!def->sockets || !def->cores || !def->threads || !def->dies || -+ !def -> clusters) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid CPU topology")); - goto cleanup; -@@ -833,10 +846,12 @@ virCPUDefFormatBuf(virBufferPtr buf, + if (virXMLPropUInt(topology, "cores", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &def->cores) < 0) { +@@ -827,10 +834,11 @@ virCPUDefFormatBuf(virBuffer *buf, virBufferAddLit(buf, "/>\n"); } - if (def->sockets && def->dies && def->cores && def->threads) { -+ if (def->sockets && def->dies && def->clusters && def->cores && -+ def->threads) { ++ if (def->sockets && def->dies && def->clusters && def->cores && def->threads) { virBufferAddLit(buf, "sockets); virBufferAsprintf(buf, " dies='%u'", def->dies); @@ -222,36 +130,36 @@ index 989306b..3c2ee73 100644 virBufferAsprintf(buf, " cores='%u'", def->cores); virBufferAsprintf(buf, " threads='%u'", def->threads); virBufferAddLit(buf, "/>\n"); -@@ -1081,6 +1096,12 @@ virCPUDefIsEqual(virCPUDefPtr src, +@@ -1106,6 +1114,12 @@ virCPUDefIsEqual(virCPUDef *src, return false; } + if (src->clusters != dst->clusters) { -+ MISMATCH(_("Target CPU clusters %d does not match source %d"), ++ MISMATCH(_("Target CPU clusters %1$d does not match source %2$d"), + dst->clusters, src->clusters); + return false; + } + if (src->cores != dst->cores) { - MISMATCH(_("Target CPU cores %d does not match source %d"), + MISMATCH(_("Target CPU cores %1$d does not match source %2$d"), dst->cores, src->cores); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index 1b297ed..10a2252 100644 +index 3e4c53675c..2694022fed 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h -@@ -134,6 +134,7 @@ struct _virCPUDef { +@@ -148,6 +148,7 @@ struct _virCPUDef { unsigned int microcodeVersion; unsigned int sockets; unsigned int dies; + unsigned int clusters; unsigned int cores; unsigned int threads; - size_t nfeatures; + unsigned int sigFamily; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index b8cf1ad..7ae4034 100644 +index e56eb02f61..4798d01d12 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c -@@ -2088,6 +2088,7 @@ virDomainDefGetVcpusTopology(const virDomainDef *def, +@@ -2325,6 +2325,7 @@ virDomainDefGetVcpusTopology(const virDomainDef *def, /* multiplication of 32bit numbers fits into a 64bit variable */ if ((tmp *= def->cpu->dies) > UINT_MAX || @@ -259,11 +167,27 @@ index b8cf1ad..7ae4034 100644 (tmp *= def->cpu->cores) > UINT_MAX || (tmp *= def->cpu->threads) > UINT_MAX) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng +index db1aa57158..3a8910e09f 100644 +--- a/src/conf/schemas/cputypes.rng ++++ b/src/conf/schemas/cputypes.rng +@@ -92,6 +92,11 @@ + + + ++ ++ ++ ++ ++ + + + diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index df78a0d..27d26fc 100644 +index bc43aa4e93..4f048d0dad 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c -@@ -426,6 +426,7 @@ virCPUGetHost(virArch arch, +@@ -435,6 +435,7 @@ virCPUGetHost(virArch arch, if (nodeInfo) { cpu->sockets = nodeInfo->sockets; cpu->dies = 1; @@ -271,27 +195,39 @@ index df78a0d..27d26fc 100644 cpu->cores = nodeInfo->cores; cpu->threads = nodeInfo->threads; } +diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c +index 177e8b988e..c3736bd0a9 100644 +--- a/src/libxl/libxl_capabilities.c ++++ b/src/libxl/libxl_capabilities.c +@@ -159,6 +159,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info) + cpu->cores = phy_info->cores_per_socket; + cpu->threads = phy_info->threads_per_core; + cpu->dies = 1; ++ cpu->clusters = 1; + cpu->sockets = phy_info->nr_cpus / (cpu->cores * cpu->threads); + + if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap)) || diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 5f7e847..85f95b4 100644 +index 9cff03632c..461584566f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c -@@ -7335,6 +7335,11 @@ qemuBuildSmpCommandLine(virCommandPtr cmd, +@@ -7217,6 +7217,11 @@ qemuBuildSmpCommandLine(virCommand *cmd, _("Only 1 die per socket is supported")); return -1; } + if (def->cpu->clusters != 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("Only 1 cluster per dies is supported")); ++ _("Only 1 cluster per die is supported")); + return -1; + } virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_DIES)) virBufferAsprintf(&buf, ",dies=%u", def->cpu->dies); diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c -index 5f2ada6..76e5e66 100644 +index 26b89776e1..4ac2320251 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c -@@ -1494,6 +1494,7 @@ virVMXParseConfig(virVMXContext *ctx, +@@ -1583,6 +1583,7 @@ virVMXParseConfig(virVMXContext *ctx, goto cleanup; } cpu->dies = 1; @@ -299,7 +235,7 @@ index 5f2ada6..76e5e66 100644 cpu->cores = coresPerSocket; cpu->threads = 1; -@@ -3222,6 +3223,12 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe +@@ -3377,6 +3378,12 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef goto cleanup; } @@ -313,7 +249,7 @@ index 5f2ada6..76e5e66 100644 if (calculated_vcpus != maxvcpus) { virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/tests/cputestdata/x86_64-host+guest,model486-result.xml b/tests/cputestdata/x86_64-host+guest,model486-result.xml -index ea8e2d3..b533f22 100644 +index ea8e2d3a48..b533f22b88 100644 --- a/tests/cputestdata/x86_64-host+guest,model486-result.xml +++ b/tests/cputestdata/x86_64-host+guest,model486-result.xml @@ -1,6 +1,6 @@ @@ -325,19 +261,19 @@ index ea8e2d3..b533f22 100644 diff --git a/tests/cputestdata/x86_64-host+guest,models-result.xml b/tests/cputestdata/x86_64-host+guest,models-result.xml -index 0dd6955..f476022 100644 +index 42664a48b4..e975d9bc18 100644 --- a/tests/cputestdata/x86_64-host+guest,models-result.xml +++ b/tests/cputestdata/x86_64-host+guest,models-result.xml @@ -1,6 +1,6 @@ - Nehalem + qemu64 - + - + diff --git a/tests/cputestdata/x86_64-host+guest-result.xml b/tests/cputestdata/x86_64-host+guest-result.xml -index 28e3152..cf41b3f 100644 +index 28e3152cbf..cf41b3f872 100644 --- a/tests/cputestdata/x86_64-host+guest-result.xml +++ b/tests/cputestdata/x86_64-host+guest-result.xml @@ -1,6 +1,6 @@ @@ -349,7 +285,7 @@ index 28e3152..cf41b3f 100644 diff --git a/tests/cputestdata/x86_64-host+guest.xml b/tests/cputestdata/x86_64-host+guest.xml -index 28e3152..cf41b3f 100644 +index 28e3152cbf..cf41b3f872 100644 --- a/tests/cputestdata/x86_64-host+guest.xml +++ b/tests/cputestdata/x86_64-host+guest.xml @@ -1,6 +1,6 @@ @@ -361,7 +297,7 @@ index 28e3152..cf41b3f 100644 diff --git a/tests/cputestdata/x86_64-host+host-model-nofallback.xml b/tests/cputestdata/x86_64-host+host-model-nofallback.xml -index 16d6e1d..881eea7 100644 +index 16d6e1daf2..881eea7bd0 100644 --- a/tests/cputestdata/x86_64-host+host-model-nofallback.xml +++ b/tests/cputestdata/x86_64-host+host-model-nofallback.xml @@ -1,7 +1,7 @@ @@ -374,7 +310,7 @@ index 16d6e1d..881eea7 100644 diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml -index 8eda668..67994c6 100644 +index 8eda6684a0..67994c62cc 100644 --- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml +++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell,haswell-result.xml @@ -1,6 +1,6 @@ @@ -386,7 +322,7 @@ index 8eda668..67994c6 100644 diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml -index cb02449..4804c0b 100644 +index cb02449d60..4804c0b818 100644 --- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml +++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml @@ -1,6 +1,6 @@ @@ -398,7 +334,7 @@ index cb02449..4804c0b 100644 diff --git a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml -index 7ee926a..c21b331 100644 +index 7ee926aba8..c21b331248 100644 --- a/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml +++ b/tests/cputestdata/x86_64-host-Haswell-noTSX+Haswell-noTSX-result.xml @@ -1,4 +1,4 @@ @@ -408,7 +344,7 @@ index 7ee926a..c21b331 100644 + diff --git a/tests/cputestdata/x86_64-host-worse+guest-result.xml b/tests/cputestdata/x86_64-host-worse+guest-result.xml -index 9d54c66..712c3ad 100644 +index 9d54c66a8f..712c3ad341 100644 --- a/tests/cputestdata/x86_64-host-worse+guest-result.xml +++ b/tests/cputestdata/x86_64-host-worse+guest-result.xml @@ -1,6 +1,6 @@ @@ -420,711 +356,594 @@ index 9d54c66..712c3ad 100644 diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml -index f80c436..e976c00 100644 +index ad11b2f8a6..1a0d28257e 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-conf.xml -@@ -43,7 +43,7 @@ - +@@ -44,7 +44,7 @@ - + + POWER9 - + destroy diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml -index 7998b97..21666a0 100644 +index 2a3b4a495f..b127883b36 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-bulk-result-live.xml -@@ -43,7 +43,7 @@ - +@@ -44,7 +44,7 @@ - + + POWER9 - + destroy diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml -index 2a48a97..2740737 100644 +index 34aec9b965..29f1a5ac45 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml -@@ -43,7 +43,7 @@ - +@@ -44,7 +44,7 @@ - + + POWER9 - + destroy diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml -index 90518d1..b9e325d 100644 +index 5ce2cfd0b0..76a85ac9f0 100644 --- a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml -@@ -43,7 +43,7 @@ - +@@ -44,7 +44,7 @@ - + + POWER9 - + destroy diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml -index 0d622fc..0b86f3a 100644 +index 8d52ffedb4..bec46987ff 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-conf.xml -@@ -19,7 +19,7 @@ - +@@ -20,7 +20,7 @@ - + + qemu64 - + destroy diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml -index ed9deae..c21b000 100644 +index f416397e33..be9769c686 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-result-live.xml -@@ -19,7 +19,7 @@ - +@@ -20,7 +20,7 @@ - + + qemu64 - + destroy diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml -index 342f172..bef1189 100644 +index 0bd2af8e43..539f607818 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml -@@ -19,7 +19,7 @@ - +@@ -20,7 +20,7 @@ - + + qemu64 - + destroy diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml -index b8341c7..aa63e72 100644 +index b31e6ebe55..acbdd3cfd5 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml -@@ -19,7 +19,7 @@ - - - -- -+ - - - destroy -diff --git a/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml b/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml -index 29da89f..2952fba 100644 ---- a/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml -+++ b/tests/qemuhotplugtestcpus/x86-old-bulk-result-conf.xml -@@ -9,7 +9,7 @@ - - - -- -+ - - - destroy -diff --git a/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml b/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml -index f81194d..a5087a7 100644 ---- a/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml -+++ b/tests/qemuhotplugtestcpus/x86-old-bulk-result-live.xml -@@ -9,7 +9,7 @@ - +@@ -20,7 +20,7 @@ - + + qemu64 - + destroy +diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml +index 03964ad01c..ee53339338 100644 +--- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml ++++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml +@@ -18,7 +18,7 @@ + + core2duo + Intel +- ++ + + + +diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml +index e6b0cc833a..eb9b902fc5 100644 +--- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml ++++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml +@@ -18,7 +18,7 @@ + + core2duo + Intel +- ++ + + + diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml -index 0749952..d9e20d4 100644 +index 2090bb8288..92f418fb88 100644 --- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml +++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + destroy diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml -index 05ea164..7e082eb 100644 +index 2f94690656..543509d832 100644 --- a/tests/qemuxml2argvdata/fd-memory-numa-topology.xml +++ b/tests/qemuxml2argvdata/fd-memory-numa-topology.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml -index 904e64f..919b30a 100644 +index 3a4e9b478e..d3b98da3c6 100644 --- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml +++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - -- -+ + + qemu64 +- ++ - + diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml -index 9785609..a429a27 100644 +index 0f7f74283b..459d1b9d1d 100644 --- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml +++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - -- -+ + + qemu64 +- ++ - + diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.xml b/tests/qemuxml2argvdata/hugepages-nvdimm.xml -index 144d02b..f8a5a2f 100644 +index 1a1500895b..b786b0d3dd 100644 --- a/tests/qemuxml2argvdata/hugepages-nvdimm.xml +++ b/tests/qemuxml2argvdata/hugepages-nvdimm.xml -@@ -16,7 +16,7 @@ - +@@ -17,7 +17,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml -index 69d27ef..f3e155a 100644 +index 238d4c6b52..a70bd53134 100644 --- a/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml +++ b/tests/qemuxml2argvdata/memfd-memory-default-hugepage.xml -@@ -18,7 +18,7 @@ - +@@ -19,7 +19,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml -index e3d5d92..ed814a0 100644 +index 1ac87e3aef..0c5d7ba4ef 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.xml +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml -@@ -20,7 +20,7 @@ - +@@ -22,7 +22,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml -index a1cc126..5e74f58 100644 +index bee0346aca..84baf82bf5 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml -index 018a693..c1de357 100644 +index decf87db63..664418e805 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml -index c9d54a6..db0d67e 100644 +index 8a0dab3908..f998f7f276 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml -index 391d70f..bfa1589 100644 +index a712adfe1e..d66481fd35 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml -index 09b2c5c..bff89db 100644 +index 57629ccb8c..56d6b7b712 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml -index a32474d..827a7ca 100644 +index 865ddcf0ea..ff6e3b7b0f 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml -@@ -14,7 +14,7 @@ - +@@ -15,7 +15,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml -index d7f5372..2e4c53c 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml +index c578209d8a..52fa6b14e9 100644 +--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml ++++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml +@@ -11,7 +11,7 @@ - + + qemu64 +- ++ + + + +diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml +index a8b22dd3c5..2786a739ad 100644 +--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml ++++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml +@@ -11,7 +11,7 @@ + + + qemu64 +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml +index fa2ec31463..4f33094949 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa-disjoint.x86_64-latest.xml +@@ -10,7 +10,7 @@ + + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml b/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml -index 487ced1..e5979c3 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa-disordered.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml +index 1b4d0bfa67..75dcb8c9e2 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa-disordered.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml b/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml -index f472bff..f4af5be 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa-memshared.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml +index 47ed9efd69..c45e295921 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa-memshared.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml -index 2ef7f84..d583f86 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml +index 57bbacdff0..663d137ff5 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa-no-memory-element.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa1.xml b/tests/qemuxml2xmloutdata/cpu-numa1.xml -index 2ef7f84..d583f86 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa1.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa1.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml +index 57bbacdff0..663d137ff5 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa1.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/cpu-numa2.xml b/tests/qemuxml2xmloutdata/cpu-numa2.xml -index 2ef7f84..d583f86 100644 ---- a/tests/qemuxml2xmloutdata/cpu-numa2.xml -+++ b/tests/qemuxml2xmloutdata/cpu-numa2.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml b/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml +index 57bbacdff0..663d137ff5 100644 +--- a/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/cpu-numa2.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml b/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml -index 0749952..d9e20d4 100644 ---- a/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml -+++ b/tests/qemuxml2xmloutdata/fd-memory-no-numa-topology.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - destroy -diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml -index 05ea164..7e082eb 100644 ---- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml -+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml -index 904e64f..919b30a 100644 ---- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml -+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology2.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml b/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml -index 9785609..a429a27 100644 ---- a/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml -+++ b/tests/qemuxml2xmloutdata/fd-memory-numa-topology3.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml -index 6e23652..f7a7c87 100644 ---- a/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml -+++ b/tests/qemuxml2xmloutdata/graphics-spice-timeout.xml -@@ -18,7 +18,7 @@ - - core2duo - Intel -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml -index 144d02b..f8a5a2f 100644 ---- a/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml -+++ b/tests/qemuxml2xmloutdata/hugepages-nvdimm.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml b/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml -index 69d27ef..f3e155a 100644 ---- a/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml -+++ b/tests/qemuxml2xmloutdata/memfd-memory-default-hugepage.xml -@@ -18,7 +18,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memfd-memory-numa.xml b/tests/qemuxml2xmloutdata/memfd-memory-numa.xml -index e3d5d92..ed814a0 100644 ---- a/tests/qemuxml2xmloutdata/memfd-memory-numa.xml -+++ b/tests/qemuxml2xmloutdata/memfd-memory-numa.xml -@@ -20,7 +20,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml +index 0a32d5491a..38b41e6719 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm-addr.x86_64-latest.xml +@@ -11,7 +11,7 @@ - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml -index 326b5c9..378b262 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.xml -@@ -14,7 +14,7 @@ - - - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml -index a1cc126..5e74f58 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-access.xml -@@ -14,7 +14,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml +index 7c1b7b2c5d..7f0dc85c0e 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug-dimm.x86_64-latest.xml +@@ -15,7 +15,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml -index 018a693..c1de357 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-align.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml -index c9d54a6..db0d67e 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-label.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml -index 391d70f..bfa1589 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml -@@ -14,7 +14,7 @@ - - - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml +index 42b0f7b880..b3306fb569 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug-multiple.x86_64-latest.xml +@@ -11,7 +11,7 @@ + + + qemu64 - + - + -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml -index ae5a17d..e90b462 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml -@@ -10,7 +10,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml +index ae157c4849..4cc0c674df 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.ppc64-latest.xml +@@ -11,7 +11,7 @@ - + + POWER9 - + -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml -index 09b2c5c..bff89db 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-readonly.xml -@@ -14,7 +14,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml -index a32474d..827a7ca 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm.xml -@@ -14,7 +14,7 @@ - - - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml +index 3c1cbc731d..a5c26e3c5b 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.ppc64-latest.xml +@@ -11,7 +11,7 @@ + + + POWER9 - + -diff --git a/tests/qemuxml2xmloutdata/memory-hotplug.xml b/tests/qemuxml2xmloutdata/memory-hotplug.xml -index 0e5295d..547f613 100644 ---- a/tests/qemuxml2xmloutdata/memory-hotplug.xml -+++ b/tests/qemuxml2xmloutdata/memory-hotplug.xml -@@ -10,7 +10,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml b/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml +index 083102e8d6..697819387f 100644 +--- a/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/memory-hotplug.x86_64-latest.xml +@@ -11,7 +11,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml -index 841ea69..f438a7c 100644 ---- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml -+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.xml -@@ -12,7 +12,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml +index 2d04bc23c2..6068a76464 100644 +--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-cpuset.x86_64-latest.xml +@@ -13,7 +13,7 @@ - + + qemu64 - + destroy -diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml -index 2e3998e..4d37383 100644 ---- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml -+++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.xml -@@ -12,7 +12,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml +index 80f7284126..6c558526e9 100644 +--- a/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/numad-auto-memory-vcpu-no-cpuset-and-placement.x86_64-latest.xml +@@ -13,7 +13,7 @@ - + + qemu64 - + destroy -diff --git a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml -index 7c1f18c..051606f 100644 ---- a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml -+++ b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.xml -@@ -12,7 +12,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml +index 724209f6e3..6e1fecb488 100644 +--- a/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/numad-auto-vcpu-no-numatune.x86_64-latest.xml +@@ -13,7 +13,7 @@ - + + qemu64 - + destroy -diff --git a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml -index 3d05790..2479852 100644 ---- a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml -+++ b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml +index 2a4ee0d496..c42d7066f9 100644 +--- a/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/numad-static-vcpu-no-numatune.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + destroy -diff --git a/tests/qemuxml2xmloutdata/pci-expander-bus.xml b/tests/qemuxml2xmloutdata/pci-expander-bus.xml -index 60e4e4a..6f8103b 100644 ---- a/tests/qemuxml2xmloutdata/pci-expander-bus.xml -+++ b/tests/qemuxml2xmloutdata/pci-expander-bus.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml b/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml +index b63c8c145a..2a6c329a40 100644 +--- a/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/pci-expander-bus.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml b/tests/qemuxml2xmloutdata/pcie-expander-bus.xml -index 452d476..80d5ece 100644 ---- a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml -+++ b/tests/qemuxml2xmloutdata/pcie-expander-bus.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml b/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml +index a441be8ebe..99612740b2 100644 +--- a/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml ++++ b/tests/qemuxml2xmloutdata/pcie-expander-bus.x86_64-latest.xml +@@ -10,7 +10,7 @@ - + + qemu64 - + -diff --git a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml -index b05ac33..35c0e18 100644 ---- a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml -+++ b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.xml -@@ -13,7 +13,7 @@ - +diff --git a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml +index 59015846fb..0a044f50b0 100644 +--- a/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml ++++ b/tests/qemuxml2xmloutdata/pseries-phb-numa-node.ppc64-latest.xml +@@ -14,7 +14,7 @@ - + + POWER9 - + -diff --git a/tests/qemuxml2xmloutdata/smp.xml b/tests/qemuxml2xmloutdata/smp.xml -index 3e00f57..0816d5f 100644 ---- a/tests/qemuxml2xmloutdata/smp.xml -+++ b/tests/qemuxml2xmloutdata/smp.xml -@@ -9,7 +9,7 @@ - +diff --git a/tests/vmx2xmldata/esx-in-the-wild-10.xml b/tests/vmx2xmldata/esx-in-the-wild-10.xml +index 47ed637920..78129682bd 100644 +--- a/tests/vmx2xmldata/esx-in-the-wild-10.xml ++++ b/tests/vmx2xmldata/esx-in-the-wild-10.xml +@@ -12,7 +12,7 @@ + hvm -- -+ +- ++ destroy -diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml -index 2011bfb..4b1a9d1 100644 ---- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml -+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml +diff --git a/tests/vmx2xmldata/esx-in-the-wild-8.xml b/tests/vmx2xmldata/esx-in-the-wild-8.xml +index 0eea610709..47d22ced2a 100644 +--- a/tests/vmx2xmldata/esx-in-the-wild-8.xml ++++ b/tests/vmx2xmldata/esx-in-the-wild-8.xml @@ -11,7 +11,7 @@ hvm @@ -1134,10 +953,10 @@ index 2011bfb..4b1a9d1 100644 destroy -diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml -index fa428c1..f7b6eb6 100644 ---- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml -+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml +diff --git a/tests/vmx2xmldata/esx-in-the-wild-9.xml b/tests/vmx2xmldata/esx-in-the-wild-9.xml +index 66eca400dd..ee6be2527f 100644 +--- a/tests/vmx2xmldata/esx-in-the-wild-9.xml ++++ b/tests/vmx2xmldata/esx-in-the-wild-9.xml @@ -12,7 +12,7 @@ hvm @@ -1148,5 +967,5 @@ index fa428c1..f7b6eb6 100644 destroy -- -2.25.1 +2.27.0 diff --git a/cpu_topo-support-for-reporting-cluster_id-in-NUMA-to.patch b/conf-Report-CPU-clusters-in-capabilities-XML.patch similarity index 66% rename from cpu_topo-support-for-reporting-cluster_id-in-NUMA-to.patch rename to conf-Report-CPU-clusters-in-capabilities-XML.patch index 9a214ba8c0152a9086055734662aebcd52495ce5..cea041509b92e463d1fd8248776e267ba70a1da7 100644 --- a/cpu_topo-support-for-reporting-cluster_id-in-NUMA-to.patch +++ b/conf-Report-CPU-clusters-in-capabilities-XML.patch @@ -1,62 +1,54 @@ -From baa40f939ab38d80597651aec82779af25599bb0 Mon Sep 17 00:00:00 2001 -From: zhangxinhao -Date: Tue, 9 May 2023 23:28:59 +0800 -Subject: cpu_topo: support for reporting cluster_id in NUMA - topology +From 6a7873a8facab024a6192a7d1199877ccb22168d Mon Sep 17 00:00:00 2001 +From: Andrea Bolognani +Date: Fri, 5 Jan 2024 16:03:54 +0100 +Subject: [PATCH] conf: Report CPU clusters in capabilities XML -Support report the die_id in the NUMA topology capabilities. +For machines that don't expose useful information through sysfs, +the dummy ID 0 is used. -Signed-off-by: zhangxinhao +https://issues.redhat.com/browse/RHEL-7043 + +Signed-off-by: Andrea Bolognani +Reviewed-by: Peter Krempa --- - docs/schemas/capability.rng | 3 ++ - src/conf/capabilities.c | 4 ++- + src/conf/capabilities.c | 5 +- src/conf/capabilities.h | 1 + + src/conf/schemas/capability.rng | 3 ++ src/libvirt_linux.syms | 1 + - src/util/virhostcpu.c | 22 +++++++++++++ + src/util/virhostcpu.c | 22 +++++++++ src/util/virhostcpu.h | 1 + - .../vircaps2xmldata/vircaps-aarch64-basic.xml | 32 +++++++++---------- - .../vircaps-x86_64-basic-dies.xml | 24 +++++++------- - .../vircaps2xmldata/vircaps-x86_64-basic.xml | 32 +++++++++---------- - .../vircaps2xmldata/vircaps-x86_64-caches.xml | 16 +++++----- - .../vircaps-x86_64-resctrl-cdp.xml | 24 +++++++------- - .../vircaps-x86_64-resctrl-cmt.xml | 24 +++++++------- - .../vircaps-x86_64-resctrl-fake-feature.xml | 24 +++++++------- + tests/capabilityschemadata/caps-qemu-kvm.xml | 32 ++++++------- + .../vircaps-aarch64-basic-clusters.xml | 16 +++---- + .../vircaps2xmldata/vircaps-aarch64-basic.xml | 32 ++++++------- + .../vircaps-x86_64-basic-dies.xml | 24 +++++----- + .../vircaps2xmldata/vircaps-x86_64-basic.xml | 32 ++++++------- + .../vircaps2xmldata/vircaps-x86_64-caches.xml | 16 +++---- + tests/vircaps2xmldata/vircaps-x86_64-hmat.xml | 48 +++++++++---------- + .../vircaps-x86_64-resctrl-cdp.xml | 24 +++++----- + .../vircaps-x86_64-resctrl-cmt.xml | 24 +++++----- + .../vircaps-x86_64-resctrl-fake-feature.xml | 24 +++++----- .../vircaps-x86_64-resctrl-skx-twocaches.xml | 2 +- .../vircaps-x86_64-resctrl-skx.xml | 2 +- - .../vircaps-x86_64-resctrl.xml | 24 +++++++------- - 16 files changed, 133 insertions(+), 103 deletions(-) + .../vircaps-x86_64-resctrl.xml | 24 +++++----- + 19 files changed, 182 insertions(+), 151 deletions(-) -diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng -index 031c55bf20..f5b37d8c18 100644 ---- a/docs/schemas/capability.rng -+++ b/docs/schemas/capability.rng -@@ -268,6 +268,9 @@ - - - -+ -+ -+ - - - diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c -index 12c8c3a324..3c3a66a78a 100644 +index 32badee7b3..02298e40a3 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c -@@ -874,9 +874,10 @@ virCapabilitiesHostNUMAFormat(virCapsHostNUMAPtr caps, - return -1; +@@ -811,9 +811,10 @@ virCapsHostNUMACellCPUFormat(virBuffer *buf, + return -1; - virBufferAsprintf(buf, -- " socket_id='%d' die_id='%d' core_id='%d' siblings='%s'", -+ " socket_id='%d' die_id='%d' cluster_id='%d' core_id='%d' siblings='%s'", - cell->cpus[j].socket_id, - cell->cpus[j].die_id, -+ cell->cpus[j].cluster_id, - cell->cpus[j].core_id, - siblings); - VIR_FREE(siblings); -@@ -1465,6 +1466,7 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED, + virBufferAsprintf(&childBuf, +- " socket_id='%d' die_id='%d' core_id='%d' siblings='%s'", ++ " socket_id='%d' die_id='%d' cluster_id='%d' core_id='%d' siblings='%s'", + cpus[j].socket_id, + cpus[j].die_id, ++ cpus[j].cluster_id, + cpus[j].core_id, + siblings); + } +@@ -1453,6 +1454,7 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED, if (virHostCPUGetSocket(cpu_id, &cpu->socket_id) < 0 || virHostCPUGetDie(cpu_id, &cpu->die_id) < 0 || @@ -64,8 +56,16 @@ index 12c8c3a324..3c3a66a78a 100644 virHostCPUGetCore(cpu_id, &cpu->core_id) < 0) return -1; +@@ -1712,6 +1714,7 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMA *caps) + if (tmp) { + cpus[cid].id = id; + cpus[cid].die_id = 0; ++ cpus[cid].cluster_id = 0; + cpus[cid].socket_id = s; + cpus[cid].core_id = c; + cpus[cid].siblings = virBitmapNewCopy(siblings); diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h -index e2581fac8b..f88bb412b5 100644 +index 9eaf6e2807..52e395de14 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -89,6 +89,7 @@ struct _virCapsHostNUMACellCPU { @@ -74,8 +74,22 @@ index e2581fac8b..f88bb412b5 100644 unsigned int die_id; + unsigned int cluster_id; unsigned int core_id; - virBitmapPtr siblings; + virBitmap *siblings; }; +diff --git a/src/conf/schemas/capability.rng b/src/conf/schemas/capability.rng +index b1968df258..a1606941e7 100644 +--- a/src/conf/schemas/capability.rng ++++ b/src/conf/schemas/capability.rng +@@ -201,6 +201,9 @@ + + + ++ ++ ++ + + + diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms index 55649ae39c..004cbfee97 100644 --- a/src/libvirt_linux.syms @@ -89,10 +103,10 @@ index 55649ae39c..004cbfee97 100644 virHostCPUGetDie; virHostCPUGetInfoPopulateLinux; diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c -index 8c8fc3a476..d2ac31e784 100644 +index 4027547e1e..a3781ca870 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c -@@ -240,6 +240,28 @@ virHostCPUGetDie(unsigned int cpu, unsigned int *die) +@@ -232,6 +232,28 @@ virHostCPUGetDie(unsigned int cpu, unsigned int *die) return 0; } @@ -103,13 +117,13 @@ index 8c8fc3a476..d2ac31e784 100644 + int ret = virFileReadValueInt(&cluster_id, + "%s/cpu/cpu%u/topology/cluster_id", + SYSFS_SYSTEM_PATH, cpu); ++ + if (ret == -1) + return -1; + -+ /* If the file is not there, it's 0. -+ * Another alternative is cluster_id set to -1, meaning that -+ * the arch does not have cluster_id support. Set @cluster to -+ * 0 in this case too. */ ++ /* If the file doesn't exists (old kernel) or the value contained ++ * in it is -1 (architecture without CPU clusters), report 0 to ++ * indicate the lack of information */ + if (ret == -2 || cluster_id < 0) + cluster_id = 0; + @@ -122,17 +136,101 @@ index 8c8fc3a476..d2ac31e784 100644 virHostCPUGetCore(unsigned int cpu, unsigned int *core) { diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h -index 9be2e51a38..e3a04c2eeb 100644 +index 5f0d43e069..d7e09bff22 100644 --- a/src/util/virhostcpu.h +++ b/src/util/virhostcpu.h -@@ -66,6 +66,7 @@ int virHostCPUStatsAssign(virNodeCPUStatsPtr param, +@@ -68,6 +68,7 @@ int virHostCPUStatsAssign(virNodeCPUStatsPtr param, #ifdef __linux__ int virHostCPUGetSocket(unsigned int cpu, unsigned int *socket); int virHostCPUGetDie(unsigned int cpu, unsigned int *die); +int virHostCPUGetCluster(unsigned int cpu, unsigned int *cluster); int virHostCPUGetCore(unsigned int cpu, unsigned int *core); - virBitmapPtr virHostCPUGetSiblingsList(unsigned int cpu); + virBitmap *virHostCPUGetSiblingsList(unsigned int cpu); +diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml +index acdbb362cc..317fa0885f 100644 +--- a/tests/capabilityschemadata/caps-qemu-kvm.xml ++++ b/tests/capabilityschemadata/caps-qemu-kvm.xml +@@ -64,14 +64,14 @@ + + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -84,14 +84,14 @@ + + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml +index fe61fc42cc..b37c8e7a20 100644 +--- a/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml ++++ b/tests/vircaps2xmldata/vircaps-aarch64-basic-clusters.xml +@@ -14,10 +14,10 @@ + 4096 + 6144 + +- +- +- +- ++ ++ ++ ++ + + + +@@ -26,10 +26,10 @@ + 6144 + 8192 + +- +- +- +- ++ ++ ++ ++ + + + diff --git a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml b/tests/vircaps2xmldata/vircaps-aarch64-basic.xml index 0a04052c40..5533ae0586 100644 --- a/tests/vircaps2xmldata/vircaps-aarch64-basic.xml @@ -323,6 +421,65 @@ index 28f00c0a90..05b33147b7 100644 +diff --git a/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml b/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml +index 6fe5751666..2b97354bf3 100644 +--- a/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml ++++ b/tests/vircaps2xmldata/vircaps-x86_64-hmat.xml +@@ -25,30 +25,30 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml index ee26fe9464..167b217d8e 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml @@ -408,7 +565,7 @@ index acdd97ec58..311bb58e6a 100644 diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml -index 5f3678e072..8f64bcad63 100644 +index 1327d85c98..d85407f0b1 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-fake-feature.xml @@ -17,12 +17,12 @@ @@ -476,7 +633,7 @@ index bc52480905..38ea0bdc27 100644 diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml -index c386edd4b0..ea9e2613d7 100644 +index b638bbd1c9..fd854ee91e 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml @@ -17,12 +17,12 @@ @@ -518,5 +675,5 @@ index c386edd4b0..ea9e2613d7 100644 -- -2.25.1 +2.27.0 diff --git a/conf-Use-unsigned-long-long-for-timer-frequency.patch b/conf-Use-unsigned-long-long-for-timer-frequency.patch deleted file mode 100644 index 635ad7a3c2d195b240167cfe4a92eff410ce6f8e..0000000000000000000000000000000000000000 --- a/conf-Use-unsigned-long-long-for-timer-frequency.patch +++ /dev/null @@ -1,81 +0,0 @@ -From efd4f6469f9f5f6d3a34d250cd80faf59a8dc373 Mon Sep 17 00:00:00 2001 -From: Jiri Denemark -Date: Wed, 11 Nov 2020 16:50:16 +0100 -Subject: [PATCH 068/108] conf: Use unsigned long long for timer frequency - -Although the code in qemuProcessStartValidateTSC works as if the -timer frequency was already unsigned long long (by using an appropriate -temporary variable), the virDomainTimerDef structure actually defines -frequency as unsigned long, which is not guaranteed to be 64b. - -Fixes support for frequencies higher than 2^32 - 1 on 32b systems. - -Signed-off-by: Jiri Denemark -Reviewed-by: Martin Kletzander -(cherry picked from commit 3c7c7cd4d82c2f9a5a59bbd06673b8cd1eb23ce3) ---- - src/conf/domain_conf.c | 6 +++--- - src/conf/domain_conf.h | 2 +- - src/qemu/qemu_command.c | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index a33f9144f5..9c83f4e347 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -13951,7 +13951,7 @@ virDomainTimerDefParseXML(xmlNodePtr node, - } - } - -- ret = virXPathULong("string(./@frequency)", ctxt, &def->frequency); -+ ret = virXPathULongLong("string(./@frequency)", ctxt, &def->frequency); - if (ret == -1) { - def->frequency = 0; - } else if (ret < 0) { -@@ -22259,7 +22259,7 @@ virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src, - if (src->name == VIR_DOMAIN_TIMER_NAME_TSC) { - if (src->frequency != dst->frequency) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target TSC frequency %lu does not match source %lu"), -+ _("Target TSC frequency %llu does not match source %llu"), - dst->frequency, src->frequency); - return false; - } -@@ -27355,7 +27355,7 @@ virDomainTimerDefFormat(virBufferPtr buf, - - if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) { - if (def->frequency > 0) -- virBufferAsprintf(buf, " frequency='%lu'", def->frequency); -+ virBufferAsprintf(buf, " frequency='%llu'", def->frequency); - - if (def->mode != -1) { - const char *mode -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 15b9e79d69..c0a323d465 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2078,7 +2078,7 @@ struct _virDomainTimerDef { - int track; /* host|guest */ - - /* frequency & mode are only valid for name='tsc' */ -- unsigned long frequency; /* in Hz, unspecified = 0 */ -+ unsigned long long frequency; /* in Hz, unspecified = 0 */ - int mode; /* auto|native|emulate|paravirt */ - }; - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 27b2eef8e5..42f6e10b33 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -6761,7 +6761,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, - break; - case VIR_DOMAIN_TIMER_NAME_TSC: - if (timer->frequency > 0) -- virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency); -+ virBufferAsprintf(&buf, ",tsc-frequency=%llu", timer->frequency); - break; - case VIR_DOMAIN_TIMER_NAME_ARMVTIMER: - switch (timer->tickpolicy) { --- -2.33.0 - diff --git a/conf-domain_conf-pin-the-retry_interval-and-retry_ti.patch b/conf-domain_conf-pin-the-retry_interval-and-retry_ti.patch index 14c09d7e1f80341e17f8f2438cda708a3b0582cf..d8ab57aca60319a9796f8300994d3f0f512bfb60 100644 --- a/conf-domain_conf-pin-the-retry_interval-and-retry_ti.patch +++ b/conf-domain_conf-pin-the-retry_interval-and-retry_ti.patch @@ -1,4 +1,4 @@ -From 5d762303253a8cf15204839e93cc3f6e562d3708 Mon Sep 17 00:00:00 2001 +From ca03e9837c3f79217b9375bd1f5f4fda0034ff6b Mon Sep 17 00:00:00 2001 From: Mao Zhongyi Date: Sat, 18 Sep 2021 14:20:24 +0800 Subject: [PATCH] conf/domain_conf: pin the retry_interval and retry_timeout @@ -10,21 +10,21 @@ Signed-off-by: Mao Zhongyi 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index a4e9b3290c..4e3bcf479c 100644 +index 0aa514bda3..779130671f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c -@@ -24977,6 +24977,12 @@ virDomainDiskDefFormatDriver(virBufferPtr buf, - virBufferAsprintf(&driverBuf, " rerror_policy='%s'", +@@ -22669,6 +22669,12 @@ virDomainDiskDefFormatDriver(virBuffer *buf, + virBufferAsprintf(&attrBuf, " rerror_policy='%s'", virDomainDiskErrorPolicyTypeToString(disk->rerror_policy)); + if (disk->retry_interval) -+ virBufferAsprintf(&driverBuf, " retry_interval='%ld'", disk->retry_interval); ++ virBufferAsprintf(&attrBuf, " retry_interval='%lld'", disk->retry_interval); + + if (disk->retry_timeout) -+ virBufferAsprintf(&driverBuf, " retry_timeout='%ld'", disk->retry_timeout); ++ virBufferAsprintf(&attrBuf, " retry_timeout='%lld'", disk->retry_timeout); + if (disk->iomode) - virBufferAsprintf(&driverBuf, " io='%s'", + virBufferAsprintf(&attrBuf, " io='%s'", virDomainDiskIoTypeToString(disk->iomode)); -- 2.27.0 diff --git a/conf-implement-support-for-vhostuser-disk.patch b/conf-implement-support-for-vhostuser-disk.patch deleted file mode 100644 index a7c61fed87bd2885230f20ba67917b9b1291c5e7..0000000000000000000000000000000000000000 --- a/conf-implement-support-for-vhostuser-disk.patch +++ /dev/null @@ -1,617 +0,0 @@ -From 02565aca5158fb4d9870546ea29be85278649511 Mon Sep 17 00:00:00 2001 -From: Luo Yifan -Date: Wed, 30 Nov 2022 18:13:36 +0800 -Subject: [PATCH 15/24] conf: implement support for vhostuser disk -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Pavel Hrdina -Reviewed-by: Ján Tomko -Reviewed-by: Peter Krempa -(cherry picked from commit f00fe96eb045eed2b6b40d5046449bec6d495875) -Signed-off-by: Luo Yifan ---- - src/conf/domain_conf.c | 254 ++++++++++++++++++ - src/libxl/xen_xl.c | 1 + - src/qemu/qemu_block.c | 6 + - src/qemu/qemu_command.c | 1 + - src/qemu/qemu_driver.c | 4 + - src/qemu/qemu_migration.c | 2 + - src/util/virstoragefile.c | 4 + - src/util/virstoragefile.h | 4 + - tests/qemuxml2argvdata/disk-vhostuser.xml | 30 +++ - .../disk-vhostuser.x86_64-latest.xml | 48 ++++ - tests/qemuxml2xmltest.c | 1 + - 11 files changed, 355 insertions(+) - create mode 100644 tests/qemuxml2argvdata/disk-vhostuser.xml - create mode 100644 tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index b60b9d31a1..8b1ca76d39 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1278,6 +1278,17 @@ static virClassPtr virDomainXMLOptionClass; - static void virDomainObjDispose(void *obj); - static void virDomainXMLOptionDispose(void *obj); - -+static int -+virDomainChrSourceDefFormat(virBufferPtr buf, -+ virDomainChrSourceDefPtr def, -+ unsigned int flags); -+ -+ -+static int -+virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def, -+ xmlNodePtr node, -+ xmlXPathContextPtr ctxt); -+ - static int virDomainObjOnceInit(void) - { - if (!VIR_CLASS_NEW(virDomainObj, virClassForObjectLockable())) -@@ -5200,6 +5211,12 @@ virDomainDiskDefPostParse(virDomainDiskDefPtr disk, - disk->src->nvme->managed = VIR_TRISTATE_BOOL_YES; - } - -+ /* vhost-user doesn't allow us to snapshot, disable snapshots by default */ -+ if (disk->src->type == VIR_STORAGE_TYPE_VHOST_USER && -+ disk->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT) { -+ disk->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; -+ } -+ - if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0) { - return -1; -@@ -5995,6 +6012,174 @@ virDomainDiskAddressDiskBusCompatibility(virDomainDiskBus bus, - return true; - } - -+static int -+virDomainDiskVhostUserValidate(const virDomainDiskDef *disk) -+{ -+ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("vhostuser disk supports only virtio bus")); -+ return -1; -+ } -+ -+ if (disk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("only snapshot=no is supported with vhostuser disk")); -+ return -1; -+ } -+ -+ /* Unsupported driver attributes */ -+ -+ if (disk->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("cache is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->error_policy || disk->rerror_policy) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("error_policy is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->iomode) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("io is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->ioeventfd != VIR_TRISTATE_SWITCH_ABSENT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("ioeventfd is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->copy_on_read) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("copy_on_read is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->discard) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("discard is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->iothread) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("iothread is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->detect_zeroes) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("detect_zeroes is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ /* Unsupported driver elements */ -+ -+ if (disk->virtio) { -+ if (disk->virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("iommu is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("ats is not supported with vhostuser disk")); -+ return -1; -+ } -+ } -+ -+ /* Unsupported disk elements */ -+ -+ if (disk->blkdeviotune.group_name || -+ virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("iotune is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->src->backingStore) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("backingStore is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->src->encryption) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("encryption is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->src->readonly) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("readonly is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->src->shared) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("shareable is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->transient) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("transient is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->serial) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("serial is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->wwn) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("wwn is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->vendor) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("vendor is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->product) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("product is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->src->auth) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("auth is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->geometry.cylinders > 0 || -+ disk->geometry.heads > 0 || -+ disk->geometry.sectors > 0 || -+ disk->geometry.trans != VIR_DOMAIN_DISK_TRANS_DEFAULT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("geometry is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ if (disk->blockio.logical_block_size > 0 || -+ disk->blockio.physical_block_size > 0) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("blockio is not supported with vhostuser disk")); -+ return -1; -+ } -+ -+ return 0; -+} - - static int - virSecurityDeviceLabelDefValidateXML(virSecurityDeviceLabelDefPtr *seclabels, -@@ -6095,6 +6280,11 @@ virDomainDiskDefValidate(const virDomainDef *def, - } - } - -+ if (disk->src->type == VIR_STORAGE_TYPE_VHOST_USER && -+ virDomainDiskVhostUserValidate(disk) < 0) { -+ return -1; -+ } -+ - for (next = disk->src; next; next = next->backingStore) { - if (virSecurityDeviceLabelDefValidateXML(next->seclabels, - next->nseclabels, -@@ -9530,6 +9720,47 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, - return 0; - } - -+static int -+virDomainDiskSourceVHostUserParse(xmlNodePtr node, -+ virStorageSourcePtr src, -+ virDomainXMLOptionPtr xmlopt, -+ xmlXPathContextPtr ctxt) -+{ -+ g_autofree char *type = virXMLPropString(node, "type"); -+ g_autofree char *path = virXMLPropString(node, "path"); -+ -+ if (!type) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("missing 'type' attribute for vhostuser disk source")); -+ return -1; -+ } -+ -+ if (STRNEQ(type, "unix")) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("invalid 'type' attribute for vhostuser disk source")); -+ return -1; -+ } -+ -+ if (!path) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("missing 'path' attribute for vhostuser disk source")); -+ return -1; -+ } -+ -+ if (!(src->vhostuser = virDomainChrSourceDefNew(xmlopt))) -+ return -1; -+ -+ src->vhostuser->type = virDomainChrTypeFromString(type); -+ src->vhostuser->data.nix.path = g_steal_pointer(&path); -+ -+ if (virDomainChrSourceReconnectDefParseXML(&src->vhostuser->data.nix.reconnect, -+ node, -+ ctxt) < 0) { -+ return -1; -+ } -+ -+ return 0; -+} - - static int - virDomainDiskSourceNVMeParse(xmlNodePtr node, -@@ -9746,6 +9977,10 @@ virDomainStorageSourceParse(xmlNodePtr node, - if (virDomainDiskSourceNVMeParse(node, ctxt, src) < 0) - return -1; - break; -+ case VIR_STORAGE_TYPE_VHOST_USER: -+ if (virDomainDiskSourceVHostUserParse(node, src, xmlopt, ctxt) < 0) -+ return -1; -+ break; - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -24682,6 +24917,21 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf, - virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false); - } - -+static void -+virDomainChrSourceReconnectDefFormat(virBufferPtr buf, -+ virDomainChrSourceReconnectDefPtr def); -+ -+ -+static void -+virDomainDiskSourceVhostuserFormat(virBufferPtr attrBuf, -+ virBufferPtr childBuf, -+ virDomainChrSourceDefPtr vhostuser) -+{ -+ virBufferAddLit(attrBuf, " type='unix'"); -+ virBufferAsprintf(attrBuf, " path='%s'", vhostuser->data.nix.path); -+ -+ virDomainChrSourceReconnectDefFormat(childBuf, &vhostuser->data.nix.reconnect); -+} - - static int - virDomainDiskSourceFormatPrivateData(virBufferPtr buf, -@@ -24796,6 +25046,10 @@ virDomainDiskSourceFormat(virBufferPtr buf, - virDomainDiskSourceNVMeFormat(&attrBuf, &childBuf, src->nvme); - break; - -+ case VIR_STORAGE_TYPE_VHOST_USER: -+ virDomainDiskSourceVhostuserFormat(&attrBuf, &childBuf, src->vhostuser); -+ break; -+ - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c -index 91b1825399..08eea48d6c 100644 ---- a/src/libxl/xen_xl.c -+++ b/src/libxl/xen_xl.c -@@ -1641,6 +1641,7 @@ xenFormatXLDiskSrc(virStorageSourcePtr src, char **srcstr) - - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - break; -diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c -index d32277d7fd..8bd6238238 100644 ---- a/src/qemu/qemu_block.c -+++ b/src/qemu/qemu_block.c -@@ -1108,6 +1108,11 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src, - return NULL; - break; - -+ case VIR_STORAGE_TYPE_VHOST_USER: -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("unable to create blockdev props for vhostuser disk type")); -+ return NULL; -+ - case VIR_STORAGE_TYPE_VOLUME: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("storage source pool '%s' volume '%s' is not translated"), -@@ -2491,6 +2496,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSourcePtr src, - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - return 0; - - case VIR_STORAGE_TYPE_NONE: -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 9157008b73..bc62843783 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -1166,6 +1166,7 @@ qemuGetDriveSourceString(virStorageSourcePtr src, - - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - break; -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 854b56a563..b2ad021e4d 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -14536,6 +14536,7 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -14553,6 +14554,7 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -14621,6 +14623,7 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -14749,6 +14752,7 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDiskDefPtr disk, - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 1c48138ce3..faf4e223a8 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -228,6 +228,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr conn, - case VIR_STORAGE_TYPE_BLOCK: - case VIR_STORAGE_TYPE_DIR: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -1358,6 +1359,7 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def, - unsafe = true; - break; - -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_BLOCK: - case VIR_STORAGE_TYPE_DIR: -diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c -index ffc8bdb344..2515dbf5ed 100644 ---- a/src/util/virstoragefile.c -+++ b/src/util/virstoragefile.c -@@ -56,6 +56,7 @@ VIR_ENUM_IMPL(virStorage, - "network", - "volume", - "nvme", -+ "vhostuser", - ); - - VIR_ENUM_IMPL(virStorageFileFormat, -@@ -2617,6 +2618,7 @@ virStorageSourceIsLocalStorage(const virStorageSource *src) - /* While NVMe disks are local, they are not accessible via src->path. - * Therefore, we have to return false here. */ - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_LAST: - case VIR_STORAGE_TYPE_NONE: - return false; -@@ -4164,6 +4166,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src, - /* We shouldn't get VOLUME, but the switch requires all cases */ - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - return -1; -@@ -4610,6 +4613,7 @@ virStorageSourceIsRelative(virStorageSourcePtr src) - case VIR_STORAGE_TYPE_NETWORK: - case VIR_STORAGE_TYPE_VOLUME: - case VIR_STORAGE_TYPE_NVME: -+ case VIR_STORAGE_TYPE_VHOST_USER: - case VIR_STORAGE_TYPE_NONE: - case VIR_STORAGE_TYPE_LAST: - return false; -diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h -index 7939c09cd5..f2096b8705 100644 ---- a/src/util/virstoragefile.h -+++ b/src/util/virstoragefile.h -@@ -28,6 +28,7 @@ - #include "virseclabel.h" - #include "virstorageencryption.h" - #include "virsecret.h" -+#include "../conf/virconftypes.h" - #include "virenum.h" - #include "virpci.h" - -@@ -52,6 +53,7 @@ typedef enum { - VIR_STORAGE_TYPE_NETWORK, - VIR_STORAGE_TYPE_VOLUME, - VIR_STORAGE_TYPE_NVME, -+ VIR_STORAGE_TYPE_VHOST_USER, - - VIR_STORAGE_TYPE_LAST - } virStorageType; -@@ -302,6 +304,8 @@ struct _virStorageSource { - - virStorageSourceNVMeDefPtr nvme; /* type == VIR_STORAGE_TYPE_NVME */ - -+ virDomainChrSourceDefPtr vhostuser; /* type == VIR_STORAGE_TYPE_VHOST_USER */ -+ - virStorageSourceInitiatorDef initiator; - - virObjectPtr privateData; -diff --git a/tests/qemuxml2argvdata/disk-vhostuser.xml b/tests/qemuxml2argvdata/disk-vhostuser.xml -new file mode 100644 -index 0000000000..c96ef9119c ---- /dev/null -+++ b/tests/qemuxml2argvdata/disk-vhostuser.xml -@@ -0,0 +1,30 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ -+ -+ -+ -+ 1 -+ -+ hvm -+ -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml -new file mode 100644 -index 0000000000..9712dc0b12 ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/disk-vhostuser.x86_64-latest.xml -@@ -0,0 +1,48 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ -+ -+ -+ -+ 1 -+ -+ hvm -+ -+ -+ qemu64 -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+ -+ -+ -+
-+ -+ -+ -+ -+ -+ -+ -+
-+ -+ -+
-+ -+ -+ -+ -+ -+
-+ -+ -+ -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index 3a2539596b..2569c27261 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -338,6 +338,7 @@ mymain(void) - DO_TEST("disk-network-vxhs", NONE); - DO_TEST("disk-network-tlsx509", NONE); - DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS); -+ DO_TEST_CAPS_LATEST("disk-vhostuser"); - DO_TEST("disk-scsi", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_SCSI_MEGASAS, - QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN); - DO_TEST("disk-virtio-scsi-reservations", --- -2.27.0 - diff --git a/conf-properly-clear-out-autogenerated-macvtap-names-.patch b/conf-properly-clear-out-autogenerated-macvtap-names-.patch deleted file mode 100644 index 74d94991972e64a6b63d93706e4a2e7b6ba3d570..0000000000000000000000000000000000000000 --- a/conf-properly-clear-out-autogenerated-macvtap-names-.patch +++ /dev/null @@ -1,110 +0,0 @@ -From a5ec03f25b225408a9e7ebbf7b9fc9e3e2f15166 Mon Sep 17 00:00:00 2001 -From: Laine Stump -Date: Sat, 22 Aug 2020 23:42:52 -0400 -Subject: [PATCH 049/108] conf: properly clear out autogenerated macvtap names - when formatting/parsing - -Back when macvtap support was added in commit 315baab9443 in Feb. 2010 -(libvirt-0.7.7), it was setup to autogenerate a name for the device if -one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"), -similar to the way an unspecified standard tap device name will lead -to an autogenerated "vnet%d". - -As a matter of fact, in commit ca1b7cc8e45 added in May 2010, the code -was changed to *always* ignore a supplied device name for macvtap -interfaces by deleting *any* name immediately during the -parsing (this was intended to prevent one domain which had failed to -completely start from deleting the macvtap device of another domain -which had subsequently been provided the same device name (this will -seem mildly ironic later). This was later fixed to only clear the -device name when inactive XML was being parsed. HOWEVER - this was -only done if the xml was - autogenerated -names were not cleared for (which could -also result in a macvtap device). - -Although the names of "vnetX" tap devices had always been -automatically cleared when parsing (see commit d1304583d -from July 2008 (!)), at the time macvtap support was added, both vnetX -and macvtapX device names were always included when formatting the -XML. - -Then in commit a8be259d0cc (July 2011, libvirt-0.9.4), -formatting was changed to also clear out "vnetX" device names during -XML formatting as well. However the same treatment wasn't given to -"macvtapX". - -Now in 2020, there has been a report that a failed migration leads to -the macvtap device of some other unrelated guest on the destination -host losing its network connectivity. It was determined that this was -due to the domain XML in the migration containing a macvtap device -name, e.g. "macvtap0", that was already in use by the other guest on -the destination. Normally this wouldn't be a problem, because libvirt -would see that the device was already in use, and then find a -different unused name. But in this case, other external problems were -causing the migration to fail prior to selecting a macvtap device and -successfully opening it, and during error recovery, qemuProcessStop() -was called, which went through all def->nets objects and (if they were -macvtap) deleted the device specified in net->ifname; since libvirt -hadn't gotten to the point of replacing the incoming "macvtap0" with -the name of a device it actually created for this guest, that meant -that "macvtap0" was deleted, *even though it was currently in use by a -different guest*! - -Whew! - -So, it turns out that when formatting "migratable" XML, "vnetX" -devices are omitted, just as when formatting "inactive" XML. By making -the code in both interface parsing and formatting consistent for -"vnetX", "macvtapX", and "macvlanX", we can thus make sure that the -autogenerated (and unneeded / completely *not* wanted) macvtap device -name will not be sent with the migration XML. This way when a -migration fails, net->ifname will be NULL, and libvirt won't have any -device to try and (erroneously) delete. - -Signed-off-by: Laine Stump -Reviewed-by: Daniel Henrique Barboza -(cherry picked from commit 282d135ddbb7203565cd5527b451469b14953994) ---- - src/conf/domain_conf.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 54228a2151..d3565ececf 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -12357,14 +12357,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - } - - def->data.direct.linkdev = g_steal_pointer(&dev); -- -- if (ifname && -- flags & VIR_DOMAIN_DEF_PARSE_INACTIVE && -- (STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) || -- STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX))) { -- VIR_FREE(ifname); -- } -- - break; - - case VIR_DOMAIN_NET_TYPE_HOSTDEV: -@@ -12410,6 +12402,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - if (def->managed_tap != VIR_TRISTATE_BOOL_NO && ifname && - (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && - (STRPREFIX(ifname, VIR_NET_GENERATED_TAP_PREFIX) || -+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) || -+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) || - (prefix && STRPREFIX(ifname, prefix)))) { - /* An auto-generated target name, blank it out */ - VIR_FREE(ifname); -@@ -26263,6 +26257,8 @@ virDomainNetDefFormat(virBufferPtr buf, - (def->managed_tap == VIR_TRISTATE_BOOL_NO || - !((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && - (STRPREFIX(def->ifname, VIR_NET_GENERATED_TAP_PREFIX) || -+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) || -+ STRPREFIX(def->ifname, VIR_NET_GENERATED_MACVLAN_PREFIX) || - (prefix && STRPREFIX(def->ifname, prefix)))))) { - /* Skip auto-generated target names for inactive config. */ - virBufferEscapeString(&attrBuf, " dev='%s'", def->ifname); --- -2.33.0 - diff --git a/conf-validate-serial-port-model-in-ABI-checks.patch b/conf-validate-serial-port-model-in-ABI-checks.patch deleted file mode 100644 index 926e02ff7a6cca269a81318300cf94fcb86f6844..0000000000000000000000000000000000000000 --- a/conf-validate-serial-port-model-in-ABI-checks.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0e6fcb0eb5e3eb499a3cc7232fa1b7bf9f1813a2 Mon Sep 17 00:00:00 2001 -From: jiangdawei15 -Date: Thu, 11 Aug 2022 21:24:35 +0800 -Subject: [PATCH 06/22] conf: validate serial port model in ABI checks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The serial port model cannot be allowed to -change across migration as it affects ABI. - -Reviewed-by: Andrea Bolognani - -Signed-off-by: Daniel P. Berrangé -Signed-off-by: Dawei Jiang jiangdawei15@huawei.com ---- - src/conf/domain_conf.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 1689d92c51..2d1726af8f 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -23058,6 +23058,14 @@ virDomainSerialDefCheckABIStability(virDomainChrDefPtr src, - return false; - } - -+ if (src->targetModel != dst->targetModel) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target serial model %s does not match source %s"), -+ virDomainChrSerialTargetModelTypeToString(dst->targetModel), -+ virDomainChrSerialTargetModelTypeToString(src->targetModel)); -+ return false; -+ } -+ - if (src->target.port != dst->target.port) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target serial port %d does not match source %d"), --- -2.33.0 - diff --git a/libvirt-cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch b/cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch similarity index 45% rename from libvirt-cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch rename to cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch index 5391de0b24ee36bda680762a6cd2b07618c45c64..528c761f874b8dbaf497d37294dc1ef690cb9d1d 100644 --- a/libvirt-cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch +++ b/cpu-aarch64-enable-host-model-cpu-for-AArch64-archit.patch @@ -1,4 +1,4 @@ -From 1e6875a732d896138d3bc2351e5284d1ad13dd59 Mon Sep 17 00:00:00 2001 +From 3650de04c4dc99416b7a2d4edd283217657e77c5 Mon Sep 17 00:00:00 2001 From: Xu Yandong Date: Wed, 20 May 2020 02:33:27 -0400 Subject: [PATCH] cpu/aarch64: enable host-model cpu for AArch64 architecture @@ -8,16 +8,16 @@ suit, skip hypervisor host-model externsion checking on AArch64 architecture. Signed-off-by: Xu Yandong +Signed-off-by: lishusen --- - src/qemu/qemu_command.c | 2 +- - tests/qemuxml2argvtest.c | 2 -- - 2 files changed, 1 insertion(+), 3 deletions(-) + src/qemu/qemu_command.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 2f0e919..2f65b8d 100644 +index d54149ed2d..e3cf092828 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c -@@ -6582,7 +6582,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, +@@ -6278,7 +6278,7 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver, break; } @@ -26,19 +26,6 @@ index 2f0e919..2f65b8d 100644 cpu->features && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) { virReportError(VIR_ERR_INTERNAL_ERROR, -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index 596dd7a..2153e44 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -2736,8 +2736,6 @@ mymain(void) - DO_TEST("aarch64-noacpi-nouefi", NONE); - DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE); - -- /* QEMU 4.0.0 didn't have support for aarch64 CPU features */ -- DO_TEST_CAPS_ARCH_VER_FAILURE("aarch64-features-sve", "aarch64", "4.0.0"); - /* aarch64 doesn't support the same CPU features as x86 */ - DO_TEST_CAPS_ARCH_LATEST_FAILURE("aarch64-features-wrong", "aarch64"); - /* Can't enable vector lengths when SVE is overall disabled */ -- -1.8.3.1 +2.27.0 diff --git a/cpu_map-Add-Cooperlake-x86-CPU-model.patch b/cpu_map-Add-Cooperlake-x86-CPU-model.patch deleted file mode 100644 index 96d36bbad7454f0b8fb3a0fece69ed2e4de02bd4..0000000000000000000000000000000000000000 --- a/cpu_map-Add-Cooperlake-x86-CPU-model.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 41717af8988db9c2d9d8b753f306f6deaa1cec8d Mon Sep 17 00:00:00 2001 -From: Jiri Denemark -Date: Tue, 19 May 2020 15:08:11 +0200 -Subject: [PATCH 2/3] cpu_map: Add Cooperlake x86 CPU model - -The stepping range (10-11) is likely incomplete. QEMU uses 10 and the -CPUID data for Cooperlake show 11. We will update the range if needed -once more details about he CPU are available. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -Signed-off-by: Jingyi Wang ---- - src/cpu_map/index.xml | 1 + - src/cpu_map/x86_Cooperlake.xml | 89 +++++++++++++++++++ - .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + - .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + - tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + - 5 files changed, 93 insertions(+) - create mode 100644 src/cpu_map/x86_Cooperlake.xml - -diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml -index 672d0a3c92..3ccc76b9ed 100644 ---- a/src/cpu_map/index.xml -+++ b/src/cpu_map/index.xml -@@ -54,6 +54,7 @@ - - - -+ - - - -diff --git a/src/cpu_map/x86_Cooperlake.xml b/src/cpu_map/x86_Cooperlake.xml -new file mode 100644 -index 0000000000..77e695aea4 ---- /dev/null -+++ b/src/cpu_map/x86_Cooperlake.xml -@@ -0,0 +1,89 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -index ff721530cd..fa945fc002 100644 ---- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -@@ -93,6 +93,7 @@ - EPYC-IBPB - EPYC - Dhyana -+ Cooperlake - Conroe - Cascadelake-Server-noTSX - Cascadelake-Server -diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml -index d567863f49..a0eeed7c2d 100644 ---- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml -+++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml -@@ -101,6 +101,7 @@ - EPYC-IBPB - EPYC - Dhyana -+ Cooperlake - Conroe - Cascadelake-Server-noTSX - Cascadelake-Server -diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -index 2c6066003d..fbde7a6ba2 100644 ---- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -@@ -92,6 +92,7 @@ - EPYC-IBPB - EPYC - Dhyana -+ Cooperlake - Conroe - Cascadelake-Server-noTSX - Cascadelake-Server --- -2.27.0 - diff --git a/cpu_map-Add-pschange-mc-no-bit-in-IA32_ARCH_CAPABILI.patch b/cpu_map-Add-pschange-mc-no-bit-in-IA32_ARCH_CAPABILI.patch deleted file mode 100644 index 79420a720918c2f968903cc9af093e76cb67de66..0000000000000000000000000000000000000000 --- a/cpu_map-Add-pschange-mc-no-bit-in-IA32_ARCH_CAPABILI.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 9696e88e150fce9ea82eadb16726c8c3a7a197ae Mon Sep 17 00:00:00 2001 -From: Jiri Denemark -Date: Mon, 18 May 2020 20:55:42 +0200 -Subject: [PATCH 1/3] cpu_map: Add pschange-mc-no bit in IA32_ARCH_CAPABILITIES - MSR - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -Signed-off-by: Jingyi Wang ---- - src/cpu_map/x86_features.xml | 3 +++ - tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml | 2 +- - tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml | 1 + - tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml | 1 + - tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml | 1 + - tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + - tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + - tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + - tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + - 9 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml -index 2c4c29dc99..8525ae0fa5 100644 ---- a/src/cpu_map/x86_features.xml -+++ b/src/cpu_map/x86_features.xml -@@ -509,6 +509,9 @@ - - - -+ -+ -+ - - - -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml -index 6c480eeacf..57f8ebabba 100644 ---- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-enabled.xml -@@ -5,5 +5,5 @@ - - - -- -+ - -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml -index 92404e4d03..ed06515e99 100644 ---- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-guest.xml -@@ -26,6 +26,7 @@ - - - -+ - - - -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml -index 7f6fe2eac3..7681c94649 100644 ---- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-host.xml -@@ -27,4 +27,5 @@ - - - -+ - -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml -index 645c0934c2..4774d39c7e 100644 ---- a/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-8550U-json.xml -@@ -14,6 +14,7 @@ - - - -+ - - - -diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml -index 1b8b8be2f5..fcb0505da0 100644 ---- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml -+++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml -@@ -47,6 +47,7 @@ - - - -+ - - - qemu64 -diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml -index 213dcc5a08..e22ef8e032 100644 ---- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml -+++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml -@@ -46,6 +46,7 @@ - - - -+ - - - qemu64 -diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -index 45c3e00b1e..ff721530cd 100644 ---- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -+++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml -@@ -47,6 +47,7 @@ - - - -+ - - - qemu64 -diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -index d2a884eed1..2c6066003d 100644 ---- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -+++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml -@@ -46,6 +46,7 @@ - - - -+ - - - qemu64 --- -2.27.0 - diff --git a/cpu_map-Distribute-x86_Cooperlake.xml.patch b/cpu_map-Distribute-x86_Cooperlake.xml.patch deleted file mode 100644 index bcef2fb93ac2ca71d00dee664026063e027f2834..0000000000000000000000000000000000000000 --- a/cpu_map-Distribute-x86_Cooperlake.xml.patch +++ /dev/null @@ -1,30 +0,0 @@ -From fc20e12b3be7a4c96ff0a71112d69181408506d1 Mon Sep 17 00:00:00 2001 -From: Jiri Denemark -Date: Tue, 26 May 2020 12:52:00 +0200 -Subject: [PATCH 3/3] cpu_map: Distribute x86_Cooperlake.xml -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Jiri Denemark -Reviewed-by: Daniel P. Berrangé -Signed-off-by: Jingyi Wang ---- - src/cpu_map/Makefile.inc.am | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am -index ab5268d94f..8eb818706a 100644 ---- a/src/cpu_map/Makefile.inc.am -+++ b/src/cpu_map/Makefile.inc.am -@@ -22,6 +22,7 @@ cpumap_DATA = \ - cpu_map/x86_Cascadelake-Server.xml \ - cpu_map/x86_Cascadelake-Server-noTSX.xml \ - cpu_map/x86_Conroe.xml \ -+ cpu_map/x86_Cooperlake.xml \ - cpu_map/x86_core2duo.xml \ - cpu_map/x86_coreduo.xml \ - cpu_map/x86_cpu64-rhel5.xml \ --- -2.27.0 - diff --git a/cpu_map-Fix-Icelake-Server-model-number.patch b/cpu_map-Fix-Icelake-Server-model-number.patch deleted file mode 100644 index 0261661c3459f6750598e8b6e95c4e75f1822926..0000000000000000000000000000000000000000 --- a/cpu_map-Fix-Icelake-Server-model-number.patch +++ /dev/null @@ -1,45 +0,0 @@ -From a70f3b2d8b707063c63fb3b43751651e5fedebb9 Mon Sep 17 00:00:00 2001 -From: Tim Wiederhake -Date: Wed, 2 Dec 2020 11:38:22 +0100 -Subject: [PATCH 012/108] cpu_map: Fix Icelake Server model number - -See arch/x86/include/asm/intel-family.h in the Kernel: - #define INTEL_FAM6_ICELAKE_X 0x6A - -Signed-off-by: Tim Wiederhake -Reviewed-by: Jiri Denemark -(cherry picked from commit 1278ac6265589cd83cc2e661056c860e98105507) ---- - src/cpu_map/x86_Icelake-Server-noTSX.xml | 2 +- - src/cpu_map/x86_Icelake-Server.xml | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/cpu_map/x86_Icelake-Server-noTSX.xml b/src/cpu_map/x86_Icelake-Server-noTSX.xml -index 2fd6906406..34a0f7c18c 100644 ---- a/src/cpu_map/x86_Icelake-Server-noTSX.xml -+++ b/src/cpu_map/x86_Icelake-Server-noTSX.xml -@@ -1,7 +1,7 @@ - - - -- -+ - - - -diff --git a/src/cpu_map/x86_Icelake-Server.xml b/src/cpu_map/x86_Icelake-Server.xml -index 367ade7240..1ee4ea9cd4 100644 ---- a/src/cpu_map/x86_Icelake-Server.xml -+++ b/src/cpu_map/x86_Icelake-Server.xml -@@ -1,7 +1,7 @@ - - - -- -+ - - - --- -2.33.0 - diff --git a/libvirt-cpu_map-add-kunpeng-920-features-as-known-features.patch b/cpu_map-add-kunpeng-920-features-to-arm-features.patch similarity index 87% rename from libvirt-cpu_map-add-kunpeng-920-features-as-known-features.patch rename to cpu_map-add-kunpeng-920-features-to-arm-features.patch index aefd050dc689daa3ee80c1f3995977625de7ba0e..a504ad57060a8af380d2e4f88e57f39878d5fe4d 100644 --- a/libvirt-cpu_map-add-kunpeng-920-features-as-known-features.patch +++ b/cpu_map-add-kunpeng-920-features-to-arm-features.patch @@ -1,15 +1,16 @@ -From f67e57fa41c76e21effd9e61773319ef424a5265 Mon Sep 17 00:00:00 2001 +From 1fafc7b5a9392fce83e8f1701ccec289d11d4344 Mon Sep 17 00:00:00 2001 From: Xu Yandong Date: Tue, 26 May 2020 20:08:07 +0800 Subject: [PATCH] cpu_map: add kunpeng-920 features to arm features Signed-off-by: Xu Yandong +Signed-off-by: lishusen --- src/cpu_map/arm_features.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/cpu_map/arm_features.xml b/src/cpu_map/arm_features.xml -index 8a53384..5bed298 100644 +index 8a53384463..5bed298071 100644 --- a/src/cpu_map/arm_features.xml +++ b/src/cpu_map/arm_features.xml @@ -19,4 +19,23 @@ @@ -37,5 +38,5 @@ index 8a53384..5bed298 100644 + -- -2.23.0 +2.27.0 diff --git a/cpu_ppc64-compare-CPU-function-is-ignoring-return-va.patch b/cpu_ppc64-compare-CPU-function-is-ignoring-return-va.patch deleted file mode 100644 index 369d6621b6e1c6e5c0a22190a6f68151211de3e5..0000000000000000000000000000000000000000 --- a/cpu_ppc64-compare-CPU-function-is-ignoring-return-va.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9549d796fd310e41ec58f1c438328d1bedc0cb93 Mon Sep 17 00:00:00 2001 -From: tangbinzy -Date: Tue, 29 Nov 2022 12:12:58 +0000 -Subject: [PATCH 09/24] cpu_ppc64: compare CPU function is ignoring return - value Function to compare CPU on 64-bits PowerPC is ignoring the flag to - avoid failure in case of CPUs (host and guest) are incompatible. Basically, - the function is returning -1 even if it is set to continue. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Julio Faracco jcfaracco@gmail.com -Reviewed-by: Ján Tomko jtomko@redhat.com -Signed-off-by: Ján Tomko jtomko@redhat.com - -Signed-off-by: tangbin tangbin_yewu@cmss.chinamobile.com -(cherry-pick from b356d81b8960c3a43212f8c0e9eab66465c8c10a) ---- - src/cpu/cpu_ppc64.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c -index 6b3590ab6a..9cbb28cbc5 100644 ---- a/src/cpu/cpu_ppc64.c -+++ b/src/cpu/cpu_ppc64.c -@@ -561,11 +561,11 @@ virCPUppc64Compare(virCPUDefPtr host, - if (failIncompatible) { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", - _("unknown host CPU")); -- } else { -- VIR_WARN("unknown host CPU"); -- ret = VIR_CPU_COMPARE_INCOMPATIBLE; -+ return VIR_CPU_COMPARE_ERROR; - } -- return -1; -+ -+ VIR_WARN("unknown host CPU"); -+ return VIR_CPU_COMPARE_INCOMPATIBLE; - } - - ret = ppc64Compute(host, cpu, NULL, &message); --- -2.27.0 - diff --git a/cpu_topo-support-for-specifying-clusters-in-qemu-com.patch b/cpu_topo-support-for-specifying-clusters-in-qemu-com.patch deleted file mode 100644 index 08c5cc8313015def65920fd2c6bcd26250718609..0000000000000000000000000000000000000000 --- a/cpu_topo-support-for-specifying-clusters-in-qemu-com.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 2e275763162623b59b1872a16c0c9f0f3837f530 Mon Sep 17 00:00:00 2001 -From: zhangxinhao -Date: Tue, 9 May 2023 23:01:36 +0800 -Subject: cpu_topo: support for specifying "clusters" in qemu - comand - -Support for cpu topology "clusters" for qemu command parameter "-smp". - -Signed-off-by: zhangxinhao ---- - src/qemu/qemu_capabilities.c | 2 ++ - src/qemu/qemu_capabilities.h | 1 + - src/qemu/qemu_command.c | 7 ++--- - tests/qemuxml2argvdata/smp-clusters.args | 30 +++++++++++++++++++++ - tests/qemuxml2argvdata/smp-clusters.xml | 33 ++++++++++++++++++++++++ - tests/qemuxml2argvtest.c | 1 + - 6 files changed, 69 insertions(+), 5 deletions(-) - create mode 100644 tests/qemuxml2argvdata/smp-clusters.args - create mode 100644 tests/qemuxml2argvdata/smp-clusters.xml - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 21b477cd4d..19030b2040 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -579,6 +579,7 @@ VIR_ENUM_IMPL(virQEMUCaps, - /* 365 */ - "calc-dirty-rate", - "dirtyrate-param.mode", -+ "smp-clusters", - ); - - -@@ -3218,6 +3219,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { - { "chardev", "fd", QEMU_CAPS_CHARDEV_FD_PASS }, - { "overcommit", NULL, QEMU_CAPS_OVERCOMMIT }, - { "smp-opts", "dies", QEMU_CAPS_SMP_DIES }, -+ { "smp-opts", "clusters", QEMU_CAPS_SMP_CLUSTERS }, - }; - - static int -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index 00682eb52c..43507760c8 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -560,6 +560,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ - /* 365 */ - QEMU_CAPS_CALC_DIRTY_RATE, /* accepts calc-dirty-rate */ - QEMU_CAPS_DIRTYRATE_MODE , /* calc-dirty-rate accepts mode parameter */ -+ QEMU_CAPS_SMP_CLUSTERS, /* -smp clusters= */ - - QEMU_CAPS_LAST /* this must always be the last item */ - } virQEMUCapsFlags; -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 85f95b41c3..dc7fb871e7 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -7335,14 +7335,11 @@ qemuBuildSmpCommandLine(virCommandPtr cmd, - _("Only 1 die per socket is supported")); - return -1; - } -- if (def->cpu->clusters != 1) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("Only 1 cluster per dies is supported")); -- return -1; -- } - virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_DIES)) - virBufferAsprintf(&buf, ",dies=%u", def->cpu->dies); -+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SMP_CLUSTERS)) -+ virBufferAsprintf(&buf, ",clusters=%u", def->cpu->clusters); - virBufferAsprintf(&buf, ",cores=%u", def->cpu->cores); - virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads); - } else { -diff --git a/tests/qemuxml2argvdata/smp-clusters.args b/tests/qemuxml2argvdata/smp-clusters.args -new file mode 100644 -index 0000000000..ab91ad7218 ---- /dev/null -+++ b/tests/qemuxml2argvdata/smp-clusters.args -@@ -0,0 +1,30 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/tmp/lib/domain--1-QEMUGuest1 \ -+USER=test \ -+LOGNAME=test \ -+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/qemu-system-i386 \ -+-name QEMUGuest1 \ -+-S \ -+-machine pc,usb=off,dump-guest-core=off \ -+-accel tcg \ -+-m 214 \ -+-realtime mlock=off \ -+-smp 1,maxcpus=4,sockets=2,clusters=2,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-display none \ -+-no-user-config \ -+-nodefaults \ -+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ -+server,nowait \ -+-mon chardev=charmonitor,id=monitor,mode=control \ -+-rtc base=utc \ -+-no-shutdown \ -+-no-acpi \ -+-usb \ -+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -diff --git a/tests/qemuxml2argvdata/smp-clusters.xml b/tests/qemuxml2argvdata/smp-clusters.xml -new file mode 100644 -index 0000000000..c1845b8213 ---- /dev/null -+++ b/tests/qemuxml2argvdata/smp-clusters.xml -@@ -0,0 +1,33 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 4 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-i386 -+ -+ -+ -+ -+
-+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index ec90532b5f..df62dfacb6 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -1828,6 +1828,7 @@ mymain(void) - - DO_TEST("smp", NONE); - DO_TEST("smp-dies", QEMU_CAPS_SMP_DIES); -+ DO_TEST("smp-clusters", QEMU_CAPS_SMP_CLUSTERS); - - DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD); - DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD); --- -2.25.1 - diff --git a/disk-storage-fix-allocation-size-for-pool-format-dos.patch b/disk-storage-fix-allocation-size-for-pool-format-dos.patch deleted file mode 100644 index 061ba4fd1f83fe10d80ce84412829831f10e7903..0000000000000000000000000000000000000000 --- a/disk-storage-fix-allocation-size-for-pool-format-dos.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 9e4751b3a9c0435c4cb199c353144acb55458473 Mon Sep 17 00:00:00 2001 -From: Sebastian Mitterle -Date: Sat, 29 Aug 2020 00:49:07 +0000 -Subject: [PATCH 027/108] disk storage: fix allocation size for pool format dos - -The changed condition was always false because the function was always -called with boundary values 0. - -Use the free extent's start value to get its start offset from the -cylinder boundary and determine if the needed size for allocation -needs to be expanded too in case the offset doesn't fit within extra -bytes for alignment. - -This fixes an issue where vol-create-from will call qemu-img convert -to create a destination volume of same capacity as the source volume -and qemu-img will error 'Cannot grow device files' due to the partition -being too small for the source although both destination partition and -source volume have the same capacity. - -Signed-off-by: Sebastian Mitterle -Reviewed-by: Michal Privoznik -(cherry picked from commit 653fdf48e352814efdbff72aa5421f65385088ac) ---- - src/storage/storage_backend_disk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c -index eae23ec24a..da06357b90 100644 ---- a/src/storage/storage_backend_disk.c -+++ b/src/storage/storage_backend_disk.c -@@ -691,7 +691,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool, - if (def->source.format == VIR_STORAGE_POOL_DISK_DOS) { - /* align to cylinder boundary */ - neededSize += extraBytes; -- if ((*start % cylinderSize) > extraBytes) { -+ if ((dev->freeExtents[i].start % cylinderSize) > extraBytes) { - /* add an extra cylinder if the offset can't fit within - the extra bytes we have */ - neededSize += cylinderSize; --- -2.33.0 - diff --git a/docs-Document-CPU-clusters.patch b/docs-Document-CPU-clusters.patch new file mode 100644 index 0000000000000000000000000000000000000000..7b8a280a45cf2ae9d8e1d89771183f5af0469652 --- /dev/null +++ b/docs-Document-CPU-clusters.patch @@ -0,0 +1,124 @@ +From 0041b76d5b82a15cbb0b1d6f70fe12e5017b940a Mon Sep 17 00:00:00 2001 +From: Andrea Bolognani +Date: Mon, 8 Jan 2024 16:11:51 +0100 +Subject: [PATCH] docs: Document CPU clusters + +Signed-off-by: Andrea Bolognani +Reviewed-by: Peter Krempa +--- + docs/formatcaps.rst | 26 ++++++++++++++++---------- + docs/formatdomain.rst | 18 ++++++++++-------- + 2 files changed, 26 insertions(+), 18 deletions(-) + +diff --git a/docs/formatcaps.rst b/docs/formatcaps.rst +index 60f8b7caca..f37532296f 100644 +--- a/docs/formatcaps.rst ++++ b/docs/formatcaps.rst +@@ -77,6 +77,12 @@ The ```` element consists of the following child elements: + Note that not all architectures support CPU dies: if the current + architecture doesn't, the value will be 0 for all CPUs. + ++ ``cluster_id`` ++ Identifier for the cluster the CPU is in. ++ ++ Note that not all architectures support CPU clusters: if the current ++ architecture doesn't, the value will be 0 for all CPUs. ++ + ``core_id`` + Identifier for the core the CPU is in. + +@@ -84,7 +90,7 @@ The ```` element consists of the following child elements: + List of CPUs that are in the same core. + + The list will include the current CPU, plus all other CPUs that have the +- same values for ``socket_id``, ``die_id`` and ``core_id``. ++ same values for ``socket_id``, ``die_id``, ``cluster_id`` and ``core_id``. + + ``secmodel`` + To find out default security labels for different security models you need to +@@ -196,7 +202,7 @@ capabilities enabled in the chip and BIOS you will see: + + + +- ++ + + + +@@ -261,14 +267,14 @@ capabilities enabled in the chip and BIOS you will see: + + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 366918b32c..2d794cc8a2 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -1377,7 +1377,7 @@ following collection of elements. :since:`Since 0.7.5` + + core2duo + Intel +- ++ + + + +@@ -1388,7 +1388,7 @@ following collection of elements. :since:`Since 0.7.5` + + + +- ++ + + ... + +@@ -1414,7 +1414,7 @@ In case no restrictions need to be put on CPU model and its features, a simpler + + ... + +- ++ + + ... + +@@ -1579,12 +1579,14 @@ In case no restrictions need to be put on CPU model and its features, a simpler + ``topology`` + The ``topology`` element specifies requested topology of virtual CPU provided + to the guest. +- Its attributes ``sockets``, ``dies`` (:since:`Since 6.1.0`), ``cores``, +- and ``threads`` accept non-zero positive integer values. ++ Its attributes ``sockets``, ``dies`` (:since:`Since 6.1.0`), ``clusters`` ++ (:since:`Since 10.1.0`), ``cores``, and ``threads`` accept non-zero positive ++ integer values. + They refer to the total number of CPU sockets, number of dies per socket, +- number of cores per die, and number of threads per core, respectively. +- The ``dies`` attribute is optional and will default to 1 if omitted, while +- the other attributes are all mandatory. ++ number of clusters per die, number of cores per cluster, and number of ++ threads per core, respectively. ++ The ``dies`` and ``clusters`` attributes are optional and will default to 1 ++ if omitted, while the other attributes are all mandatory. + Hypervisors may require that the maximum number of vCPUs specified + by the ``cpus`` element equals to the number of vcpus resulting from the + topology. +-- +2.27.0 + diff --git a/docs-Fix-template-matching-in-page.xsl.patch b/docs-Fix-template-matching-in-page.xsl.patch deleted file mode 100644 index 29478d685730448df473d651dc7e57082390a24a..0000000000000000000000000000000000000000 --- a/docs-Fix-template-matching-in-page.xsl.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2fc51790318ec17fbca46185991fac8cc3302ec0 Mon Sep 17 00:00:00 2001 -From: Martin Kletzander -Date: Mon, 21 Feb 2022 09:26:13 +0100 -Subject: [PATCH] docs: Fix template matching in page.xsl - -Our last default template had a match of "node()" which incidentally matched -everything, including text nodes. Since this has the same priority according to -the XSLT spec, section 5.5: - - https://www.w3.org/TR/1999/REC-xslt-19991116#conflict - -this is an error. Also according to the same spec section, the XSLT processor -may signal the error or pick the last rule. - -This was uncovered with libxslt 1.1.35 which contains the following commit: - - https://gitlab.gnome.org/GNOME/libxslt/-/commit/b0074eeca3c6b21b4da14fdf712b853900c51635 - -which makes the build fail with: - - runtime error: file ../docs/page.xsl line 223 element element - xsl:element: The effective name '' is not a valid QName. - -because our last rule also matches text nodes and we are trying to extract the -node name out of them. - -To fix this we change the match to "*" which only matches elements and not all -the nodes, and to avoid any possible errors with different XSLT processors we -also bump the priority of the match="text()" rule a little higher, just in case -someone needs to use an XSLT processor that chooses signalling the error instead -of the optional recovery. - -https://bugs.gentoo.org/833586 - -Signed-off-by: Martin Kletzander ---- - docs/page.xsl | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/docs/page.xsl b/docs/page.xsl -index ddae5ab508..5dc46329fd 100644 ---- a/docs/page.xsl -+++ b/docs/page.xsl -@@ -194,11 +194,11 @@ - - - -- -+ - - - -- -+ - - - --- -2.27.0 - diff --git a/docs-Improve-documentation-for-CPU-topology.patch b/docs-Improve-documentation-for-CPU-topology.patch new file mode 100644 index 0000000000000000000000000000000000000000..8d620c9afb7afdf8d9a1c5c2b88a8b03d70613bc --- /dev/null +++ b/docs-Improve-documentation-for-CPU-topology.patch @@ -0,0 +1,119 @@ +From 35d7f3c8b34744d8430eb9487a106e3a98f372e4 Mon Sep 17 00:00:00 2001 +From: Andrea Bolognani +Date: Mon, 8 Jan 2024 16:13:25 +0100 +Subject: [PATCH] docs: Improve documentation for CPU topology + +On the guest configuration side, mention that support for the +"dies" attribute was introduced in libvirt 6.1.0 and clarify +that the ability to use non-default values is subject to +architecture and machine limitations. + +On the host capabilities side, the documentation was pretty +much entirely missing. It's still far from perfect, but anything +is better than having no information at all. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Peter Krempa +--- + docs/formatcaps.rst | 48 +++++++++++++++++++++++++++++++++++++------ + docs/formatdomain.rst | 16 +++++++++------ + 2 files changed, 52 insertions(+), 12 deletions(-) + +diff --git a/docs/formatcaps.rst b/docs/formatcaps.rst +index 3cccf70882..60f8b7caca 100644 +--- a/docs/formatcaps.rst ++++ b/docs/formatcaps.rst +@@ -37,6 +37,12 @@ The ```` element consists of the following child elements: + The host UUID. + ``cpu`` + The host CPU architecture and features. ++ ++ Note that, while this element contains a ``topology`` sub-element, ++ the information contained therein is farily high-level and likely ++ not very useful when it comes to optimizing guest vCPU placement. ++ Look into the ``topology`` *element*, described below, for more ++ detailed information. + ``power_management`` + whether host is capable of memory suspend, disk hibernation, or hybrid + suspend. +@@ -44,12 +50,42 @@ The ```` element consists of the following child elements: + This element exposes information on the hypervisor's migration capabilities, + like live migration, supported URI transports, and so on. + ``topology`` +- This element embodies the host internal topology. Management applications may +- want to learn this information when orchestrating new guests - e.g. due to +- reduce inter-NUMA node transfers. Note that the ``sockets`` value reported +- here is per-NUMA-node; this is in contrast to the value given in domain +- definitions, which is interpreted as a total number of sockets for the +- domain. ++ This element describes the host CPU topology in detail. ++ ++ Management applications may want to use this information when defining new ++ guests: for example, in order to ensure that all vCPUs are scheduled on ++ CPUs that are in the same NUMA node or even CPU core. ++ ++ The ``cells`` sub-element contains a list of NUMA nodes, each one ++ represented by a single ``cell`` element. Within each ``cell``, a ``cpus`` ++ sub-element contains a list of logical CPUs, each one represented by a ++ single ``cpu`` element. In both cases, the ``num`` attribute of the ++ top-level element contains the number of children. ++ ++ Each ``cpu`` element contains the following attributes: ++ ++ ``id`` ++ CPU identifier. Can be used to refer to it in the context of ++ `CPU tuning `__. ++ ++ ``socket_id`` ++ Identifier for the physical package the CPU is in. ++ ++ ``die_id`` ++ Identifier for the die the CPU is in. ++ ++ Note that not all architectures support CPU dies: if the current ++ architecture doesn't, the value will be 0 for all CPUs. ++ ++ ``core_id`` ++ Identifier for the core the CPU is in. ++ ++ ``siblings`` ++ List of CPUs that are in the same core. ++ ++ The list will include the current CPU, plus all other CPUs that have the ++ same values for ``socket_id``, ``die_id`` and ``core_id``. ++ + ``secmodel`` + To find out default security labels for different security models you need to + parse this element. In contrast with the former elements, this is repeated +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 310d2bc427..366918b32c 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -1578,14 +1578,18 @@ In case no restrictions need to be put on CPU model and its features, a simpler + supported vendors can be found in ``cpu_map/*_vendors.xml``. + ``topology`` + The ``topology`` element specifies requested topology of virtual CPU provided +- to the guest. Four attributes, ``sockets``, ``dies``, ``cores``, and +- ``threads``, accept non-zero positive integer values. They refer to the +- total number of CPU sockets, number of dies per socket, number of cores per +- die, and number of threads per core, respectively. The ``dies`` attribute is +- optional and will default to 1 if omitted, while the other attributes are all +- mandatory. Hypervisors may require that the maximum number of vCPUs specified ++ to the guest. ++ Its attributes ``sockets``, ``dies`` (:since:`Since 6.1.0`), ``cores``, ++ and ``threads`` accept non-zero positive integer values. ++ They refer to the total number of CPU sockets, number of dies per socket, ++ number of cores per die, and number of threads per core, respectively. ++ The ``dies`` attribute is optional and will default to 1 if omitted, while ++ the other attributes are all mandatory. ++ Hypervisors may require that the maximum number of vCPUs specified + by the ``cpus`` element equals to the number of vcpus resulting from the + topology. ++ Moreover, not all architectures and machine types support specifying a value ++ other than 1 for all attributes. + ``feature`` + The ``cpu`` element can contain zero or more ``feature`` elements used to + fine-tune features provided by the selected CPU model. The list of known +-- +2.27.0 + diff --git a/docs-build-Don-t-include-stylesheet-in-intermediate-.patch b/docs-build-Don-t-include-stylesheet-in-intermediate-.patch deleted file mode 100644 index b13d5e0987f025a28ecc6b4060a979496e7a688d..0000000000000000000000000000000000000000 --- a/docs-build-Don-t-include-stylesheet-in-intermediate-.patch +++ /dev/null @@ -1,62 +0,0 @@ -From c99e7e8abe1e22f504173a976a82e1a72551bdc1 Mon Sep 17 00:00:00 2001 -From: Peter Krempa -Date: Mon, 3 Aug 2020 07:32:29 +0200 -Subject: [PATCH] docs: build: Don't include stylesheet in intermediate html - files generated from RST -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -'docutils' add a stylesheet to the output html file for direct -consumption. Since we use the html files just as an intermediate step -which is post-processed to add our own stylesheet and drop the docutils -one in the process we can ask 'rst2html' to not add any for an -intermediate file with less garbage. - -Signed-off-by: Peter Krempa -Reviewed-by: Ján Tomko -Signed-off-by: rpm-build ---- - docs/Makefile.am | 4 ++-- - docs/Makefile.in | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/docs/Makefile.am b/docs/Makefile.am -index 61862c4..4c44504 100644 ---- a/docs/Makefile.am -+++ b/docs/Makefile.am -@@ -420,11 +420,11 @@ manpages/%.html.in: manpages/%.rst - grep -v '^:Manual ' < $< | \ - sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \ - -e 's|RUNSTATEDIR|$(runstatedir)|g' | \ -- $(RST2HTML) --strict > $@ || { rm $@ && exit 1; } -+ $(RST2HTML) --stylesheet= --strict > $@ || { rm $@ && exit 1; } - - %.html.in: %.rst - $(AM_V_GEN)$(MKDIR_P) `dirname $@` && \ -- $(RST2HTML) --strict $< > $@ || { rm $@ && exit 1; } -+ $(RST2HTML) --stylesheet= --strict $< > $@ || { rm $@ && exit 1; } - - %.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \ - $(acl_generated) -diff --git a/docs/Makefile.in b/docs/Makefile.in -index 61eac52..1836655 100644 ---- a/docs/Makefile.in -+++ b/docs/Makefile.in -@@ -1469,11 +1469,11 @@ manpages/%.html.in: manpages/%.rst - grep -v '^:Manual ' < $< | \ - sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \ - -e 's|RUNSTATEDIR|$(runstatedir)|g' | \ -- $(RST2HTML) --strict > $@ || { rm $@ && exit 1; } -+ $(RST2HTML) --stylesheet= --strict > $@ || { rm $@ && exit 1; } - - %.html.in: %.rst - $(AM_V_GEN)$(MKDIR_P) `dirname $@` && \ -- $(RST2HTML) --strict $< > $@ || { rm $@ && exit 1; } -+ $(RST2HTML) --stylesheet= --strict $< > $@ || { rm $@ && exit 1; } - - %.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \ - $(acl_generated) --- -2.27.0 - diff --git a/docs-introduces-new-vhostuser-disk-type.patch b/docs-introduces-new-vhostuser-disk-type.patch deleted file mode 100644 index f08325387090ff3f3be44f502417e43d3f638762..0000000000000000000000000000000000000000 --- a/docs-introduces-new-vhostuser-disk-type.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 0b8ff5672665c3792c27c02d9d05e0951c03d440 Mon Sep 17 00:00:00 2001 -From: Luo Yifan -Date: Wed, 30 Nov 2022 18:13:36 +0800 -Subject: [PATCH 14/24] docs: introduces new vhostuser disk type -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - - - - - - - - -Signed-off-by: Pavel Hrdina -Reviewed-by: Ján Tomko -Reviewed-by: Peter Krempa -(cherry picked from commit e88bdaf789b6f1cc5347b217240f15afd86a94c1) -Signed-off-by: Luo Yifan ---- - docs/formatdomain.html.in | 51 ++++++++++++++++++++++++++++++++++- - docs/schemas/domaincommon.rng | 19 +++++++++++++ - 2 files changed, 69 insertions(+), 1 deletion(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index aaeb05961f..5860ec9f20 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -2977,6 +2977,13 @@ - </source> - <target dev='vde' bus='virtio'/> - </disk> -+ <disk type='vhostuser' device='disk'> -+ <driver name='qemu' type='raw'/> -+ <source type='unix' path='/tmp/vhost-blk.sock'> -+ <reconnect enabled='yes' timeout='10'/> -+ </source> -+ <target dev='vdf' bus='virtio'/> -+ </disk> - </devices> - ... - -@@ -2991,7 +2998,8 @@ - "dir" (since 0.7.5), - "network" (since 0.8.7), or - "volume" (since 1.0.5), or -- "nvme" (since 6.0.0) -+ "nvme" (since 6.0.0), or -+ "vhostuser" (since 6.2.0) - and refer to the underlying source for the disk. - Since 0.0.3 -
-@@ -3217,6 +3225,31 @@ - <disk type='block'> and therefore lower - latencies can be achieved. - -+
vhostuser
-+
-+ Enables the hypervisor to connect to another process using vhost-user -+ protocol. Requires shared memory configured for the VM, for more details -+ see access mode for -+ memoryBacking <#elementsMemoryBacking> element. -+ -+ The source element has following mandatory attributes: -+
-+
type
-+
The type of char device. Currently only unix type -+ is supported. -+
-+ -+
path
-+
Path to the unix socket to be used as disk source. -+
-+
-+ -+ Note that the vhost server replaces both the disk frontend and backend -+ thus almost all of the disk properties can't be configured via the -+ <disk> XML for this disk type. Additionally features -+ such as blockjobs, incremental backups and snapshots are not supported -+ for this disk type. -+
- - With "file", "block", and "volume", one or more optional - sub-elements seclabel, described -@@ -3424,6 +3457,22 @@ - Note that '0' is considered as if the value is not provided. - Since 6.2.0 - -+
reconnect
-+
-+ For disk type vhostuser configures reconnect timeout -+ if the connection is lost. It has two mandatory attributes: -+
-+
enabled
-+
If the reconnect feature is enabled, acceptsyes -+ and no -+
-+ -+
timeout
-+
The amount of seconds after which hypervisor tries to reconnect. -+
-+
-+ Since 6.2.0 -+
- - -

-diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 1807df521c..764f826df4 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -1631,6 +1631,7 @@ - - - -+ - - - -@@ -2103,6 +2104,24 @@ - - - -+ -+ -+ vhostuser -+ -+ -+ -+ unix -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - (ioemu:)?(fd|hd|sd|vd|xvd|ubd)[a-zA-Z0-9_]+ --- -2.27.0 - diff --git a/domain-add-logs-for-virDomainHotpatchManage.patch b/domain-add-logs-for-virDomainHotpatchManage.patch index ef63bf495abf03a2d6f94e65d3489eb050205505..e0c062155553c9cfc7da741af5ec2ad8120bcb9f 100644 --- a/domain-add-logs-for-virDomainHotpatchManage.patch +++ b/domain-add-logs-for-virDomainHotpatchManage.patch @@ -1,4 +1,4 @@ -From e59b2064ffefbc94c729d38ec0180197e2b1f8ed Mon Sep 17 00:00:00 2001 +From a7f63f8c85e3bc287920ed83361e4f44ce2e25d7 Mon Sep 17 00:00:00 2001 From: AlexChen Date: Mon, 12 Jul 2021 21:28:41 +0800 Subject: [PATCH] domain: add logs for virDomainHotpatchManage @@ -13,10 +13,10 @@ Signed-off-by: AlexChen 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index 068ab52f54..3cf6bcb3b4 100644 +index 21b01110fe..b1c5a8c52c 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c -@@ -12777,12 +12777,21 @@ virDomainHotpatchManage(virDomainPtr domain, +@@ -13829,12 +13829,21 @@ virDomainHotpatchManage(virDomainPtr domain, if (action == VIR_DOMAIN_HOTPATCH_UNAPPLY) virCheckNonNullArgGoto(id, error); diff --git a/domain_capabilities-Assert-enums-fit-into-unsigned-i.patch b/domain_capabilities-Assert-enums-fit-into-unsigned-i.patch deleted file mode 100644 index db0eadb4379d4681fc3dd7a997b25f8544077e39..0000000000000000000000000000000000000000 --- a/domain_capabilities-Assert-enums-fit-into-unsigned-i.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 11073a79e7c7275436a43a43dd6b6e772b05588f Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Wed, 18 Nov 2020 11:58:01 +0100 -Subject: [PATCH 066/108] domain_capabilities: Assert enums fit into unsigned - int bitmask - -The way our domain capabilities work currently, is that we have -virDomainCapsEnum struct which contains 'unsigned int values' -member which serves as a bitmask. More complicated structs are -composed from this struct, giving us whole virDomainCaps -eventually. - -Whenever we want to report that a certain value is supported, the -'1 << value' bit is set in the corresponding unsigned int member. -This works as long as the resulting value after bitshift does not -overflow unsigned int. There is a check inside -virDomainCapsEnumSet() which ensures exactly this, but no caller -really checks whether virDomainCapsEnumSet() succeeded. Also, -checking at runtime is a bit too late. - -Fortunately, we know the largest value we want to store in each -member, because each enum of ours ends with _LAST member. -Therefore, we can check at build time whether an overflow can -occur. - -Signed-off-by: Michal Privoznik -Reviewed-by: Erik Skultety -(cherry picked from commit 912421e7b63a358d552b79fac62a5518ec58f4e5) ---- - src/conf/domain_capabilities.h | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h -index 9f4a23d015..0345c84855 100644 ---- a/src/conf/domain_capabilities.h -+++ b/src/conf/domain_capabilities.h -@@ -36,6 +36,9 @@ struct _virDomainCapsEnum { - unsigned int values; /* Bitmask of values supported in the corresponding enum */ - }; - -+#define STATIC_ASSERT_ENUM(last) \ -+ G_STATIC_ASSERT(last <= sizeof(unsigned int) * CHAR_BIT) -+ - typedef struct _virDomainCapsStringValues virDomainCapsStringValues; - typedef virDomainCapsStringValues *virDomainCapsStringValuesPtr; - struct _virDomainCapsStringValues { -@@ -43,6 +46,8 @@ struct _virDomainCapsStringValues { - size_t nvalues; /* number of strings */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_LOADER_TYPE_LAST); -+STATIC_ASSERT_ENUM(VIR_TRISTATE_BOOL_LAST); - typedef struct _virDomainCapsLoader virDomainCapsLoader; - typedef virDomainCapsLoader *virDomainCapsLoaderPtr; - struct _virDomainCapsLoader { -@@ -53,6 +58,7 @@ struct _virDomainCapsLoader { - virDomainCapsEnum secure; /* Info about secure:virTristateBool */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_OS_DEF_FIRMWARE_LAST); - typedef struct _virDomainCapsOS virDomainCapsOS; - typedef virDomainCapsOS *virDomainCapsOSPtr; - struct _virDomainCapsOS { -@@ -61,6 +67,9 @@ struct _virDomainCapsOS { - virDomainCapsLoader loader; /* Info about virDomainLoaderDef */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_DEVICE_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_BUS_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_MODEL_LAST); - typedef struct _virDomainCapsDeviceDisk virDomainCapsDeviceDisk; - typedef virDomainCapsDeviceDisk *virDomainCapsDeviceDiskPtr; - struct _virDomainCapsDeviceDisk { -@@ -71,6 +80,7 @@ struct _virDomainCapsDeviceDisk { - /* add new fields here */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_GRAPHICS_TYPE_LAST); - typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics; - typedef virDomainCapsDeviceGraphics *virDomainCapsDeviceGraphicsPtr; - struct _virDomainCapsDeviceGraphics { -@@ -78,6 +88,7 @@ struct _virDomainCapsDeviceGraphics { - virDomainCapsEnum type; /* virDomainGraphicsType */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_VIDEO_TYPE_LAST); - typedef struct _virDomainCapsDeviceVideo virDomainCapsDeviceVideo; - typedef virDomainCapsDeviceVideo *virDomainCapsDeviceVideoPtr; - struct _virDomainCapsDeviceVideo { -@@ -85,6 +96,11 @@ struct _virDomainCapsDeviceVideo { - virDomainCapsEnum modelType; /* virDomainVideoType */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_MODE_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_STARTUP_POLICY_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST); - typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev; - typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr; - struct _virDomainCapsDeviceHostdev { -@@ -97,6 +113,8 @@ struct _virDomainCapsDeviceHostdev { - /* add new fields here */ - }; - -+STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_MODEL_LAST); -+STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_BACKEND_LAST); - typedef struct _virDomainCapsDeviceRNG virDomainCapsDeviceRNG; - typedef virDomainCapsDeviceRNG *virDomainCapsDeviceRNGPtr; - struct _virDomainCapsDeviceRNG { -@@ -105,6 +123,7 @@ struct _virDomainCapsDeviceRNG { - virDomainCapsEnum backendModel; /* virDomainRNGBackend */ - }; - -+STATIC_ASSERT_ENUM(VIR_GIC_VERSION_LAST); - typedef struct _virDomainCapsFeatureGIC virDomainCapsFeatureGIC; - typedef virDomainCapsFeatureGIC *virDomainCapsFeatureGICPtr; - struct _virDomainCapsFeatureGIC { --- -2.33.0 - diff --git a/domain_cgroup.c-update-domain-after-setting-blkio.we.patch b/domain_cgroup.c-update-domain-after-setting-blkio.we.patch deleted file mode 100644 index c7e8c4d3a4a5a108b0ec9343e159dbb5dcea01bd..0000000000000000000000000000000000000000 --- a/domain_cgroup.c-update-domain-after-setting-blkio.we.patch +++ /dev/null @@ -1,48 +0,0 @@ -From da99b4e69fab6a14f55873a0b27f962ed6ed5f11 Mon Sep 17 00:00:00 2001 -From: Daniel Henrique Barboza -Date: Mon, 22 Mar 2021 16:28:59 -0300 -Subject: [PATCH 091/108] domain_cgroup.c: update domain after setting - blkio.weight -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit ac87d3520ad5 consolidated common cgroup code between the QEMU and -lxc drivers in domain_cgroup.c. In this process, in -virDomainCgroupSetupDomainBlkioParameters(), a call to -virCgroupGetBlkioWeight() went missing. - -The result is that 'virsh blkiotune' is setting the blkio.weight for the -guest in the host cgroup, but not on the domain XML, because -virCgroupGetBlkioWeight() is also used to write the blkio.weight value -in the domain object. - -Fix it by adding the virCgroupGetBlkioWeight() call in the -virDomainCgroupSetupDomainBlkioParameters() helper. - -Fixes: ac87d3520ad542d558854a72b0ae0a81fddc6747 -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1941407 -Reviewed-by: Ján Tomko -Signed-off-by: Daniel Henrique Barboza -(cherry picked from commit e2602f2bb186da100116a5668d95ca829b7f2767) ---- - src/hypervisor/domain_cgroup.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c -index eb4fa20a9e..05e3aa7e6a 100644 ---- a/src/hypervisor/domain_cgroup.c -+++ b/src/hypervisor/domain_cgroup.c -@@ -104,7 +104,8 @@ virDomainCgroupSetupDomainBlkioParameters(virCgroupPtr cgroup, - virTypedParameterPtr param = ¶ms[i]; - - if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { -- if (virCgroupSetBlkioWeight(cgroup, params[i].value.ui) < 0) -+ if (virCgroupSetBlkioWeight(cgroup, params[i].value.ui) < 0 || -+ virCgroupGetBlkioWeight(cgroup, &def->blkio.weight) < 0) - ret = -1; - } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) || - STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) || --- -2.33.0 - diff --git a/domain_conf-fix-NULL-dereference-on-error-in-virDoma.patch b/domain_conf-fix-NULL-dereference-on-error-in-virDoma.patch deleted file mode 100644 index 8806010b31d6ad9da25f7d173c10072c02d0b32f..0000000000000000000000000000000000000000 --- a/domain_conf-fix-NULL-dereference-on-error-in-virDoma.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5862d4429c3c3b813b46c32830800df34c6dafe0 Mon Sep 17 00:00:00 2001 -From: Pavel Hrdina -Date: Wed, 11 Mar 2020 13:25:59 +0100 -Subject: [PATCH 074/108] domain_conf: fix NULL dereference on error in - virDomainObjCopyPersistentDef - -The issue was introduced together with the function itself by commit -. Calling -`virDomainObjGetPersistentDef` may return NULL which is later passed -to `virDomainDefFormat` where the `def` attribute is marked as NONNULL -and later in `virDomainDefFormatInternalSetRootName` it is actually -defererenced without any other check. - -Signed-off-by: Pavel Hrdina -Reviewed-by: Peter Krempa -(cherry picked from commit b96174d9f2dcf0197bb6e58eea3fbbda17043478) ---- - src/conf/domain_conf.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 9c83f4e347..b60b9d31a1 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -30074,6 +30074,12 @@ virDomainObjCopyPersistentDef(virDomainObjPtr dom, - virDomainDefPtr cur; - - cur = virDomainObjGetPersistentDef(xmlopt, dom, parseOpaque); -+ if (!cur) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("failed to get persistent definition object")); -+ return NULL; -+ } -+ - return virDomainDefCopy(cur, xmlopt, parseOpaque, false); - } - --- -2.33.0 - diff --git a/domain_conf.c-do-not-leak-video-in-virDomainDefParse.patch b/domain_conf.c-do-not-leak-video-in-virDomainDefParse.patch deleted file mode 100644 index 084a3f74aad798dad60275c2b890e474f3412c5f..0000000000000000000000000000000000000000 --- a/domain_conf.c-do-not-leak-video-in-virDomainDefParse.patch +++ /dev/null @@ -1,65 +0,0 @@ -From fbb537ad89c6820e8763a57722cebc5a3db363e0 Mon Sep 17 00:00:00 2001 -From: Daniel Henrique Barboza -Date: Thu, 19 Nov 2020 13:57:43 -0300 -Subject: [PATCH 067/108] domain_conf.c: do not leak 'video' in - virDomainDefParseXML() - -The 'video' pointer is only being freed on error path, meaning -that we're leaking it after each loop restart. - -There are more opportunities for auto cleanups of virDomainVideoDef -pointers, so let's register AUTOPTR_CLEANUP_FUNC for it to use -g_autoptr() later on. - -Reviewed-by: Michal Privoznik -Signed-off-by: Daniel Henrique Barboza -(cherry picked from commit 18d29844c616fb633f7042dbe4cf80819cdd2f1d) ---- - src/conf/domain_conf.c | 4 +--- - src/conf/domain_conf.h | 1 + - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index d3565ececf..a33f9144f5 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -21631,7 +21631,7 @@ virDomainDefParseXML(xmlDocPtr xml, - if (n && VIR_ALLOC_N(def->videos, n) < 0) - goto error; - for (i = 0; i < n; i++) { -- virDomainVideoDefPtr video; -+ g_autoptr(virDomainVideoDef) video = NULL; - ssize_t insertAt = -1; - - if (!(video = virDomainVideoDefParseXML(xmlopt, nodes[i], -@@ -21640,7 +21640,6 @@ virDomainDefParseXML(xmlDocPtr xml, - - if (video->primary) { - if (def->nvideos != 0 && def->videos[0]->primary) { -- virDomainVideoDefFree(video); - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Only one primary video device is supported")); - goto error; -@@ -21652,7 +21651,6 @@ virDomainDefParseXML(xmlDocPtr xml, - insertAt, - def->nvideos, - video) < 0) { -- virDomainVideoDefFree(video); - goto error; - } - } -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index e057c384c6..15b9e79d69 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2938,6 +2938,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def); - void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); - virDomainVideoDefPtr virDomainVideoDefNew(virDomainXMLOptionPtr xmlopt); - void virDomainVideoDefFree(virDomainVideoDefPtr def); -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVideoDef, virDomainVideoDefFree); - void virDomainVideoDefClear(virDomainVideoDefPtr def); - virDomainHostdevDefPtr virDomainHostdevDefNew(void); - void virDomainHostdevDefClear(virDomainHostdevDefPtr def); --- -2.33.0 - diff --git a/enum-Add-helpers-for-converting-virTristate-to-a-pla.patch b/enum-Add-helpers-for-converting-virTristate-to-a-pla.patch deleted file mode 100644 index 78c611b96b2ef9fca983766f8559fdef67e0449e..0000000000000000000000000000000000000000 --- a/enum-Add-helpers-for-converting-virTristate-to-a-pla.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 04c5fee85547da11323b66b2fb79fb590e8307a1 Mon Sep 17 00:00:00 2001 -From: jiangdawei15 -Date: Thu, 18 Aug 2022 20:15:54 +0800 -Subject: [PATCH 22/22] enum: Add helpers for converting virTristate* to a - plain bool -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The helpers will update the passed boolean if the tristate's value is -not _ABSENT. - -Signed-off-by: Peter Krempa -Reviewed-by: Ján Tomko ---- - src/libvirt_private.syms | 2 ++ - src/util/virenum.c | 54 ++++++++++++++++++++++++++++++++++++++++ - src/util/virenum.h | 2 ++ - 3 files changed, 58 insertions(+) - -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index f30eb7ffb5..a00e354859 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -1965,9 +1965,11 @@ ebtablesRemoveForwardAllowIn; - virEnumFromString; - virEnumToString; - virTristateBoolFromBool; -+virTristateBoolToBool; - virTristateBoolTypeFromString; - virTristateBoolTypeToString; - virTristateSwitchFromBool; -+virTristateSwitchToBool; - virTristateSwitchTypeFromString; - virTristateSwitchTypeToString; - -diff --git a/src/util/virenum.c b/src/util/virenum.c -index 26093bd795..dfedc28ba7 100644 ---- a/src/util/virenum.c -+++ b/src/util/virenum.c -@@ -47,6 +47,33 @@ virTristateBoolFromBool(bool val) - } - - -+/** -+ * virTristateBoolToBool: The value pointed to by @b is -+ * updated if the tristate value @t is not absent. -+ * -+ * @t: a virTristateBool value -+ * @b: pointer to a boolean to be updated according to the value of @t -+ */ -+void -+virTristateBoolToBool(virTristateBool t, -+ bool *b) -+{ -+ switch (t) { -+ case VIR_TRISTATE_BOOL_YES: -+ *b = true; -+ break; -+ -+ case VIR_TRISTATE_BOOL_NO: -+ *b = false; -+ break; -+ -+ case VIR_TRISTATE_BOOL_ABSENT: -+ case VIR_TRISTATE_BOOL_LAST: -+ break; -+ } -+} -+ -+ - virTristateSwitch - virTristateSwitchFromBool(bool val) - { -@@ -57,6 +84,33 @@ virTristateSwitchFromBool(bool val) - } - - -+/** -+ * virTristateSwitchToBool: The value pointed to by @b -+ * is updated if the tristate value @t is not absent. -+ * -+ * @t: a virTristateSwitch value -+ * @b: pointer to a boolean to be updated according to the value of @t -+ */ -+void -+virTristateSwitchToBool(virTristateSwitch t, -+ bool *b) -+{ -+ switch (t) { -+ case VIR_TRISTATE_SWITCH_ON: -+ *b = true; -+ break; -+ -+ case VIR_TRISTATE_SWITCH_OFF: -+ *b = false; -+ break; -+ -+ case VIR_TRISTATE_SWITCH_ABSENT: -+ case VIR_TRISTATE_SWITCH_LAST: -+ break; -+ } -+} -+ -+ - int - virEnumFromString(const char * const *types, - unsigned int ntypes, -diff --git a/src/util/virenum.h b/src/util/virenum.h -index d74af35530..98f01d574d 100644 ---- a/src/util/virenum.h -+++ b/src/util/virenum.h -@@ -68,7 +68,9 @@ VIR_ENUM_DECL(virTristateBool); - VIR_ENUM_DECL(virTristateSwitch); - - virTristateBool virTristateBoolFromBool(bool val); -+void virTristateBoolToBool(virTristateBool t, bool *b); - virTristateSwitch virTristateSwitchFromBool(bool val); -+void virTristateSwitchToBool(virTristateSwitch t, bool *b); - - /* the two enums must be in sync to be able to use helpers interchangeably in - * some special cases */ --- -2.33.0 - diff --git a/esx-call-freeaddrinfo-earlier-in-esxUtil_ResolveHost.patch b/esx-call-freeaddrinfo-earlier-in-esxUtil_ResolveHost.patch deleted file mode 100644 index ec363101af232c3bb162feb8fd92a875a279d1d2..0000000000000000000000000000000000000000 --- a/esx-call-freeaddrinfo-earlier-in-esxUtil_ResolveHost.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 9b80543fb6ebccf64d0bcbe91a2e97873886164c Mon Sep 17 00:00:00 2001 -From: tangbinzy -Date: Thu, 16 Mar 2023 07:03:51 +0000 -Subject: [PATCH] esx: call freeaddrinfo earlier in esxUtil_ResolveHostname - Call freeaddrinfo() as soon as @result is not needed anymore, i.e. right - after getnameinfo(); this avoids calling freeaddrinfo() in two branches. - -Signed-off-by: Pino Toscano -Reviewed-by: Laine Stump - -Signed-off-by: tangbin -(cherry-pick from 3aaf23ff69cea9abb7b7a43d9ff3eb687a916a2e) ---- - src/esx/esx_util.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c -index 89d136248f..98ce462ff0 100644 ---- a/src/esx/esx_util.c -+++ b/src/esx/esx_util.c -@@ -311,17 +311,15 @@ esxUtil_ResolveHostname(const char *hostname, - - errcode = getnameinfo(result->ai_addr, result->ai_addrlen, ipAddress, - ipAddress_length, NULL, 0, NI_NUMERICHOST); -+ freeaddrinfo(result); - - if (errcode != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Formatting IP address for host '%s' failed: %s"), hostname, - gai_strerror(errcode)); -- freeaddrinfo(result); - return -1; - } - -- freeaddrinfo(result); -- - return 0; - } - --- -2.27.0 - diff --git a/examples-hellolibvirt-fix-argc-check.patch b/examples-hellolibvirt-fix-argc-check.patch deleted file mode 100644 index 7b56c05695ac804764a06bf1703da479e42bd970..0000000000000000000000000000000000000000 --- a/examples-hellolibvirt-fix-argc-check.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7a13a72308b5ad5887497e13995522ab151e6293 Mon Sep 17 00:00:00 2001 -From: wangmeiyang -Date: Wed, 30 Nov 2022 19:47:10 +0800 -Subject: [PATCH 20/24] examples: hellolibvirt: fix argc check -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://gitlab.com/libvirt/libvirt/-/issues/255 - -cherry-pick from dacf616b788a989ecaa1679845a07ff8010372cf - -Reported-by: Jeremy Alcim -Signed-off-by: Ján Tomko -Signed-off-by: Meiyang Wang ---- - examples/c/misc/hellolibvirt.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/examples/c/misc/hellolibvirt.c b/examples/c/misc/hellolibvirt.c -index a598e01be2..39cefe934c 100644 ---- a/examples/c/misc/hellolibvirt.c -+++ b/examples/c/misc/hellolibvirt.c -@@ -107,11 +107,12 @@ main(int argc, char *argv[]) - { - int ret = 0; - virConnectPtr conn; -- char *uri; -+ char *uri = NULL; - - printf("Attempting to connect to hypervisor\n"); - -- uri = (argc > 0 ? argv[1] : NULL); -+ if (argc > 1) -+ uri = argv[1]; - - /* virConnectOpenAuth is called here with all default parameters, - * except, possibly, the URI of the hypervisor. */ --- -2.27.0 - diff --git a/fix-error-in-printf-format-string.patch b/fix-error-in-printf-format-string.patch deleted file mode 100644 index 78edba3e6614031ba36d9bf14b38247cdc13ef07..0000000000000000000000000000000000000000 --- a/fix-error-in-printf-format-string.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 56dc1a61719f5133b30676afe71c4d1482c84476 Mon Sep 17 00:00:00 2001 -From: Zhenyu Ye -Date: Thu, 19 Aug 2021 20:14:11 +0800 -Subject: [PATCH] fix error in printf format string - -Use %s to print NULLSTR(duri). - -Reported-by: Peng Liang -Signed-off-by: Zhenyu Ye -Reviewed-by: Michal Privoznik -Signed-off-by: zhujun2 -(cherry-pick from 94ac9d55fd9067326c483372c858bb4233826880) ---- - src/libvirt-domain.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index 6ce4a6715c..8f6ff2fe22 100644 ---- a/src/libvirt-domain.c -+++ b/src/libvirt-domain.c -@@ -4086,7 +4086,7 @@ virDomainMigrateToURI(virDomainPtr domain, - const char *dconnuri = NULL; - const char *miguri = NULL; - -- VIR_DOMAIN_DEBUG(domain, "duri=%p, flags=0x%lx, dname=%s, bandwidth=%lu", -+ VIR_DOMAIN_DEBUG(domain, "duri=%s, flags=0x%lx, dname=%s, bandwidth=%lu", - NULLSTR(duri), flags, NULLSTR(dname), bandwidth); - - virResetLastError(); --- -2.41.0.windows.1 - diff --git a/fix-the-issue-of-errors-when-saving-after-virsh-edit.patch b/fix-the-issue-of-errors-when-saving-after-virsh-edit.patch deleted file mode 100644 index 7a0e38ae565279cfa7b538e930caa8780054e9b4..0000000000000000000000000000000000000000 --- a/fix-the-issue-of-errors-when-saving-after-virsh-edit.patch +++ /dev/null @@ -1,24 +0,0 @@ -From d5c1bd627d522b16eb87e2684a912c16ce79c12b Mon Sep 17 00:00:00 2001 -From: lifeng 71117973 -Date: Mon, 15 May 2023 15:39:32 +0800 -Subject: [PATCH] fix the issue of errors when saving after 'virsh edit' - ---- - docs/schemas/basictypes.rng | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng -index 34d285db48..8b430e71a6 100644 ---- a/docs/schemas/basictypes.rng -+++ b/docs/schemas/basictypes.rng -@@ -440,6 +440,7 @@ - sh4eb - sparc - sparc64 -+ sw_64 - unicore32 - x86_64 - xtensa --- -2.27.0 - diff --git a/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch b/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch deleted file mode 100644 index 2c6042f7f34b977608e665a08ba58addcd90a6b6..0000000000000000000000000000000000000000 --- a/glibcompat-Provide-implementation-for-G_GNUC_NO_INLI.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 1ac928729853d29d030944ece5e10db69d54267d Mon Sep 17 00:00:00 2001 -From: mayunlong -Date: Tue, 14 Feb 2023 19:09:08 +0800 -Subject: [PATCH] glibcompat: Provide implementation for G_GNUC_NO_INLINE - -Currently, we require glib-2.56.0 at minimum (because of RHEL-8) -but we use G_GNUC_NO_INLINE which was introduced in 2.58.0. While -we provide an implementation for older versions, where the macro -does not exists, it's a bit more tricky than that. Since we -define GLIB_VERSION_MAX_ALLOWED we would get a compile time error -when trying to use something too new, except for G_GNUC_NO_INLINE -which was intentionally not marked as -GLIB_AVAILABLE_MACRO_IN_2_58. But this is about to change with -glib-2.73.2 (which contains commit [1]). - -At the same time, we can't just bump glib and thus we have to -provide an alternative implementation without the version -annotation. - -1: https://gitlab.gnome.org/GNOME/glib/-/commit/a6f8fe071e44b0145619c21f3bfbc90c56ab805e -Signed-off-by: Michal Privoznik -Reviewed-by: Pavel Hrdina ---- - src/internal.h | 12 ------------ - src/util/glibcompat.h | 9 +++++++++ - 2 files changed, 9 insertions(+), 12 deletions(-) - -diff --git a/src/internal.h b/src/internal.h -index 302fddba34..440f01d370 100644 ---- a/src/internal.h -+++ b/src/internal.h -@@ -94,18 +94,6 @@ - # endif - #endif - --/** -- * G_GNUC_NO_INLINE: -- * -- * Force compiler not to inline a method. Should be used if -- * the method need to be overridable by test mocks. -- * -- * TODO: Remove after upgrading to GLib >= 2.58 -- */ --#ifndef G_GNUC_NO_INLINE --# define G_GNUC_NO_INLINE __attribute__((__noinline__)) --#endif -- - /** - * ATTRIBUTE_PACKED - * -diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h -index 6f50a76f3c..15d3266686 100644 ---- a/src/util/glibcompat.h -+++ b/src/util/glibcompat.h -@@ -37,3 +37,12 @@ char *vir_g_strdup_vprintf(const char *msg, va_list args) - #define g_canonicalize_filename vir_g_canonicalize_filename - #undef g_fsync - #define g_fsync vir_g_fsync -+ -+/* Intentionally redefine macro so that it's not marked as available in 2.58 -+ * and newer. Drop when bumping to 2.58 or newer. */ -+#undef G_GNUC_NO_INLINE -+#if g_macro__has_attribute(__noinline__) -+# define G_GNUC_NO_INLINE __attribute__ ((__noinline__)) -+#else -+# define G_GNUC_NO_INLINE -+#endif --- -2.25.1 - diff --git a/vdpa-Introduce-the-new-device-type-vdpa-to-hostdev.patch b/hostdev-Introduce-vDPA-device-to-hostdev-subsystem-a.patch similarity index 40% rename from vdpa-Introduce-the-new-device-type-vdpa-to-hostdev.patch rename to hostdev-Introduce-vDPA-device-to-hostdev-subsystem-a.patch index 22439955d50cccf46270c3afd610afa727b70637..f98bd557a5bc3fc1661ce5a0cafe5fa2bc378c3d 100644 --- a/vdpa-Introduce-the-new-device-type-vdpa-to-hostdev.patch +++ b/hostdev-Introduce-vDPA-device-to-hostdev-subsystem-a.patch @@ -1,39 +1,54 @@ -From ccb6ee3cd899a2209cbe29f6c3b70522b86323ba Mon Sep 17 00:00:00 2001 +From 5d9ad485395b057739736ea31efa82d275c57324 Mon Sep 17 00:00:00 2001 From: AlexChen -Date: Sat, 25 Nov 2023 10:34:05 +0800 -Subject: [PATCH] vdpa: Introduce the new device type vdpa to hostdev +Date: Fri, 29 Mar 2024 15:27:46 +0800 +Subject: [PATCH] hostdev:Introduce vDPA device to hostdev subsystem as a new + subtype -Introduce the new device type vdpa to hostdev +The following is the xml of vdpa device: + + + + + +And the command line passed to QEMU is as follows: +-device {"driver":"vhost-vdpa-device-pci","vhostdev":"/dev/vhost-vdpa-0"} + +This solution is selected according to the previous discussion +on the solution of supporting the vDPA device. +For details, see the following: +https://listman.redhat.com/archives/libvir-list/2023-March/239018.html -Signed-off-by: libai -Signed-off-by: jiangdongxu Signed-off-by: AlexChen --- - src/conf/domain_audit.c | 4 ++++ - src/conf/domain_conf.c | 38 +++++++++++++++++++++++++++++++++ - src/conf/domain_conf.h | 6 ++++++ - src/conf/virconftypes.h | 3 +++ - src/qemu/qemu_command.c | 29 +++++++++++++++++++++++++ - src/qemu/qemu_command.h | 4 ++++ + src/conf/domain_audit.c | 4 +++ + src/conf/domain_conf.c | 43 +++++++++++++++++++++++++++++++++ + src/conf/domain_conf.h | 6 +++++ + src/conf/domain_postparse.c | 1 + + src/conf/domain_validate.c | 1 + + src/conf/virconftypes.h | 2 ++ + src/qemu/qemu_command.c | 19 +++++++++++++++ + src/qemu/qemu_command.h | 3 +++ src/qemu/qemu_domain.c | 7 ++++++ - src/qemu/qemu_domain_address.c | 6 ++++-- + src/qemu/qemu_hotplug.c | 3 +++ + src/qemu/qemu_migration.c | 2 ++ + src/qemu/qemu_validate.c | 2 ++ src/security/security_dac.c | 2 ++ src/security/security_selinux.c | 2 ++ - 10 files changed, 99 insertions(+), 2 deletions(-) + 14 files changed, 97 insertions(+) diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c -index 1b0abb21a0..d920dcbf09 100644 +index 7a6bb02203..e4d4d6d912 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c -@@ -350,6 +350,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, - virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; - virDomainHostdevSubsysSCSIVHostPtr hostsrc = &hostdev->source.subsys.u.scsi_host; - virDomainHostdevSubsysMediatedDevPtr mdevsrc = &hostdev->source.subsys.u.mdev; -+ virDomainHostdevSubsysVDPAPtr vdpasrc = &hostdev->source.subsys.u.vdpa; +@@ -344,6 +344,7 @@ virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef *hostdev, + virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHost *hostsrc = &hostdev->source.subsys.u.scsi_host; + virDomainHostdevSubsysMediatedDev *mdevsrc = &hostdev->source.subsys.u.mdev; ++ virDomainHostdevSubsysVDPA *vdpasrc = &hostdev->source.subsys.u.vdpa; virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname = virAuditEncode("vm", vm->def->name))) { -@@ -393,6 +394,9 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, +@@ -383,6 +384,9 @@ virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef *hostdev, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: address = g_strdup(mdevsrc->uuidstr); break; @@ -44,10 +59,10 @@ index 1b0abb21a0..d920dcbf09 100644 default: VIR_WARN("Unexpected hostdev type while encoding audit message: %d", diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 7ae403424d..5a04d1b5d1 100644 +index f54f99f379..0f4c9012c1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c -@@ -911,6 +911,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, +@@ -1052,6 +1052,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, "scsi", "scsi_host", "mdev", @@ -55,39 +70,31 @@ index 7ae403424d..5a04d1b5d1 100644 ); VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend, -@@ -2980,6 +2981,9 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def) - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: - VIR_FREE(def->source.subsys.u.scsi_host.wwpn); +@@ -2645,6 +2646,9 @@ virDomainHostdevDefClear(virDomainHostdevDef *def) + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + g_clear_pointer(&def->source.subsys.u.pci.origstates, virBitmapFree); break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + VIR_FREE(def->source.subsys.u.vdpa.devpath); + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: -@@ -6706,6 +6710,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev) - } - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: -+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: - break; - } -@@ -8590,6 +8595,22 @@ virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDefPtr def, +@@ -6170,6 +6174,22 @@ virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDef *def, return 0; } +static int -+virDomainHostdevSubsysVDPADefParseXML(virDomainHostdevDefPtr def, -+ xmlNodePtr sourcenode) ++virDomainHostdevSubsysVDPADefParseXML(xmlNodePtr sourcenode, ++ virDomainHostdevDef *def) +{ + g_autofree char *devpath = NULL; -+ virDomainHostdevSubsysVDPAPtr vdpa = &def->source.subsys.u.vdpa; ++ virDomainHostdevSubsysVDPA *vdpa = &def->source.subsys.u.vdpa; + -+ if (!(devpath = virXMLPropString(sourcenode, "dev"))) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("Missing 'dev' attribute for element ")); -+ return -1; ++ if(!(devpath = virXMLPropString(sourcenode, "dev"))) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("Missing 'dev' attribute for element ")); ++ return -1; + } + vdpa->devpath = g_steal_pointer(&devpath); + return 0; @@ -96,19 +103,19 @@ index 7ae403424d..5a04d1b5d1 100644 static int virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, xmlXPathContextPtr ctxt, -@@ -8779,6 +8800,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, +@@ -6315,6 +6335,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, if (virDomainHostdevSubsysMediatedDevDefParseXML(def, ctxt) < 0) return -1; break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: -+ if (virDomainHostdevSubsysVDPADefParseXML(def, sourcenode) < 0) { ++ if (virDomainHostdevSubsysVDPADefParseXML(sourcenode, def) < 0) { + return -1; + } + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -@@ -16328,6 +16354,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt, +@@ -13005,6 +13030,7 @@ virDomainHostdevDefParseXML(virDomainXMLOption *xmlopt, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: @@ -116,7 +123,7 @@ index 7ae403424d..5a04d1b5d1 100644 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } -@@ -17407,6 +17434,9 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a, +@@ -14152,6 +14178,9 @@ virDomainHostdevMatchSubsys(virDomainHostdevDef *a, return 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: return virDomainHostdevMatchSubsysMediatedDev(a, b); @@ -126,40 +133,39 @@ index 7ae403424d..5a04d1b5d1 100644 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: return 0; } -@@ -25891,6 +25921,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, - virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi; - virDomainHostdevSubsysSCSIVHostPtr hostsrc = &def->source.subsys.u.scsi_host; - virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev; -+ virDomainHostdevSubsysVDPAPtr vdpasrc = &def->source.subsys.u.vdpa; - virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; - virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi; - -@@ -25940,6 +25971,11 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, - protocol, hostsrc->wwpn); - } +@@ -23501,6 +23530,16 @@ virDomainHostdevDefFormatSubsysMdev(virBuffer *buf, + virXMLFormatElement(buf, "source", NULL, &sourceChildBuf); + } -+ if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA) { -+ closedSource = true; -+ virBufferAsprintf(buf, " dev='%s'/", vdpasrc->devpath); -+ } ++static void ++virDomainHostdevDefFormatSubsysVDPA(virBuffer *buf, ++ virDomainHostdevDef *def) ++{ ++ g_auto(virBuffer) sourceAttrBuf = VIR_BUFFER_INITIALIZER; ++ virDomainHostdevSubsysVDPA *vdpasrc = &def->source.subsys.u.vdpa; ++ virBufferAsprintf(&sourceAttrBuf, " dev='%s'", vdpasrc->devpath); ++ virXMLFormatElement(buf, "source", &sourceAttrBuf, NULL); ++} + - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); -@@ -25998,6 +26034,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, - virBufferAsprintf(buf, "

\n", - mdevsrc->uuidstr); - break; + static int + virDomainHostdevDefFormatSubsys(virBuffer *buf, +@@ -23528,6 +23567,10 @@ virDomainHostdevDefFormatSubsys(virBuffer *buf, + virDomainHostdevDefFormatSubsysMdev(buf, def); + return 0; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: -+ break; ++ virDomainHostdevDefFormatSubsysVDPA(buf, def); ++ return 0; ++ + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev type %d"), + virReportEnumRangeError(virDomainHostdevSubsysType, def->source.subsys.type); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 98fa323679..6d56ef0282 100644 +index 196053d950..2a85f7bcf0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h -@@ -199,6 +199,7 @@ typedef enum { +@@ -198,6 +198,7 @@ typedef enum { VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV, @@ -167,8 +173,8 @@ index 98fa323679..6d56ef0282 100644 VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST } virDomainHostdevSubsysType; -@@ -267,6 +268,10 @@ struct _virDomainHostdevSubsysMediatedDev { - int ramfb; /* virTristateSwitch */ +@@ -290,6 +291,10 @@ struct _virDomainHostdevSubsysMediatedDev { + virTristateSwitch ramfb; }; +struct _virDomainHostdevSubsysVDPA { @@ -176,9 +182,9 @@ index 98fa323679..6d56ef0282 100644 +}; + typedef enum { - VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE = 0, VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST, -@@ -301,6 +306,7 @@ struct _virDomainHostdevSubsys { +@@ -324,6 +329,7 @@ struct _virDomainHostdevSubsys { virDomainHostdevSubsysSCSI scsi; virDomainHostdevSubsysSCSIVHost scsi_host; virDomainHostdevSubsysMediatedDev mdev; @@ -186,104 +192,108 @@ index 98fa323679..6d56ef0282 100644 } u; }; +diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c +index e79913b73f..b948bf0653 100644 +--- a/src/conf/domain_postparse.c ++++ b/src/conf/domain_postparse.c +@@ -351,6 +351,7 @@ virDomainHostdevDefPostParse(virDomainHostdevDef *dev, + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; + } +diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c +index c72108886e..d88ef6b915 100644 +--- a/src/conf/domain_validate.c ++++ b/src/conf/domain_validate.c +@@ -2190,6 +2190,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev) + } + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; + } diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h -index 1c62cde251..ca1a17b262 100644 +index 26cb966194..bcdcb8b825 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h -@@ -174,6 +174,9 @@ typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr; +@@ -120,6 +120,8 @@ typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys; + typedef struct _virDomainHostdevSubsysMediatedDev virDomainHostdevSubsysMediatedDev; - typedef virDomainHostdevSubsysMediatedDev *virDomainHostdevSubsysMediatedDevPtr; +typedef struct _virDomainHostdevSubsysVDPA virDomainHostdevSubsysVDPA; -+typedef virDomainHostdevSubsysVDPA *virDomainHostdevSubsysVDPAPtr; + typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI; - typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr; + typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 832c17b602..d7db30d19b 100644 +index d54149ed2d..de3be7fc1c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c -@@ -5476,6 +5476,25 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def, - return virBufferContentAndReset(&buf); +@@ -5004,6 +5004,18 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def, + return g_steal_pointer(&props); } -+char * -+qemuBuildHostdevVDPAStr(const virDomainDef *def, -+ virDomainHostdevDefPtr dev, -+ virQEMUCapsPtr qemuCaps) ++virJSONValue * ++qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev) +{ -+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; -+ virDomainHostdevSubsysVDPAPtr vdpa = &dev->source.subsys.u.vdpa; -+ if (!vdpa->devpath) { ++ g_autoptr(virJSONValue) props = NULL; ++ virDomainHostdevSubsysVDPA *vdpasrc = &dev->source.subsys.u.vdpa; ++ if (virJSONValueObjectAdd(&props, ++ "s:driver", "vhost-vdpa-device-pci", ++ "s:vhostdev", vdpasrc->devpath, ++ NULL) < 0) + return NULL; -+ } -+ -+ virBufferAdd(&buf, "vhost-vdpa-device-pci", -1); -+ virBufferAsprintf(&buf, ",id=%s", dev->info->alias); -+ virBufferAsprintf(&buf, ",vhostdev=%s", vdpa->devpath); -+ if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) -+ return NULL; -+ return virBufferContentAndReset(&buf); ++ return g_steal_pointer(&props); +} -+ - static int - qemuBuildHostdevCommandLine(virCommandPtr cmd, - const virDomainDef *def, -@@ -5607,6 +5626,16 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, + qemuBlockStorageSourceAttachData * + qemuBuildHostdevSCSIDetachPrepare(virDomainHostdevDef *hostdev, +@@ -5199,6 +5211,13 @@ qemuBuildHostdevCommandLine(virCommand *cmd, + return -1; break; -+ /* VDPA */ + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: -+ virCommandAddArg(cmd, "-device"); -+ if (!(devstr = qemuBuildHostdevVDPAStr(def, hostdev, qemuCaps))) { ++ if (!(devprops = qemuBuildHostdevVDPADevProps(hostdev))) ++ return -1; ++ if (qemuBuildDeviceCommandlineFromJSON(cmd, devprops, def, qemuCaps) < 0) + return -1; -+ } -+ virCommandAddArg(cmd, devstr); -+ + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h -index 283aaf358c..080cf41b81 100644 +index 341ec43f9a..432ea59310 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h -@@ -198,6 +198,10 @@ char * - qemuBuildHostdevMediatedDevStr(const virDomainDef *def, - virDomainHostdevDefPtr dev, - virQEMUCapsPtr qemuCaps); -+char * -+qemuBuildHostdevVDPAStr(const virDomainDef *def, -+ virDomainHostdevDefPtr dev, -+ virQEMUCapsPtr qemuCaps); +@@ -198,6 +198,9 @@ virJSONValue * + qemuBuildHostdevMediatedDevProps(const virDomainDef *def, + virDomainHostdevDef *dev); - char *qemuBuildRedirdevDevStr(const virDomainDef *def, - virDomainRedirdevDefPtr dev, ++virJSONValue * ++qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev); ++ + virJSONValue * + qemuBuildRedirdevDevProps(const virDomainDef *def, + virDomainRedirdevDef *dev); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 5933039f5c..fd3e3f64c0 100644 +index f8a6c43797..5a7e8d2607 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c -@@ -6879,6 +6879,8 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev, - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: - return qemuDomainMdevDefValidate(hostdev, def, qemuCaps); -+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: -+ break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: - default: - virReportEnumRangeError(virDomainHostdevSubsysType, -@@ -14442,6 +14444,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, - virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi; - virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host; - virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev; -+ virDomainHostdevSubsysVDPAPtr vdpasrc = &dev->source.subsys.u.vdpa; +@@ -10528,6 +10528,8 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev, + virDomainHostdevSubsysSCSI *scsisrc = &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHost *hostsrc = &dev->source.subsys.u.scsi_host; + virDomainHostdevSubsysMediatedDev *mdevsrc = &dev->source.subsys.u.mdev; ++ virDomainHostdevSubsysVDPA *vdpasrc = &dev->source.subsys.u.vdpa; ++ g_autoptr(virUSBDevice) usb = NULL; g_autoptr(virSCSIDevice) scsi = NULL; g_autoptr(virSCSIVHostDevice) host = NULL; -@@ -14512,6 +14515,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, +@@ -10598,6 +10600,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev, if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) return -1; @@ -294,35 +304,73 @@ index 5933039f5c..fd3e3f64c0 100644 perm = VIR_CGROUP_DEVICE_RW; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: -diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c -index 7f48773832..6649553486 100644 ---- a/src/qemu/qemu_domain_address.c -+++ b/src/qemu/qemu_domain_address.c -@@ -792,7 +792,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, - if (!virHostdevIsMdevDevice(hostdev) && - (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || - (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && -- hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST))) { -+ hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && -+ hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA))) { - return 0; - } - -@@ -2418,7 +2419,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, - if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && - subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && - !(subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && -- subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_PCI)) { -+ subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_PCI) && -+ subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA) { - continue; - } +@@ -11373,6 +11379,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev, + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; + } +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index 4e2fc724c0..29c0856f62 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -2805,6 +2805,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver, + return -1; + break; ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +@@ -4717,6 +4718,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver, + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: + qemuDomainRemoveMediatedDevice(driver, vm, hostdev); + break; ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; + } +@@ -5743,6 +5745,7 @@ qemuDomainDetachPrepHostdev(virDomainObj *vm, + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + break; ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + default: + virReportError(VIR_ERR_INTERNAL_ERROR, +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 41ce565ede..0a89d102df 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1310,6 +1310,8 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def) + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: ++ /* The vDPA devices don't support migration for now */ ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot migrate a domain with "), + virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type)); +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index e475ad035e..18c5b60a35 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -2496,6 +2496,8 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev, + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: + return qemuValidateDomainMdevDef(hostdev, def, qemuCaps); ++ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: ++ break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSubsysType, diff --git a/src/security/security_dac.c b/src/security/security_dac.c -index 51cabf1961..52b3c156e4 100644 +index c07e488db7..96aebfce5b 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c -@@ -1357,6 +1357,7 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, +@@ -1313,6 +1313,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr, break; } @@ -330,7 +378,7 @@ index 51cabf1961..52b3c156e4 100644 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret = 0; break; -@@ -1520,6 +1521,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr mgr, +@@ -1469,6 +1470,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr, break; } @@ -339,10 +387,10 @@ index 51cabf1961..52b3c156e4 100644 ret = 0; break; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c -index cb4dc3e101..54cb42fb8d 100644 +index 84c5ce75ed..652c086cb0 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c -@@ -2213,6 +2213,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManagerPtr mgr, +@@ -2256,6 +2256,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr, break; } @@ -350,7 +398,7 @@ index cb4dc3e101..54cb42fb8d 100644 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret = 0; break; -@@ -2449,6 +2450,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManagerPtr mgr, +@@ -2487,6 +2488,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager *mgr, break; } diff --git a/hostdev-Update-mdev-pointer-reference-after-checking.patch b/hostdev-Update-mdev-pointer-reference-after-checking.patch deleted file mode 100644 index b49c96d049b659c076a8697f382ece6039791ae4..0000000000000000000000000000000000000000 --- a/hostdev-Update-mdev-pointer-reference-after-checking.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 24ae6a276d538a31f42feb5e988d15b08b444b4a Mon Sep 17 00:00:00 2001 -From: Erik Skultety -Date: Thu, 7 Jan 2021 16:48:40 +0100 -Subject: [PATCH 078/108] hostdev: Update mdev pointer reference after checking - device type -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We set the pointer to some garbage packed structure data without -knowing whether we were actually handling the type of device we -expected to be handling. On its own, this was harmless, because we'd -never use the pointer as we'd skip the device if it were not the -expected type. However, it's better to make the logic even more -explicit - we first check the device and only when we're sure we have -the expected type we then update the pointer shortcut. - -Signed-off-by: Erik Skultety -Reviewed-by: Ján Tomko -(cherry picked from commit 964738cff3d949d90fc5c3317a2618fcd8d217b4) ---- - src/hypervisor/virhostdev.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c -index 9017cc3be8..c88c8bee0e 100644 ---- a/src/hypervisor/virhostdev.c -+++ b/src/hypervisor/virhostdev.c -@@ -1986,11 +1986,11 @@ virHostdevReAttachMediatedDevices(virHostdevManagerPtr mgr, - virDomainHostdevSubsysMediatedDevPtr mdevsrc; - virDomainHostdevDefPtr hostdev = hostdevs[i]; - -- mdevsrc = &hostdev->source.subsys.u.mdev; -- - if (!virHostdevIsMdevDevice(hostdev)) - continue; - -+ mdevsrc = &hostdev->source.subsys.u.mdev; -+ - if (!(mdev = virMediatedDeviceNew(mdevsrc->uuidstr, - mdevsrc->model))) - continue; --- -2.33.0 - diff --git a/hostdev-mdev-Lookup-mdevs-by-sysfs-path-rather-than-.patch b/hostdev-mdev-Lookup-mdevs-by-sysfs-path-rather-than-.patch deleted file mode 100644 index 44953b358ff2e9759e1e680251a21b0be83c3573..0000000000000000000000000000000000000000 --- a/hostdev-mdev-Lookup-mdevs-by-sysfs-path-rather-than-.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 7b752336bd26048514d55bb222531c0b0183fa9c Mon Sep 17 00:00:00 2001 -From: Erik Skultety -Date: Thu, 7 Jan 2021 16:53:21 +0100 -Subject: [PATCH 079/108] hostdev: mdev: Lookup mdevs by sysfs path rather than - mdev struct -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The lookup didn't do anything apart from comparing the sysfs paths -anyway since that's what makes each mdev unique. -The most ridiculous usage of the old logic was in -virHostdevReAttachMediatedDevices where in order to drop an mdev -hostdev from the list of active devices we first had to create a new -mdev and use it in the lookup call. Why couldn't we have used the -hostdev directly? Because the hostdev and mdev structures are -incompatible. - -The way mdevs are currently removed is via a write to a specific sysfs -attribute. If you do it while the machine which has the mdev assigned -is running, the write call may block (with a new enough kernel, with -older kernels it would return a write error!) until the device -is no longer in use which is when the QEMU process exits. - -The interesting part here comes afterwards when we're cleaning up and -call virHostdevReAttachMediatedDevices. The domain doesn't exist -anymore, so the list of active hostdevs needs to be updated and the -respective hostdevs removed from the list, but remember we had to -create an mdev object in the memory in order to find it in the list -first which will fail because the write to sysfs had already removed -the mdev instance from the host system. -And so the next time you try to start the same domain you'll get: - -"Requested operation is not valid: mediated device is in use by -driver QEMU, domain " - -Fixes: https://gitlab.com/libvirt/libvirt/-/issues/119 - -Signed-off-by: Erik Skultety -Reviewed-by: Ján Tomko -(cherry picked from commit 49cb59778a4e6c2d04bb9383a9d97fbbc83f9fce) ---- - src/hypervisor/virhostdev.c | 10 ++++------ - src/util/virmdev.c | 16 ++++++++-------- - src/util/virmdev.h | 4 ++-- - 3 files changed, 14 insertions(+), 16 deletions(-) - -diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c -index c88c8bee0e..4057f7b25f 100644 ---- a/src/hypervisor/virhostdev.c -+++ b/src/hypervisor/virhostdev.c -@@ -1981,7 +1981,7 @@ virHostdevReAttachMediatedDevices(virHostdevManagerPtr mgr, - - virObjectLock(mgr->activeMediatedHostdevs); - for (i = 0; i < nhostdevs; i++) { -- g_autoptr(virMediatedDevice) mdev = NULL; -+ g_autofree char *sysfspath = NULL; - virMediatedDevicePtr tmp; - virDomainHostdevSubsysMediatedDevPtr mdevsrc; - virDomainHostdevDefPtr hostdev = hostdevs[i]; -@@ -1990,14 +1990,12 @@ virHostdevReAttachMediatedDevices(virHostdevManagerPtr mgr, - continue; - - mdevsrc = &hostdev->source.subsys.u.mdev; -- -- if (!(mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model))) -- continue; -+ sysfspath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr); - - /* Remove from the list only mdevs assigned to @drv_name/@dom_name */ - -- tmp = virMediatedDeviceListFind(mgr->activeMediatedHostdevs, mdev); -+ tmp = virMediatedDeviceListFind(mgr->activeMediatedHostdevs, -+ sysfspath); - - /* skip inactive devices */ - if (!tmp) -diff --git a/src/util/virmdev.c b/src/util/virmdev.c -index c2499c0a20..bae4a7d2c1 100644 ---- a/src/util/virmdev.c -+++ b/src/util/virmdev.c -@@ -312,7 +312,7 @@ int - virMediatedDeviceListAdd(virMediatedDeviceListPtr list, - virMediatedDevicePtr *dev) - { -- if (virMediatedDeviceListFind(list, *dev)) { -+ if (virMediatedDeviceListFind(list, (*dev)->path)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("device %s is already in use"), (*dev)->path); - return -1; -@@ -358,7 +358,7 @@ virMediatedDevicePtr - virMediatedDeviceListSteal(virMediatedDeviceListPtr list, - virMediatedDevicePtr dev) - { -- int idx = virMediatedDeviceListFindIndex(list, dev); -+ int idx = virMediatedDeviceListFindIndex(list, dev->path); - - return virMediatedDeviceListStealIndex(list, idx); - } -@@ -374,13 +374,13 @@ virMediatedDeviceListDel(virMediatedDeviceListPtr list, - - int - virMediatedDeviceListFindIndex(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev) -+ const char *sysfspath) - { - size_t i; - - for (i = 0; i < list->count; i++) { -- virMediatedDevicePtr other = list->devs[i]; -- if (STREQ(other->path, dev->path)) -+ virMediatedDevicePtr dev = list->devs[i]; -+ if (STREQ(sysfspath, dev->path)) - return i; - } - return -1; -@@ -389,11 +389,11 @@ virMediatedDeviceListFindIndex(virMediatedDeviceListPtr list, - - virMediatedDevicePtr - virMediatedDeviceListFind(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev) -+ const char *sysfspath) - { - int idx; - -- if ((idx = virMediatedDeviceListFindIndex(list, dev)) >= 0) -+ if ((idx = virMediatedDeviceListFindIndex(list, sysfspath)) >= 0) - return list->devs[idx]; - else - return NULL; -@@ -407,7 +407,7 @@ virMediatedDeviceIsUsed(virMediatedDevicePtr dev, - const char *drvname, *domname; - virMediatedDevicePtr tmp = NULL; - -- if ((tmp = virMediatedDeviceListFind(list, dev))) { -+ if ((tmp = virMediatedDeviceListFind(list, dev->path))) { - virMediatedDeviceGetUsedBy(tmp, &drvname, &domname); - virReportError(VIR_ERR_OPERATION_INVALID, - _("mediated device %s is in use by " -diff --git a/src/util/virmdev.h b/src/util/virmdev.h -index 51f7f608a2..1d97f7d44f 100644 ---- a/src/util/virmdev.h -+++ b/src/util/virmdev.h -@@ -119,11 +119,11 @@ virMediatedDeviceListDel(virMediatedDeviceListPtr list, - - virMediatedDevicePtr - virMediatedDeviceListFind(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev); -+ const char *sysfspath); - - int - virMediatedDeviceListFindIndex(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev); -+ const char *sysfspath); - - int - virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst, --- -2.33.0 - diff --git a/hotpatch-Implement-qemuDomainHotpatchManage.patch b/hotpatch-Implement-qemuDomainHotpatchManage.patch index 79bcd38a37d2ee86a6278a2bd08d8df245736644..0b3fae0be0008aed1e5b2cb334fa3684d949415c 100644 --- a/hotpatch-Implement-qemuDomainHotpatchManage.patch +++ b/hotpatch-Implement-qemuDomainHotpatchManage.patch @@ -1,46 +1,97 @@ -From b255a024007eb236745b703586a2fed8bdedae6c Mon Sep 17 00:00:00 2001 +From 2721c0ce65045c90e54fcab383d4af83415bd3f3 Mon Sep 17 00:00:00 2001 From: AlexChen -Date: Tue, 19 Oct 2021 22:11:45 +0800 +Date: Tue, 19 Oct 2021 14:50:32 +0800 Subject: [PATCH] hotpatch: Implement qemuDomainHotpatchManage Signed-off-by: Hao Wang Signed-off-by: Bihong Yu Signed-off-by: AlexChen --- - src/qemu/Makefile.inc.am | 2 + - src/qemu/qemu_driver.c | 48 +++++++++++ - src/qemu/qemu_hotpatch.c | 182 +++++++++++++++++++++++++++++++++++++++ - src/qemu/qemu_hotpatch.h | 36 ++++++++ - 4 files changed, 268 insertions(+) + include/libvirt/libvirt-domain.h | 10 +- + src/libvirt-domain.c | 2 +- + src/libvirt_public.syms | 2 +- + src/qemu/meson.build | 1 + + src/qemu/qemu_driver.c | 48 ++++++++ + src/qemu/qemu_hotpatch.c | 182 +++++++++++++++++++++++++++++++ + src/qemu/qemu_hotpatch.h | 36 ++++++ + 7 files changed, 274 insertions(+), 7 deletions(-) create mode 100644 src/qemu/qemu_hotpatch.c create mode 100644 src/qemu/qemu_hotpatch.h -diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am -index 51cd79879d..a1a8bfa17c 100644 ---- a/src/qemu/Makefile.inc.am -+++ b/src/qemu/Makefile.inc.am -@@ -73,6 +73,8 @@ QEMU_DRIVER_SOURCES = \ - qemu/qemu_checkpoint.h \ - qemu/qemu_backup.c \ - qemu/qemu_backup.h \ -+ qemu/qemu_hotpatch.c \ -+ qemu/qemu_hotpatch.h \ - $(NULL) +diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h +index f8def59032..e786ecfab2 100644 +--- a/include/libvirt/libvirt-domain.h ++++ b/include/libvirt/libvirt-domain.h +@@ -6422,13 +6422,13 @@ int virDomainAuthorizedSSHKeysGet(virDomainPtr domain, + * Since: 6.2.0 + */ + typedef enum { +- VIR_DOMAIN_HOTPATCH_NONE = 0, /* No action */ +- VIR_DOMAIN_HOTPATCH_APPLY, /* Apply hotpatch */ +- VIR_DOMAIN_HOTPATCH_UNAPPLY, /* Unapply hotpatch */ +- VIR_DOMAIN_HOTPATCH_QUERY, /* Query hotpatch */ ++ VIR_DOMAIN_HOTPATCH_NONE = 0, /* No action (Since: 6.2.0) */ ++ VIR_DOMAIN_HOTPATCH_APPLY, /* Apply hotpatch (Since: 6.2.0) */ ++ VIR_DOMAIN_HOTPATCH_UNAPPLY, /* Unapply hotpatch (Since: 6.2.0) */ ++ VIR_DOMAIN_HOTPATCH_QUERY, /* Query hotpatch (Since: 6.2.0) */ + # ifdef VIR_ENUM_SENTINELS +- VIR_DOMAIN_HOTPATCH_LAST ++ VIR_DOMAIN_HOTPATCH_LAST /* Last index (Since: 6.2.0) */ + # endif + } virDomainHotpatchAction; +diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c +index 26833efd0e..21b01110fe 100644 +--- a/src/libvirt-domain.c ++++ b/src/libvirt-domain.c +@@ -13805,7 +13805,7 @@ virDomainBackupGetXMLDesc(virDomainPtr domain, + * + * Returns success messages in case of success, NULL otherwise. + * +- * Since: 6.10.0 ++ * Since: 6.2.0 + */ + char * + virDomainHotpatchManage(virDomainPtr domain, +diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms +index 52a5d03240..8b38fe9a5f 100644 +--- a/src/libvirt_public.syms ++++ b/src/libvirt_public.syms +@@ -882,7 +882,7 @@ LIBVIRT_6.10.0 { + global: + virDomainAuthorizedSSHKeysGet; + virDomainAuthorizedSSHKeysSet; +-} LIBVIRT_6.0.0; ++} LIBVIRT_6.2.0; + + LIBVIRT_7.1.0 { + global: +diff --git a/src/qemu/meson.build b/src/qemu/meson.build +index 2279fef2ca..9d5b4da35d 100644 +--- a/src/qemu/meson.build ++++ b/src/qemu/meson.build +@@ -42,6 +42,7 @@ qemu_driver_sources = [ + 'qemu_vhost_user.c', + 'qemu_vhost_user_gpu.c', + 'qemu_virtiofs.c', ++ 'qemu_hotpatch.c', + ] + + driver_source_files += files(qemu_driver_sources) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 5901f922bf..f6d99957a5 100644 +index d00d2a27c6..3dd82d6f12 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c -@@ -50,6 +50,7 @@ - #include "qemu_security.h" - #include "qemu_checkpoint.h" - #include "qemu_backup.h" +@@ -105,6 +105,7 @@ + #include "virdomaincheckpointobjlist.h" + #include "virutil.h" + #include "backup_conf.h" +#include "qemu_hotpatch.h" - #include "virerror.h" - #include "virlog.h" -@@ -23171,6 +23172,52 @@ qemuDomainAgentSetResponseTimeout(virDomainPtr dom, + #define VIR_FROM_THIS VIR_FROM_QEMU + +@@ -19934,6 +19935,52 @@ qemuDomainFDAssociate(virDomainPtr domain, return ret; } @@ -93,17 +144,17 @@ index 5901f922bf..f6d99957a5 100644 static virHypervisorDriver qemuHypervisorDriver = { .name = QEMU_DRIVER_NAME, -@@ -23411,6 +23458,7 @@ static virHypervisorDriver qemuHypervisorDriver = { +@@ -20178,6 +20225,7 @@ static virHypervisorDriver qemuHypervisorDriver = { .domainAgentSetResponseTimeout = qemuDomainAgentSetResponseTimeout, /* 5.10.0 */ .domainBackupBegin = qemuDomainBackupBegin, /* 6.0.0 */ .domainBackupGetXMLDesc = qemuDomainBackupGetXMLDesc, /* 6.0.0 */ + .domainHotpatchManage = qemuDomainHotpatchManage, /* 6.2.0 */ - }; - - + .domainAuthorizedSSHKeysGet = qemuDomainAuthorizedSSHKeysGet, /* 6.10.0 */ + .domainAuthorizedSSHKeysSet = qemuDomainAuthorizedSSHKeysSet, /* 6.10.0 */ + .domainGetMessages = qemuDomainGetMessages, /* 7.1.0 */ diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c new file mode 100644 -index 0000000000..45796b3f24 +index 0000000000..c1a4ab7aca --- /dev/null +++ b/src/qemu/qemu_hotpatch.c @@ -0,0 +1,182 @@ @@ -147,7 +198,7 @@ index 0000000000..45796b3f24 +VIR_LOG_INIT("qemu_hotpatch"); + +char * -+qemuDomainHotpatchQuery(virDomainObjPtr vm) ++qemuDomainHotpatchQuery(virDomainObj *vm) +{ + g_autoptr(virCommand) cmd = NULL; + g_autofree char *binary = NULL; @@ -183,7 +234,7 @@ index 0000000000..45796b3f24 +} + +char * -+qemuDomainHotpatchApply(virDomainObjPtr vm, ++qemuDomainHotpatchApply(virDomainObj *vm, + const char *patch) +{ + g_autoptr(virCommand) cmd = NULL; @@ -247,7 +298,7 @@ index 0000000000..45796b3f24 +} + +char * -+qemuDomainHotpatchUnapply(virDomainObjPtr vm, ++qemuDomainHotpatchUnapply(virDomainObj *vm, + const char *id) +{ + g_autoptr(virCommand) cmd = NULL; @@ -291,7 +342,7 @@ index 0000000000..45796b3f24 +} diff --git a/src/qemu/qemu_hotpatch.h b/src/qemu/qemu_hotpatch.h new file mode 100644 -index 0000000000..4c84a57950 +index 0000000000..3cf22f7fc4 --- /dev/null +++ b/src/qemu/qemu_hotpatch.h @@ -0,0 +1,36 @@ @@ -322,14 +373,14 @@ index 0000000000..4c84a57950 +#include "qemu/qemu_conf.h" + +char * -+qemuDomainHotpatchQuery(virDomainObjPtr vm); ++qemuDomainHotpatchQuery(virDomainObj *vm); + +char * -+qemuDomainHotpatchApply(virDomainObjPtr vm, ++qemuDomainHotpatchApply(virDomainObj *vm, + const char *patch); + +char * -+qemuDomainHotpatchUnapply(virDomainObjPtr vm, ++qemuDomainHotpatchUnapply(virDomainObj *vm, + const char *id); -- 2.27.0 diff --git a/hotpatch-check-vm-id-and-pid-before-using-hotpatch-a.patch b/hotpatch-check-vm-id-and-pid-before-using-hotpatch-a.patch index 13d997c3364985fffd88de1446d769b24badaf8b..a1bb62055d28f744617f68faa6727249b53bb3bd 100644 --- a/hotpatch-check-vm-id-and-pid-before-using-hotpatch-a.patch +++ b/hotpatch-check-vm-id-and-pid-before-using-hotpatch-a.patch @@ -1,4 +1,4 @@ -From 58121fbc3085296364e6b90bc16cb56eeaf36f77 Mon Sep 17 00:00:00 2001 +From ebdf0312a590ba60f3d304f338737155f469dd7a Mon Sep 17 00:00:00 2001 From: AlexChen Date: Fri, 9 Jul 2021 10:50:07 +0800 Subject: [PATCH] hotpatch: check vm id and pid before using hotpatch api @@ -10,26 +10,42 @@ qemuDomainHotpatchCheckPid() to check vm pid. Signed-off-by: Bihong Yu Signed-off-by: AlexChen --- - src/qemu/qemu_driver.c | 3 +++ + src/qemu/qemu_driver.c | 9 ++++++--- src/qemu/qemu_hotpatch.c | 36 ++++++++++++++++++++++++++++++------ - 2 files changed, 33 insertions(+), 6 deletions(-) + 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index d4c5f073bb..2b24881f75 100644 +index 31917ef591..05cc0db3ae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c -@@ -23196,6 +23196,9 @@ qemuDomainHotpatchManage(virDomainPtr domain, +@@ -19954,11 +19954,14 @@ qemuDomainHotpatchManage(virDomainPtr domain, + if (!(vm = qemuDomainObjFromDomain(domain))) + goto cleanup; + +- if (VirDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_HOTPATCH, ++ if (virDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_HOTPATCH, VIR_DOMAIN_JOB_OPERATION_HOTPATCH, 0) < 0) goto cleanup; +- qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK); + if (virDomainObjCheckActive(vm) < 0) + goto endjob; + - qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK); ++ qemuDomainObjSetAsyncJobMask(vm, VIR_JOB_DEFAULT_MASK); switch (action) { + case VIR_DOMAIN_HOTPATCH_APPLY: +@@ -19987,7 +19990,7 @@ qemuDomainHotpatchManage(virDomainPtr domain, + ret[len - 1] = '\0'; + + endjob: +- qemuDomainObjEndAsyncJob(driver, vm); ++ virDomainObjEndAsyncJob(vm); + + cleanup: + virDomainObjEndAPI(&vm); diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c -index 45796b3f24..03e63c1341 100644 +index c1a4ab7aca..31ef5bb7f2 100644 --- a/src/qemu/qemu_hotpatch.c +++ b/src/qemu/qemu_hotpatch.c @@ -37,12 +37,25 @@ @@ -49,7 +65,7 @@ index 45796b3f24..03e63c1341 100644 +} + char * - qemuDomainHotpatchQuery(virDomainObjPtr vm) + qemuDomainHotpatchQuery(virDomainObj *vm) { g_autoptr(virCommand) cmd = NULL; g_autofree char *binary = NULL; @@ -58,7 +74,7 @@ index 45796b3f24..03e63c1341 100644 int ret = -1; if (!(binary = virFindFileInPath(LIBCARE_CTL))) { -@@ -51,12 +64,15 @@ qemuDomainHotpatchQuery(virDomainObjPtr vm) +@@ -51,12 +64,15 @@ qemuDomainHotpatchQuery(virDomainObj *vm) return NULL; } @@ -76,7 +92,7 @@ index 45796b3f24..03e63c1341 100644 if (virCommandRun(cmd, &ret) < 0) goto error; -@@ -80,6 +96,7 @@ qemuDomainHotpatchApply(virDomainObjPtr vm, +@@ -80,6 +96,7 @@ qemuDomainHotpatchApply(virDomainObj *vm, g_autoptr(virCommand) cmd = NULL; g_autofree char *binary = NULL; char *output = NULL; @@ -84,7 +100,7 @@ index 45796b3f24..03e63c1341 100644 int ret = -1; if (!patch || !virFileExists(patch)) { -@@ -94,13 +111,16 @@ qemuDomainHotpatchApply(virDomainObjPtr vm, +@@ -94,13 +111,16 @@ qemuDomainHotpatchApply(virDomainObj *vm, return NULL; } @@ -103,7 +119,7 @@ index 45796b3f24..03e63c1341 100644 if (virCommandRun(cmd, &ret) < 0) goto error; -@@ -144,6 +164,7 @@ qemuDomainHotpatchUnapply(virDomainObjPtr vm, +@@ -144,6 +164,7 @@ qemuDomainHotpatchUnapply(virDomainObj *vm, g_autoptr(virCommand) cmd = NULL; g_autofree char *binary = NULL; char *output = NULL; @@ -111,7 +127,7 @@ index 45796b3f24..03e63c1341 100644 int ret = -1; if (!id || !qemuDomainHotpatchIsPatchidValid(id)) { -@@ -158,13 +179,16 @@ qemuDomainHotpatchUnapply(virDomainObjPtr vm, +@@ -158,13 +179,16 @@ qemuDomainHotpatchUnapply(virDomainObj *vm, return NULL; } diff --git a/hotpatch-if-hotpatch_path-not-in-qemu.conf-the-hotpa.patch b/hotpatch-if-hotpatch_path-not-in-qemu.conf-the-hotpa.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3f1a9edb1c04beefda6609d4c216b8ef51bf614 --- /dev/null +++ b/hotpatch-if-hotpatch_path-not-in-qemu.conf-the-hotpa.patch @@ -0,0 +1,34 @@ +From 033b8d177e4512f0ba3af8ed46ee38a4251c7e1c Mon Sep 17 00:00:00 2001 +From: Dawei Jiang +Date: Mon, 8 Apr 2024 19:59:11 +0800 +Subject: [PATCH] hotpatch: if hotpatch_path not in qemu.conf,the hotpatch + doesn't antoload + +Signed-off-by: Dawei Jiang +--- + src/qemu/qemu_process.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 41e9660ecd..348280d9be 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -7929,10 +7929,12 @@ qemuProcessLaunch(virConnectPtr conn, + goto cleanup; + + /* Autoload hotpatch */ +- if ((autoLoadStatus = qemuDomainHotpatchAutoload(vm, cfg->hotpatchPath)) == NULL) { +- VIR_WARN("Failed to autoload the hotpatch for %s.", vm->def->name); ++ if (cfg->hotpatchPath != NULL) { ++ autoLoadStatus = qemuDomainHotpatchAutoload(vm, cfg->hotpatchPath); ++ if (autoLoadStatus == NULL) { ++ VIR_WARN("Failed to autoload the hotpatch for %s.", vm->def->name); ++ } + } +- + ret = 0; + + cleanup: +-- +2.27.0 + diff --git a/hotpatch-implement-hotpatch-virsh-api.patch b/hotpatch-implement-hotpatch-virsh-api.patch index 552ae2dda8d20bb8266739d61eda1bca9fbb6bac..30b91a373de8342d1d82859b1a721b31ead2d49d 100644 --- a/hotpatch-implement-hotpatch-virsh-api.patch +++ b/hotpatch-implement-hotpatch-virsh-api.patch @@ -1,4 +1,4 @@ -From cf380e22898f70f5782bcea8b0d22027ff7d86af Mon Sep 17 00:00:00 2001 +From d56a3df418b90f4a6f303a3830732b5fde8d3a10 Mon Sep 17 00:00:00 2001 From: AlexChen Date: Wed, 20 Oct 2021 11:07:34 +0800 Subject: [PATCH] hotpatch: implement hotpatch virsh api @@ -11,10 +11,10 @@ Signed-off-by: AlexChen 1 file changed, 78 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c -index f643bd403e..813be4a0db 100644 +index 9d22e219f7..d88ac3cca6 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c -@@ -14326,6 +14326,78 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) +@@ -13556,6 +13556,78 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) return ret; } @@ -90,11 +90,11 @@ index f643bd403e..813be4a0db 100644 + return true; +} + - const vshCmdDef domManagementCmds[] = { - {.name = "attach-device", - .handler = cmdAttachDevice, -@@ -14953,5 +15025,11 @@ const vshCmdDef domManagementCmds[] = { - .info = info_guestinfo, + /* + * "get-user-sshkeys" command + */ +@@ -14456,5 +14528,11 @@ const vshCmdDef domManagementCmds[] = { + .info = info_dom_fd_associate, .flags = 0 }, + {.name = "hotpatch", diff --git a/hotpatch-introduce-hotpatch-async-job-flag.patch b/hotpatch-introduce-hotpatch-async-job-flag.patch index 24f1611410ace86ce95e81c3629b6bc9ec3d4f05..8e3667bd1ed28f01e1b5b0a486705096c0db5a4c 100644 --- a/hotpatch-introduce-hotpatch-async-job-flag.patch +++ b/hotpatch-introduce-hotpatch-async-job-flag.patch @@ -1,4 +1,4 @@ -From a83bb0dc19d7c92c200b9a234e120d16878eac19 Mon Sep 17 00:00:00 2001 +From 180e19162083fb74e9e9cbc676ce42611bb2e496 Mon Sep 17 00:00:00 2001 From: AlexChen Date: Tue, 19 Oct 2021 22:41:24 +0800 Subject: [PATCH] hotpatch: introduce hotpatch async job flag @@ -8,93 +8,99 @@ Signed-off-by: Bihong Yu Signed-off-by: AlexChen --- include/libvirt/libvirt-domain.h | 1 + - src/qemu/qemu_domain.c | 3 +++ - src/qemu/qemu_domain.h | 1 + - src/qemu/qemu_driver.c | 13 +++++++++++++ + src/conf/virdomainjob.c | 1 + + src/conf/virdomainjob.h | 1 + + src/qemu/qemu_domainjob.c | 2 ++ + src/qemu/qemu_driver.c | 14 +++++++++++++- src/qemu/qemu_migration.c | 2 ++ src/qemu/qemu_process.c | 1 + tools/virsh-domain.c | 1 + - 7 files changed, 22 insertions(+) + 8 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index f91061724b..2d6432cab2 100644 +index e786ecfab2..96e62deac3 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h -@@ -3295,6 +3295,7 @@ typedef enum { - VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = 7, - VIR_DOMAIN_JOB_OPERATION_DUMP = 8, - VIR_DOMAIN_JOB_OPERATION_BACKUP = 9, -+ VIR_DOMAIN_JOB_OPERATION_HOTPATCH = 10, +@@ -4201,6 +4201,7 @@ typedef enum { + VIR_DOMAIN_JOB_OPERATION_DUMP = 8, /* (Since: 3.3.0) */ + VIR_DOMAIN_JOB_OPERATION_BACKUP = 9, /* (Since: 6.0.0) */ + VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE = 10, /* (Since: 9.0.0) */ ++ VIR_DOMAIN_JOB_OPERATION_HOTPATCH = 11, /* (Since: 6.2.0) */ # ifdef VIR_ENUM_SENTINELS - VIR_DOMAIN_JOB_OPERATION_LAST -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 5d35d49638..2351cac120 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -111,6 +111,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob, + VIR_DOMAIN_JOB_OPERATION_LAST /* (Since: 3.3.0) */ +diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c +index 38f08f1d18..d21fc653a0 100644 +--- a/src/conf/virdomainjob.c ++++ b/src/conf/virdomainjob.c +@@ -51,6 +51,7 @@ VIR_ENUM_IMPL(virDomainAsyncJob, "snapshot", "start", "backup", + "hotpatch", ); - VIR_ENUM_IMPL(qemuDomainNamespace, -@@ -217,6 +218,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, - case QEMU_ASYNC_JOB_START: - case QEMU_ASYNC_JOB_NONE: - case QEMU_ASYNC_JOB_BACKUP: -+ case QEMU_ASYNC_JOB_HOTPATCH: + virDomainJobData * +diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h +index 0d62bab287..d0f632edad 100644 +--- a/src/conf/virdomainjob.h ++++ b/src/conf/virdomainjob.h +@@ -75,6 +75,7 @@ typedef enum { + VIR_ASYNC_JOB_SNAPSHOT, + VIR_ASYNC_JOB_START, + VIR_ASYNC_JOB_BACKUP, ++ VIR_ASYNC_JOB_HOTPATCH, + + VIR_ASYNC_JOB_LAST + } virDomainAsyncJob; +diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c +index 245e51f14b..c9753c4f2b 100644 +--- a/src/qemu/qemu_domainjob.c ++++ b/src/qemu/qemu_domainjob.c +@@ -56,6 +56,7 @@ qemuDomainAsyncJobPhaseToString(virDomainAsyncJob job, + case VIR_ASYNC_JOB_START: + case VIR_ASYNC_JOB_NONE: + case VIR_ASYNC_JOB_BACKUP: ++ case VIR_ASYNC_JOB_HOTPATCH: G_GNUC_FALLTHROUGH; - case QEMU_ASYNC_JOB_LAST: + case VIR_ASYNC_JOB_LAST: break; -@@ -243,6 +245,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job, - case QEMU_ASYNC_JOB_START: - case QEMU_ASYNC_JOB_NONE: - case QEMU_ASYNC_JOB_BACKUP: -+ case QEMU_ASYNC_JOB_HOTPATCH: +@@ -82,6 +83,7 @@ qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob job, + case VIR_ASYNC_JOB_START: + case VIR_ASYNC_JOB_NONE: + case VIR_ASYNC_JOB_BACKUP: ++ case VIR_ASYNC_JOB_HOTPATCH: G_GNUC_FALLTHROUGH; - case QEMU_ASYNC_JOB_LAST: + case VIR_ASYNC_JOB_LAST: break; -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index cf19f4d101..678ddab624 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -107,6 +107,7 @@ typedef enum { - QEMU_ASYNC_JOB_SNAPSHOT, - QEMU_ASYNC_JOB_START, - QEMU_ASYNC_JOB_BACKUP, -+ QEMU_ASYNC_JOB_HOTPATCH, - - QEMU_ASYNC_JOB_LAST - } qemuDomainAsyncJob; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index f6d99957a5..d4c5f073bb 100644 +index 3dd82d6f12..31917ef591 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c -@@ -13866,6 +13866,9 @@ static int qemuDomainAbortJob(virDomainPtr dom) +@@ -12251,6 +12251,8 @@ qemuDomainAbortJobFlags(virDomainPtr dom, + qemuBackupJobCancelBlockjobs(vm, priv->backup, true, VIR_ASYNC_JOB_NONE); ret = 0; break; - -+ case QEMU_ASYNC_JOB_HOTPATCH: ++ case VIR_ASYNC_JOB_HOTPATCH: + break; -+ - case QEMU_ASYNC_JOB_LAST: + + case VIR_ASYNC_JOB_LAST: default: - virReportEnumRangeError(qemuDomainAsyncJob, priv->job.asyncJob); -@@ -23180,6 +23183,7 @@ qemuDomainHotpatchManage(virDomainPtr domain, +@@ -19942,7 +19944,8 @@ qemuDomainHotpatchManage(virDomainPtr domain, + const char *id, unsigned int flags) { - virDomainObjPtr vm; -+ virQEMUDriverPtr driver = domain->conn->privateData; +- virDomainObjPtr vm; ++ virDomainObj *vm; ++ virQEMUDriver *driver = domain->conn->privateData; char *ret = NULL; size_t len; -@@ -23188,6 +23192,12 @@ qemuDomainHotpatchManage(virDomainPtr domain, +@@ -19951,6 +19954,12 @@ qemuDomainHotpatchManage(virDomainPtr domain, if (!(vm = qemuDomainObjFromDomain(domain))) goto cleanup; -+ if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_HOTPATCH, ++ if (VirDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_HOTPATCH, + VIR_DOMAIN_JOB_OPERATION_HOTPATCH, 0) < 0) + goto cleanup; + @@ -103,7 +109,7 @@ index f6d99957a5..d4c5f073bb 100644 switch (action) { case VIR_DOMAIN_HOTPATCH_APPLY: ret = qemuDomainHotpatchApply(vm, patch); -@@ -23214,6 +23224,9 @@ qemuDomainHotpatchManage(virDomainPtr domain, +@@ -19977,6 +19986,9 @@ qemuDomainHotpatchManage(virDomainPtr domain, if (len > 0) ret[len - 1] = '\0'; @@ -114,38 +120,38 @@ index f6d99957a5..d4c5f073bb 100644 virDomainObjEndAPI(&vm); return ret; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 3f4627bd39..1665071eb3 100644 +index f9c34b72e8..73395ce3b2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c -@@ -1532,6 +1532,8 @@ qemuMigrationJobName(virDomainObjPtr vm) - return _("start job"); - case QEMU_ASYNC_JOB_BACKUP: - return _("backup job"); -+ case QEMU_ASYNC_JOB_HOTPATCH: +@@ -1846,6 +1846,8 @@ qemuMigrationJobName(virDomainObj *vm) + return _("start"); + case VIR_ASYNC_JOB_BACKUP: + return _("backup"); ++ case VIR_ASYNC_JOB_HOTPATCH: + return _("hotpatch job"); - case QEMU_ASYNC_JOB_LAST: + case VIR_ASYNC_JOB_NONE: + case VIR_ASYNC_JOB_LAST: default: - return _("job"); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 9cf7242f31..818a72d8f9 100644 +index fc05b4b24f..318f9f6182 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c -@@ -3646,6 +3646,7 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver, - priv->job.current->started = now; +@@ -3758,6 +3758,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver, + JOB_MASK(VIR_JOB_MODIFY))); break; -+ case QEMU_ASYNC_JOB_HOTPATCH: - case QEMU_ASYNC_JOB_NONE: - case QEMU_ASYNC_JOB_LAST: ++ case VIR_ASYNC_JOB_HOTPATCH: + case VIR_ASYNC_JOB_NONE: + case VIR_ASYNC_JOB_LAST: break; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c -index 65d5c831ec..f643bd403e 100644 +index 66f933dead..9d22e219f7 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c -@@ -6167,6 +6167,7 @@ VIR_ENUM_IMPL(virshDomainJobOperation, - N_("Snapshot revert"), +@@ -6152,6 +6152,7 @@ VIR_ENUM_IMPL(virshDomainJobOperation, N_("Dump"), N_("Backup"), + N_("Snapshot delete"), + N_("Hotpatch"), ); diff --git a/hotpatch-virsh-support-autoload-mode.patch b/hotpatch-virsh-support-autoload-mode.patch index 2c95db6e60c039fc6e7911f39ff0e4484d8ab696..b8442884d789bb6f7eddf64d748c7d7f4af2c7d0 100644 --- a/hotpatch-virsh-support-autoload-mode.patch +++ b/hotpatch-virsh-support-autoload-mode.patch @@ -1,4 +1,4 @@ -From 3be8bb571d13795c2824dd6d2089035a1be6cf57 Mon Sep 17 00:00:00 2001 +From 48da26004ea0222cc8819e097a004980662ef3eb Mon Sep 17 00:00:00 2001 From: jiang-dawei15 Date: Wed, 26 Jan 2022 15:18:10 +0800 Subject: [PATCH] hotpatch: virsh support autoload mode @@ -6,44 +6,44 @@ Subject: [PATCH] hotpatch: virsh support autoload mode --- include/libvirt/libvirt-domain.h | 1 + src/qemu/qemu_conf.c | 9 +++ - src/qemu/qemu_conf.h | 1 + + src/qemu/qemu_conf.h | 2 + src/qemu/qemu_driver.c | 5 ++ - src/qemu/qemu_hotpatch.c | 122 +++++++++++++++++++++++++++++++ + src/qemu/qemu_hotpatch.c | 120 +++++++++++++++++++++++++++++++ src/qemu/qemu_hotpatch.h | 3 + - src/qemu/qemu_process.c | 6 ++ + src/qemu/qemu_process.c | 7 ++ tools/virsh-domain.c | 5 +- 8 files changed, 150 insertions(+), 2 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index 2d6432cab2..4ab0c9c0b2 100644 +index 96e62deac3..6120c6cea7 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h -@@ -4997,6 +4997,7 @@ typedef enum { - VIR_DOMAIN_HOTPATCH_APPLY, /* Apply hotpatch */ - VIR_DOMAIN_HOTPATCH_UNAPPLY, /* Unapply hotpatch */ - VIR_DOMAIN_HOTPATCH_QUERY, /* Query hotpatch */ -+ VIR_DOMAIN_HOTPATCH_AUTOLOAD, /* Autoload hotpatch */ +@@ -6427,6 +6427,7 @@ typedef enum { + VIR_DOMAIN_HOTPATCH_APPLY, /* Apply hotpatch (Since: 6.2.0) */ + VIR_DOMAIN_HOTPATCH_UNAPPLY, /* Unapply hotpatch (Since: 6.2.0) */ + VIR_DOMAIN_HOTPATCH_QUERY, /* Query hotpatch (Since: 6.2.0) */ ++ VIR_DOMAIN_HOTPATCH_AUTOLOAD, /* Autoload hotpatch (Since: 6.2.0) */ # ifdef VIR_ENUM_SENTINELS - VIR_DOMAIN_HOTPATCH_LAST + VIR_DOMAIN_HOTPATCH_LAST /* Last index (Since: 6.2.0) */ diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 809e8fe526..bd96ccb78e 100644 +index 513b5ebb1e..30343d3d12 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c -@@ -1006,6 +1006,12 @@ virQEMUDriverConfigLoadCapsFiltersEntry(virQEMUDriverConfigPtr cfg, +@@ -1064,6 +1064,12 @@ virQEMUDriverConfigLoadCapsFiltersEntry(virQEMUDriverConfig *cfg, return 0; } +static int -+virQEMUDriverConfigLoadHotpatchPathEntry(virQEMUDriverConfigPtr cfg, -+ virConfPtr conf) ++virQEMUDriverConfigLoadHotpatchPathEntry(virQEMUDriverConfig *cfg, ++ virConf *conf) +{ + return virConfGetValueString(conf, "hotpatch_path", &cfg->hotpatchPath); +} - int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, + int virQEMUDriverConfigLoadFile(virQEMUDriverConfig *cfg, const char *filename, -@@ -1078,6 +1084,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, +@@ -1136,6 +1142,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfig *cfg, if (virQEMUDriverConfigLoadCapsFiltersEntry(cfg, conf) < 0) return -1; @@ -54,30 +54,31 @@ index 809e8fe526..bd96ccb78e 100644 } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h -index 14f9b9e81e..f0124a0fe2 100644 +index 1a3ba3a0fb..8034ec7885 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h -@@ -220,6 +220,7 @@ struct _virQEMUDriverConfig { - gid_t swtpm_group; +@@ -231,6 +231,8 @@ struct _virQEMUDriverConfig { + char *deprecationBehavior; - char **capabilityfilters; + virQEMUSchedCore schedCore; ++ + char *hotpatchPath; }; G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 2b24881f75..37b2c4a2da 100644 +index 05cc0db3ae..6b07bcc8dc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c -@@ -23186,6 +23186,7 @@ qemuDomainHotpatchManage(virDomainPtr domain, - virQEMUDriverPtr driver = domain->conn->privateData; +@@ -19948,6 +19948,7 @@ qemuDomainHotpatchManage(virDomainPtr domain, + virQEMUDriver *driver = domain->conn->privateData; char *ret = NULL; size_t len; + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virCheckFlags(0, NULL); -@@ -23214,6 +23215,10 @@ qemuDomainHotpatchManage(virDomainPtr domain, +@@ -19976,6 +19977,10 @@ qemuDomainHotpatchManage(virDomainPtr domain, ret = qemuDomainHotpatchQuery(vm); break; @@ -89,7 +90,7 @@ index 2b24881f75..37b2c4a2da 100644 virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Unknow hotpatch action")); diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c -index 03e63c1341..02f511cc38 100644 +index 31ef5bb7f2..0259ae76c8 100644 --- a/src/qemu/qemu_hotpatch.c +++ b/src/qemu/qemu_hotpatch.c @@ -25,6 +25,8 @@ @@ -109,16 +110,16 @@ index 03e63c1341..02f511cc38 100644 #define VIR_FROM_THIS VIR_FROM_QEMU -@@ -204,3 +207,122 @@ qemuDomainHotpatchUnapply(virDomainObjPtr vm, +@@ -204,3 +207,120 @@ qemuDomainHotpatchUnapply(virDomainObj *vm, VIR_FREE(output); return NULL; } + +char * -+qemuDomainHotpatchAutoload(virDomainObjPtr vm, char *hotpatch_path) ++qemuDomainHotpatchAutoload(virDomainObj *vm, char *hotpatch_path) +{ -+ VIR_AUTOSTRINGLIST applied_patches = NULL; -+ VIR_AUTOSTRINGLIST lines = NULL; ++ g_auto(GStrv) applied_patches = NULL; ++ g_auto(GStrv) lines = NULL; + g_autofree char *applied_patch = NULL; + g_autofree char *libvirtd_conf = NULL; + g_autofree char *patch_conf = NULL; @@ -142,7 +143,7 @@ index 03e63c1341..02f511cc38 100644 + if (len > 0) + buf[len-1] = '\0'; + -+ lines = virStringSplit(buf, "\n", 0); ++ lines = g_strsplit(buf, "\n", 0); + if (!lines) + return NULL; + @@ -151,23 +152,23 @@ index 03e63c1341..02f511cc38 100644 + if (!applied_patch) + return NULL; + -+ applied_patches = virStringSplit(applied_patch, "\n", 0); ++ applied_patches = g_strsplit(applied_patch, "\n", 0); + if (!applied_patches) + return NULL; + + /* load all hotpatch which are listed in Patch.conf one by one */ + for (i = 0; lines[i] != NULL; i++) { -+ VIR_AUTOSTRINGLIST patch_info = NULL; ++ g_auto(GStrv) patch_info = NULL; + g_autofree char *kpatch_dir = NULL; + g_autofree char *file_path = NULL; + struct dirent *de; -+ DIR *dh; ++ g_autoptr(DIR) dh = NULL; + int direrr; + + if (!strstr(lines[i], "QEMU-")) + continue; + -+ patch_info = virStringSplit(lines[i], " ", 0); ++ patch_info = g_strsplit(lines[i], " ", 0); + if (!patch_info) + continue; + @@ -189,11 +190,9 @@ index 03e63c1341..02f511cc38 100644 + if (g_lstat(file_path, &sb) < 0) { + virReportSystemError(errno, _("Cannot access '%s'"), + file_path); -+ VIR_DIR_CLOSE(dh); + return NULL; + } + } -+ VIR_DIR_CLOSE(dh); + + if (qemuDomainHotpatchApply(vm, file_path) == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -233,52 +232,53 @@ index 03e63c1341..02f511cc38 100644 + return ret; +} diff --git a/src/qemu/qemu_hotpatch.h b/src/qemu/qemu_hotpatch.h -index 4c84a57950..8e0bfe348a 100644 +index 3cf22f7fc4..7cab4787c6 100644 --- a/src/qemu/qemu_hotpatch.h +++ b/src/qemu/qemu_hotpatch.h -@@ -34,3 +34,6 @@ qemuDomainHotpatchApply(virDomainObjPtr vm, +@@ -34,3 +34,6 @@ qemuDomainHotpatchApply(virDomainObj *vm, char * - qemuDomainHotpatchUnapply(virDomainObjPtr vm, + qemuDomainHotpatchUnapply(virDomainObj *vm, const char *id); + +char * -+qemuDomainHotpatchAutoload(virDomainObjPtr vm, char *path_config); ++qemuDomainHotpatchAutoload(virDomainObj *vm, char *path_config); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 818a72d8f9..24dd9f052c 100644 +index 318f9f6182..41e9660ecd 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c -@@ -59,6 +59,7 @@ - #include "qemu_firmware.h" +@@ -61,6 +61,7 @@ #include "qemu_backup.h" #include "qemu_dbus.h" + #include "qemu_snapshot.h" +#include "qemu_hotpatch.h" #include "cpu/cpu.h" #include "cpu/cpu_x86.h" -@@ -6684,6 +6685,7 @@ qemuProcessLaunch(virConnectPtr conn, - g_autoptr(virQEMUDriverConfig) cfg = NULL; - size_t nnicindexes = 0; +@@ -7595,6 +7596,7 @@ qemuProcessLaunch(virConnectPtr conn, g_autofree int *nicindexes = NULL; + unsigned long long maxMemLock = 0; + bool incomingMigrationExtDevices = false; + g_autofree char *autoLoadStatus = NULL; - size_t i; - VIR_DEBUG("conn=%p driver=%p vm=%p name=%s if=%d asyncJob=%d " -@@ -6993,6 +6995,10 @@ qemuProcessLaunch(virConnectPtr conn, - qemuProcessAutoDestroyAdd(driver, vm, conn) < 0) + VIR_DEBUG("conn=%p driver=%p vm=%p name=%s id=%d asyncJob=%d " + "incoming.uri=%s " +@@ -7926,6 +7928,11 @@ qemuProcessLaunch(virConnectPtr conn, + if (qemuProcessDeleteThreadContextHelper(vm, asyncJob) < 0) goto cleanup; + /* Autoload hotpatch */ + if ((autoLoadStatus = qemuDomainHotpatchAutoload(vm, cfg->hotpatchPath)) == NULL) { + VIR_WARN("Failed to autoload the hotpatch for %s.", vm->def->name); + } ++ ret = 0; cleanup: diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c -index 813be4a0db..b5375ebd3e 100644 +index d88ac3cca6..89bd737f19 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c -@@ -14344,7 +14344,7 @@ static const vshCmdOptDef opts_hotpatch[] = { +@@ -13574,7 +13574,7 @@ static const vshCmdOptDef opts_hotpatch[] = { {.name = "action", .type = VSH_OT_DATA, .flags = VSH_OFLAG_REQ, @@ -287,7 +287,7 @@ index 813be4a0db..b5375ebd3e 100644 }, {.name = "patch", .type = VSH_OT_STRING, -@@ -14363,7 +14363,8 @@ VIR_ENUM_IMPL(virDomainHotpatchAction, +@@ -13593,7 +13593,8 @@ VIR_ENUM_IMPL(virDomainHotpatchAction, "none", "apply", "unapply", @@ -298,5 +298,5 @@ index 813be4a0db..b5375ebd3e 100644 static bool cmdHotpatch(vshControl *ctl, -- -2.30.0 +2.27.0 diff --git a/hyperv-fix-the-number-of-threads-per-core.patch b/hyperv-fix-the-number-of-threads-per-core.patch deleted file mode 100644 index 3f717fe7538451817f02a85023312b97f5b5ecf8..0000000000000000000000000000000000000000 --- a/hyperv-fix-the-number-of-threads-per-core.patch +++ /dev/null @@ -1,32 +0,0 @@ -From ee9069defba076d94b432662af93a784ea002f5a Mon Sep 17 00:00:00 2001 -From: tangbinzy -Date: Tue, 29 Nov 2022 08:57:42 +0000 -Subject: [PATCH 04/24] hyperv: fix the number of threads per core The operands - were reversed, producing an incorrect result. - -Co-authored-by: Sri Ramanujam -Signed-off-by: Matt Coleman -Reviewed-by: Michal Privoznik - -Signed-off-by: tangbin -(cherry-pick from 1e18d3b833b9daa7bb18b9550a2cf4d140303d86) ---- - src/hyperv/hyperv_driver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c -index 4677a25ff8..213dd8837b 100644 ---- a/src/hyperv/hyperv_driver.c -+++ b/src/hyperv/hyperv_driver.c -@@ -310,7 +310,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) - } - - info->cores = processorList->data.common->NumberOfCores; -- info->threads = info->cores / processorList->data.common->NumberOfLogicalProcessors; -+ info->threads = processorList->data.common->NumberOfLogicalProcessors / info->cores; - info->cpus = info->sockets * info->cores; - - result = 0; --- -2.27.0 - diff --git a/include-Introduce-virDomainDirtyRateCalcFlags.patch b/include-Introduce-virDomainDirtyRateCalcFlags.patch deleted file mode 100644 index cc700c62eba130da06aeba168357f5d647c73b4b..0000000000000000000000000000000000000000 --- a/include-Introduce-virDomainDirtyRateCalcFlags.patch +++ /dev/null @@ -1,77 +0,0 @@ -From c4c665b4654280560eafe5782359b71e8ef2b1b5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= - -Date: Sun, 20 Feb 2022 21:28:11 +0800 -Subject: [PATCH 6/7] include: Introduce virDomainDirtyRateCalcFlags -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Introduce virDomainDirtyRateCalcFlags to get ready for -adding mode parameter to qemuDomainStartDirtyRateCalc. - -Signed-off-by: Hyman Huang(黄勇) -Signed-off-by: Michal Privoznik -Reviewed-by: Michal Privoznik ---- - include/libvirt/libvirt-domain.h | 13 +++++++++++++ - src/libvirt-domain.c | 12 +++++++++++- - 2 files changed, 24 insertions(+), 1 deletion(-) - -diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index e1954ae663..c7956c81d6 100644 ---- a/include/libvirt/libvirt-domain.h -+++ b/include/libvirt/libvirt-domain.h -@@ -5030,6 +5030,19 @@ typedef enum { - # endif - } virDomainDirtyRateStatus; - -+/** -+ * virDomainDirtyRateCalcFlags: -+ * -+ * Flags OR'ed together to provide specific behaviour when calculating dirty page -+ * rate for a Domain -+ * -+ */ -+typedef enum { -+ VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */ -+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */ -+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */ -+} virDomainDirtyRateCalcFlags; -+ - int virDomainStartDirtyRateCalc(virDomainPtr domain, - int seconds, - unsigned int flags); -diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index 6a37ea85b7..0ff99c94b6 100644 ---- a/src/libvirt-domain.c -+++ b/src/libvirt-domain.c -@@ -12821,7 +12821,7 @@ virDomainHotpatchManage(virDomainPtr domain, - * virDomainStartDirtyRateCalc: - * @domain: a domain object - * @seconds: specified calculating time in seconds -- * @flags: extra flags; not used yet, so callers should always pass 0 -+ * @flags: bitwise-OR of supported virDomainDirtyRateCalcFlags - * - * Calculate the current domain's memory dirty rate in next @seconds. - * The calculated dirty rate information is available by calling -@@ -12845,6 +12845,16 @@ virDomainStartDirtyRateCalc(virDomainPtr domain, - - virCheckReadOnlyGoto(conn->flags, error); - -+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING, -+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP, -+ error); -+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING, -+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING, -+ error); -+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP, -+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING, -+ error); -+ - if (conn->driver->domainStartDirtyRateCalc) { - int ret; - ret = conn->driver->domainStartDirtyRateCalc(domain, seconds, flags); --- -2.27.0 - diff --git a/leaseshelper-Report-errors-on-failure.patch b/leaseshelper-Report-errors-on-failure.patch deleted file mode 100644 index cb4ea48078246f32b8d928f0048cdfbc4138602a..0000000000000000000000000000000000000000 --- a/leaseshelper-Report-errors-on-failure.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 75d4ed800f297532a7b3ac2b8f8a94c049959e3b Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Fri, 18 Dec 2020 16:09:08 +0100 -Subject: [PATCH 024/108] leaseshelper: Report errors on failure -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If leasehelper fails all that we are left with is a simple error -message produced by dnsmasq: - - lease-init script returned exit code 1 - -This is because the leasehelper did not write any message to -stderr. According to dnsmasq's manpage, whenever it's invoking -leasehelper the stderr is kept open: - - All file descriptors are closed except stdin, which is open to - /dev/null, and stdout and stderr which capture output for - logging by dnsmasq. - -As debugging leasehelper is not trivial (because dnsmasq invokes -it with plenty of env vars set - that's how data is passed onto -helper), let's print an error into stderr if exiting with an -error. And since we are not calling public APIs, we have to call -virDispatchError() explicitly and since we don't have any -connection open, we have to pass NULL. - -Signed-off-by: Michal Privoznik -Reviewed-by: Daniel P. Berrangé -(cherry picked from commit c14bd64f3eba9838af8ab1cac369d51abfeb21b9) ---- - src/network/leaseshelper.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c -index 2b5fc0f442..fdd7fd3e80 100644 ---- a/src/network/leaseshelper.c -+++ b/src/network/leaseshelper.c -@@ -253,6 +253,8 @@ main(int argc, char **argv) - rv = EXIT_SUCCESS; - - cleanup: -+ if (rv != EXIT_SUCCESS) -+ virDispatchError(NULL); - if (pid_file_fd != -1) - virPidFileReleasePath(pid_file, pid_file_fd); - --- -2.33.0 - diff --git a/libvirt-6.2.0.tar.xz b/libvirt-6.2.0.tar.xz deleted file mode 100644 index 4d27d2ffb7b658746540a82edd4aadc8dbe8e401..0000000000000000000000000000000000000000 Binary files a/libvirt-6.2.0.tar.xz and /dev/null differ diff --git a/libvirt-9.10.0.tar.xz b/libvirt-9.10.0.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..43ccea27c3e7cc0b25984e4c777603b39b916c6a Binary files /dev/null and b/libvirt-9.10.0.tar.xz differ diff --git a/libvirt-Add-retry-support-for-error-policy.patch b/libvirt-Add-retry-support-for-error-policy.patch index 3b5d3e326f5c78c8728c96e03ea973db4c9a4cfd..ec8230190b42f9b48f3e1a3011dca4c16708380f 100644 --- a/libvirt-Add-retry-support-for-error-policy.patch +++ b/libvirt-Add-retry-support-for-error-policy.patch @@ -1,4 +1,4 @@ -From 9ba3e54d2b33e1105f5879fff3656c093337e60a Mon Sep 17 00:00:00 2001 +From c45717fa823682a04814ca49669116b2f5917671 Mon Sep 17 00:00:00 2001 From: Jiahui Cen Date: Thu, 25 Feb 2021 18:55:30 +0800 Subject: [PATCH] libvirt: Add 'retry' support for error policy @@ -12,17 +12,17 @@ Add retry_timeout parameter to control the total retry times. Signed-off-by: Jiahui Cen Signed-off-by: Ying Fang --- - src/conf/domain_conf.c | 25 +++++++++++++++++++++++++ + src/conf/domain_conf.c | 26 ++++++++++++++++++++++++++ src/conf/domain_conf.h | 3 +++ - src/qemu/qemu_command.c | 8 ++++++++ + src/qemu/qemu_command.c | 13 +++++++++++++ src/qemu/qemu_domain.c | 2 ++ - 4 files changed, 38 insertions(+) + 4 files changed, 44 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index dbc3e103ff..5c469cedd0 100644 +index 22ad43e1d7..f31f06b428 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c -@@ -355,6 +355,7 @@ VIR_ENUM_IMPL(virDomainDiskErrorPolicy, +@@ -385,6 +385,7 @@ VIR_ENUM_IMPL(virDomainDiskErrorPolicy, "report", "ignore", "enospace", @@ -30,15 +30,24 @@ index dbc3e103ff..5c469cedd0 100644 ); VIR_ENUM_IMPL(virDomainDiskIo, -@@ -10213,6 +10214,30 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def, +@@ -7773,6 +7774,8 @@ static int + virDomainDiskDefDriverParseXML(virDomainDiskDef *def, + xmlNodePtr cur) + { ++ g_autofree char *tmp = NULL; ++ + def->driverName = virXMLPropString(cur, "name"); + + if (virXMLPropEnum(cur, "cache", virDomainDiskCacheTypeFromString, +@@ -7796,6 +7799,29 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, + return -1; } - VIR_FREE(tmp); + def->retry_interval = -1; + if ((tmp = virXMLPropString(cur, "retry_interval")) && + ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY && + def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) || -+ (virStrToLong_l(tmp, NULL, 10, &def->retry_interval) < 0) || ++ (virStrToLong_ll(tmp, NULL, 10, &def->retry_interval) < 0) || + (def->retry_interval < 0))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk retry interval '%s'"), tmp); @@ -50,22 +59,21 @@ index dbc3e103ff..5c469cedd0 100644 + if ((tmp = virXMLPropString(cur, "retry_timeout")) && + ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY && + def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) || -+ (virStrToLong_l(tmp, NULL, 10, &def->retry_timeout) < 0) || ++ (virStrToLong_ll(tmp, NULL, 10, &def->retry_timeout) < 0) || + (def->retry_timeout < 0))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk retry interval '%s'"), tmp); + return -1; + } -+ VIR_FREE(tmp); + - if ((tmp = virXMLPropString(cur, "io")) && - (def->iomode = virDomainDiskIoTypeFromString(tmp)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + if (virXMLPropEnum(cur, "io", virDomainDiskIoTypeFromString, + VIR_XML_PROP_NONZERO, &def->iomode) < 0) + return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 16e625331c..86a86d3090 100644 +index ed07859bc5..021623cce7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h -@@ -396,6 +396,7 @@ typedef enum { +@@ -419,6 +419,7 @@ typedef enum { VIR_DOMAIN_DISK_ERROR_POLICY_REPORT, VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE, VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE, @@ -73,39 +81,58 @@ index 16e625331c..86a86d3090 100644 VIR_DOMAIN_DISK_ERROR_POLICY_LAST } virDomainDiskErrorPolicy; -@@ -561,6 +562,8 @@ struct _virDomainDiskDef { - int cachemode; /* enum virDomainDiskCache */ - int error_policy; /* enum virDomainDiskErrorPolicy */ - int rerror_policy; /* enum virDomainDiskErrorPolicy */ -+ long retry_interval; -+ long retry_timeout; - int iomode; /* enum virDomainDiskIo */ - int ioeventfd; /* enum virTristateSwitch */ - int event_idx; /* enum virTristateSwitch */ +@@ -556,6 +557,8 @@ struct _virDomainDiskDef { + virDomainDiskCache cachemode; + virDomainDiskErrorPolicy error_policy; + virDomainDiskErrorPolicy rerror_policy; ++ long long retry_interval; ++ long long retry_timeout; + virDomainDiskIo iomode; + virTristateSwitch ioeventfd; + virTristateSwitch event_idx; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 315deb5cfd..c3ad041959 100644 +index d54149ed2d..678b84b332 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c -@@ -1723,6 +1723,14 @@ qemuBuildDiskFrontendAttributeErrorPolicy(virDomainDiskDefPtr disk, - virBufferAsprintf(buf, ",werror=%s", wpolicy); - if (rpolicy) - virBufferAsprintf(buf, ",rerror=%s", rpolicy); +@@ -1753,6 +1753,8 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, + const char *biosCHSTrans = NULL; + const char *wpolicy = NULL; + const char *rpolicy = NULL; ++ g_autoptr(virJSONValue) retry_interval = NULL; ++ g_autoptr(virJSONValue) retry_timeout = NULL; + + switch (disk->bus) { + case VIR_DOMAIN_DISK_BUS_IDE: +@@ -1912,6 +1914,15 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, + } + + qemuBuildDiskGetErrorPolicy(disk, &wpolicy, &rpolicy); + if ((disk->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY || + disk->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) && -+ disk->retry_interval >= 0) -+ virBufferAsprintf(buf, ",retry_interval=%ld", disk->retry_interval); ++ disk->retry_interval >= 0) ++ retry_interval = virJSONValueNewNumberUlong(disk->retry_interval); + if ((disk->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY || + disk->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) && -+ disk->retry_timeout >= 0) -+ virBufferAsprintf(buf, ",retry_timeout=%ld", disk->retry_timeout); - } ++ disk->retry_timeout >= 0) ++ retry_timeout = virJSONValueNewNumberUlong(disk->retry_timeout); ++ + if (virJSONValueObjectAdd(&props, + "S:device_id", scsiVPDDeviceId, +@@ -1936,6 +1947,8 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, + "S:serial", serial, + "S:werror", wpolicy, + "S:rerror", rpolicy, ++ "A:retry_interval", &retry_interval, ++ "A:retry_timeout", &retry_timeout, + NULL) < 0) + return NULL; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index f89ff20a84..58493706a1 100644 +index 953808fcfe..fa6a7fd1c9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c -@@ -12308,6 +12308,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk, +@@ -8325,6 +8325,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDef *disk, CHECK_EQ(cachemode, "cache", true); CHECK_EQ(error_policy, "error_policy", true); CHECK_EQ(rerror_policy, "rerror_policy", true); diff --git a/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch b/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch deleted file mode 100644 index 579fbc72fa6e23c58a8f67fa2c7e35bb58d0aab7..0000000000000000000000000000000000000000 --- a/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 19845de491a3102df4256a3457c7d5669bccda63 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 18 May 2020 10:07:30 +0200 -Subject: [PATCH] Don't require secdrivers to implement - .domainMoveImageMetadata - -The AppArmor secdriver does not use labels to grant access to -resources. Therefore, it doesn't use XATTRs and hence it lacks -implementation of .domainMoveImageMetadata callback. This leads -to a harmless but needless error message appearing in the logs: - - virSecurityManagerMoveImageMetadata:476 : this function is not - supported by the connection driver: virSecurityManagerMoveImageMetadata - -Closes: https://gitlab.com/libvirt/libvirt/-/issues/25 - -cherry-pick from commit: cc8c297e473afd55e5d8e35e18345d8df176059d - -Signed-off-by: Michal Privoznik -Reviewed-by: Erik Skultety -Signed-off-by: Jin Yan ---- - src/security/security_manager.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/security/security_manager.c b/src/security/security_manager.c -index fe03274..1445291 100644 ---- a/src/security/security_manager.c -+++ b/src/security/security_manager.c -@@ -473,8 +473,7 @@ virSecurityManagerMoveImageMetadata(virSecurityManagerPtr mgr, - return ret; - } - -- virReportUnsupportedError(); -- return -1; -+ return 0; - } - - --- -1.8.3.1 - diff --git a/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch b/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch deleted file mode 100644 index 240f77e1af2ced57bd99827764296dd3be2ae26c..0000000000000000000000000000000000000000 --- a/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 42e4b74e1bbd08aad3afa46d741e46c40a8af73d Mon Sep 17 00:00:00 2001 -From: Bihong Yu -Date: Sat, 6 Jun 2020 18:52:35 +0800 -Subject: [PATCH] Fix some wrong usage of ATTRIBUTE_NONNULL() - -The virStateInitialize() function has ATTRIBUTE_NONNULL() -referring to @root argument (incorrectly anyway) but in -daemonRunStateInit() NULL is passed in anyway. - -Then there is virCommandAddArgPair() which also has -ATTRIBUTE_NONNULL() for one of its arguments and then checks the -argument for being NULL anyways. - -cherry-pick from commit: 2a372a5ad5fab3bf26fb9bea019d38fa04ba8b34 - -Signed-off-by:Bihong Yu -Reviewed-by:Chuan Zheng -Signed-off-by: Michal Privoznik -Reviewed-by: Michal Privoznik -Signed-off-by: Jin Yan ---- - src/libvirt_internal.h | 3 +-- - src/util/vircommand.h | 3 +-- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h -index 00ef7aa..72c6127 100644 ---- a/src/libvirt_internal.h -+++ b/src/libvirt_internal.h -@@ -33,8 +33,7 @@ int virStateInitialize(bool privileged, - bool mandatory, - const char *root, - virStateInhibitCallback inhibit, -- void *opaque) -- ATTRIBUTE_NONNULL(2); -+ void *opaque); - int virStateCleanup(void); - int virStateReload(void); - int virStateStop(void); -diff --git a/src/util/vircommand.h b/src/util/vircommand.h -index 9086f9a..4e6cb0a 100644 ---- a/src/util/vircommand.h -+++ b/src/util/vircommand.h -@@ -128,8 +128,7 @@ void virCommandAddArgFormat(virCommandPtr cmd, - - void virCommandAddArgPair(virCommandPtr cmd, - const char *name, -- const char *val) -- ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); -+ const char *val); - - void virCommandAddArgSet(virCommandPtr cmd, - const char *const*vals) ATTRIBUTE_NONNULL(2); --- -1.8.3.1 - diff --git a/libvirt-Substitute-security_context_t-with-char.patch b/libvirt-Substitute-security_context_t-with-char.patch deleted file mode 100644 index 93ebe82b1c9a54d3c03a163ce5a39e55bb940990..0000000000000000000000000000000000000000 --- a/libvirt-Substitute-security_context_t-with-char.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 0ca4dd0cd279448ff28beb4c88e52107531783a3 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Tue, 4 Aug 2020 01:44:48 +0000 -Subject: [PATCH] Substitute security_context_t with char * - -Historically, we've used security_context_t for variables passed -to libselinux APIs. But almost 7 years ago, libselinux developers -admitted in their API that in fact, it's just a 'char *' type -[1]. Ever since then the APIs accept 'char *' instead, but they -kept the old alias just for API stability. Well, not anymore [2]. - -1: https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9 -2: https://github.com/SELinuxProject/selinux/commit/7a124ca2758136f49cc38efc26fb1a2d385ecfd9 - -Signed-off-by: Michal Privoznik -Reviewed-by: Andrea Bolognani -(cherry-picked from commit e71e13488dc1aa65456e54a4b41bc925821b4263) -Signed-off-by: Xu Yandong ---- - src/libvirt-lxc.c | 2 +- - src/rpc/virnetsocket.c | 2 +- - src/security/security_selinux.c | 26 +++++++++++++------------- - src/storage/storage_util.c | 2 +- - src/util/viridentity.c | 2 +- - tests/securityselinuxhelper.c | 16 ++++++++-------- - tests/securityselinuxlabeltest.c | 4 ++-- - tests/securityselinuxtest.c | 2 +- - tests/viridentitytest.c | 2 +- - 9 files changed, 29 insertions(+), 29 deletions(-) - -diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c -index 47a06a3..25f1cfc 100644 ---- a/src/libvirt-lxc.c -+++ b/src/libvirt-lxc.c -@@ -204,7 +204,7 @@ virDomainLxcEnterSecurityLabel(virSecurityModelPtr model, - if (STREQ(model->model, "selinux")) { - #ifdef WITH_SELINUX - if (oldlabel) { -- security_context_t ctx; -+ char *ctx; - - if (getcon(&ctx) < 0) { - virReportSystemError(errno, -diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c -index 6c790cb..5537289 100644 ---- a/src/rpc/virnetsocket.c -+++ b/src/rpc/virnetsocket.c -@@ -1595,7 +1595,7 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock G_GNUC_UNUSED, - int virNetSocketGetSELinuxContext(virNetSocketPtr sock, - char **context) - { -- security_context_t seccon = NULL; -+ char *seccon = NULL; - int ret = -1; - - *context = NULL; -diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c -index 8aeb6e4..72d1658 100644 ---- a/src/security/security_selinux.c -+++ b/src/security/security_selinux.c -@@ -198,7 +198,7 @@ virSecuritySELinuxTransactionAppend(const char *path, - - static int - virSecuritySELinuxRememberLabel(const char *path, -- const security_context_t con) -+ const char *con) - { - return virSecuritySetRememberedLabel(SECURITY_SELINUX_NAME, - path, con); -@@ -207,7 +207,7 @@ virSecuritySELinuxRememberLabel(const char *path, - - static int - virSecuritySELinuxRecallLabel(const char *path, -- security_context_t *con) -+ char **con) - { - int rv; - -@@ -431,7 +431,7 @@ virSecuritySELinuxMCSGetProcessRange(char **sens, - int *catMin, - int *catMax) - { -- security_context_t ourSecContext = NULL; -+ char *ourSecContext = NULL; - context_t ourContext = NULL; - char *cat = NULL; - char *tmp; -@@ -530,8 +530,8 @@ virSecuritySELinuxMCSGetProcessRange(char **sens, - } - - static char * --virSecuritySELinuxContextAddRange(security_context_t src, -- security_context_t dst) -+virSecuritySELinuxContextAddRange(char *src, -+ char *dst) - { - char *str = NULL; - char *ret = NULL; -@@ -575,7 +575,7 @@ virSecuritySELinuxGenNewContext(const char *basecontext, - context_t context = NULL; - char *ret = NULL; - char *str; -- security_context_t ourSecContext = NULL; -+ char *ourSecContext = NULL; - context_t ourContext = NULL; - - VIR_DEBUG("basecontext=%s mcs=%s isObjectContext=%d", -@@ -967,7 +967,7 @@ virSecuritySELinuxReserveLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - pid_t pid) - { -- security_context_t pctx; -+ char *pctx; - context_t ctx = NULL; - const char *mcs; - int rv; -@@ -1217,7 +1217,7 @@ virSecuritySELinuxGetProcessLabel(virSecurityManagerPtr mgr G_GNUC_UNUSED, - pid_t pid, - virSecurityLabelPtr sec) - { -- security_context_t ctx; -+ char *ctx; - - if (getpidcon_raw(pid, &ctx) == -1) { - virReportSystemError(errno, -@@ -1330,7 +1330,7 @@ virSecuritySELinuxSetFilecon(virSecurityManagerPtr mgr, - bool remember) - { - bool privileged = virSecurityManagerGetPrivileged(mgr); -- security_context_t econ = NULL; -+ char *econ = NULL; - int refcount; - int rc; - bool rollback = false; -@@ -1440,7 +1440,7 @@ virSecuritySELinuxFSetFilecon(int fd, char *tcon) - /* Set fcon to the appropriate label for path and mode, or return -1. */ - static int - getContext(virSecurityManagerPtr mgr G_GNUC_UNUSED, -- const char *newpath, mode_t mode, security_context_t *fcon) -+ const char *newpath, mode_t mode, char **fcon) - { - virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr); - -@@ -1457,7 +1457,7 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManagerPtr mgr, - { - bool privileged = virSecurityManagerGetPrivileged(mgr); - struct stat buf; -- security_context_t fcon = NULL; -+ char *fcon = NULL; - char *newpath = NULL; - int rc; - int ret = -1; -@@ -2972,7 +2972,7 @@ virSecuritySELinuxSetDaemonSocketLabel(virSecurityManagerPtr mgr G_GNUC_UNUSED, - { - /* TODO: verify DOI */ - virSecurityLabelDefPtr secdef; -- security_context_t scon = NULL; -+ char *scon = NULL; - char *str = NULL; - int rc = -1; - -@@ -3259,7 +3259,7 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr mgr, - int fd) - { - struct stat buf; -- security_context_t fcon = NULL; -+ char *fcon = NULL; - virSecurityLabelDefPtr secdef; - char *str = NULL, *proc = NULL, *fd_path = NULL; - int rc = -1; -diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c -index 1ec1d13..4c67d3a 100644 ---- a/src/storage/storage_util.c -+++ b/src/storage/storage_util.c -@@ -1818,7 +1818,7 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target, - struct stat *sb) - { - #if WITH_SELINUX -- security_context_t filecon = NULL; -+ char *filecon = NULL; - #endif - - if (virStorageSourceUpdateBackingSizes(target, fd, sb) < 0) -diff --git a/src/util/viridentity.c b/src/util/viridentity.c -index 8cc2db2..2cb9042 100644 ---- a/src/util/viridentity.c -+++ b/src/util/viridentity.c -@@ -157,7 +157,7 @@ virIdentityPtr virIdentityGetSystem(void) - unsigned long long startTime; - g_autoptr(virIdentity) ret = NULL; - #if WITH_SELINUX -- security_context_t con; -+ char *con; - #endif - - if (!(ret = virIdentityNew())) -diff --git a/tests/securityselinuxhelper.c b/tests/securityselinuxhelper.c -index f89224c..63b5726 100644 ---- a/tests/securityselinuxhelper.c -+++ b/tests/securityselinuxhelper.c -@@ -58,7 +58,7 @@ static struct selabel_handle *(*real_selabel_open)(unsigned int backend, - unsigned nopts); - static void (*real_selabel_close)(struct selabel_handle *handle); - static int (*real_selabel_lookup_raw)(struct selabel_handle *handle, -- security_context_t *con, -+ char **con, - const char *key, - int type); - -@@ -94,7 +94,7 @@ static void init_syms(void) - * the virt_use_nfs bool is set. - */ - --int getcon_raw(security_context_t *context) -+int getcon_raw(char **context) - { - if (!is_selinux_enabled()) { - errno = EINVAL; -@@ -109,12 +109,12 @@ int getcon_raw(security_context_t *context) - return 0; - } - --int getcon(security_context_t *context) -+int getcon(char **context) - { - return getcon_raw(context); - } - --int getpidcon_raw(pid_t pid, security_context_t *context) -+int getpidcon_raw(pid_t pid, char **context) - { - if (!is_selinux_enabled()) { - errno = EINVAL; -@@ -134,7 +134,7 @@ int getpidcon_raw(pid_t pid, security_context_t *context) - return 0; - } - --int getpidcon(pid_t pid, security_context_t *context) -+int getpidcon(pid_t pid, char **context) - { - return getpidcon_raw(pid, context); - } -@@ -170,7 +170,7 @@ int setfilecon(const char *path, const char *con) - return setfilecon_raw(path, con); - } - --int getfilecon_raw(const char *path, security_context_t *con) -+int getfilecon_raw(const char *path, char **con) - { - char *constr = NULL; - ssize_t len = getxattr(path, "user.libvirt.selinux", -@@ -194,7 +194,7 @@ int getfilecon_raw(const char *path, security_context_t *con) - } - - --int getfilecon(const char *path, security_context_t *con) -+int getfilecon(const char *path, char **con) - { - return getfilecon_raw(path, con); - } -@@ -315,7 +315,7 @@ void selabel_close(struct selabel_handle *handle) - } - - int selabel_lookup_raw(struct selabel_handle *handle, -- security_context_t *con, -+ char **con, - const char *key, - int type) - { -diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c -index 3040a36..50b447c 100644 ---- a/tests/securityselinuxlabeltest.c -+++ b/tests/securityselinuxlabeltest.c -@@ -252,7 +252,7 @@ static int - testSELinuxCheckLabels(testSELinuxFile *files, size_t nfiles) - { - size_t i; -- security_context_t ctx; -+ char *ctx; - - for (i = 0; i < nfiles; i++) { - ctx = NULL; -@@ -360,7 +360,7 @@ mymain(void) - if (virTestRun("Labelling " # name, testSELinuxLabeling, name) < 0) \ - ret = -1; - -- setcon((security_context_t)"system_r:system_u:libvirtd_t:s0:c0.c1023"); -+ setcon("system_r:system_u:libvirtd_t:s0:c0.c1023"); - - DO_TEST_LABELING("disks"); - DO_TEST_LABELING("kernel"); -diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c -index 6c8314d..3f069c2 100644 ---- a/tests/securityselinuxtest.c -+++ b/tests/securityselinuxtest.c -@@ -217,7 +217,7 @@ testSELinuxGenLabel(const void *opaque) - context_t con = NULL; - context_t imgcon = NULL; - -- if (setcon_raw((security_context_t)data->pidcon) < 0) { -+ if (setcon_raw(data->pidcon) < 0) { - perror("Cannot set process security context"); - return -1; - } -diff --git a/tests/viridentitytest.c b/tests/viridentitytest.c -index 3f87af1..9a8c891 100644 ---- a/tests/viridentitytest.c -+++ b/tests/viridentitytest.c -@@ -120,7 +120,7 @@ static int testIdentityGetSystem(const void *data) - static int testSetFakeSELinuxContext(const void *data G_GNUC_UNUSED) - { - #if WITH_SELINUX -- return setcon_raw((security_context_t)data); -+ return setcon_raw(data); - #else - VIR_DEBUG("libvirt not compiled with SELinux, skipping this test"); - return EXIT_AM_SKIP; --- -2.25.4 - diff --git a/libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch b/libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch deleted file mode 100644 index c9f2a2eda2594d3cd3ced1535edcc832ce26a5b8..0000000000000000000000000000000000000000 --- a/libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 432afe3f14418ea5d2d69e62d678ef5bb08caaa1 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Wed, 15 Apr 2020 11:55:43 +0800 -Subject: cgroup: cleanup eventParams when virTypedParamsAddULLong failed - -Function virTypedParamsAddULLong use realloc to gain memory, -and doesn't free it when failed. so we need free eventParams to -prevent a memory leak. - -Signed-off-by: Xu Yandong ---- - src/qemu/qemu_cgroup.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c -index c0e30f6..057f871 100644 ---- a/src/qemu/qemu_cgroup.c -+++ b/src/qemu/qemu_cgroup.c -@@ -904,8 +904,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm) - if (virTypedParamsAddULLong(&eventParams, &eventNparams, - &eventMaxparams, - VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES, -- val) < 0) -+ val) < 0) { -+ if (eventParams) -+ virTypedParamsFree(eventParams, eventNparams); - return -1; -+ } - - event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams); - } --- -2.23.0 - diff --git a/libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF.patch b/libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF.patch deleted file mode 100644 index bb035030aa5b8315d52e37f90a76f02b66d1d604..0000000000000000000000000000000000000000 --- a/libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF.patch +++ /dev/null @@ -1,53 +0,0 @@ -From cec735e6f4001caa0395eddc9d8a0fe18e97f9eb Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Tue, 4 Aug 2020 08:40:36 +0000 -Subject: [PATCH] conf: Don't format http cookies unless - VIR_DOMAIN_DEF_FORMAT_SECURE is used - -Starting with 3b076391befc3fe72deb0c244ac6c2b4c100b410 -(v6.1.0-122-g3b076391be) we support http cookies. Since they may contain -somewhat sensitive information we should not format them into the XML -unless VIR_DOMAIN_DEF_FORMAT_SECURE is asserted. - -Reported-by: Han Han -Signed-off-by: Peter Krempa -Reviewed-by: Erik Skultety -(cherry-picked from commit a5b064bf4b17a9884d7d361733737fb614ad8979) -Signed-off-by: Xu Yandong ---- - src/conf/domain_conf.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 914e03c..cf93a59 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -24565,11 +24565,15 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf, - - static void - virDomainDiskSourceFormatNetworkCookies(virBufferPtr buf, -- virStorageSourcePtr src) -+ virStorageSourcePtr src, -+ unsigned int flags) - { - g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); - size_t i; - -+ if (!(flags & VIR_DOMAIN_DEF_FORMAT_SECURE)) -+ return; -+ - for (i = 0; i < src->ncookies; i++) { - virBufferEscapeString(&childBuf, "", src->cookies[i]->name); - virBufferEscapeString(&childBuf, "%s\n", src->cookies[i]->value); -@@ -24630,7 +24634,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, - virTristateBoolTypeToString(src->sslverify)); - } - -- virDomainDiskSourceFormatNetworkCookies(childBuf, src); -+ virDomainDiskSourceFormatNetworkCookies(childBuf, src, flags); - - if (src->readahead) - virBufferAsprintf(childBuf, "\n", src->readahead); --- -2.25.4 - diff --git a/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch b/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch deleted file mode 100644 index 7c09892a7c438355f68f21dc3364060fdec39916..0000000000000000000000000000000000000000 --- a/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch +++ /dev/null @@ -1,33 +0,0 @@ -From fc8c41dbb52eb9ce3ee36680ecb53a41f4146610 Mon Sep 17 00:00:00 2001 -From: Jiri Denemark -Date: Thu, 11 Jun 2020 13:53:27 +0200 -Subject: [PATCH] conf: Increase cpuset length limit for CPU pinning - -Domains are now allowed to be pinned to host CPUs with IDs up to 16383. -The new limit is as arbitrary as the old one. It's just bigger. - -cherry-pick from commit: e728ffba5119cfb1488aa7363fef596940449f50 - -Signed-off-by: Jiri Denemark -Reviewed-by: Michal Privoznik -Signed-off-by: Jin Yan ---- - src/conf/domain_conf.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index a40773a..16e6253 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2241,7 +2241,7 @@ struct _virDomainHugePage { - unsigned long long size; /* hugepage size in KiB */ - }; - --#define VIR_DOMAIN_CPUMASK_LEN 1024 -+#define VIR_DOMAIN_CPUMASK_LEN 16384 - - struct _virDomainIOThreadIDDef { - bool autofill; --- -1.8.3.1 - diff --git a/libvirt-conf-Set-default-values-of-retry-fileds.patch b/libvirt-conf-Set-default-values-of-retry-fileds.patch index 457305cd1cb8b0b68ed50fcb459e769c24138888..a600ead4e6853544758ef6b5eb28359faae00137 100644 --- a/libvirt-conf-Set-default-values-of-retry-fileds.patch +++ b/libvirt-conf-Set-default-values-of-retry-fileds.patch @@ -1,4 +1,4 @@ -From 04292a5ad4cb9741fa8f9687befd1e1c644043a6 Mon Sep 17 00:00:00 2001 +From 2b79389fe60dc8fc0bf8788a346a35d63ae6883d Mon Sep 17 00:00:00 2001 From: Jiahui Cen Date: Thu, 18 Mar 2021 15:14:20 +0800 Subject: [PATCH] libvirt/conf: Set default values of retry fileds @@ -13,14 +13,14 @@ retry policy is not enabled. Signed-off-by: Jiahui Cen --- src/conf/domain_conf.c | 18 ++++++++++++------ - src/conf/domain_conf.h | 3 +++ - 2 files changed, 15 insertions(+), 6 deletions(-) + src/conf/domain_conf.h | 2 ++ + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 5c469cedd0..a4e9b3290c 100644 +index f31f06b428..0aa514bda3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c -@@ -10186,6 +10186,7 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def, +@@ -7775,6 +7775,7 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, xmlNodePtr cur) { g_autofree char *tmp = NULL; @@ -28,9 +28,9 @@ index 5c469cedd0..a4e9b3290c 100644 def->driverName = virXMLPropString(cur, "name"); -@@ -10214,28 +10215,33 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def, +@@ -7799,28 +7800,33 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, + return -1; } - VIR_FREE(tmp); - def->retry_interval = -1; + retry_enabled = (def->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) || @@ -40,7 +40,7 @@ index 5c469cedd0..a4e9b3290c 100644 - ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY && - def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) || + (!retry_enabled || - (virStrToLong_l(tmp, NULL, 10, &def->retry_interval) < 0) || + (virStrToLong_ll(tmp, NULL, 10, &def->retry_interval) < 0) || (def->retry_interval < 0))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk retry interval '%s'"), tmp); @@ -56,7 +56,7 @@ index 5c469cedd0..a4e9b3290c 100644 - ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY && - def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) || + (!retry_enabled || - (virStrToLong_l(tmp, NULL, 10, &def->retry_timeout) < 0) || + (virStrToLong_ll(tmp, NULL, 10, &def->retry_timeout) < 0) || (def->retry_timeout < 0))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk retry interval '%s'"), tmp); @@ -65,23 +65,22 @@ index 5c469cedd0..a4e9b3290c 100644 + if (retry_enabled && !tmp) { + def->retry_timeout = VIR_DOMAIN_DISK_DEFAULT_RETRY_TIMEOUT; + } - VIR_FREE(tmp); - if ((tmp = virXMLPropString(cur, "io")) && + if (virXMLPropEnum(cur, "io", virDomainDiskIoTypeFromString, + VIR_XML_PROP_NONZERO, &def->iomode) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 86a86d3090..ccee986849 100644 +index 021623cce7..c810721d5b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h -@@ -523,6 +523,9 @@ typedef enum { - } virDomainMemoryAllocation; +@@ -515,6 +515,8 @@ typedef enum { + VIR_ENUM_DECL(virDomainSnapshotLocation); +#define VIR_DOMAIN_DISK_DEFAULT_RETRY_INTERVAL 1000 +#define VIR_DOMAIN_DISK_DEFAULT_RETRY_TIMEOUT 0 -+ + /* Stores the virtual disk configuration */ struct _virDomainDiskDef { - virStorageSourcePtr src; /* non-NULL. XXX Allow NULL for empty cdrom? */ -- 2.27.0 diff --git a/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch b/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch deleted file mode 100644 index e822e9ddb78451b755d26f67e4e7e877c78791d3..0000000000000000000000000000000000000000 --- a/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 657c7f5d79fe43823ffb4d46e244bea15a65baf6 Mon Sep 17 00:00:00 2001 -From: Laine Stump -Date: Thu, 18 Jun 2020 12:49:09 -0400 -Subject: [PATCH 1/6] conf, vmx: check for OOM after calling xmlBufferCreate() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Although libvirt itself uses g_malloc0() and friends, which exit when -there isn't enouogh memory, libxml2 uses standard malloc(), which just -returns NULL on OOM - this means we must check for NULL on return from -any libxml2 functions that allocate memory. - -xmlBufferCreate(), for example, might return NULL, and we don't always -check for it. This patch adds checks where it isn't already done. - -(NB: Although libxml2 has a provision for changing behavior on OOM (by -calling xmlMemSetup() to change what functions are used to -allocating/freeing memory), we can't use that, since parts of libvirt -code end up in libvirt.so, which is linked and called directly by -applications that may themselves use libxml2 (and may have already set -their own alternate malloc()), e.g. drivers like esx which live totally -in the library rather than a separate process.) - -cherry pick from: b7a92bce070fd57844a59bf8b1c30cb4ef4f3acd - -Signed-off-by: Laine Stump -Reviewed-by: Ján Tomko ---- - src/conf/domain_conf.c | 6 +++++- - src/conf/network_conf.c | 6 +++++- - src/vmx/vmx.c | 11 +++++++---- - 3 files changed, 17 insertions(+), 6 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 914e03c..37c785a 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -29022,7 +29022,11 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def, - * Thankfully, libxml maps what looks like globals into - * thread-local uses, so we are thread-safe. */ - xmlIndentTreeOutput = 1; -- xmlbuf = xmlBufferCreate(); -+ if (!(xmlbuf = xmlBufferCreate())) { -+ virReportOOMError(); -+ goto error; -+ } -+ - if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, - virBufferGetIndent(buf) / 2, 1) < 0) { - xmlBufferFree(xmlbuf); -diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c -index 819b645..c379042 100644 ---- a/src/conf/network_conf.c -+++ b/src/conf/network_conf.c -@@ -2478,7 +2478,11 @@ virNetworkDefFormatBuf(virBufferPtr buf, - * Thankfully, libxml maps what looks like globals into - * thread-local uses, so we are thread-safe. */ - xmlIndentTreeOutput = 1; -- xmlbuf = xmlBufferCreate(); -+ if (!(xmlbuf = xmlBufferCreate())) { -+ virReportOOMError(); -+ return -1; -+ } -+ - if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, - virBufferGetIndent(buf) / 2, 1) < 0) { - xmlBufferFree(xmlbuf); -diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c -index b1fd118..fbc8366 100644 ---- a/src/vmx/vmx.c -+++ b/src/vmx/vmx.c -@@ -697,8 +697,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) - { - char *result = NULL; - xmlCharEncodingHandlerPtr handler; -- xmlBufferPtr input; -- xmlBufferPtr utf8; -+ xmlBufferPtr input = NULL; -+ xmlBufferPtr utf8 = NULL; - - handler = xmlFindCharEncodingHandler(encoding); - -@@ -708,8 +708,11 @@ virVMXConvertToUTF8(const char *encoding, const char *string) - return NULL; - } - -- input = xmlBufferCreateStatic((char *)string, strlen(string)); -- utf8 = xmlBufferCreate(); -+ if (!(input = xmlBufferCreateStatic((char *)string, strlen(string))) || -+ !(utf8 = xmlBufferCreate())) { -+ virReportOOMError(); -+ goto cleanup; -+ } - - if (xmlCharEncInFunc(handler, utf8, input) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, --- -1.8.3.1 - diff --git a/libvirt-cpu-arm-add-cpu-data-free-function-to-virCPUarmDataF.patch b/libvirt-cpu-arm-add-cpu-data-free-function-to-virCPUarmDataF.patch deleted file mode 100644 index 2adbb48e448e89dc59a00ac728ae9235ccd677f9..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-add-cpu-data-free-function-to-virCPUarmDataF.patch +++ /dev/null @@ -1,51 +0,0 @@ -From efde450d2d0648475cde04f04f5e26c1a006c226 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Fri, 17 Apr 2020 14:40:27 +0800 -Subject: cpu/arm: add cpu data free function to virCPUarmDataFree - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index ee58021..230cd27 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -61,6 +61,25 @@ virCPUarmFeatureFree(virCPUarmFeaturePtr feature) - - G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmFeature, virCPUarmFeatureFree); - -+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); -+} -+ - typedef struct _virCPUarmMap virCPUarmMap; - typedef virCPUarmMap *virCPUarmMapPtr; - struct _virCPUarmMap { -@@ -259,6 +278,7 @@ struct cpuArchDriver cpuDriverArm = { - .compare = virCPUarmCompare, - .decode = NULL, - .encode = NULL, -+ .dataFree = virCPUarmDataFree, - .baseline = virCPUarmBaseline, - .update = virCPUarmUpdate, - .validateFeatures = virCPUarmValidateFeatures, --- -2.23.0 - diff --git a/libvirt-cpu-arm-add-decode-function.patch b/libvirt-cpu-arm-add-decode-function.patch deleted file mode 100644 index 6b43380d85c240367877b932dfac13cd4aeb012c..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-add-decode-function.patch +++ /dev/null @@ -1,275 +0,0 @@ -From c69a629367b0e9bfa1a034301a4c3f88ad080586 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Sat, 18 Apr 2020 11:16:13 +0800 -Subject: cpu/arm: add decode function - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 150 ++++++++++++++++++++++++++++++++++-------- - src/cpu_map/index.xml | 3 - - 2 files changed, 122 insertions(+), 31 deletions(-) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index d85f111..eb9b1c9 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -55,7 +55,6 @@ virCPUarmFeatureFree(virCPUarmFeaturePtr feature) - return; - - g_free(feature->name); -- - g_free(feature); - } - -@@ -80,6 +79,8 @@ virCPUarmDataFree(virCPUDataPtr cpuData) - g_free(cpuData); - } - -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUData, virCPUarmDataFree); -+ - typedef struct _virCPUarmVendor virCPUarmVendor; - typedef virCPUarmVendor *virCPUarmVendorPtr; - struct _virCPUarmVendor { -@@ -103,6 +104,8 @@ virCPUarmVendorFree(virCPUarmVendorPtr vendor) - VIR_FREE(vendor); - } - -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmVendor, virCPUarmVendorFree); -+ - typedef struct _virCPUarmModel virCPUarmModel; - typedef virCPUarmModel *virCPUarmModelPtr; - struct _virCPUarmModel { -@@ -175,6 +178,38 @@ virCPUarmMapFree(virCPUarmMapPtr map) - - G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmMap, virCPUarmMapFree); - -+static virCPUarmVendorPtr -+virCPUarmVendorFindByID(virCPUarmMapPtr map, -+ unsigned long vendor_id) -+{ -+ size_t i; -+ -+ for (i = 0; i < map->vendors->len; i++) { -+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ -+ if (vendor->value == vendor_id) -+ return vendor; -+ } -+ -+ return NULL; -+} -+ -+static virCPUarmVendorPtr -+virCPUarmVendorFindByName(virCPUarmMapPtr map, -+ const char *name) -+{ -+ size_t i; -+ -+ for (i = 0; i < map->vendors->len; i++) { -+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ -+ if (STREQ(vendor->name, name)) -+ return vendor; -+ } -+ -+ return NULL; -+} -+ - static virCPUarmFeaturePtr - virCPUarmMapFeatureFind(virCPUarmMapPtr map, - const char *name) -@@ -213,36 +248,43 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, - return 0; - } - --static virCPUarmVendorPtr --virCPUarmVendorFindByID(virCPUarmMapPtr map, -- unsigned long vendor_id) -+static int -+armCpuDataParseFeatures(virCPUDefPtr cpu, -+ const virCPUarmData *cpuData) - { -+ int ret = -1; - size_t i; -+ char **features; - -- for (i = 0; i < map->vendors->len; i++) { -- virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ if (!cpu || !cpuData) -+ return ret; - -- if (vendor->value == vendor_id) -- return vendor; -- } -+ if (!(features = virStringSplitCount(cpuData->features, " ", -+ 0, &cpu->nfeatures))) -+ return ret; - -- return NULL; --} -+ if (cpu->nfeatures) { -+ if (VIR_ALLOC_N(cpu->features, cpu->nfeatures) < 0) -+ goto error; - --static virCPUarmVendorPtr --virCPUarmVendorFindByName(virCPUarmMapPtr map, -- const char *name) --{ -- size_t i; -+ for (i = 0; i < cpu->nfeatures; i++) { -+ cpu->features[i].policy = VIR_CPU_FEATURE_REQUIRE; -+ cpu->features[i].name = g_strdup(features[i]); -+ } -+ } - -- for (i = 0; i < map->vendors->len; i++) { -- virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ ret = 0; - -- if (STREQ(vendor->name, name)) -- return vendor; -- } -+cleanup: -+ virStringListFree(features); -+ return ret; - -- return NULL; -+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 -@@ -252,7 +294,6 @@ virCPUarmVendorParse(xmlXPathContextPtr ctxt, - { - virCPUarmMapPtr map = (virCPUarmMapPtr)data; - g_autoptr(virCPUarmVendor) vendor = NULL; -- int ret = -1; - - if (virCPUarmVendorFindByName(map, name)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -289,7 +330,7 @@ virCPUarmModelFindByPVR(virCPUarmMapPtr map, - for (i = 0; i < map->models->len; i++) { - virCPUarmModelPtr model = g_ptr_array_index(map->models, i); - -- if (STREQ(model->pvr, pvr)) -+ if (model->data.pvr == pvr) - return model; - } - -@@ -299,7 +340,7 @@ virCPUarmModelFindByPVR(virCPUarmMapPtr map, - - static virCPUarmModelPtr - virCPUarmModelFindByName(virCPUarmMapPtr map, -- const char *name) -+ const char *name) - { - size_t i; - -@@ -321,7 +362,6 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt, - virCPUarmMapPtr map = (virCPUarmMapPtr)data; - g_autoptr(virCPUarmModel) model = NULL; - char *vendor = NULL; -- int ret = -1; - - if (virCPUarmModelFindByName(map, name)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -404,6 +444,60 @@ virCPUarmGetMap(void) - return cpuMap; - } - -+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 && -+ armCpuDataParseFeatures(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 - virCPUarmUpdate(virCPUDefPtr guest, - const virCPUDef *host) -@@ -432,7 +526,7 @@ virCPUarmUpdate(virCPUDefPtr guest, - guest->match = VIR_CPU_MATCH_EXACT; - ret = 0; - -- cleanup: -+cleanup: - virCPUDefFree(updated); - return ret; - } -@@ -493,7 +587,7 @@ struct cpuArchDriver cpuDriverArm = { - .arch = archs, - .narch = G_N_ELEMENTS(archs), - .compare = virCPUarmCompare, -- .decode = NULL, -+ .decode = virCPUarmDecodeCPUData, - .encode = NULL, - .dataFree = virCPUarmDataFree, - .baseline = virCPUarmBaseline, -diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml -index 2e78834..985af86 100644 ---- a/src/cpu_map/index.xml -+++ b/src/cpu_map/index.xml -@@ -86,9 +86,6 @@ - - - -- -- -- - - - --- -2.23.0 - diff --git a/libvirt-cpu-arm-add-load-cpu-map-parse-function.patch b/libvirt-cpu-arm-add-load-cpu-map-parse-function.patch deleted file mode 100644 index cf59ab29790f6d4669a1d1dc458ca8e18b817b7a..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-add-load-cpu-map-parse-function.patch +++ /dev/null @@ -1,287 +0,0 @@ -From a0574d45603010761d3f3034f97457fda94d2266 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Fri, 17 Apr 2020 18:13:32 +0800 -Subject: cpu/arm: add load cpu map parse function - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 223 +++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 220 insertions(+), 3 deletions(-) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index 230cd27..d85f111 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -67,7 +67,7 @@ virCPUarmDataClear(virCPUarmData *data) - if (!data) - return; - -- VIR_FREE(data->features); -+ g_free(data->features); - } - - static void -@@ -77,12 +77,64 @@ virCPUarmDataFree(virCPUDataPtr cpuData) - return; - - virCPUarmDataClear(&cpuData->data.arm); -- VIR_FREE(cpuData); -+ g_free(cpuData); - } - -+typedef struct _virCPUarmVendor virCPUarmVendor; -+typedef virCPUarmVendor *virCPUarmVendorPtr; -+struct _virCPUarmVendor { -+ char *name; -+ unsigned long value; -+}; -+ -+static virCPUarmVendorPtr -+virCPUarmVendorNew(void) -+{ -+ return g_new0(virCPUarmVendor, 1); -+} -+ -+static void -+virCPUarmVendorFree(virCPUarmVendorPtr vendor) -+{ -+ if (!vendor) -+ return; -+ -+ g_free(vendor->name); -+ VIR_FREE(vendor); -+} -+ -+typedef struct _virCPUarmModel virCPUarmModel; -+typedef virCPUarmModel *virCPUarmModelPtr; -+struct _virCPUarmModel { -+ char *name; -+ virCPUarmVendorPtr vendor; -+ virCPUarmData data; -+}; -+ -+static virCPUarmModelPtr -+virCPUarmModelNew(void) -+{ -+ return g_new0(virCPUarmModel, 1); -+} -+ -+static void -+virCPUarmModelFree(virCPUarmModelPtr model) -+{ -+ if (!model) -+ return; -+ -+ virCPUarmDataClear(&model->data); -+ g_free(model->name); -+ g_free(model); -+} -+ -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUarmModel, virCPUarmModelFree); -+ - typedef struct _virCPUarmMap virCPUarmMap; - typedef virCPUarmMap *virCPUarmMapPtr; - struct _virCPUarmMap { -+ GPtrArray *vendors; -+ GPtrArray *models; - GPtrArray *features; - }; - -@@ -93,6 +145,14 @@ virCPUarmMapNew(void) - - map = g_new0(virCPUarmMap, 1); - -+ map->vendors = g_ptr_array_new(); -+ g_ptr_array_set_free_func(map->vendors, -+ (GDestroyNotify) virCPUarmVendorFree); -+ -+ map->models = g_ptr_array_new(); -+ g_ptr_array_set_free_func(map->models, -+ (GDestroyNotify) virCPUarmModelFree); -+ - map->features = g_ptr_array_new(); - g_ptr_array_set_free_func(map->features, - (GDestroyNotify) virCPUarmFeatureFree); -@@ -106,6 +166,8 @@ virCPUarmMapFree(virCPUarmMapPtr map) - if (!map) - return; - -+ g_ptr_array_free(map->vendors, TRUE); -+ g_ptr_array_free(map->models, TRUE); - g_ptr_array_free(map->features, TRUE); - - g_free(map); -@@ -151,6 +213,161 @@ 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->vendors->len; i++) { -+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ -+ if (vendor->value == vendor_id) -+ return vendor; -+ } -+ -+ return NULL; -+} -+ -+static virCPUarmVendorPtr -+virCPUarmVendorFindByName(virCPUarmMapPtr map, -+ const char *name) -+{ -+ size_t i; -+ -+ for (i = 0; i < map->vendors->len; i++) { -+ virCPUarmVendorPtr vendor = g_ptr_array_index(map->vendors, i); -+ -+ if (STREQ(vendor->name, name)) -+ return vendor; -+ } -+ -+ return NULL; -+} -+ -+static int -+virCPUarmVendorParse(xmlXPathContextPtr ctxt, -+ const char *name, -+ void *data) -+{ -+ virCPUarmMapPtr map = (virCPUarmMapPtr)data; -+ g_autoptr(virCPUarmVendor) vendor = NULL; -+ int ret = -1; -+ -+ if (virCPUarmVendorFindByName(map, name)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU vendor %s already defined"), name); -+ return -1; -+ } -+ -+ vendor = virCPUarmVendorNew(); -+ vendor->name = g_strdup(name); -+ -+ if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ "%s", _("Missing CPU vendor value")); -+ return -1; -+ } -+ -+ if (virCPUarmVendorFindByID(map, vendor->value)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU vendor value 0x%2lx already defined"), vendor->value); -+ return -1; -+ } -+ -+ g_ptr_array_add(map->vendors, g_steal_pointer(&vendor)); -+ -+ return 0; -+} -+ -+static virCPUarmModelPtr -+virCPUarmModelFindByPVR(virCPUarmMapPtr map, -+ unsigned long pvr) -+{ -+ size_t i; -+ -+ for (i = 0; i < map->models->len; i++) { -+ virCPUarmModelPtr model = g_ptr_array_index(map->models, i); -+ -+ if (STREQ(model->pvr, pvr)) -+ return model; -+ } -+ -+ return NULL; -+ -+} -+ -+static virCPUarmModelPtr -+virCPUarmModelFindByName(virCPUarmMapPtr map, -+ const char *name) -+{ -+ size_t i; -+ -+ for (i = 0; i < map->models->len; i++) { -+ virCPUarmModelPtr model = g_ptr_array_index(map->models, i); -+ -+ if (STREQ(model->name, name)) -+ return model; -+ } -+ -+ return NULL; -+} -+ -+static int -+virCPUarmModelParse(xmlXPathContextPtr ctxt, -+ const char *name, -+ void *data) -+{ -+ virCPUarmMapPtr map = (virCPUarmMapPtr)data; -+ g_autoptr(virCPUarmModel) model = NULL; -+ char *vendor = NULL; -+ int ret = -1; -+ -+ if (virCPUarmModelFindByName(map, name)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU model %s already defined"), name); -+ return -1; -+ } -+ -+ model = virCPUarmModelNew(); -+ model->name = g_strdup(name); -+ -+ 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"), -+ name); -+ return -1; -+ } -+ -+ if (!(model->vendor = virCPUarmVendorFindByName(map, vendor))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown vendor %s referenced by CPU model %s"), -+ vendor, model->name); -+ return -1; -+ } -+ } -+ -+ if (!virXPathBoolean("boolean(./pvr)", ctxt)) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Missing PVR information for CPU model %s"), -+ model->name); -+ return -1; -+ } -+ -+ 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); -+ return -1; -+ } -+ -+ g_ptr_array_add(map->models, g_steal_pointer(&model)); -+ -+ return 0; -+} -+ - static virCPUarmMapPtr - virCPUarmLoadMap(void) - { -@@ -158,7 +375,7 @@ 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.23.0 - diff --git a/libvirt-cpu-arm-add-virCPUarmGetHost-implment.patch b/libvirt-cpu-arm-add-virCPUarmGetHost-implment.patch deleted file mode 100644 index 981204257ef8a4c82c2a1f2b445903c5d328193e..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-add-virCPUarmGetHost-implment.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 208c9f1eb9a06d2550b7b3cfe0172840925255d4 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Mon, 20 Apr 2020 17:29:17 +0800 -Subject: cpu/arm: add virCPUarmGetHost implment - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 86 insertions(+) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index eb9b1c9..78e604c 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -26,9 +26,15 @@ - #include "cpu_map.h" - #include "virstring.h" - #include "virxml.h" -+#include "virfile.h" - - #define VIR_FROM_THIS VIR_FROM_CPU - -+static const char *sysinfoCpuinfo = "/proc/cpuinfo"; -+ -+#define CPUINFO sysinfoCpuinfo -+#define CPUINFO_FILE_LEN (1024*1024) /* 1MB limit for /proc/cpuinfo file */ -+ - static const virArch archs[] = { - VIR_ARCH_ARMV6L, - VIR_ARCH_ARMV7B, -@@ -531,6 +537,85 @@ cleanup: - return ret; - } - -+static int -+armCpuDataFromCpuInfo(virCPUarmData *data) -+{ -+ g_autofree char *str_vendor = NULL; -+ g_autofree char *str_pvr = NULL; -+ g_autofree char *outbuf = NULL; -+ char *eol = NULL; -+ const char *cur; -+ -+ if (!data) -+ return -1; -+ -+ if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Failed to open %s"), CPUINFO); -+ return -1; -+ } -+ -+ /* Account for format 'CPU implementer : XXXX' */ -+ if ((cur = strstr(outbuf, "CPU implementer")) == NULL) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("there is no \"CPU implementer\" info in %s"), CPUINFO); -+ return -1; -+ } -+ -+ cur = strchr(cur, ':') + 1; -+ eol = strchr(cur, '\n'); -+ virSkipSpaces(&cur); -+ if (!eol || !(str_vendor = g_strndup(cur, eol - cur)) || -+ virStrToLong_ul(str_vendor, NULL, 16, &data->vendor_id) < 0) -+ return -1; -+ -+ /* Account for format 'CPU part : XXXX' */ -+ if ((cur = strstr(outbuf, "CPU part")) == NULL) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("there is no \"CPU part\" info in %s"), CPUINFO); -+ return -1; -+ } -+ -+ cur = strchr(cur, ':') + 1; -+ eol = strchr(cur, '\n'); -+ virSkipSpaces(&cur); -+ if (!eol || !(str_pvr = g_strndup(cur, eol - cur)) || -+ virStrToLong_ul(str_pvr, NULL, 16, &data->pvr) < 0) -+ return -1; -+ -+ /* Account for format 'CPU Features : XXXX' */ -+ if ((cur = strstr(outbuf, "Features")) == NULL) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("there is no \"Features\" info in %s"), CPUINFO); -+ return -1; -+ } -+ cur = strchr(cur, ':') + 1; -+ eol = strchr(cur, '\n'); -+ virSkipSpaces(&cur); -+ if (eol && !(data->features = g_strndup(cur, eol - cur))) -+ return -1; -+ -+ return 0; -+} -+ -+static int -+virCPUarmGetHost(virCPUDefPtr cpu, -+ virDomainCapsCPUModelsPtr models) -+{ -+ g_autoptr(virCPUData) cpuData = NULL; -+ -+ if (virCPUarmDriverInitialize() < 0) -+ return -1; -+ -+ if (!(cpuData = virCPUDataNew(archs[0]))) -+ return -1; -+ -+ if (armCpuDataFromCpuInfo(&cpuData->data.arm) < 0) -+ return -1; -+ -+ return virCPUarmDecodeCPUData(cpu, cpuData, models); -+} -+ - - static virCPUDefPtr - virCPUarmBaseline(virCPUDefPtr *cpus, -@@ -590,6 +675,7 @@ struct cpuArchDriver cpuDriverArm = { - .decode = virCPUarmDecodeCPUData, - .encode = NULL, - .dataFree = virCPUarmDataFree, -+ .getHost = virCPUarmGetHost, - .baseline = virCPUarmBaseline, - .update = virCPUarmUpdate, - .validateFeatures = virCPUarmValidateFeatures, --- -2.23.0 - diff --git a/libvirt-cpu-arm-implment-cpu-baseline-function.patch b/libvirt-cpu-arm-implment-cpu-baseline-function.patch deleted file mode 100644 index d9dc344d55139a248f0b1c59fc979bf106739159..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-implment-cpu-baseline-function.patch +++ /dev/null @@ -1,216 +0,0 @@ -From 4606782bde2a6e75e88d782fc58e5db5365502c2 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Mon, 20 Apr 2020 19:17:56 +0800 -Subject: cpu/arm: implment cpu baseline function - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 178 ++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 174 insertions(+), 4 deletions(-) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index 78e604c..a7c9523 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -616,24 +616,194 @@ virCPUarmGetHost(virCPUDefPtr cpu, - return virCPUarmDecodeCPUData(cpu, cpuData, models); - } - -+static void -+virCPUarmDataIntersect(virCPUarmData *data1, -+ const virCPUarmData *data2) -+{ -+ char **features = NULL; -+ char **features1 = NULL; -+ char **features2 = NULL; -+ size_t count = 0; -+ size_t i; -+ -+ if (!data1 || !data2) -+ return; -+ -+ data1->pvr = MIN(data1->pvr, data2->pvr); -+ -+ if (virStringIsEmpty(data1->features) || -+ virStringIsEmpty(data2->features)) { -+ VIR_FREE(data1->features); -+ return; -+ } -+ -+ if (STREQ_NULLABLE(data1->features, data2->features)) -+ return; -+ -+ if (!(features = virStringSplitCount(data1->features, " ", 0, &count)) || -+ !(features1 = virStringSplitCount(data1->features, " ", 0, &count)) || -+ !(features2 = virStringSplit(data2->features, " ", 0))) -+ goto cleanup; -+ -+ for (i = 0; i < count; i++) { -+ if (!virStringListHasString((const char**)features2, features1[i])) -+ virStringListRemove(&features, features1[i]); -+ } -+ -+ VIR_FREE(data1->features); -+ if (features) -+ data1->features = virStringListJoin((const char**)features, " "); -+ -+cleanup: -+ virStringListFree(features); -+ virStringListFree(features1); -+ virStringListFree(features2); -+ return; -+} -+ -+static void -+virCPUarmDataCopy(virCPUarmData *dst, const virCPUarmData *src) -+{ -+ dst->features = g_strdup(src->features); -+ dst->vendor_id = src->vendor_id; -+ dst->pvr = src->pvr; -+} -+ -+static virCPUarmModelPtr -+virCPUarmModelCopy(virCPUarmModelPtr model) -+{ -+ g_autoptr(virCPUarmModel) copy = NULL; -+ -+ copy = virCPUarmModelNew(); -+ -+ virCPUarmDataCopy(©->data, &model->data); -+ copy->name = g_strdup(model->name); -+ copy->vendor = model->vendor; -+ -+ return g_steal_pointer(©); -+} -+ -+static virCPUarmModelPtr -+virCPUarmModelFromCPU(const virCPUDef *cpu, -+ virCPUarmMapPtr map) -+{ -+ g_autoptr(virCPUarmModel) model = NULL; -+ virCPUarmVendorPtr vendor = NULL; -+ char **features = NULL; -+ size_t i; -+ -+ if (!cpu->model) { -+ virReportError(VIR_ERR_INVALID_ARG, "%s", -+ _("no CPU model specified")); -+ return NULL; -+ } -+ -+ if (!(model = virCPUarmModelFindByName(map, cpu->model))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown CPU model %s"), cpu->model); -+ return NULL; -+ } -+ -+ if (!(model = virCPUarmModelCopy(model))) -+ return NULL; -+ -+ if (cpu->vendor) { -+ if (!(vendor = virCPUarmVendorFindByName(map, cpu->vendor))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Unknown CPU vendor %s"), cpu->vendor); -+ return NULL; -+ } -+ model->data.vendor_id = vendor->value; -+ } -+ -+ if (cpu->nfeatures) { -+ if (VIR_REALLOC_N(features, cpu->nfeatures + 1) < 0) -+ return model; -+ -+ features[cpu->nfeatures] = NULL; -+ for (i = 0; i < cpu->nfeatures; i++) -+ features[i] = g_strdup(cpu->features[i].name); -+ VIR_FREE(model->data.features); -+ model->data.features = virStringListJoin((const char **)features, " "); -+ } -+ -+ virStringListFree(features); -+ return g_steal_pointer(&model); -+} - - static virCPUDefPtr - virCPUarmBaseline(virCPUDefPtr *cpus, -- unsigned int ncpus G_GNUC_UNUSED, -- virDomainCapsCPUModelsPtr models G_GNUC_UNUSED, -+ unsigned int ncpus, -+ virDomainCapsCPUModelsPtr models, - const char **features G_GNUC_UNUSED, - bool migratable G_GNUC_UNUSED) - { -- virCPUDefPtr cpu = NULL; -+ virCPUarmMapPtr map = NULL; -+ g_autoptr(virCPUDef) cpu = NULL; -+ g_autoptr(virCPUarmModel) model = NULL; -+ g_autoptr(virCPUarmModel) baseModel = NULL; -+ virCPUarmVendorPtr vendor = NULL; -+ bool outputVendor = true; -+ size_t i; - - cpu = virCPUDefNew(); - - cpu->model = g_strdup(cpus[0]->model); - -+ cpu->arch = cpus[0]->arch; - cpu->type = VIR_CPU_TYPE_GUEST; - cpu->match = VIR_CPU_MATCH_EXACT; -+ cpu->fallback = VIR_CPU_FALLBACK_FORBID; -+ -+ if (!(map = virCPUarmGetMap())) -+ return NULL; -+ -+ if (!(baseModel = virCPUarmModelFromCPU(cpus[0], map))) -+ return NULL; -+ -+ if (!cpus[0]->vendor) { -+ outputVendor = false; -+ } else if (!(vendor = virCPUarmVendorFindByName(map, cpus[0]->vendor))) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ _("Unknown CPU vendor %s"), cpus[0]->vendor); -+ return NULL; -+ } -+ -+ for (i = 0; i < ncpus; i++) { -+ const char *vn = NULL; -+ if (!(model = virCPUarmModelFromCPU(cpus[i], map))) -+ return NULL; -+ -+ if (cpus[i]->vendor) { -+ vn = cpus[i]->vendor; -+ } else { -+ outputVendor = false; -+ } -+ -+ if (vn) { -+ if (!vendor) { -+ if (!(vendor = virCPUarmVendorFindByName(map, vn))) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ _("Unknown CPU vendor %s"), vn); -+ return NULL; -+ } -+ } else if (STRNEQ(vendor->name, vn)) { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ "%s", _("CPU vendors do not match")); -+ return NULL; -+ } -+ -+ virCPUarmDataIntersect(&baseModel->data, &model->data); -+ } -+ } -+ -+ if (virCPUarmDecode(cpu, &baseModel->data, models) < 0) -+ return NULL; -+ -+ if (!outputVendor) -+ g_free(cpu->vendor); - -- return cpu; -+ return g_steal_pointer(&cpu); - } - - static virCPUCompareResult --- -2.23.0 - diff --git a/libvirt-cpu-arm-implment-cpu-compare-function.patch b/libvirt-cpu-arm-implment-cpu-compare-function.patch deleted file mode 100644 index c08e4bb3fcb216586e78f1f7ef6fc5d55ec49c44..0000000000000000000000000000000000000000 --- a/libvirt-cpu-arm-implment-cpu-compare-function.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 1a70b1e3bdbd8d0dcf9281341bc23b4ff2ffaa3a Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Mon, 20 Apr 2020 19:33:49 +0800 -Subject: cpu/arm: implment cpu compare function - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu_arm.c | 196 +++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 193 insertions(+), 3 deletions(-) - -diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c -index a7c9523..3ef54b9 100644 ---- a/src/cpu/cpu_arm.c -+++ b/src/cpu/cpu_arm.c -@@ -21,6 +21,7 @@ - - #include - -+#include "virlog.h" - #include "viralloc.h" - #include "cpu.h" - #include "cpu_map.h" -@@ -30,6 +31,8 @@ - - #define VIR_FROM_THIS VIR_FROM_CPU - -+VIR_LOG_INIT("cpu.cpu_arm"); -+ - static const char *sysinfoCpuinfo = "/proc/cpuinfo"; - - #define CPUINFO sysinfoCpuinfo -@@ -806,14 +809,201 @@ virCPUarmBaseline(virCPUDefPtr *cpus, - return g_steal_pointer(&cpu); - } - -+static bool -+virCPUarmFeaturesIsSub(char *subFeatures, -+ char *fullFeatures) -+{ -+ bool ret = false; -+ char **sub = NULL; -+ char **full = NULL; -+ size_t subCount = 0; -+ size_t fullCount = 0; -+ size_t i; -+ -+ if (virStringIsEmpty(subFeatures)) -+ return true; -+ -+ if (virStringIsEmpty(fullFeatures)) -+ return ret; -+ -+ if (STREQ(subFeatures, fullFeatures)) -+ return true; -+ -+ if (!(sub = virStringSplitCount(subFeatures, " ", 0, &subCount)) || -+ !(full = virStringSplitCount(fullFeatures, " ", 0, &fullCount)) || -+ subCount > fullCount) -+ goto cleanup; -+ -+ for (i = 0; i < subCount; i++) { -+ if (!virStringListHasString((const char**)full, sub[i])) -+ goto cleanup; -+ } -+ -+ ret = true; -+ -+ cleanup: -+ virStringListFree(sub); -+ virStringListFree(full); -+ return ret; -+} -+ -+static virCPUDataPtr -+armMakeCPUData(virArch arch, -+ virCPUarmData *data) -+{ -+ virCPUDataPtr cpuData; -+ -+ if (!(cpuData = virCPUDataNew(arch))) -+ return NULL; -+ -+ virCPUarmDataCopy(&cpuData->data.arm, data); -+ -+ return cpuData; -+} -+ - static virCPUCompareResult --virCPUarmCompare(virCPUDefPtr host G_GNUC_UNUSED, -- virCPUDefPtr cpu G_GNUC_UNUSED, -- bool failMessages G_GNUC_UNUSED) -+armCompute(virCPUDefPtr host, -+ virCPUDefPtr cpu, -+ virCPUDataPtr *guestData, -+ char **message) - { -+ virCPUarmMapPtr map = NULL; -+ g_autoptr(virCPUarmModel) hostModel = NULL; -+ g_autoptr(virCPUarmModel) guestModel = NULL; -+ virArch arch; -+ size_t i; -+ -+ if (cpu->arch != VIR_ARCH_NONE) { -+ bool found = false; -+ -+ for (i = 0; i < G_N_ELEMENTS(archs); i++) { -+ if (archs[i] == cpu->arch) { -+ found = true; -+ break; -+ } -+ } -+ -+ if (!found) { -+ VIR_DEBUG("CPU arch %s does not match host arch", -+ virArchToString(cpu->arch)); -+ if (message) -+ *message = g_strdup_printf(_("CPU arch %s does not match host arch"), -+ virArchToString(cpu->arch)); -+ -+ return VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ arch = cpu->arch; -+ } else { -+ arch = host->arch; -+ } -+ -+ if (cpu->vendor && -+ (!host->vendor || STRNEQ(cpu->vendor, host->vendor))) { -+ VIR_DEBUG("host CPU vendor does not match required CPU vendor %s", -+ cpu->vendor); -+ if (message) -+ *message = g_strdup_printf(_("host CPU vendor does not match required " -+ "CPU vendor %s"), -+ cpu->vendor); -+ -+ return VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ -+ if (!(map = virCPUarmGetMap())) -+ return VIR_CPU_COMPARE_ERROR; -+ -+ /* Host CPU information */ -+ if (!(hostModel = virCPUarmModelFromCPU(host, map))) -+ return VIR_CPU_COMPARE_ERROR; -+ -+ if (cpu->type == VIR_CPU_TYPE_GUEST) { -+ /* Guest CPU information */ -+ switch (cpu->mode) { -+ case VIR_CPU_MODE_HOST_MODEL: -+ case VIR_CPU_MODE_HOST_PASSTHROUGH: -+ /* host-model and host-passthrough: -+ * the guest CPU is the same as the host */ -+ guestModel = virCPUarmModelCopy(hostModel); -+ break; -+ -+ case VIR_CPU_MODE_CUSTOM: -+ /* custom: -+ * look up guest CPU information */ -+ guestModel = virCPUarmModelFromCPU(cpu, map); -+ break; -+ } -+ } else { -+ /* Other host CPU information */ -+ guestModel = virCPUarmModelFromCPU(cpu, map); -+ } -+ -+ if (!guestModel) -+ return VIR_CPU_COMPARE_ERROR; -+ -+ if (STRNEQ(guestModel->name, hostModel->name)) { -+ VIR_DEBUG("host CPU model %s does not match required CPU model %s", -+ hostModel->name, guestModel->name); -+ if (message) -+ *message = g_strdup_printf(_("host CPU model %s does not match required " -+ "CPU model %s"), -+ hostModel->name, guestModel->name); -+ -+ return VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ -+ if (!virCPUarmFeaturesIsSub(guestModel->data.features, hostModel->data.features)) { -+ VIR_DEBUG("guest CPU features '%s' is not subset of " -+ "host CPU features '%s'", -+ guestModel->data.features, hostModel->data.features); -+ if (message) -+ *message = g_strdup_printf(_("guest CPU features '%s' is not subset of " -+ "host CPU features '%s'"), -+ guestModel->data.features, -+ hostModel->data.features); -+ -+ return VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ -+ if (guestData && -+ !(*guestData = armMakeCPUData(arch, &guestModel->data))) -+ return VIR_CPU_COMPARE_ERROR; -+ - return VIR_CPU_COMPARE_IDENTICAL; - } - -+static virCPUCompareResult -+virCPUarmCompare(virCPUDefPtr host, -+ virCPUDefPtr cpu, -+ bool failMessages) -+{ -+ virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; -+ g_autofree char *message = NULL; -+ -+ if (!host || !host->model) { -+ if (failMessages) { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", -+ _("unknown host CPU")); -+ } else { -+ VIR_WARN("unknown host CPU"); -+ return VIR_CPU_COMPARE_INCOMPATIBLE; -+ } -+ return VIR_CPU_COMPARE_ERROR; -+ } -+ -+ ret = armCompute(host, cpu, NULL, &message); -+ -+ if (failMessages && ret == VIR_CPU_COMPARE_INCOMPATIBLE) { -+ if (message) { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); -+ } else { -+ virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); -+ } -+ return VIR_CPU_COMPARE_ERROR; -+ } -+ -+ return ret; -+} -+ - static int - virCPUarmValidateFeatures(virCPUDefPtr cpu) - { --- -2.23.0 - diff --git a/libvirt-cpu-introduce-virCPUarmData-to-virCPUData.patch b/libvirt-cpu-introduce-virCPUarmData-to-virCPUData.patch deleted file mode 100644 index 51afaa10fcc7dfcfc4968b0bd9d469b1ef28558c..0000000000000000000000000000000000000000 --- a/libvirt-cpu-introduce-virCPUarmData-to-virCPUData.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 43ebd81b60121ce002a58ebc046b19f31bb23cb6 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Thu, 16 Apr 2020 11:00:49 +0800 -Subject: cpu: introduce virCPUarmData to virCPUData - -introduce virCPUarmData to virCPUData union, CPUarmData include -vendor id, pvr and cpu features. - -Signed-off-by: Xu Yandong ---- - src/cpu/cpu.h | 2 ++ - src/cpu/cpu_arm_data.h | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 34 insertions(+) - create mode 100644 src/cpu/cpu_arm_data.h - -diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h -index f779d2b..ec22a18 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 0000000..72b3a29 ---- /dev/null -+++ b/src/cpu/cpu_arm_data.h -@@ -0,0 +1,32 @@ -+/* -+ * cpu_arm_data.h: 64-bit arm CPU specific data -+ * -+ * Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved. -+ * -+ * 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 -+ * . -+ * -+ */ -+ -+#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.23.0 - diff --git a/libvirt-cpu_map-Introduce-arm-CPU-models.patch b/libvirt-cpu_map-Introduce-arm-CPU-models.patch deleted file mode 100644 index b47a7c5445a071f84276b7c5bf43df6b304aba6a..0000000000000000000000000000000000000000 --- a/libvirt-cpu_map-Introduce-arm-CPU-models.patch +++ /dev/null @@ -1,150 +0,0 @@ -From b305f4c05d22277ba6092bc0c2a15b752959bdec Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Thu, 16 Apr 2020 10:57:11 +0800 -Subject: cpu_map: Introduce arm CPU models - -Support vendor and model for virConnectGetCapabilities in ARM, -add arm cpu info to cpu map. - -Signed-off-by: Xu Yandong ---- - src/cpu_map/Makefile.inc.am | 5 +++++ - src/cpu_map/arm_Kunpeng-920.xml | 24 ++++++++++++++++++++++++ - src/cpu_map/arm_cortex-a53.xml | 6 ++++++ - src/cpu_map/arm_cortex-a57.xml | 6 ++++++ - src/cpu_map/arm_cortex-a72.xml | 6 ++++++ - src/cpu_map/arm_vendors.xml | 14 ++++++++++++++ - src/cpu_map/index.xml | 12 ++++++++++++ - 7 files changed, 73 insertions(+) - create mode 100644 src/cpu_map/arm_Kunpeng-920.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 be64c9a..8663877 100644 ---- a/src/cpu_map/Makefile.inc.am -+++ b/src/cpu_map/Makefile.inc.am -@@ -67,6 +67,11 @@ cpumap_DATA = \ - cpu_map/x86_Skylake-Server-noTSX-IBRS.xml \ - cpu_map/x86_Westmere.xml \ - cpu_map/x86_Westmere-IBRS.xml \ -+ cpu_map/arm_vendors.xml \ -+ cpu_map/arm_cortex-a53.xml \ -+ cpu_map/arm_cortex-a57.xml \ -+ cpu_map/arm_cortex-a72.xml \ -+ cpu_map/arm_Kunpeng-920.xml \ - $(NULL) - - EXTRA_DIST += $(cpumap_DATA) -diff --git a/src/cpu_map/arm_Kunpeng-920.xml b/src/cpu_map/arm_Kunpeng-920.xml -new file mode 100644 -index 0000000..b681546 ---- /dev/null -+++ b/src/cpu_map/arm_Kunpeng-920.xml -@@ -0,0 +1,24 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_cortex-a53.xml b/src/cpu_map/arm_cortex-a53.xml -new file mode 100644 -index 0000000..3580236 ---- /dev/null -+++ b/src/cpu_map/arm_cortex-a53.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_cortex-a57.xml b/src/cpu_map/arm_cortex-a57.xml -new file mode 100644 -index 0000000..3bc4324 ---- /dev/null -+++ b/src/cpu_map/arm_cortex-a57.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_cortex-a72.xml b/src/cpu_map/arm_cortex-a72.xml -new file mode 100644 -index 0000000..c509a40 ---- /dev/null -+++ b/src/cpu_map/arm_cortex-a72.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/arm_vendors.xml b/src/cpu_map/arm_vendors.xml -new file mode 100644 -index 0000000..840bf9a ---- /dev/null -+++ b/src/cpu_map/arm_vendors.xml -@@ -0,0 +1,14 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml -index 50b030d..2e78834 100644 ---- a/src/cpu_map/index.xml -+++ b/src/cpu_map/index.xml -@@ -87,4 +87,16 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - --- -2.23.0 - diff --git a/libvirt-ensure-defresult-is-used-in-virConnectAuthCa.patch b/libvirt-ensure-defresult-is-used-in-virConnectAuthCa.patch deleted file mode 100644 index 68964c3c8d92eecd15e78b96596c0977c8b0b78e..0000000000000000000000000000000000000000 --- a/libvirt-ensure-defresult-is-used-in-virConnectAuthCa.patch +++ /dev/null @@ -1,39 +0,0 @@ -From fe9f75a69b6dac1dec4f77d8b17ec2406415d89d Mon Sep 17 00:00:00 2001 -From: Matt Coleman -Date: Mon, 21 Sep 2020 22:01:46 -0400 -Subject: [PATCH 037/108] libvirt: ensure defresult is used in - virConnectAuthCallbackDefault -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A previous change to this function's password handling broke the use of -default values for credential types other than VIR_CRED_PASSPHRASE and -VIR_CRED_NOECHOPROMPT. - -Reviewed-by: Daniel P. Berrangé -Reviewed-by: Neal Gompa -Signed-off-by: Matt Coleman -(cherry picked from commit 1bb9f872a02f8be50c8f98b0ad13de62d2986fa9) ---- - src/libvirt.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/libvirt.c b/src/libvirt.c -index 76bf1fa677..b11a15d7fe 100644 ---- a/src/libvirt.c -+++ b/src/libvirt.c -@@ -146,7 +146,9 @@ virConnectAuthCallbackDefault(virConnectCredentialPtr cred, - len = strlen(buf); - if (len != 0 && buf[len-1] == '\n') - buf[len-1] = '\0'; -- bufptr = g_strdup(buf); -+ -+ if (strlen(buf) > 0) -+ bufptr = g_strdup(buf); - break; - - case VIR_CRED_PASSPHRASE: --- -2.33.0 - diff --git a/libvirt-guests-Sync-time-for-autostarted-guests.patch b/libvirt-guests-Sync-time-for-autostarted-guests.patch deleted file mode 100644 index 16a14d4e2844b3dd15a9a857116f4217364b16cd..0000000000000000000000000000000000000000 --- a/libvirt-guests-Sync-time-for-autostarted-guests.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bad0bdbee1225d4d5831bc7ea7d4113df4de743d Mon Sep 17 00:00:00 2001 -From: tangbinzy -Date: Tue, 29 Nov 2022 10:01:51 +0000 -Subject: [PATCH 08/24] libvirt-guests: Sync time for autostarted guests - Setting SYNC_TIME=1 does not work on autostarted guests. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -See https://bugzilla.redhat.com/show_bug.cgi?id=1555398. - -Signed-off-by: Tim Wiederhake -Reviewed-by: Daniel P. Berrangé - -Signed-off-by: tangbin -(cherry-pick from a501fa7cae2b93807496295945e6d3b51e5ccb3f) ---- - tools/libvirt-guests.sh.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in -index a881f6266e..74286a12c4 100644 ---- a/tools/libvirt-guests.sh.in -+++ b/tools/libvirt-guests.sh.in -@@ -200,9 +200,9 @@ start() { - retval run_virsh "$uri" start $bypass "$name" \ - >/dev/null && \ - gettext "done"; echo -- if "$sync_time"; then -- run_virsh "$uri" domtime --sync "$name" >/dev/null -- fi -+ fi -+ if "$sync_time"; then -+ run_virsh "$uri" domtime --sync "$name" >/dev/null - fi - fi - done --- -2.27.0 - diff --git a/libvirt-leaseshelper-Report-more-errors.patch b/libvirt-leaseshelper-Report-more-errors.patch deleted file mode 100644 index b6dce6f73d1c0a520009e87c2fe0b2a5cd55e674..0000000000000000000000000000000000000000 --- a/libvirt-leaseshelper-Report-more-errors.patch +++ /dev/null @@ -1,66 +0,0 @@ -From cc842aa3030697b1a454e15ccfb2a201e57d5602 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 15 Jun 2020 12:53:48 +0200 -Subject: [PATCH 3/6] leaseshelper: Report more errors -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some functions or code paths that may fail don't report error -(e.g. when acquiring PID file fails) leading to a silent quit -of the leaseshelper. This makes it super hard for us and users -to debug what is happening. Fortunately, dnsmasq captures both -stdout and stderr so we can write an error message there. - -cherry pick from: 9ed345ac1a035c8cf1de37431de638f4bac41de3 - -Signed-off-by: Michal Privoznik -Reviewed-by: Daniel P. Berrangé ---- - src/network/leaseshelper.c | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - -diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c -index 86c847d..2b5fc0f 100644 ---- a/src/network/leaseshelper.c -+++ b/src/network/leaseshelper.c -@@ -131,8 +131,10 @@ main(int argc, char **argv) - * events for expired leases. So, libvirtd sets another env var for this - * purpose */ - if (!interface && -- !(interface = getenv("VIR_BRIDGE_NAME"))) -- goto cleanup; -+ !(interface = getenv("VIR_BRIDGE_NAME"))) { -+ fprintf(stderr, _("interface not set\n")); -+ exit(EXIT_FAILURE); -+ } - - ip = argv[3]; - mac = argv[2]; -@@ -160,13 +162,21 @@ main(int argc, char **argv) - pid_file = g_strdup(RUNSTATEDIR "/leaseshelper.pid"); - - /* Try to claim the pidfile, exiting if we can't */ -- if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) -+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) { -+ fprintf(stderr, -+ _("Unable to acquire PID file: %s\n errno=%d"), -+ pid_file, errno); - goto cleanup; -+ } - - /* Since interfaces can be hot plugged, we need to make sure that the - * corresponding custom lease file exists. If not, 'touch' it */ -- if (virFileTouch(custom_lease_file, 0644) < 0) -+ if (virFileTouch(custom_lease_file, 0644) < 0) { -+ fprintf(stderr, -+ _("Unable to create: %s\n errno=%d"), -+ custom_lease_file, errno); - goto cleanup; -+ } - - switch ((enum virLeaseActionFlags) action) { - case VIR_LEASE_ACTION_ADD: --- -1.8.3.1 - diff --git a/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch b/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch deleted file mode 100644 index 4cbdd02a1d08b4eebd0f836b2d2413ded35d9868..0000000000000000000000000000000000000000 --- a/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 173b80e8f8103f26438d344e9b97335d4e5036b4 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Thu, 11 Jun 2020 16:43:22 +0200 -Subject: [PATCH 2/6] leaseshelper: Wait to acquire PID file -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On a DHCP transaction, dnsmasq runs our leases helper which -updates corresponding JSON files. While one dnsmasq won't run the -leaseshelper in parallel, two dnsmasqs (from two distinct -networks) might. To avoid corrupting JSON file, the leaseshelper -acquires PID file first. Well, the way it's acquiring it is not -ideal - it calls virPidFileAcquirePath(wait = false); which -means, that either it acquires the PID file instantly or returns -an error and does not touch the JSON at all. This in turn means -that there might be a leases record missing. With wait = true, -this won't happen. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1840307 - -cherry pick from: 876211ef4a192df1603b45715044ec14567d7e9f - -Signed-off-by: Michal Privoznik -Reviewed-by: Daniel P. Berrangé ---- - src/network/leaseshelper.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c -index a1780ca..86c847d 100644 ---- a/src/network/leaseshelper.c -+++ b/src/network/leaseshelper.c -@@ -160,7 +160,7 @@ main(int argc, char **argv) - pid_file = g_strdup(RUNSTATEDIR "/leaseshelper.pid"); - - /* Try to claim the pidfile, exiting if we can't */ -- if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) -+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) - goto cleanup; - - /* Since interfaces can be hot plugged, we need to make sure that the --- -1.8.3.1 - diff --git a/libvirt-libxl-fix-crash-when-initializing-driver.patch b/libvirt-libxl-fix-crash-when-initializing-driver.patch deleted file mode 100644 index 4d295c0435c4896aeda3057a0ec96123d11f745a..0000000000000000000000000000000000000000 --- a/libvirt-libxl-fix-crash-when-initializing-driver.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0e95f7b912055cf254b71b0b02dcb0acf7da3870 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Fri, 3 Apr 2020 15:51:48 -0600 -Subject: [PATCH 1/8] libxl: fix crash when initializing driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but -then called it a bit late from libxlStateInitialize. The cfg is used in -libxlDriverConfigLoadFile and when uninitialized results in a crash. -Calling DriverConfigInit immediately after DriverConfigNew fixes the -crash. - -Signed-off-by: Jim Fehlig -Reviewed-by: Erik Skultety -Reviewed-by: Ján Tomko -(cherry-picked from commit 88011ed2) -Signed-off-by: AlexChen ---- - src/libxl/libxl_driver.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c -index 7ec4fcc3d1..980984b199 100644 ---- a/src/libxl/libxl_driver.c -+++ b/src/libxl/libxl_driver.c -@@ -702,14 +702,14 @@ libxlStateInitialize(bool privileged, - if (!(cfg = libxlDriverConfigNew())) - goto error; - -+ if (libxlDriverConfigInit(cfg) < 0) -+ goto error; -+ - driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir); - - if (libxlDriverConfigLoadFile(cfg, driverConf) < 0) - goto error; - -- if (libxlDriverConfigInit(cfg) < 0) -- goto error; -- - /* Register the callbacks providing access to libvirt's event loop */ - libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx); - --- -2.23.0 - diff --git a/libvirt-po-Refresh-translation-for-running-state.patch b/libvirt-po-Refresh-translation-for-running-state.patch deleted file mode 100644 index 146ef476699e1c177d141936f11990b76f12b78c..0000000000000000000000000000000000000000 --- a/libvirt-po-Refresh-translation-for-running-state.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 26c64d58383d391add464b7f640fd6111f0d82d3 Mon Sep 17 00:00:00 2001 -From: Xu Yandong -Date: Wed, 15 Apr 2020 14:17:32 +0800 -Subject: po: Refresh translation for running state - -Signed-off-by: Xu Yandong ---- - po/zh_CN.mini.po | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/po/zh_CN.mini.po b/po/zh_CN.mini.po -index 94920d1..3d588ab 100644 ---- a/po/zh_CN.mini.po -+++ b/po/zh_CN.mini.po -@@ -19075,7 +19075,7 @@ msgid "rule node requires direction attribute" - msgstr "rule 节点需要 direction 属性" - - msgid "running" --msgstr "running" -+msgstr "运行中" - - msgid "sanlock is too old to support lock failure action" - msgstr "sanlock 太旧不支持锁失败动作" --- -2.23.0 - diff --git a/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch b/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch deleted file mode 100644 index 2fadfadfc941a2478530240e7f49c876d8025efe..0000000000000000000000000000000000000000 --- a/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 19d06bcb3c64662d5c131a035146d2caa8c5a437 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Tue, 14 Apr 2020 11:18:02 +0200 -Subject: [PATCH 4/8] qemu: Revoke access to mirror on failed blockcopy - -When preparing to do a blockcopy, the mirror image is modified so -that QEMU can access it. For instance, the mirror has seclabels -set, if it is a NVMe disk it is detached from the host and so on. -And usually, the restore is done upon successful finish of the -blockcopy operation. But, if something fails then we need to -explicitly revoke the access to the mirror image (and thus -reattach NVMe disk back to the host). - -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1822538 - -Signed-off-by: Michal Privoznik -Reviewed-by: Pavel Mores -(cherry-picked from commit 67e19fc9) -Signed-off-by: AlexChen ---- - src/qemu/qemu_driver.c | 21 +++++++++++++-------- - 1 file changed, 13 insertions(+), 8 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 8bc5368b2f..7162875492 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -17972,6 +17972,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, - virDomainDiskDefPtr disk = NULL; - int ret = -1; - bool need_unlink = false; -+ bool need_revoke = false; - g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); - const char *format = NULL; - bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); -@@ -18146,6 +18147,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, - - if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0) - goto endjob; -+ need_revoke = true; - - if (blockdev) { - if (mirror_reuse) { -@@ -18254,14 +18256,17 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, - - endjob: - if (ret < 0 && -- virDomainObjIsActive(vm) && -- (data || crdata)) { -- qemuDomainObjEnterMonitor(driver, vm); -- if (data) -- qemuBlockStorageSourceChainDetach(priv->mon, data); -- if (crdata) -- qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); -- ignore_value(qemuDomainObjExitMonitor(driver, vm)); -+ virDomainObjIsActive(vm)) { -+ if (data || crdata) { -+ qemuDomainObjEnterMonitor(driver, vm); -+ if (data) -+ qemuBlockStorageSourceChainDetach(priv->mon, data); -+ if (crdata) -+ qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); -+ ignore_value(qemuDomainObjExitMonitor(driver, vm)); -+ } -+ if (need_revoke) -+ qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); - } - if (need_unlink && virStorageFileUnlink(mirror) < 0) - VIR_WARN("%s", _("unable to remove just-created copy target")); --- -2.23.0 - diff --git a/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch b/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch deleted file mode 100644 index d1c07be670ee1ba74f9a4429d4fcbf92dbdd5074..0000000000000000000000000000000000000000 --- a/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch +++ /dev/null @@ -1,53 +0,0 @@ -From a7f7d8f7513af2b98d01259480f63167cf44cced Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Tue, 26 May 2020 16:26:25 +0200 -Subject: [PATCH] qemu: Skip pre-creation of NVMe disks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Upon migration with disks, libvirt determines if each disk exists -on the destination and tries to pre-create missing ones. Well, -NVMe disks can't be pre-created, but they can be checked for -presence. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1823639 - -cherry-pick from commit: a5a297f387fee9e9aa4cbc2df6788c330fd33ad1 - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -Signed-off-by: Jin Yan ---- - src/qemu/qemu_migration.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 65b47ec..3f4627b 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -315,6 +315,7 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm, - for (i = 0; i < nbd->ndisks; i++) { - virDomainDiskDefPtr disk; - const char *diskSrcPath; -+ g_autofree char *nvmePath = NULL; - - VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)", - nbd->disks[i].target, nbd->disks[i].capacity); -@@ -326,7 +327,12 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm, - goto cleanup; - } - -- diskSrcPath = virDomainDiskGetSource(disk); -+ if (disk->src->type == VIR_STORAGE_TYPE_NVME) { -+ virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath); -+ diskSrcPath = nvmePath; -+ } else { -+ diskSrcPath = virDomainDiskGetSource(disk); -+ } - - /* Skip disks we don't want to migrate and already existing disks. */ - if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks) || --- -1.8.3.1 - diff --git a/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch b/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch deleted file mode 100644 index c3b82555cceaaba775c32c44cd4d49afd634949e..0000000000000000000000000000000000000000 --- a/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c8a043dcdf4f04288bcfc34c25054dcef571a6a7 Mon Sep 17 00:00:00 2001 -From: Paulo de Rezende Pinatti -Date: Tue, 16 Jun 2020 16:32:10 +0200 -Subject: [PATCH] qemu: do not add model when actual iface type is hostdev - -No default model should be added to the interface -entry at post parse when its actual network type is hostdev -as doing so might cause a mismatch between the interface -definition and its actual device type. - -cherry-pick from commit: bdb8f2e41867ae5dbcc040909b1b8c20fd864a40 - -Signed-off-by: Paulo de Rezende Pinatti -Reviewed-by: Laine Stump -Signed-off-by: Jin Yan ---- - src/qemu/qemu_domain.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 91c1a49..cfada81 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -9334,6 +9334,7 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net, - virQEMUCapsPtr qemuCaps) - { - if (net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && -+ virDomainNetResolveActualType(net) != VIR_DOMAIN_NET_TYPE_HOSTDEV && - !virDomainNetGetModelString(net)) - net->model = qemuDomainDefaultNetModel(def, qemuCaps); - --- -1.8.3.1 - diff --git a/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch b/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch deleted file mode 100644 index 5905cf7e4b592b275230d86aa2f05fe23d90eeca..0000000000000000000000000000000000000000 --- a/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch +++ /dev/null @@ -1,48 +0,0 @@ -From f15935ea3b510bf0633dc2219a132412a7a8e96c Mon Sep 17 00:00:00 2001 -From: Lin Ma -Date: Thu, 16 Apr 2020 12:44:51 +0800 -Subject: [PATCH 3/8] qemu: fix hang in p2p + xbzrle compression + parallel - migration - -When we do parallel migration, The multifd-channels migration parameter -needs to be set on the destination side as well before incoming migration -URI, unless we accept the default number of connections(2). - -Usually, This can be correctly handled by libvirtd. But in this case if -we use p2p + xbzrle compression without parameter '--comp-xbzrle-cache', -qemuMigrationParamsDump returns too early, The corresponding migration -parameter will not be set on the destination side, It results QEMU hangs. - -Reproducer: -virsh migrate --live --p2p --comp-methods xbzrle \ ---parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system - -or - -virsh migrate --live --p2p --compressed \ ---parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system - -Signed-off-by: Lin Ma -Message-Id: <20200416044451.21134-1-lma@suse.com> -Reviewed-by: Jiri Denemark -(cherry-picked from commit 93b15ba0) -Signed-off-by: AlexChen ---- - src/qemu/qemu_migration_params.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c -index dd5e2ce1b6..810199370f 100644 ---- a/src/qemu/qemu_migration_params.c -+++ b/src/qemu/qemu_migration_params.c -@@ -630,7 +630,6 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams, - if (migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE && - !migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set) { - *flags |= VIR_MIGRATE_COMPRESSED; -- return 0; - } - - for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { --- -2.23.0 - diff --git a/libvirt-qemu-fix-potential-memory-leak.patch b/libvirt-qemu-fix-potential-memory-leak.patch deleted file mode 100644 index 40d03c59550032e2e823f1909d0ddd654d7a8907..0000000000000000000000000000000000000000 --- a/libvirt-qemu-fix-potential-memory-leak.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 4f4ebf64009e402db79bf53db1226966bf5c0a99 Mon Sep 17 00:00:00 2001 -From: Feng Ni -Date: Wed, 15 Apr 2020 11:11:16 +0800 -Subject: qemu: fix potential memory leak - -function virTypedParamsAddString may return -1 but alloc params, -so invoker should free it. - -Signed-off-by: Feng Ni -Signed-off-by: Xu Yandong ---- - src/qemu/qemu_driver.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index ff97f10..8bc5368 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -5175,6 +5175,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm, - goto cleanup; - - event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams); -+ eventParams = NULL; -+ eventNparams = 0; - - ret = 0; - -@@ -5182,6 +5184,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm, - virBitmapFree(tmpmap); - virCgroupFree(&cgroup_vcpu); - virObjectEventStateQueue(driver->domainEventState, event); -+ if (eventParams) -+ virTypedParamsFree(eventParams, eventNparams); - return ret; - } - -@@ -5388,6 +5392,8 @@ qemuDomainPinEmulator(virDomainPtr dom, - goto endjob; - - event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams); -+ eventParams = NULL; -+ eventNparams = 0; - } - - if (persistentDef) { -@@ -5409,6 +5415,8 @@ qemuDomainPinEmulator(virDomainPtr dom, - cleanup: - if (cgroup_emulator) - virCgroupFree(&cgroup_emulator); -+ if (eventParams) -+ virTypedParamsFree(eventParams, eventNparams); - virObjectEventStateQueue(driver->domainEventState, event); - virBitmapFree(pcpumap); - virDomainObjEndAPI(&vm); -@@ -5871,6 +5879,8 @@ qemuDomainPinIOThread(virDomainPtr dom, - goto endjob; - - event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams); -+ eventParams = NULL; -+ eventNparams = 0; - } - - if (persistentDef) { -@@ -5902,6 +5912,8 @@ qemuDomainPinIOThread(virDomainPtr dom, - cleanup: - if (cgroup_iothread) - virCgroupFree(&cgroup_iothread); -+ if (eventParams) -+ virTypedParamsFree(eventParams, eventNparams); - virObjectEventStateQueue(driver->domainEventState, event); - virBitmapFree(pcpumap); - virDomainObjEndAPI(&vm); --- -2.23.0 - diff --git a/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch b/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch deleted file mode 100644 index 0cbf3a46ebf2259adaf92c51d4ceaaa545fba683..0000000000000000000000000000000000000000 --- a/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch +++ /dev/null @@ -1,107 +0,0 @@ -From e017f95c7d833c0e9a463a1613d01fe93020606b Mon Sep 17 00:00:00 2001 -From: Jonathon Jongsma -Date: Tue, 23 Jun 2020 13:29:56 -0500 -Subject: [PATCH 5/6] qemu: format 'ramfb' attribute for mediated devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's possible to use ramfb as the boot display of an assigned vgpu -device. This was introduced in 4b95738c, but unfortunately the attribute -was not formatted into the xml output for such a device. This patch -fixes that oversight and adds a xml2xml test to verify proper behavior. - -https://bugzilla.redhat.com/show_bug.cgi?id=1847791 - -cherry pick from: c5815b31976f3982d18c7f6c1367ab6e403eb7eb - -Signed-off-by: Jonathon Jongsma -Reviewed-by: Daniel Henrique Barboza -Signed-off-by: Ján Tomko -Reviewed-by: Ján Tomko ---- - src/conf/domain_conf.c | 3 ++ - .../hostdev-mdev-display-ramfb.x86_64-latest.xml | 44 ++++++++++++++++++++++ - tests/qemuxml2xmltest.c | 1 + - 3 files changed, 48 insertions(+) - create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 37c785a..93e78a0 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -27849,6 +27849,9 @@ virDomainHostdevDefFormat(virBufferPtr buf, - if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT) - virBufferAsprintf(buf, " display='%s'", - virTristateSwitchTypeToString(mdevsrc->display)); -+ if (mdevsrc->ramfb != VIR_TRISTATE_SWITCH_ABSENT) -+ virBufferAsprintf(buf, " ramfb='%s'", -+ virTristateSwitchTypeToString(mdevsrc->ramfb)); - } - - } -diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml -new file mode 100644 -index 0000000..c134400 ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml -@@ -0,0 +1,44 @@ -+ -+ QEMUGuest2 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ qemu64 -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-i386 -+ -+
-+ -+ -+ -+
-+ -+ -+ -+ -+ -+ -+