From patchwork Sun Sep 13 12:43:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 53527 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 45BEC22B26 for ; Sun, 13 Sep 2015 12:47:16 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf32614457wic.3 for ; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=zUHKN/Otu/T3b1Ne3eAJh/FZ5In1FLtIZ/Y6GSLEOws=; b=H0EOts7dAD9ft3Cv4HdsCm7KDe6m03dNO8PO4VCRZxZ3mt1y1KIr0ZnzhV4kCQDNfs zS61dtL+B4AUaZr/XGi6TzqrRIgTwEuj+ab2z9lqkZCy6NrO7cuzJAOwSFi7zMasDD50 4nyDbGO4P5W3+8puXJSOueURXlujuJArQHbUC9YuxOw0tLvunM6DMq17QYiY5me1iYD9 Q3rfRxIECP56WIibz7iOORfLs63dHUt2GoFj36K93Z85LQYVTwqbNU130UbpLr7joR9h XQ+NAHFTUjLyDWoLEkmVfE2WqKMLjA/QEjUaJcLQO1unzgeQo4GNAHlG1+V9Sk6vojya onoQ== X-Gm-Message-State: ALoCoQlh4Qr+LYukjD+fKIl98BAdQLXu/dBD+BDtNmwCtoUVT68V2v4iRwNcPYy3o9B7FjyizseL X-Received: by 10.194.57.200 with SMTP id k8mr1993369wjq.2.1442148435607; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.130 with SMTP id c2ls211125lag.27.gmail; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) X-Received: by 10.152.19.228 with SMTP id i4mr8217790lae.47.1442148435401; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id z5si6421948lae.138.2015.09.13.05.47.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 05:47:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lamp12 with SMTP id p12so71318492lam.0 for ; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) X-Received: by 10.152.18.133 with SMTP id w5mr8475921lad.72.1442148435290; Sun, 13 Sep 2015 05:47:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp701501lbq; Sun, 13 Sep 2015 05:47:14 -0700 (PDT) X-Received: by 10.107.34.18 with SMTP id i18mr17091751ioi.149.1442148434293; Sun, 13 Sep 2015 05:47:14 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 85si6032612iot.140.2015.09.13.05.47.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 05:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb6gb-0008FN-4B for patch@linaro.org; Sun, 13 Sep 2015 08:47:13 -0400 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) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8DChnOs024712; Sun, 13 Sep 2015 08:43:56 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gal Hammer , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Subject: [Qemu-devel] [PATCH FYI 02/13] hw/acpi: add i386 callbacks for injecting GPE 04 when the VMGENID changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 = {