Accepting request 940701 from home:dfaggioli:devel:Virtualization

- Reinstate Lin Ma's fixes for bsc#1192147 as they were
  submitted only to IBS.
* Patches added:
  hw-acpi-ich9-Add-compat-prop-to-keep-HPC.patch
  hw-i386-acpi-build-Deny-control-on-PCIe-.patch
  pcie-rename-native-hotplug-to-x-native-h.patch
- Rename the Guest Agent service to qemu-guest-agent, like in other
  distros, and upstream too (bsc#1185543)

OBS-URL: https://build.opensuse.org/request/show/940701
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=680
This commit is contained in:
Dario Faggioli 2021-12-15 11:09:40 +00:00 committed by Git OBS Bridge
parent fd109a833e
commit 7ada9507da
10 changed files with 326 additions and 35 deletions

View File

@ -1 +1 @@
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service"
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-guest-agent.service"

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc61bc17591d6fcddcd9148979bd62fa3bce2d164bb22d342fba802949713b19
size 57244
oid sha256:8c04f9c1178d8aa0b6ebb78ae4f9836caddeb8c8ec6a31943f47d94caae2ee71
size 61200

View File

@ -0,0 +1,121 @@
From: Julia Suvorova <jusual@redhat.com>
Date: Fri, 12 Nov 2021 06:08:54 -0500
Subject: hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine
type
Git-commit: c318bef76206c2ecb6016e8e68c4ac6ff9a4c8cb
References: bsc#1192147
To solve issues [1-2] the Hot Plug Capable bit in PCIe Slots will be
turned on, while the switch to ACPI Hot-plug will be done in the
DSDT table.
[1] https://gitlab.com/qemu-project/qemu/-/issues/641
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2006409
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20211112110857.3116853-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
hw/acpi/ich9.c | 18 ++++++++++++++++++
hw/i386/pc.c | 1 +
hw/i386/pc_q35.c | 7 ++++++-
include/hw/acpi/ich9.h | 1 +
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 778e27b65985326b3543e0083c4f..48d7e59bc900d1a5ca12817e72cc 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -419,6 +419,20 @@ static void ich9_pm_set_acpi_pci_hotplug(Object *obj, bool value, Error **errp)
s->pm.use_acpi_hotplug_bridge = value;
}
+static bool ich9_pm_get_keep_pci_slot_hpc(Object *obj, Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+ return s->pm.keep_pci_slot_hpc;
+}
+
+static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+ s->pm.keep_pci_slot_hpc = value;
+}
+
void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
{
static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
@@ -428,6 +442,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
pm->disable_s4 = 0;
pm->s4_val = 2;
pm->use_acpi_hotplug_bridge = true;
+ pm->keep_pci_slot_hpc = true;
object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
&pm->pm_io_base, OBJ_PROP_FLAG_READ);
@@ -454,6 +469,9 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
object_property_add_bool(obj, "acpi-pci-hotplug-with-bridge-support",
ich9_pm_get_acpi_pci_hotplug,
ich9_pm_set_acpi_pci_hotplug);
+ object_property_add_bool(obj, "x-keep-pci-slot-hpc",
+ ich9_pm_get_keep_pci_slot_hpc,
+ ich9_pm_set_keep_pci_slot_hpc);
}
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a358f7b9d25dc91ff85e6..cbcb803549496f20185a070d422c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -100,6 +100,7 @@ GlobalProperty pc_compat_6_0[] = {
{ "qemu64" "-" TYPE_X86_CPU, "stepping", "3" },
{ TYPE_X86_CPU, "x-vendor-cpuid-only", "off" },
{ "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" },
+ { "ICH9-LPC", "x-keep-pci-slot-hpc", "false" },
};
const size_t pc_compat_6_0_len = G_N_ELEMENTS(pc_compat_6_0);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 9070544a903d08117d4a14bf70b0..2db27a56649fd2ae31de1c0d6cf7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -138,6 +138,7 @@ static void pc_q35_init(MachineState *machine)
DriveInfo *hd[MAX_SATA_PORTS];
MachineClass *mc = MACHINE_GET_CLASS(machine);
bool acpi_pcihp;
+ bool keep_pci_slot_hpc;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
@@ -242,7 +243,11 @@ static void pc_q35_init(MachineState *machine)
"acpi-pci-hotplug-with-bridge-support",
NULL);
- if (acpi_pcihp) {
+ keep_pci_slot_hpc = object_property_get_bool(OBJECT(lpc),
+ "x-keep-pci-slot-hpc",
+ NULL);
+
+ if (!keep_pci_slot_hpc && acpi_pcihp) {
object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
"false", true);
}
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a329ce43abb27d6a1af43cf5fe24..64dc39cf5b091ee6662c3f80e5bf 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -56,6 +56,7 @@ typedef struct ICH9LPCPMRegs {
AcpiCpuHotplug gpe_cpu;
CPUHotplugState cpuhp_state;
+ bool keep_pci_slot_hpc;
bool use_acpi_hotplug_bridge;
AcpiPciHpState acpi_pci_hotplug;
MemHotplugState acpi_memory_hotplug;

View File

@ -0,0 +1,87 @@
From: Julia Suvorova <jusual@redhat.com>
Date: Fri, 12 Nov 2021 06:08:56 -0500
Subject: hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC
Git-commit: 211afe5c69b597acf85fdd577eb497f5be1ffbd8
References: bsc#1192147
There are two ways to enable ACPI PCI Hot-plug:
* Disable the Hot-plug Capable bit on PCIe slots.
This was the first approach which led to regression [1-2], as
I/O space for a port is allocated only when it is hot-pluggable,
which is determined by HPC bit.
* Leave the HPC bit on and disable PCIe Native Hot-plug in _OSC
method.
This removes the (future) ability of hot-plugging switches with PCIe
Native hotplug since ACPI PCI Hot-plug only works with cold-plugged
bridges. If the user wants to explicitely use this feature, they can
disable ACPI PCI Hot-plug with:
--global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
Change the bit in _OSC method so that the OS selects ACPI PCI Hot-plug
instead of PCIe Native.
[1] https://gitlab.com/qemu-project/qemu/-/issues/641
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2006409
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20211112110857.3116853-5-imammedo@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
hw/i386/acpi-build.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a33ac8b91e1baa129dac61ab32b6..ef28c3de772abe1cafe232f7754c 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1329,7 +1329,7 @@ static void build_x86_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr)
aml_append(table, scope);
}
-static Aml *build_q35_osc_method(void)
+static Aml *build_q35_osc_method(bool enable_native_pcie_hotplug)
{
Aml *if_ctx;
Aml *if_ctx2;
@@ -1351,8 +1351,10 @@ static Aml *build_q35_osc_method(void)
/*
* Always allow native PME, AER (no dependencies)
* Allow SHPC (PCI bridges can have SHPC controller)
+ * Disable PCIe Native Hot-plug if ACPI PCI Hot-plug is enabled.
*/
- aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1F), a_ctrl));
+ aml_append(if_ctx, aml_and(a_ctrl,
+ aml_int(0x1E | (enable_native_pcie_hotplug ? 0x1 : 0x0)), a_ctrl));
if_ctx2 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1))));
/* Unknown revision */
@@ -1441,7 +1443,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid)));
- aml_append(dev, build_q35_osc_method());
+ aml_append(dev, build_q35_osc_method(!pm->pcihp_bridge_en));
aml_append(sb_scope, dev);
if (mcfg_valid) {
aml_append(sb_scope, build_q35_dram_controller(&mcfg));
@@ -1557,7 +1559,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
if (pci_bus_is_express(bus)) {
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
- aml_append(dev, build_q35_osc_method());
+
+ /* Expander bridges do not have ACPI PCI Hot-plug enabled */
+ aml_append(dev, build_q35_osc_method(true));
} else {
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
}

View File

@ -0,0 +1,61 @@
From: Igor Mammedov <imammedo@redhat.com>
Date: Fri, 12 Nov 2021 06:08:53 -0500
Subject: pcie: rename 'native-hotplug' to 'x-native-hotplug'
Git-commit: 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df
References: bsc#1192147
Mark property as experimental/internal adding 'x-' prefix.
Property was introduced in 6.1 and it should have provided
ability to turn on native PCIE hotplug on port even when
ACPI PCI hotplug is in use is user explicitly sets property
on CLI. However that never worked since slot is wired to
ACPI hotplug controller.
Another non-intended usecase: disable native hotplug on slot
when APCI based hotplug is disabled, which works but slot has
'hotplug' property for this taks.
It should be relatively safe to rename it to experimental
as no users should exist for it and given that the property
is broken we don't really want to leave it around for much
longer lest users start using it.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <20211112110857.3116853-2-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
hw/i386/pc_q35.c | 2 +-
hw/pci/pcie_port.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d75bbed294c01174a87..9070544a903d08117d4a14bf70b0 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine)
NULL);
if (acpi_pcihp) {
- object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug",
+ object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
"false", true);
}
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index da850e8dde7c8f86b4004a54e561..e95c1e5519ce89f5b41682869ebe 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -148,7 +148,7 @@ static Property pcie_slot_props[] = {
DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0),
DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0),
DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true),
- DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true),
+ DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true),
DEFINE_PROP_END_OF_LIST()
};

View File

@ -1,14 +0,0 @@
[Unit]
Description=QEMU Guest Agent
Documentation=http://wiki.qemu.org/Features/GuestAgent
BindsTo=dev-%i.device
After=dev-%i.device
[Service]
Type=simple
ExecStart=-/usr/bin/qemu-ga -p /dev/%I
Restart=always
RestartSec=0
[Install]
WantedBy=dev-%i.device

14
qemu-guest-agent.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=QEMU Guest Agent
Documentation=http://wiki.qemu.org/Features/GuestAgent
BindsTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device
After=dev-virtio\x2dports-org.qemu.guest_agent.0.device
[Service]
Type=simple
ExecStart=-/usr/bin/qemu-ga -p /dev/virtio-ports/org.qemu.guest_agent.0
Restart=always
RestartSec=0
[Install]
WantedBy=dev-virtio\x2dports-org.qemu.guest_agent.0.device

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Dec 14 19:16:51 UTC 2021 - Dario Faggioli <dfaggioli@suse.com>
- Reinstate Lin Ma's fixes for bsc#1192147 as they were
submitted only to IBS.
* Patches added:
hw-acpi-ich9-Add-compat-prop-to-keep-HPC.patch
hw-i386-acpi-build-Deny-control-on-PCIe-.patch
pcie-rename-native-hotplug-to-x-native-h.patch
-------------------------------------------------------------------
Tue Dec 14 18:34:50 UTC 2021 - Dario Faggioli <dfaggioli@suse.com>
- Rename the Guest Agent service qemu-guest-agent, like in other
distros (and upstream). bsc#1185543
-------------------------------------------------------------------
Mon Dec 13 15:31:38 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@ -113,7 +113,7 @@ Source3: qemu-ifup
Source4: bridge.conf
Source5: qemu-kvm.1.gz
Source6: ksm.service
Source7: qemu-ga@.service
Source7: qemu-guest-agent.service
Source8: 80-qemu-ga.rules
Source9: qemu-supportconfig
Source10: supported.arm.txt
@ -197,6 +197,9 @@ Patch00061: vhost-vsock-fix-migration-issue-when-seq.patch
Patch00062: block-introduce-max_hw_iov-for-use-in-sc.patch
Patch00063: uas-add-stream-number-sanity-checks.patch
Patch00064: qemu-binfmt-conf.sh-allow-overriding-SUS.patch
Patch00065: pcie-rename-native-hotplug-to-x-native-h.patch
Patch00066: hw-acpi-ich9-Add-compat-prop-to-keep-HPC.patch
Patch00067: hw-i386-acpi-build-Deny-control-on-PCIe-.patch
# Patches applied in roms/seabios/:
Patch01000: seabios-use-python2-explicitly-as-needed.patch
Patch01001: seabios-switch-to-python3-as-needed.patch
@ -1150,6 +1153,9 @@ This package records qemu testsuite results and represents successful testing.
%patch00062 -p1
%patch00063 -p1
%patch00064 -p1
%patch00065 -p1
%patch00066 -p1
%patch00067 -p1
%patch01000 -p1
%patch01001 -p1
%patch01002 -p1
@ -1800,7 +1806,7 @@ rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot
%if %{kvm_available}
install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules
%endif
install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-ga@.service
install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%ifarch s390x
install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf
@ -1868,24 +1874,24 @@ fi
%verify_permissions %_libexecdir/qemu-bridge-helper
%pre guest-agent
%service_add_pre qemu-ga@.service
%service_add_pre qemu-guest-agent.service
%post guest-agent
%service_add_post qemu-ga@.service
%service_add_post qemu-guest-agent.service
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl start qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl start qemu-guest-agent.service || :
fi
%preun guest-agent
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl stop qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl stop qemu-guest-agent.service || :
fi
%postun guest-agent
%service_del_postun_without_restart qemu-ga@.service
%service_del_postun_without_restart qemu-guest-agent.service
if [ "$1" = "1" ] ; then
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl restart qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl restart qemu-guest-agent.service || :
fi
fi
@ -2529,7 +2535,7 @@ fi
%dir %_docdir/%name/interop
%_docdir/%name/interop/qemu-ga.html
%_mandir/man8/qemu-ga.8.gz
%{_unitdir}/qemu-ga@.service
%{_unitdir}/qemu-guest-agent.service
/usr/lib/udev/rules.d/80-qemu-ga.rules
%files ksm

