[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/28] hw/acpi: move "etc/system-states" fw_cfg file
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 26/28] hw/acpi: move "etc/system-states" fw_cfg file from PIIX4 to core |
Date: |
Thu, 4 Jun 2015 13:11:33 +0200 |
From: Laszlo Ersek <address@hidden>
The acpi_pm1_cnt_init() core function is responsible for setting up the
register block that will ultimately react to S3 and S4 requests (see
acpi_pm1_cnt_write()). It makes sense to advertise this configuration to
the guest firmware via an easy to parse fw_cfg file (ACPI is too complex
for firmware to parse), and indeed PIIX4 does that. However, since
acpi_pm1_cnt_init() is not specific to PIIX4, neither should be the fw_cfg
file.
This patch makes "etc/system-states" appear on all chipsets modified in
the previous patch, not just PIIX4 (assuming they have fw_cfg at all).
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1204696
Cc: Amit Shah <address@hidden>
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Aurelien Jarno <address@hidden>
Cc: Leon Alrae <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
---
hw/acpi/core.c | 12 ++++++++++++
hw/acpi/piix4.c | 8 --------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index c165096..0f201d8 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -22,6 +22,7 @@
#include "hw/hw.h"
#include "hw/i386/pc.h"
#include "hw/acpi/acpi.h"
+#include "hw/nvram/fw_cfg.h"
#include "qemu/config-file.h"
#include "qapi/opts-visitor.h"
#include "qapi/dealloc-visitor.h"
@@ -595,12 +596,23 @@ static const MemoryRegionOps acpi_pm_cnt_ops = {
void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent,
bool disable_s3, bool disable_s4, uint8_t s4_val)
{
+ FWCfgState *fw_cfg;
+
ar->pm1.cnt.s4_val = s4_val;
ar->wakeup.notify = acpi_notify_wakeup;
qemu_register_wakeup_notifier(&ar->wakeup);
memory_region_init_io(&ar->pm1.cnt.io, memory_region_owner(parent),
&acpi_pm_cnt_ops, ar, "acpi-cnt", 2);
memory_region_add_subregion(parent, 4, &ar->pm1.cnt.io);
+
+ fw_cfg = fw_cfg_find();
+ if (fw_cfg) {
+ uint8_t suspend[6] = {128, 0, 0, 129, 128, 128};
+ suspend[3] = 1 | ((!disable_s3) << 7);
+ suspend[4] = s4_val | ((!disable_s4) << 7);
+
+ fw_cfg_add_file(fw_cfg, "etc/system-states", g_memdup(suspend, 6), 6);
+ }
}
void acpi_pm1_cnt_reset(ACPIREGS *ar)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 01b304a..13895ad 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -525,14 +525,6 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t
smb_io_base,
qdev_init_nofail(dev);
- if (fw_cfg) {
- uint8_t suspend[6] = {128, 0, 0, 129, 128, 128};
- suspend[3] = 1 | ((!s->disable_s3) << 7);
- suspend[4] = s->s4_val | ((!s->disable_s4) << 7);
-
- fw_cfg_add_file(fw_cfg, "etc/system-states", g_memdup(suspend, 6), 6);
- }
-
return s->smb.smbus;
}
--
MST
- [Qemu-devel] [PULL 16/28] hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query, (continued)
- [Qemu-devel] [PULL 16/28] hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 17/28] hw/pci: introduce PCI Expander Bridge (PXB), Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 18/28] hw/pci: inform bios if the system has extra pci root buses, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 19/28] hw/pxb: add map_irq func, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 20/28] hw/pci: add support for NUMA nodes, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 21/28] hw/pxb: add numa_node parameter, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 22/28] apci: fix PXB behaviour if used with unsupported BIOS, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 24/28] pc-dimm: don't assert if pc-dimm alignment != hotpluggable mem range size, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 23/28] docs: Add PXB documentation, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 25/28] hw/acpi: acpi_pm1_cnt_init(): take "disable_s3" and "disable_s4", Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 26/28] hw/acpi: move "etc/system-states" fw_cfg file from PIIX4 to core,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 27/28] hw/acpi: piix4_pm_init(): take fw_cfg object no more, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 28/28] vhost: logs sharing, Michael S. Tsirkin, 2015/06/04
- Re: [Qemu-devel] [PULL 00/28] pc, acpi, virtio, tpm, Peter Maydell, 2015/06/05