2023-02-13 20:30:33 +03:00
|
|
|
#ifndef HW_SOUTHBRIDGE_ICH9_H
|
|
|
|
#define HW_SOUTHBRIDGE_ICH9_H
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/isa/apm.h"
|
|
|
|
#include "hw/acpi/ich9.h"
|
2023-02-13 20:30:32 +03:00
|
|
|
#include "hw/intc/ioapic.h"
|
|
|
|
#include "hw/pci/pci.h"
|
|
|
|
#include "hw/pci/pci_device.h"
|
|
|
|
#include "exec/memory.h"
|
|
|
|
#include "qemu/notify.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2015-06-28 20:58:56 +03:00
|
|
|
void ich9_generate_smi(void);
|
|
|
|
|
2016-03-07 15:38:58 +03:00
|
|
|
#define ICH9_CC_SIZE (16 * 1024) /* 16KB. Chipset configuration registers */
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2014-06-08 19:45:25 +04:00
|
|
|
#define TYPE_ICH9_LPC_DEVICE "ICH9-LPC"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(ICH9LPCState, ICH9_LPC_DEVICE)
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct ICH9LPCState {
|
2012-11-23 07:05:06 +04:00
|
|
|
/* ICH9 LPC PCI to ISA bridge */
|
|
|
|
PCIDevice d;
|
|
|
|
|
|
|
|
/* (pci device, intx) -> pirq
|
|
|
|
* In real chipset case, the unused slots are never used
|
2016-05-17 04:41:18 +03:00
|
|
|
* as ICH9 supports only D25-D31 irq routing.
|
2012-11-23 07:05:06 +04:00
|
|
|
* On the other hand in qemu case, any slot/function can be populated
|
|
|
|
* via command line option.
|
|
|
|
* So fallback interrupt routing for any devices in any slots is necessary.
|
|
|
|
*/
|
|
|
|
uint8_t irr[PCI_SLOT_MAX][PCI_NUM_PINS];
|
|
|
|
|
|
|
|
APMState apm;
|
|
|
|
ICH9LPCPMRegs pm;
|
|
|
|
uint32_t sci_level; /* track sci level */
|
2016-06-23 08:54:22 +03:00
|
|
|
uint8_t sci_gsi;
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2015-06-28 20:58:58 +03:00
|
|
|
/* 2.24 Pin Straps */
|
|
|
|
struct {
|
|
|
|
bool spkr_hi;
|
|
|
|
} pin_strap;
|
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
/* 10.1 Chipset Configuration registers(Memory Space)
|
|
|
|
which is pointed by RCBA */
|
|
|
|
uint8_t chip_config[ICH9_CC_SIZE];
|
2013-02-20 05:51:24 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 13.7.5 RST_CNT---Reset Control Register (LPC I/F---D31:F0)
|
|
|
|
*
|
|
|
|
* register contents and IO memory region
|
|
|
|
*/
|
|
|
|
uint8_t rst_cnt;
|
|
|
|
MemoryRegion rst_cnt_mem;
|
|
|
|
|
hw/isa/lpc_ich9: add SMI feature negotiation via fw_cfg
Introduce the following fw_cfg files:
- "etc/smi/supported-features": a little endian uint64_t feature bitmap,
presenting the features known by the host to the guest. Read-only for
the guest.
The content of this file will be determined via bit-granularity ICH9-LPC
device properties, to be introduced later. For now, the bitmask is left
zeroed. The bits will be set from machine type compat properties and on
the QEMU command line, hence this file is not migrated.
- "etc/smi/requested-features": a little endian uint64_t feature bitmap,
representing the features the guest would like to request. Read-write
for the guest.
The guest can freely (re)write this file, it has no direct consequence.
Initial value is zero. A nonzero value causes the SMI-related fw_cfg
files and fields that are under guest influence to be migrated.
- "etc/smi/features-ok": contains a uint8_t value, and it is read-only for
the guest. When the guest selects the associated fw_cfg key, the guest
features are validated against the host features. In case of error, the
negotiation doesn't proceed, and the "features-ok" file remains zero. In
case of success, the "features-ok" file becomes (uint8_t)1, and the
negotiated features are locked down internally (to which no further
changes are possible until reset).
The initial value is zero. A nonzero value causes the SMI-related
fw_cfg files and fields that are under guest influence to be migrated.
The C-language fields backing the "supported-features" and
"requested-features" files are uint8_t arrays. This is because they carry
guest-side representation (our choice is little endian), while
VMSTATE_UINT64() assumes / implies host-side endianness for any uint64_t
fields. If we migrate a guest between hosts with different endiannesses
(which is possible with TCG), then the host-side value is preserved, and
the host-side representation is translated. This would be visible to the
guest through fw_cfg, unless we used plain byte arrays. So we do.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20170126014416.11211-2-lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-26 04:44:14 +03:00
|
|
|
/* SMI feature negotiation via fw_cfg */
|
|
|
|
uint64_t smi_host_features; /* guest-invisible, host endian */
|
|
|
|
uint8_t smi_host_features_le[8]; /* guest-visible, read-only, little
|
|
|
|
* endian uint64_t */
|
|
|
|
uint8_t smi_guest_features_le[8]; /* guest-visible, read-write, little
|
|
|
|
* endian uint64_t */
|
|
|
|
uint8_t smi_features_ok; /* guest-visible, read-only; selecting it
|
|
|
|
* triggers feature lockdown */
|
|
|
|
uint64_t smi_negotiated_features; /* guest-invisible, host endian */
|
|
|
|
|
2016-03-07 15:38:58 +03:00
|
|
|
MemoryRegion rcrb_mem; /* root complex register block */
|
2012-11-23 18:02:18 +04:00
|
|
|
Notifier machine_ready;
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2023-02-13 20:30:30 +03:00
|
|
|
qemu_irq gsi[IOAPIC_NUM_PINS];
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-11-23 07:05:06 +04:00
|
|
|
|
2023-02-13 20:30:22 +03:00
|
|
|
#define ICH9_MASK(bit, ms_bit, ls_bit) \
|
2012-11-23 07:05:06 +04:00
|
|
|
((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1)))
|
|
|
|
|
|
|
|
/* ICH9: Chipset Configuration Registers */
|
|
|
|
#define ICH9_CC_ADDR_MASK (ICH9_CC_SIZE - 1)
|
|
|
|
|
|
|
|
#define ICH9_CC
|
|
|
|
#define ICH9_CC_D28IP 0x310C
|
|
|
|
#define ICH9_CC_D28IP_SHIFT 4
|
|
|
|
#define ICH9_CC_D28IP_MASK 0xf
|
|
|
|
#define ICH9_CC_D28IP_DEFAULT 0x00214321
|
|
|
|
#define ICH9_CC_D31IR 0x3140
|
|
|
|
#define ICH9_CC_D30IR 0x3142
|
|
|
|
#define ICH9_CC_D29IR 0x3144
|
|
|
|
#define ICH9_CC_D28IR 0x3146
|
|
|
|
#define ICH9_CC_D27IR 0x3148
|
|
|
|
#define ICH9_CC_D26IR 0x314C
|
|
|
|
#define ICH9_CC_D25IR 0x3150
|
|
|
|
#define ICH9_CC_DIR_DEFAULT 0x3210
|
|
|
|
#define ICH9_CC_D30IR_DEFAULT 0x0
|
|
|
|
#define ICH9_CC_DIR_SHIFT 4
|
|
|
|
#define ICH9_CC_DIR_MASK 0x7
|
|
|
|
#define ICH9_CC_OIC 0x31FF
|
|
|
|
#define ICH9_CC_OIC_AEN 0x1
|
2015-06-28 20:58:56 +03:00
|
|
|
#define ICH9_CC_GCS 0x3410
|
|
|
|
#define ICH9_CC_GCS_DEFAULT 0x00000020
|
|
|
|
#define ICH9_CC_GCS_NO_REBOOT (1 << 5)
|
2012-11-23 07:05:06 +04:00
|
|
|
|
|
|
|
/* D28:F[0-5] */
|
|
|
|
#define ICH9_PCIE_DEV 28
|
|
|
|
#define ICH9_PCIE_FUNC_MAX 6
|
|
|
|
|
|
|
|
|
|
|
|
/* D29:F0 USB UHCI Controller #1 */
|
|
|
|
#define ICH9_USB_UHCI1_DEV 29
|
|
|
|
#define ICH9_USB_UHCI1_FUNC 0
|
|
|
|
|
2014-02-28 14:28:03 +04:00
|
|
|
/* D30:F0 DMI-to-PCI bridge */
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_D2P_BRIDGE "ICH9 D2P BRIDGE"
|
|
|
|
#define ICH9_D2P_BRIDGE_SAVEVM_VERSION 0
|
|
|
|
|
|
|
|
#define ICH9_D2P_BRIDGE_DEV 30
|
|
|
|
#define ICH9_D2P_BRIDGE_FUNC 0
|
|
|
|
|
|
|
|
#define ICH9_D2P_SECONDARY_DEFAULT (256 - 8)
|
|
|
|
|
|
|
|
#define ICH9_D2P_A2_REVISION 0x92
|
|
|
|
|
2013-02-20 05:51:24 +04:00
|
|
|
/* D31:F0 LPC Processor Interface */
|
|
|
|
#define ICH9_RST_CNT_IOPORT 0xCF9
|
2012-11-23 07:05:06 +04:00
|
|
|
|
|
|
|
/* D31:F1 LPC controller */
|
|
|
|
#define ICH9_A2_LPC "ICH9 A2 LPC"
|
|
|
|
#define ICH9_A2_LPC_SAVEVM_VERSION 0
|
|
|
|
|
|
|
|
#define ICH9_LPC_DEV 31
|
|
|
|
#define ICH9_LPC_FUNC 0
|
|
|
|
|
|
|
|
#define ICH9_A2_LPC_REVISION 0x2
|
|
|
|
#define ICH9_LPC_NB_PIRQS 8 /* PCI A-H */
|
|
|
|
|
|
|
|
#define ICH9_LPC_PMBASE 0x40
|
2023-02-13 20:30:22 +03:00
|
|
|
#define ICH9_LPC_PMBASE_BASE_ADDRESS_MASK ICH9_MASK(32, 15, 7)
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_PMBASE_RTE 0x1
|
|
|
|
#define ICH9_LPC_PMBASE_DEFAULT 0x1
|
2020-07-17 18:17:05 +03:00
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_ACPI_CTRL 0x44
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_ACPI_EN 0x80
|
2023-02-13 20:30:22 +03:00
|
|
|
#define ICH9_LPC_ACPI_CTRL_SCI_IRQ_SEL_MASK ICH9_MASK(8, 2, 0)
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_ACPI_CTRL_9 0x0
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_10 0x1
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_11 0x2
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_20 0x4
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_21 0x5
|
|
|
|
#define ICH9_LPC_ACPI_CTRL_DEFAULT 0x0
|
|
|
|
|
|
|
|
#define ICH9_LPC_PIRQA_ROUT 0x60
|
|
|
|
#define ICH9_LPC_PIRQB_ROUT 0x61
|
|
|
|
#define ICH9_LPC_PIRQC_ROUT 0x62
|
|
|
|
#define ICH9_LPC_PIRQD_ROUT 0x63
|
|
|
|
|
|
|
|
#define ICH9_LPC_PIRQE_ROUT 0x68
|
|
|
|
#define ICH9_LPC_PIRQF_ROUT 0x69
|
|
|
|
#define ICH9_LPC_PIRQG_ROUT 0x6a
|
|
|
|
#define ICH9_LPC_PIRQH_ROUT 0x6b
|
|
|
|
|
|
|
|
#define ICH9_LPC_PIRQ_ROUT_IRQEN 0x80
|
2023-02-13 20:30:22 +03:00
|
|
|
#define ICH9_LPC_PIRQ_ROUT_MASK ICH9_MASK(8, 3, 0)
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_PIRQ_ROUT_DEFAULT 0x80
|
|
|
|
|
2015-05-06 11:58:30 +03:00
|
|
|
#define ICH9_LPC_GEN_PMCON_1 0xa0
|
|
|
|
#define ICH9_LPC_GEN_PMCON_1_SMI_LOCK (1 << 4)
|
|
|
|
#define ICH9_LPC_GEN_PMCON_2 0xa2
|
|
|
|
#define ICH9_LPC_GEN_PMCON_3 0xa4
|
|
|
|
#define ICH9_LPC_GEN_PMCON_LOCK 0xa6
|
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_RCBA 0xf0
|
2023-02-13 20:30:22 +03:00
|
|
|
#define ICH9_LPC_RCBA_BA_MASK ICH9_MASK(32, 31, 14)
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_LPC_RCBA_EN 0x1
|
|
|
|
#define ICH9_LPC_RCBA_DEFAULT 0x0
|
|
|
|
|
|
|
|
#define ICH9_LPC_PIC_NUM_PINS 16
|
|
|
|
#define ICH9_LPC_IOAPIC_NUM_PINS 24
|
|
|
|
|
2016-06-22 15:24:54 +03:00
|
|
|
#define ICH9_GPIO_GSI "gsi"
|
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
/* D31:F2 SATA Controller #1 */
|
|
|
|
#define ICH9_SATA1_DEV 31
|
|
|
|
#define ICH9_SATA1_FUNC 2
|
|
|
|
|
2016-05-17 04:41:18 +03:00
|
|
|
/* D31:F0 power management I/O registers
|
2012-11-23 07:05:06 +04:00
|
|
|
offset from the address ICH9_LPC_PMBASE */
|
|
|
|
|
|
|
|
/* ICH9 LPC PM I/O registers are 128 ports and 128-aligned */
|
|
|
|
#define ICH9_PMIO_SIZE 128
|
|
|
|
#define ICH9_PMIO_MASK (ICH9_PMIO_SIZE - 1)
|
|
|
|
|
|
|
|
#define ICH9_PMIO_PM1_STS 0x00
|
|
|
|
#define ICH9_PMIO_PM1_EN 0x02
|
|
|
|
#define ICH9_PMIO_PM1_CNT 0x04
|
|
|
|
#define ICH9_PMIO_PM1_TMR 0x08
|
|
|
|
#define ICH9_PMIO_GPE0_STS 0x20
|
|
|
|
#define ICH9_PMIO_GPE0_EN 0x28
|
|
|
|
#define ICH9_PMIO_GPE0_LEN 16
|
|
|
|
#define ICH9_PMIO_SMI_EN 0x30
|
|
|
|
#define ICH9_PMIO_SMI_EN_APMC_EN (1 << 5)
|
2015-06-28 20:58:56 +03:00
|
|
|
#define ICH9_PMIO_SMI_EN_TCO_EN (1 << 13)
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_PMIO_SMI_STS 0x34
|
2015-06-28 20:58:56 +03:00
|
|
|
#define ICH9_PMIO_TCO_RLD 0x60
|
|
|
|
#define ICH9_PMIO_TCO_LEN 32
|
2012-11-23 07:05:06 +04:00
|
|
|
|
|
|
|
/* FADT ACPI_ENABLE/ACPI_DISABLE */
|
|
|
|
#define ICH9_APM_ACPI_ENABLE 0x2
|
|
|
|
#define ICH9_APM_ACPI_DISABLE 0x3
|
|
|
|
|
|
|
|
|
|
|
|
/* D31:F3 SMBus controller */
|
hw: Replace anti-social QOM type names
Several QOM type names contain ',':
ARM,bitband-memory
etraxfs,pic
etraxfs,serial
etraxfs,timer
fsl,imx25
fsl,imx31
fsl,imx6
fsl,imx6ul
fsl,imx7
grlib,ahbpnp
grlib,apbpnp
grlib,apbuart
grlib,gptimer
grlib,irqmp
qemu,register
SUNW,bpp
SUNW,CS4231
SUNW,DBRI
SUNW,DBRI.prom
SUNW,fdtwo
SUNW,sx
SUNW,tcx
xilinx,zynq_slcr
xlnx,zynqmp
xlnx,zynqmp-pmu-soc
xlnx,zynq-xadc
These are all device types. They can't be plugged with -device /
device_add, except for xlnx,zynqmp-pmu-soc, and I doubt that one
actually works.
They *can* be used with -device / device_add to request help.
Usability is poor, though: you have to double the comma, like this:
$ qemu-system-x86_64 -device SUNW,,fdtwo,help
Trap for the unwary. The fact that this was broken in
device-introspect-test for more than six years until commit e27bd49876
fixed it demonstrates that "the unwary" includes seasoned developers.
One QOM type name contains ' ': "ICH9 SMB". Because having to
remember just one way to quote would be too easy.
Rename the "SUNW,FOO types to "sun-FOO". Summarily replace ',' and '
' by '-' in the other type names.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210304140229.575481-2-armbru@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2021-03-04 17:02:28 +03:00
|
|
|
#define TYPE_ICH9_SMB_DEVICE "ICH9-SMB"
|
2016-06-22 15:24:53 +03:00
|
|
|
|
2012-11-23 07:05:06 +04:00
|
|
|
#define ICH9_A2_SMB_REVISION 0x02
|
|
|
|
#define ICH9_SMB_PI 0x00
|
|
|
|
|
|
|
|
#define ICH9_SMB_SMBMBAR0 0x10
|
|
|
|
#define ICH9_SMB_SMBMBAR1 0x14
|
|
|
|
#define ICH9_SMB_SMBM_BAR 0
|
|
|
|
#define ICH9_SMB_SMBM_SIZE (1 << 8)
|
|
|
|
#define ICH9_SMB_SMB_BASE 0x20
|
|
|
|
#define ICH9_SMB_SMB_BASE_BAR 4
|
|
|
|
#define ICH9_SMB_SMB_BASE_SIZE (1 << 5)
|
|
|
|
#define ICH9_SMB_HOSTC 0x40
|
|
|
|
#define ICH9_SMB_HOSTC_SSRESET ((uint8_t)(1 << 3))
|
|
|
|
#define ICH9_SMB_HOSTC_I2C_EN ((uint8_t)(1 << 2))
|
|
|
|
#define ICH9_SMB_HOSTC_SMB_SMI_EN ((uint8_t)(1 << 1))
|
|
|
|
#define ICH9_SMB_HOSTC_HST_EN ((uint8_t)(1 << 0))
|
|
|
|
|
|
|
|
/* D31:F3 SMBus I/O and memory mapped I/O registers */
|
|
|
|
#define ICH9_SMB_DEV 31
|
|
|
|
#define ICH9_SMB_FUNC 3
|
|
|
|
|
|
|
|
#define ICH9_SMB_HST_STS 0x00
|
|
|
|
#define ICH9_SMB_HST_CNT 0x02
|
|
|
|
#define ICH9_SMB_HST_CMD 0x03
|
|
|
|
#define ICH9_SMB_XMIT_SLVA 0x04
|
|
|
|
#define ICH9_SMB_HST_D0 0x05
|
|
|
|
#define ICH9_SMB_HST_D1 0x06
|
|
|
|
#define ICH9_SMB_HOST_BLOCK_DB 0x07
|
|
|
|
|
2020-09-23 12:46:45 +03:00
|
|
|
#define ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP "x-smi-negotiated-features"
|
|
|
|
|
hw/isa/lpc_ich9: add broadcast SMI feature
The generic edk2 SMM infrastructure prefers
EFI_SMM_CONTROL2_PROTOCOL.Trigger() to inject an SMI on each processor. If
Trigger() only brings the current processor into SMM, then edk2 handles it
in the following ways:
(1) If Trigger() is executed by the BSP (which is guaranteed before
ExitBootServices(), but is not necessarily true at runtime), then:
(a) If edk2 has been configured for "traditional" SMM synchronization,
then the BSP sends directed SMIs to the APs with APIC delivery,
bringing them into SMM individually. Then the BSP runs the SMI
handler / dispatcher.
(b) If edk2 has been configured for "relaxed" SMM synchronization,
then the APs that are not already in SMM are not brought in, and
the BSP runs the SMI handler / dispatcher.
(2) If Trigger() is executed by an AP (which is possible after
ExitBootServices(), and can be forced e.g. by "taskset -c 1
efibootmgr"), then the AP in question brings in the BSP with a
directed SMI, and the BSP runs the SMI handler / dispatcher.
The smaller problem with (1a) and (2) is that the BSP and AP
synchronization is slow. For example, the "taskset -c 1 efibootmgr"
command from (2) can take more than 3 seconds to complete, because
efibootmgr accesses non-volatile UEFI variables intensively.
The larger problem is that QEMU's current behavior diverges from the
behavior usually seen on physical hardware, and that keeps exposing
obscure corner cases, race conditions and other instabilities in edk2,
which generally expects / prefers a software SMI to affect all CPUs at
once.
Therefore introduce the "broadcast SMI" feature that causes QEMU to inject
the SMI on all VCPUs.
While the original posting of this patch
<http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg05658.html>
only intended to speed up (2), based on our recent "stress testing" of SMM
this patch actually provides functional improvements.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20170126014416.11211-3-lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-26 04:44:15 +03:00
|
|
|
/* bit positions used in fw_cfg SMI feature negotiation */
|
|
|
|
#define ICH9_LPC_SMI_F_BROADCAST_BIT 0
|
2020-09-23 12:46:40 +03:00
|
|
|
#define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT 1
|
|
|
|
#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT 2
|
hw/isa/lpc_ich9: add broadcast SMI feature
The generic edk2 SMM infrastructure prefers
EFI_SMM_CONTROL2_PROTOCOL.Trigger() to inject an SMI on each processor. If
Trigger() only brings the current processor into SMM, then edk2 handles it
in the following ways:
(1) If Trigger() is executed by the BSP (which is guaranteed before
ExitBootServices(), but is not necessarily true at runtime), then:
(a) If edk2 has been configured for "traditional" SMM synchronization,
then the BSP sends directed SMIs to the APs with APIC delivery,
bringing them into SMM individually. Then the BSP runs the SMI
handler / dispatcher.
(b) If edk2 has been configured for "relaxed" SMM synchronization,
then the APs that are not already in SMM are not brought in, and
the BSP runs the SMI handler / dispatcher.
(2) If Trigger() is executed by an AP (which is possible after
ExitBootServices(), and can be forced e.g. by "taskset -c 1
efibootmgr"), then the AP in question brings in the BSP with a
directed SMI, and the BSP runs the SMI handler / dispatcher.
The smaller problem with (1a) and (2) is that the BSP and AP
synchronization is slow. For example, the "taskset -c 1 efibootmgr"
command from (2) can take more than 3 seconds to complete, because
efibootmgr accesses non-volatile UEFI variables intensively.
The larger problem is that QEMU's current behavior diverges from the
behavior usually seen on physical hardware, and that keeps exposing
obscure corner cases, race conditions and other instabilities in edk2,
which generally expects / prefers a software SMI to affect all CPUs at
once.
Therefore introduce the "broadcast SMI" feature that causes QEMU to inject
the SMI on all VCPUs.
While the original posting of this patch
<http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg05658.html>
only intended to speed up (2), based on our recent "stress testing" of SMM
this patch actually provides functional improvements.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20170126014416.11211-3-lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-01-26 04:44:15 +03:00
|
|
|
|
2023-02-13 20:30:33 +03:00
|
|
|
#endif /* HW_SOUTHBRIDGE_ICH9_H */
|