From 57b51a5b9e056bcba2b93ed6e934d0be3773375a Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 15 Jul 2022 17:34:52 +0200 Subject: [PATCH] libvirt-8.5.0-2.el9 - domain_conf: Format more often (rhbz#2059511) - domain_conf: Format iothread IDs more often (rhbz#2059511) - qemu: Make IOThread changing more robust (rhbz#2059511) - qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag (rhbz#2059511) - virsh: Implement --config for iothreadset (rhbz#2059511) - docs: Document TPM portion of domcaps (rhbz#2103119) - virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis (rhbz#2103119) - domcaps: Introduce TPM backendVersion (rhbz#2103119) - qemu: Report supported TPM version in domcaps (rhbz#2103119) - vircpi: Add PCIe 5.0 and 6.0 link speeds (rhbz#2105231) Resolves: rhbz#2059511, rhbz#2103119, rhbz#2105231 --- ...docs-Document-TPM-portion-of-domcaps.patch | 62 ++++++ ...nf-Format-defaultiothread-more-often.patch | 96 +++++++++ ..._conf-Format-iothread-IDs-more-often.patch | 61 ++++++ ...domcaps-Introduce-TPM-backendVersion.patch | 74 +++++++ ...u-Make-IOThread-changing-more-robust.patch | 195 ++++++++++++++++++ ...ort-supported-TPM-version-in-domcaps.patch | 49 +++++ ...Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch | 41 ++++ ...cpi-Add-PCIe-5.0-and-6.0-link-speeds.patch | 64 ++++++ ...rsh-Implement-config-for-iothreadset.patch | 62 ++++++ ...duce-TPM-1.2-and-TPM-2.0-capabilieis.patch | 48 +++++ libvirt.spec | 25 ++- 11 files changed, 776 insertions(+), 1 deletion(-) create mode 100644 libvirt-docs-Document-TPM-portion-of-domcaps.patch create mode 100644 libvirt-domain_conf-Format-defaultiothread-more-often.patch create mode 100644 libvirt-domain_conf-Format-iothread-IDs-more-often.patch create mode 100644 libvirt-domcaps-Introduce-TPM-backendVersion.patch create mode 100644 libvirt-qemu-Make-IOThread-changing-more-robust.patch create mode 100644 libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch create mode 100644 libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch create mode 100644 libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch create mode 100644 libvirt-virsh-Implement-config-for-iothreadset.patch create mode 100644 libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch diff --git a/libvirt-docs-Document-TPM-portion-of-domcaps.patch b/libvirt-docs-Document-TPM-portion-of-domcaps.patch new file mode 100644 index 0000000..e093c28 --- /dev/null +++ b/libvirt-docs-Document-TPM-portion-of-domcaps.patch @@ -0,0 +1,62 @@ +From b5a226f307b01bb1b58a88c95d29da34c246757f Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Tue, 12 Jul 2022 16:10:08 +0200 +Subject: [PATCH] docs: Document TPM portion of domcaps + +Surprisingly, we don't document TPM part of domain capabilities. +Fortunately, the information exposed is pretty much self +explanatory, but we should document it regardless. + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 6a00c565c4d0f0ec970e043ea2686bd30396ed79) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +--- + docs/formatdomaincaps.rst | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index 933469b2a2..3c425a9a4a 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -494,6 +494,35 @@ instance: + ``driverType`` + Options for the ``type`` attribute of the element. + ++TPM device ++^^^^^^^^^^ ++ ++TPM device capabilities are exposed under the ``tpm`` element. For instance: ++ ++:: ++ ++ ++ ... ++ ++ ++ ++ tpm-tis ++ tpm-crb ++ ++ ++ passthrough ++ emulator ++ ++ ++ ... ++ ++ ++ ++``model`` ++ Options for the ``model`` attribute of the ```` element. ++``backendModel`` ++ Options for the ``type`` attribute of the ```` element. ++ + Features + ~~~~~~~~ + +-- +2.35.1 + diff --git a/libvirt-domain_conf-Format-defaultiothread-more-often.patch b/libvirt-domain_conf-Format-defaultiothread-more-often.patch new file mode 100644 index 0000000..46b436d --- /dev/null +++ b/libvirt-domain_conf-Format-defaultiothread-more-often.patch @@ -0,0 +1,96 @@ +From a39ce54007de67ce6909c1770a7759b09c41bfd6 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Thu, 7 Jul 2022 16:29:18 +0200 +Subject: [PATCH] domain_conf: Format more often +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The element is formatted inside +virDomainDefaultIOThreadDefFormat() which is called only from +virDomainDefIOThreadsFormat() (so that IOThread related stuff is +formatted calling one function). However, when there are no + defined (or only autoallocated ones are present), +then the outer formatting function exits early never calling the + formatter. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 24fa7004e47ce86b92bc23c1f2ef9c3d6152c3a8) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/conf/domain_conf.c | 46 ++++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 24 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 709ca53790..207a45d9ae 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27763,40 +27763,38 @@ static void + virDomainDefIOThreadsFormat(virBuffer *buf, + const virDomainDef *def) + { +- g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); +- size_t i; +- +- if (def->niothreadids == 0) +- return; ++ if (def->niothreadids > 0) { ++ virBufferAsprintf(buf, "%zu\n", ++ def->niothreadids); ++ } + +- virBufferAsprintf(buf, "%zu\n", +- def->niothreadids); ++ if (virDomainDefIothreadShouldFormat(def)) { ++ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); ++ size_t i; + +- if (!virDomainDefIothreadShouldFormat(def)) +- return; ++ for (i = 0; i < def->niothreadids; i++) { ++ virDomainIOThreadIDDef *iothread = def->iothreadids[i]; ++ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; + +- for (i = 0; i < def->niothreadids; i++) { +- virDomainIOThreadIDDef *iothread = def->iothreadids[i]; +- g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; ++ virBufferAsprintf(&attrBuf, " id='%u'", ++ iothread->iothread_id); + +- virBufferAsprintf(&attrBuf, " id='%u'", +- iothread->iothread_id); ++ if (iothread->thread_pool_min >= 0) { ++ virBufferAsprintf(&attrBuf, " thread_pool_min='%d'", ++ iothread->thread_pool_min); ++ } + +- if (iothread->thread_pool_min >= 0) { +- virBufferAsprintf(&attrBuf, " thread_pool_min='%d'", +- iothread->thread_pool_min); +- } ++ if (iothread->thread_pool_max >= 0) { ++ virBufferAsprintf(&attrBuf, " thread_pool_max='%d'", ++ iothread->thread_pool_max); ++ } + +- if (iothread->thread_pool_max >= 0) { +- virBufferAsprintf(&attrBuf, " thread_pool_max='%d'", +- iothread->thread_pool_max); ++ virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); + } + +- virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); ++ virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); + } + +- virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); +- + virDomainDefaultIOThreadDefFormat(buf, def); + } + +-- +2.35.1 + diff --git a/libvirt-domain_conf-Format-iothread-IDs-more-often.patch b/libvirt-domain_conf-Format-iothread-IDs-more-often.patch new file mode 100644 index 0000000..3a3d874 --- /dev/null +++ b/libvirt-domain_conf-Format-iothread-IDs-more-often.patch @@ -0,0 +1,61 @@ +From 711cf329b9847c4d42994389d89a7e7b83c71596 Mon Sep 17 00:00:00 2001 +Message-Id: <711cf329b9847c4d42994389d89a7e7b83c71596@dist-git> +From: Michal Privoznik +Date: Thu, 7 Jul 2022 16:29:33 +0200 +Subject: [PATCH] domain_conf: Format iothread IDs more often +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When formatting IOThreads (in virDomainDefIOThreadsFormat()), we +may only output the number of IOThreads, or the full list of IOThreads too: + + 4 + + + + + + + +Now, the deciding factor here is whether those individual +IOThreads were so called 'autofill-ed' or user provided. Well, we +need to take another factor in: if an IOThread has pool size +limit set, then we ought to format the full list. + +But how can we get into a situation when a thread is autofilled +(i.e. not provided by user in the XML) and yet it has pool size +limit set? virDomainSetIOThreadParams() is the answer. + +Sure, we could also unset the autofill flag whenever a pool size +limit is being set. But this approach allows us to not format +anything if the limits are reset (we don't lose the autofill +information). + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 5aa24958546c94a48fb8f8d6022213ca7c07c8a7) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/conf/domain_conf.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 207a45d9ae..fbc285d981 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27728,7 +27728,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef *def) + size_t i; + + for (i = 0; i < def->niothreadids; i++) { +- if (!def->iothreadids[i]->autofill) ++ if (!def->iothreadids[i]->autofill || ++ def->iothreadids[i]->thread_pool_min >= 0 || ++ def->iothreadids[i]->thread_pool_max >= 0) + return true; + } + +-- +2.35.1 + diff --git a/libvirt-domcaps-Introduce-TPM-backendVersion.patch b/libvirt-domcaps-Introduce-TPM-backendVersion.patch new file mode 100644 index 0000000..3631a14 --- /dev/null +++ b/libvirt-domcaps-Introduce-TPM-backendVersion.patch @@ -0,0 +1,74 @@ +From 266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c Mon Sep 17 00:00:00 2001 +Message-Id: <266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c@dist-git> +From: Michal Privoznik +Date: Tue, 12 Jul 2022 15:58:12 +0200 +Subject: [PATCH] domcaps: Introduce TPM backendVersion + +We accept TPM version in the domain XML. However, supported +version depends on the host (swtpm_setup binary) and thus it may +be tricky for users (or mgmt applications) chose a version. +Introduce machinery for reporting supported version in domain +capabilities. + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 1277a9c884039e92765c977917420511f45e52e8) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +--- + docs/formatdomaincaps.rst | 6 ++++++ + src/conf/domain_capabilities.c | 1 + + src/conf/domain_capabilities.h | 1 + + 3 files changed, 8 insertions(+) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index 3c425a9a4a..70f46b972a 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -513,6 +513,10 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance: + passthrough + emulator + ++ ++ 1.2 ++ 2.0 ++ + + ... + +@@ -522,6 +526,8 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance: + Options for the ``model`` attribute of the ```` element. + ``backendModel`` + Options for the ``type`` attribute of the ```` element. ++``backendVersion`` ++ Options for the ``version`` attribute of the ```` element. + + Features + ~~~~~~~~ +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index 895e8d00e8..33570a51db 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -539,6 +539,7 @@ virDomainCapsDeviceTPMFormat(virBuffer *buf, + + ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString); + ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString); ++ ENUM_PROCESS(tpm, backendVersion, virDomainTPMVersionTypeToString); + + FORMAT_EPILOGUE(tpm); + } +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index f2eed80b15..a526969cda 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -127,6 +127,7 @@ struct _virDomainCapsDeviceTPM { + virTristateBool supported; + virDomainCapsEnum model; /* virDomainTPMModel */ + virDomainCapsEnum backendModel; /* virDomainTPMBackendType */ ++ virDomainCapsEnum backendVersion; /* virDomainTPMVersion */ + }; + + STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST); +-- +2.35.1 + diff --git a/libvirt-qemu-Make-IOThread-changing-more-robust.patch b/libvirt-qemu-Make-IOThread-changing-more-robust.patch new file mode 100644 index 0000000..a94f31c --- /dev/null +++ b/libvirt-qemu-Make-IOThread-changing-more-robust.patch @@ -0,0 +1,195 @@ +From 5853ac5261b2934ca300b24a7bd78cc4b377c90c Mon Sep 17 00:00:00 2001 +Message-Id: <5853ac5261b2934ca300b24a7bd78cc4b377c90c@dist-git> +From: Michal Privoznik +Date: Thu, 7 Jul 2022 17:37:46 +0200 +Subject: [PATCH] qemu: Make IOThread changing more robust +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are three APIs that allow changing IOThreads: + + virDomainAddIOThread() + virDomainDelIOThread() + virDomainSetIOThreadParams() + +In case of QEMU driver these are handled by +qemuDomainChgIOThread() which attempts to be versatile enough to +work on both inactive and live domain definitions at the same +time. However, it's a bit clumsy - when a change to live +definition succeeds but fails in inactive definition then there's +no rollback. And somewhat rightfully so - changes to live +definition are in general harder to roll back. Therefore, do what +we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(), +qemuDomainDetachDeviceAliasLiveAndConfig(), ...): + + 1) do the change to inactive XML first, + 2) in fact, do the change to a copy of inactive XML, + 3) swap inactive XML and its copy only after everything + succeeded. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 6db9c95a45d4e24cdcd5c009b7fe5da3745b5d59) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_driver.c | 74 ++++++++++++++++++++++++------------------ + 1 file changed, 43 insertions(+), 31 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 3b5c3db67c..2c627396f1 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -5594,6 +5594,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + { + g_autoptr(virQEMUDriverConfig) cfg = NULL; + qemuDomainObjPrivate *priv; ++ g_autoptr(virDomainDef) defcopy = NULL; + virDomainDef *def; + virDomainDef *persistentDef; + virDomainIOThreadIDDef *iothreaddef = NULL; +@@ -5609,34 +5610,34 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto endjob; + +- if (def) { +- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("IOThreads not supported with this binary")); +- goto endjob; +- } ++ if (persistentDef) { ++ /* Make a copy of persistent definition and do all the changes there. ++ * Swap the definitions only after changes to live definition ++ * succeeded. */ ++ if (!(defcopy = virDomainObjCopyPersistentDef(vm, driver->xmlopt, ++ priv->qemuCaps))) ++ return -1; + + switch (action) { + case VIR_DOMAIN_IOTHREAD_ACTION_ADD: +- if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0) ++ if (virDomainDriverAddIOThreadCheck(defcopy, iothread.iothread_id) < 0) + goto endjob; + +- if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0) ++ if (!virDomainIOThreadIDAdd(defcopy, iothread.iothread_id)) + goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_DEL: +- if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0) ++ if (virDomainDriverDelIOThreadCheck(defcopy, iothread.iothread_id) < 0) + goto endjob; + +- if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0) +- goto endjob; ++ virDomainIOThreadIDDel(defcopy, iothread.iothread_id); + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: +- iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id); ++ iothreaddef = virDomainIOThreadIDFind(defcopy, iothread.iothread_id); + + if (!iothreaddef) { + virReportError(VIR_ERR_INVALID_ARG, +@@ -5645,41 +5646,47 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + goto endjob; + } + +- if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0) ++ if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0) + goto endjob; + +- if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) ++ if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) { ++ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", ++ _("configuring persistent polling values is not supported")); + goto endjob; ++ } + +- qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread); + break; +- + } +- +- qemuDomainSaveStatus(vm); + } + +- if (persistentDef) { ++ if (def) { ++ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("IOThreads not supported with this binary")); ++ goto endjob; ++ } ++ + switch (action) { + case VIR_DOMAIN_IOTHREAD_ACTION_ADD: +- if (virDomainDriverAddIOThreadCheck(persistentDef, iothread.iothread_id) < 0) ++ if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0) + goto endjob; + +- if (!virDomainIOThreadIDAdd(persistentDef, iothread.iothread_id)) ++ if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0) + goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_DEL: +- if (virDomainDriverDelIOThreadCheck(persistentDef, iothread.iothread_id) < 0) ++ if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0) + goto endjob; + +- virDomainIOThreadIDDel(persistentDef, iothread.iothread_id); ++ if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0) ++ goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: +- iothreaddef = virDomainIOThreadIDFind(persistentDef, iothread.iothread_id); ++ iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id); + + if (!iothreaddef) { + virReportError(VIR_ERR_INVALID_ARG, +@@ -5688,21 +5695,26 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + goto endjob; + } + +- if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0) ++ if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0) + goto endjob; + +- if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) { +- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", +- _("configuring persistent polling values is not supported")); ++ if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) + goto endjob; +- } + ++ qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread); + break; ++ + } + +- if (virDomainDefSave(persistentDef, driver->xmlopt, +- cfg->configDir) < 0) ++ qemuDomainSaveStatus(vm); ++ } ++ ++ /* Finally, if no error until here, we can save config. */ ++ if (defcopy) { ++ if (virDomainDefSave(defcopy, driver->xmlopt, cfg->configDir) < 0) + goto endjob; ++ ++ virDomainObjAssignDef(vm, &defcopy, false, NULL); + } + + ret = 0; +-- +2.35.1 + diff --git a/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch b/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch new file mode 100644 index 0000000..cb84c51 --- /dev/null +++ b/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch @@ -0,0 +1,49 @@ +From b3d2dae261768c00b5d92203351ff6dd7cde468e Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Tue, 12 Jul 2022 15:58:17 +0200 +Subject: [PATCH] qemu: Report supported TPM version in domcaps + +Now that we have everything prepared, we can start detecting +supported TPM versions and setting corresponding values in +backendModel struct. + +Resolves: https://gitlab.com/libvirt/libvirt/-/issues/340 +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 430ab88ab17727ac9774ee5b47f09f69c57add73) +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_capabilities.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 2c3be3ecec..8586930266 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -6368,9 +6368,18 @@ virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_PASSTHROUGH); +- if (virTPMHasSwtpm() && +- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) +- VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR); ++ if (virTPMHasSwtpm()) { ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR); ++ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_1_2)) { ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_1_2); ++ tpm->backendVersion.report = true; ++ } ++ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_2_0)) { ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_2_0); ++ tpm->backendVersion.report = true; ++ } ++ } + + /* + * Need at least one frontend if it is to be usable by applications +-- +2.35.1 + diff --git a/libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch b/libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch new file mode 100644 index 0000000..936f85d --- /dev/null +++ b/libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch @@ -0,0 +1,41 @@ +From 9b00b5666a014999a3bc9e2e8a6a844ca7a4326f Mon Sep 17 00:00:00 2001 +Message-Id: <9b00b5666a014999a3bc9e2e8a6a844ca7a4326f@dist-git> +From: Michal Privoznik +Date: Fri, 8 Jul 2022 09:35:39 +0200 +Subject: [PATCH] qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG + flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It was always possible to modify the inactive XML, because +VIR_DOMAIN_AFFECT_CURRENT (= 0) is accepted implicitly. But now +that the logic when changing both config and live XMLs is more +robust we can accept VIR_DOMAIN_AFFECT_CONFIG flag too. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 3096965ce78923b099fa39e4950279b2f21ab60a) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_driver.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 2c627396f1..654b5d65e5 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -5818,7 +5818,8 @@ qemuDomainSetIOThreadParams(virDomainPtr dom, + qemuMonitorIOThreadInfo iothread = {0}; + int ret = -1; + +- virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1); ++ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | ++ VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (iothread_id == 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", +-- +2.35.1 + diff --git a/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch b/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch new file mode 100644 index 0000000..84802e4 --- /dev/null +++ b/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch @@ -0,0 +1,64 @@ +From e13ab5c97f266eb688bc22e1124291563770370d Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Fri, 8 Jul 2022 14:29:32 +0200 +Subject: [PATCH] vircpi: Add PCIe 5.0 and 6.0 link speeds +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The PCIe 5.0 and PCIe 6.0 standards define new link speeds: +32GT/s and 64GT/s, respectively. Update our internal enum to +include these new speeds. Otherwise we format incorrect XML: + + + + + + +Like all "good" specifications, these are also locked behind a +login portal. But we can look at pciutils' source code: [1] and +[2]. + +1: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=caca31a0eea41c7b051705704c1158fddc02fbd2 +2: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=5bdf63b6b1bc35b59c4b3f47f7ca83ca1868155b + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2105231 +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit d33c2a9e2f933b31f8e96e9938c237bdffe27f84) +Signed-off-by: Michal Privoznik +--- + src/util/virpci.c | 2 +- + src/util/virpci.h | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/util/virpci.c b/src/util/virpci.c +index 03d1d7b074..7800966963 100644 +--- a/src/util/virpci.c ++++ b/src/util/virpci.c +@@ -45,7 +45,7 @@ VIR_LOG_INIT("util.pci"); + + VIR_ENUM_IMPL(virPCIELinkSpeed, + VIR_PCIE_LINK_SPEED_LAST, +- "", "2.5", "5", "8", "16", ++ "", "2.5", "5", "8", "16", "32", "64" + ); + + VIR_ENUM_IMPL(virPCIStubDriver, +diff --git a/src/util/virpci.h b/src/util/virpci.h +index b9b9cd7b34..4d9193f24e 100644 +--- a/src/util/virpci.h ++++ b/src/util/virpci.h +@@ -83,6 +83,8 @@ typedef enum { + VIR_PCIE_LINK_SPEED_5, + VIR_PCIE_LINK_SPEED_8, + VIR_PCIE_LINK_SPEED_16, ++ VIR_PCIE_LINK_SPEED_32, ++ VIR_PCIE_LINK_SPEED_64, + VIR_PCIE_LINK_SPEED_LAST + } virPCIELinkSpeed; + +-- +2.35.1 + diff --git a/libvirt-virsh-Implement-config-for-iothreadset.patch b/libvirt-virsh-Implement-config-for-iothreadset.patch new file mode 100644 index 0000000..0ef1196 --- /dev/null +++ b/libvirt-virsh-Implement-config-for-iothreadset.patch @@ -0,0 +1,62 @@ +From 02ebd15a48da7a53560bbea5e530a5b9c929daee Mon Sep 17 00:00:00 2001 +Message-Id: <02ebd15a48da7a53560bbea5e530a5b9c929daee@dist-git> +From: Michal Privoznik +Date: Thu, 7 Jul 2022 17:44:32 +0200 +Subject: [PATCH] virsh: Implement --config for iothreadset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Our man page already documents that iothreadset has --config +argument. Well, it doesn't really. Normally, I'd just fix the man +page, but with recent work on the API it's possible to tweak +values for inactive XML too. Therefore, implement the --config +argument for the command. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 3ff558c1c171f66da84b10c81937c1a6895ec6fb) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + tools/virsh-domain.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c +index 43034f2f81..da63cc95ff 100644 +--- a/tools/virsh-domain.c ++++ b/tools/virsh-domain.c +@@ -7831,6 +7831,7 @@ static const vshCmdOptDef opts_iothreadset[] = { + .type = VSH_OT_INT, + .help = N_("upper boundary for worker thread pool") + }, ++ VIRSH_COMMON_OPT_DOMAIN_CONFIG, + VIRSH_COMMON_OPT_DOMAIN_LIVE, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, + {.name = NULL} +@@ -7842,6 +7843,8 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) + g_autoptr(virshDomain) dom = NULL; + int id = 0; + bool ret = false; ++ bool current = vshCommandOptBool(cmd, "current"); ++ bool config = vshCommandOptBool(cmd, "config"); + bool live = vshCommandOptBool(cmd, "live"); + unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; + virTypedParameterPtr params = NULL; +@@ -7852,8 +7855,13 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) + int thread_val; + int rc; + ++ VSH_EXCLUSIVE_OPTIONS_VAR(current, live); ++ VSH_EXCLUSIVE_OPTIONS_VAR(current, config); ++ + if (live) + flags |= VIR_DOMAIN_AFFECT_LIVE; ++ if (config) ++ flags |= VIR_DOMAIN_AFFECT_CONFIG; + + if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) + return false; +-- +2.35.1 + diff --git a/libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch b/libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch new file mode 100644 index 0000000..6891c08 --- /dev/null +++ b/libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch @@ -0,0 +1,48 @@ +From 6d21624edd73edb9b59e5dac0d98d0812e9bf0ad Mon Sep 17 00:00:00 2001 +Message-Id: <6d21624edd73edb9b59e5dac0d98d0812e9bf0ad@dist-git> +From: Michal Privoznik +Date: Tue, 12 Jul 2022 15:46:50 +0200 +Subject: [PATCH] virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis + +These new capabilities will be used only to track whether +swtpm_setup is capable of TPM-1.2 and/or TPM-2.0. + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 7b37763278c44887789e80a6058ee27953c0e5e6) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +--- + src/util/virtpm.c | 2 ++ + src/util/virtpm.h | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/util/virtpm.c b/src/util/virtpm.c +index b898f3a6db..3c961c11cb 100644 +--- a/src/util/virtpm.c ++++ b/src/util/virtpm.c +@@ -47,6 +47,8 @@ VIR_ENUM_IMPL(virTPMSwtpmSetupFeature, + "cmdarg-create-config-files", + "tpm12-not-need-root", + "cmdarg-reconfigure-pcr-banks", ++ "tpm-1.2", ++ "tpm-2.0", + ); + + /** +diff --git a/src/util/virtpm.h b/src/util/virtpm.h +index 0a82a03b69..bbf379a54a 100644 +--- a/src/util/virtpm.h ++++ b/src/util/virtpm.h +@@ -42,6 +42,8 @@ typedef enum { + VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_CREATE_CONFIG_FILES, + VIR_TPM_SWTPM_SETUP_FEATURE_TPM12_NOT_NEED_ROOT, + VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_RECONFIGURE_PCR_BANKS, ++ VIR_TPM_SWTPM_SETUP_FEATURE_TPM_1_2, ++ VIR_TPM_SWTPM_SETUP_FEATURE_TPM_2_0, + + VIR_TPM_SWTPM_SETUP_FEATURE_LAST + } virTPMSwtpmSetupFeature; +-- +2.35.1 + diff --git a/libvirt.spec b/libvirt.spec index 0a15c83..f81a4a0 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -231,7 +231,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 8.5.0 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ URL: https://libvirt.org/ @@ -240,6 +240,17 @@ URL: https://libvirt.org/ %endif Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz Source1: symlinks +Patch1: libvirt-domain_conf-Format-defaultiothread-more-often.patch +Patch2: libvirt-domain_conf-Format-iothread-IDs-more-often.patch +Patch3: libvirt-qemu-Make-IOThread-changing-more-robust.patch +Patch4: libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch +Patch5: libvirt-virsh-Implement-config-for-iothreadset.patch +Patch6: libvirt-docs-Document-TPM-portion-of-domcaps.patch +Patch7: libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch +Patch8: libvirt-domcaps-Introduce-TPM-backendVersion.patch +Patch9: libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch +Patch10: libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2145,6 +2156,18 @@ exit 0 %changelog +* Fri Jul 15 2022 Jiri Denemark - 8.5.0-2 +- domain_conf: Format more often (rhbz#2059511) +- domain_conf: Format iothread IDs more often (rhbz#2059511) +- qemu: Make IOThread changing more robust (rhbz#2059511) +- qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag (rhbz#2059511) +- virsh: Implement --config for iothreadset (rhbz#2059511) +- docs: Document TPM portion of domcaps (rhbz#2103119) +- virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis (rhbz#2103119) +- domcaps: Introduce TPM backendVersion (rhbz#2103119) +- qemu: Report supported TPM version in domcaps (rhbz#2103119) +- vircpi: Add PCIe 5.0 and 6.0 link speeds (rhbz#2105231) + * Fri Jul 1 2022 Jiri Denemark - 8.5.0-1 - Rebased to libvirt-8.5.0 (rhbz#2060313) - The rebase also fixes the following bugs: