From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dU-0003S2-G3 for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zb6dT-0008B5-1M for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:44:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6dS-0008AJ-Qs for qemu-devel@nongnu.org; Sun, 13 Sep 2015 08:43:58 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 83E3C3F0BC for ; Sun, 13 Sep 2015 12:43:58 +0000 (UTC) From: Laszlo Ersek Date: Sun, 13 Sep 2015 14:43:36 +0200 Message-Id: <1442148227-17343-3-git-send-email-lersek@redhat.com> In-Reply-To: <1442148227-17343-1-git-send-email-lersek@redhat.com> References: <55F5647C.6030901@redhat.com> <1442148227-17343-1-git-send-email-lersek@redhat.com> Subject: [Qemu-devel] [PATCH FYI 02/13] hw/acpi: add i386 callbacks for injecting GPE 04 when the VMGENID changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gal Hammer , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Add a new method called "vm_generation_id_changed" to the AcpiDeviceIfClass interface. The new method sends an ACPI notfication when the VM generation ID is changed. This contributes to the implementation of requirement R5, from "docs/vmgenid.txt". This patch is a slight modification of Gal Hammer's [PATCH V15 2/5] acpi: add a vm_generation_id_changed method http://thread.gmane.org/gmane.comp.emulators.qemu/332451/focus=332453 (for which reason his S-o-b is preserved in the first position). The changes are (and should be captured in the commit message): - There's no need for the helper function acpi_vm_generation_id_changed(): acpi_send_gpe_event() already does the right thing and is at the right abstraction level. - The next available GPE status bit is bit 4 (value 16); less significant bits (bits 1 through 3) are already used for PCI, CPU, and memory hotplug. Furthermore, bit 0 (value 1) is not available (the _L00 method already exist in the DSDTs, with empty body as a precaution); probably because the ACPI spec (section "Queuing the Matching Control Method for Execution") reserves response code 0 for "no outstanding events". In other words, _E00 / _L00 can never be queued. Cc: Paolo Bonzini Cc: Gal Hammer Cc: Igor Mammedov Cc: "Michael S. Tsirkin" Signed-off-by: Gal Hammer [lersek@redhat.com: see changes above, plus extended commit message] Signed-off-by: Laszlo Ersek Signed-off-by: Laszlo Ersek --- Notes: fyi: - This patch is not actually related to the ACPI work, but this was the first one I wrote, when I was still trying to figure out the right order to go about this series. So I'm including it here. include/hw/acpi/acpi.h | 1 + include/hw/acpi/acpi_dev_interface.h | 4 ++++ include/hw/acpi/ich9.h | 1 + hw/acpi/ich9.c | 8 ++++++++ hw/acpi/piix4.c | 8 ++++++++ hw/isa/lpc_ich9.c | 1 + 6 files changed, 23 insertions(+) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index b20bd55..d46095d 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -96,6 +96,7 @@ typedef enum { ACPI_PCI_HOTPLUG_STATUS = 2, ACPI_CPU_HOTPLUG_STATUS = 4, ACPI_MEMORY_HOTPLUG_STATUS = 8, + ACPI_VMGENID_CHANGED_STATUS = 16, } AcpiGPEStatusBits; /* structs */ diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h index f245f8d..d0f210f 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -28,6 +28,9 @@ typedef struct AcpiDeviceIf { * ospm_status: returns status of ACPI device objects, reported * via _OST method if device supports it. * + * vm_generation_id_changed: notify the guest that its generation ID has been + * changed. + * * Interface is designed for providing unified interface * to generic ACPI functionality that could be used without * knowledge about internals of actual device that implements @@ -39,5 +42,6 @@ typedef struct AcpiDeviceIfClass { /* */ void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); + void (*vm_generation_id_changed)(AcpiDeviceIf *adev); } AcpiDeviceIfClass; #endif diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 345fd8d..e656f59 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -77,4 +77,5 @@ void ich9_pm_device_unplug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, Error **errp); void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); +void ich9_vm_generation_id_changed(AcpiDeviceIf *adev); #endif /* HW_ACPI_ICH9_H */ diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 1c7fcfa..bd7214e 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -482,3 +482,11 @@ void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) acpi_memory_ospm_status(&s->pm.acpi_memory_hotplug, list); } + +void ich9_vm_generation_id_changed(AcpiDeviceIf *adev) +{ + ICH9LPCState *s = ICH9_LPC_DEVICE(adev); + ICH9LPCPMRegs *pm = &s->pm; + + acpi_send_gpe_event(&pm->acpi_regs, pm->irq, ACPI_VMGENID_CHANGED_STATUS); +} diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 2cd2fee..d83957c 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -583,6 +583,13 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) acpi_memory_ospm_status(&s->acpi_memory_hotplug, list); } +static void piix4_vm_generation_id_changed(AcpiDeviceIf *adev) +{ + PIIX4PMState *s = PIIX4_PM(adev); + + acpi_send_gpe_event(&s->ar, s->irq, ACPI_VMGENID_CHANGED_STATUS); +} + static Property piix4_pm_properties[] = { DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0), DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0), @@ -621,6 +628,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->unplug_request = piix4_device_unplug_request_cb; hc->unplug = piix4_device_unplug_cb; adevc->ospm_status = piix4_ospm_status; + adevc->vm_generation_id_changed = piix4_vm_generation_id_changed; } static const TypeInfo piix4_pm_info = { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 360699f..bc6b737 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -724,6 +724,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->unplug_request = ich9_device_unplug_request_cb; hc->unplug = ich9_device_unplug_cb; adevc->ospm_status = ich9_pm_ospm_status; + adevc->vm_generation_id_changed = ich9_vm_generation_id_changed; } static const TypeInfo ich9_lpc_info = { -- 1.8.3.1