From 8345954d9b1b48272ef41ae06e826e7f0dd6ad39 Mon Sep 17 00:00:00 2001 From: damon_hu Date: Fri, 19 Jan 2024 10:44:14 +0000 Subject: [PATCH] =?UTF-8?q?acpi:=20pcihp:=20allow=20repeating=20hot-unplug?= =?UTF-8?q?=20requests=20=E5=BD=93guest=E6=93=8D=E4=BD=9C=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=BF=98=E5=9C=A8booting=E9=98=B6=E6=AE=B5=E6=97=B6?= =?UTF-8?q?=E5=8D=B8=E8=BD=BD=E8=AE=BE=E5=A4=87=EF=BC=8C=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E7=8E=B0libvirt=E5=91=BD=E4=BB=A4=E8=A1=8C=E6=8A=A5success?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E5=AE=9E=E9=99=85=E4=B8=8A=E8=BF=98=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=8D=B8=E8=BD=BD=E7=9A=84=E7=8E=B0=E8=B1=A1=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E5=86=8D=E6=AC=A1=E6=89=A7=E8=A1=8C=E5=8D=B8=E8=BD=BD?= =?UTF-8?q?=E5=B0=B1=E4=BC=9A=E6=8A=A5=E9=94=99=EF=BC=9Aunable=20to=20exec?= =?UTF-8?q?ute=20QEMU=20command=20'device=5Fdel':=20Device=20virtio-disk1?= =?UTF-8?q?=20is=20already=20in=20the=20process=20of=20unplug=EF=BC=8C?= =?UTF-8?q?=E6=AD=A4=E8=A1=A5=E4=B8=81=E4=BF=AE=E5=A4=8D=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=8D=B8=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: damon_hu --- hw/acpi/pcihp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index be0e846b34..6cd5a61f7b 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -430,6 +430,16 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, * acpi_pcihp_eject_slot() when the operation is completed. */ pdev->qdev.pending_deleted_event = true; + /* if unplug was requested before OSPM is initialized, + * linux kernel will clear GPE0.sts[] bits during boot, which effectively + * hides unplug event. And than followup qmp_device_del() calls remain + * blocked by above flag permanently. + * Unblock qmp_device_del() by setting expire limit, so user can + * repeat unplug request later when OSPM has been booted. + */ + pdev->qdev.pending_deleted_expires_ms = + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); /* 1 msec */ + s->acpi_pcihp_pci_status[bsel].down |= (1U << slot); acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); } -- Gitee