2012-11-23 07:05:06 +04:00
|
|
|
/*
|
|
|
|
* QEMU GMCH/ICH9 LPC PM Emulation
|
|
|
|
*
|
|
|
|
* Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
|
|
|
|
* VA Linux Systems Japan K.K.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2020-10-23 15:44:24 +03:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2012-11-23 07:05:06 +04:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_ACPI_ICH9_H
|
|
|
|
#define HW_ACPI_ICH9_H
|
|
|
|
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/acpi/acpi.h"
|
2014-01-09 20:36:32 +04:00
|
|
|
#include "hw/acpi/cpu_hotplug.h"
|
2016-06-14 17:02:06 +03:00
|
|
|
#include "hw/acpi/cpu.h"
|
2021-07-13 03:42:01 +03:00
|
|
|
#include "hw/acpi/pcihp.h"
|
2014-06-02 17:25:22 +04:00
|
|
|
#include "hw/acpi/memory_hotplug.h"
|
2014-06-16 21:12:27 +04:00
|
|
|
#include "hw/acpi/acpi_dev_interface.h"
|
2022-12-12 13:51:15 +03:00
|
|
|
#include "hw/acpi/ich9_tco.h"
|
2012-11-23 07:05:06 +04:00
|
|
|
|
hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It
starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was
written but the final version of the patch was not yet pushed upstream, this
address range was free and did not conflict with any other IO address ranges.
However, with the following change, this address range was no
longer conflict free as in this change, the IO address range
(value of ACPI_PCIHP_SIZE) was incremented by four bytes:
b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
This can be seen from the output of QMP command 'info mtree' :
0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug
0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
It shows that there is a region of conflict between IO regions of acpi
pci hotplug and acpi cpu hotplug.
Unfortunately, the change caf108bc58790 did not update the IO address range
appropriately before it was pushed upstream to accommodate the increased
length of the IO address space introduced in change b32bd763a1ca92.
Due to this bug, windows guests complain 'This device cannot find
enough free resources it can use' in the device manager panel for extended
IO buses. This issue also breaks the correct functioning of pci hotplug as the
following shows that the IO space for pci hotplug has been truncated:
(qemu) info mtree -f
FlatView #0
AS "I/O", root: io
Root memory region: io
0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug
Therefore, in this fix, we adjust the IO address range for the acpi pci
hotplug so that it does not conflict with cpu hotplug and there is no
truncation of IO spaces. The starting IO address of PCI hotplug region
has been decremented by four bytes in order to accommodate four byte
increment in the IO address space introduced by change
b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
After fixing, the following are the corrected IO ranges:
0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
This change has been tested using a Windows Server 2019 guest VM. Windows
no longer complains after this change.
Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20210916132838.3469580-3-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-09-16 16:28:37 +03:00
|
|
|
#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
|
2021-07-13 03:42:00 +03:00
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
typedef struct ICH9LPCPMRegs {
|
|
|
|
/*
|
|
|
|
* In ich9 spec says that pm1_cnt register is 32bit width and
|
|
|
|
* that the upper 16bits are reserved and unused.
|
|
|
|
* PM1a_CNT_BLK = 2 in FADT so it is defined as uint16_t.
|
|
|
|
*/
|
|
|
|
ACPIREGS acpi_regs;
|
2012-12-11 12:42:18 +04:00
|
|
|
|
2012-11-22 15:08:22 +04:00
|
|
|
MemoryRegion io;
|
2012-11-22 16:43:17 +04:00
|
|
|
MemoryRegion io_gpe;
|
2012-11-22 16:51:35 +04:00
|
|
|
MemoryRegion io_smi;
|
2012-12-11 12:42:18 +04:00
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
uint32_t smi_en;
|
2015-05-06 11:58:30 +03:00
|
|
|
uint32_t smi_en_wmask;
|
2012-11-23 07:05:06 +04:00
|
|
|
uint32_t smi_sts;
|
|
|
|
|
|
|
|
qemu_irq irq; /* SCI */
|
|
|
|
|
|
|
|
uint32_t pm_io_base;
|
|
|
|
Notifier powerdown_notifier;
|
2014-01-09 20:36:32 +04:00
|
|
|
|
2016-04-11 18:25:54 +03:00
|
|
|
bool cpu_hotplug_legacy;
|
2014-01-09 20:36:32 +04:00
|
|
|
AcpiCpuHotplug gpe_cpu;
|
2016-06-14 17:02:06 +03:00
|
|
|
CPUHotplugState cpuhp_state;
|
2014-06-02 17:25:22 +04:00
|
|
|
|
2021-11-12 14:08:54 +03:00
|
|
|
bool keep_pci_slot_hpc;
|
2021-07-13 03:42:01 +03:00
|
|
|
bool use_acpi_hotplug_bridge;
|
|
|
|
AcpiPciHpState acpi_pci_hotplug;
|
2014-06-02 17:25:22 +04:00
|
|
|
MemHotplugState acpi_memory_hotplug;
|
2015-01-12 15:00:14 +03:00
|
|
|
|
|
|
|
uint8_t disable_s3;
|
|
|
|
uint8_t disable_s4;
|
|
|
|
uint8_t s4_val;
|
2023-02-13 20:30:28 +03:00
|
|
|
bool smm_enabled;
|
2021-02-18 08:51:11 +03:00
|
|
|
bool smm_compat;
|
2015-06-28 20:58:56 +03:00
|
|
|
bool enable_tco;
|
|
|
|
TCOIORegs tco_regs;
|
2012-11-23 07:05:06 +04:00
|
|
|
} ICH9LPCPMRegs;
|
|
|
|
|
2017-10-17 19:44:18 +03:00
|
|
|
#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
|
|
|
|
|
2023-02-13 20:30:28 +03:00
|
|
|
void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq);
|
2015-06-28 20:58:56 +03:00
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
|
|
|
|
extern const VMStateDescription vmstate_ich9_pm;
|
|
|
|
|
2020-05-05 18:29:23 +03:00
|
|
|
void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm);
|
2013-07-24 19:56:10 +04:00
|
|
|
|
2019-03-01 06:35:48 +03:00
|
|
|
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|
|
|
Error **errp);
|
2016-05-31 13:01:17 +03:00
|
|
|
void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|
|
|
Error **errp);
|
|
|
|
void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|
|
|
DeviceState *dev, Error **errp);
|
|
|
|
void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
2015-01-28 10:45:40 +03:00
|
|
|
Error **errp);
|
2023-03-02 19:15:43 +03:00
|
|
|
bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bus);
|
2014-06-16 21:12:27 +04:00
|
|
|
|
|
|
|
void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
|
2012-11-23 07:05:06 +04:00
|
|
|
#endif /* HW_ACPI_ICH9_H */
|