View File

@ -110,7 +110,7 @@ Source3: qemu-ifup
Source4: bridge.conf
Source5: qemu-kvm.1.gz
Source6: ksm.service
Source7: qemu-ga@.service
Source7: qemu-guest-agent.service
Source8: 80-qemu-ga.rules
Source9: qemu-supportconfig
Source10: supported.arm.txt
@ -1631,7 +1631,7 @@ rst2html --exit-status=2 %{buildroot}%_docdir/qemu-x86/supported.txt %{buildroot
%if %{kvm_available}
install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/udev/rules.d/80-kvm.rules
%endif
install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-ga@.service
install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-guest-agent.service
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%ifarch s390x
install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf
@ -1699,24 +1699,24 @@ fi
%verify_permissions %_libexecdir/qemu-bridge-helper
%pre guest-agent
%service_add_pre qemu-ga@.service
%service_add_pre qemu-guest-agent.service
%post guest-agent
%service_add_post qemu-ga@.service
%service_add_post qemu-guest-agent.service
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl start qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl start qemu-guest-agent.service || :
fi
%preun guest-agent
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl stop qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl stop qemu-guest-agent.service || :
fi
%postun guest-agent
%service_del_postun_without_restart qemu-ga@.service
%service_del_postun_without_restart qemu-guest-agent.service
if [ "$1" = "1" ] ; then
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl restart qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
/usr/bin/systemctl restart qemu-guest-agent.service || :
fi
fi
@ -2360,7 +2360,7 @@ fi
%dir %_docdir/%name/interop
%_docdir/%name/interop/qemu-ga.html
%_mandir/man8/qemu-ga.8.gz
%{_unitdir}/qemu-ga@.service
%{_unitdir}/qemu-guest-agent.service
/usr/lib/udev/rules.d/80-qemu-ga.rules
%files ksm