[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/34] hw/arm/virt-acpi-build: Only expose flash on older machine
From: |
Peter Maydell |
Subject: |
[PULL 13/34] hw/arm/virt-acpi-build: Only expose flash on older machine types |
Date: |
Fri, 3 Jul 2020 17:53:44 +0100 |
From: Andrew Jones <drjones@redhat.com>
The flash device is exclusively for the host-controlled firmware, so
we should not expose it to the OS. Exposing it risks the OS messing
with it, which could break firmware runtime services and surprise the
OS when all its changes disappear after reboot.
As firmware needs the device and uses DT, we leave the device exposed
there. It's up to firmware to remove the nodes from DT before sending
it on to the OS. However, there's no need to force firmware to remove
tables from ACPI (which it doesn't know how to do anyway), so we
simply don't add the tables in the first place. But, as we've been
adding the tables for quite some time and don't want to change the
default hardware exposed to versioned machines, then we only stop
exposing the flash device tables for 5.1 and later machine types.
Suggested-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 20200629140938.17566-4-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/arm/virt.h | 1 +
hw/arm/virt-acpi-build.c | 5 ++++-
hw/arm/virt.c | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index a18b6b397b6..54bcf17afd3 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -125,6 +125,7 @@ typedef struct {
bool no_highmem_ecam;
bool no_ged; /* Machines < 4.2 has no support for ACPI GED device */
bool kvm_no_adjvtime;
+ bool acpi_expose_flash;
} VirtMachineClass;
typedef struct {
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 1384a2cf2ab..91f0df7b13a 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -749,6 +749,7 @@ static void build_fadt_rev5(GArray *table_data, BIOSLinker
*linker,
static void
build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
Aml *scope, *dsdt;
MachineState *ms = MACHINE(vms);
const MemMapEntry *memmap = vms->memmap;
@@ -767,7 +768,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
VirtMachineState *vms)
acpi_dsdt_add_cpus(scope, vms->smp_cpus);
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
- acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
+ if (vmc->acpi_expose_flash) {
+ acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
+ }
acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]);
acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],
(irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7922f3c23a5..c78972fb797 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2510,9 +2510,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 1)
static void virt_machine_5_0_options(MachineClass *mc)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
+
virt_machine_5_1_options(mc);
compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len);
mc->numa_mem_supported = true;
+ vmc->acpi_expose_flash = true;
}
DEFINE_VIRT_MACHINE(5, 0)
--
2.20.1
- [PULL 04/34] qdev: Introduce DEFINE_PROP_RESERVED_REGION, (continued)
- [PULL 04/34] qdev: Introduce DEFINE_PROP_RESERVED_REGION, Peter Maydell, 2020/07/03
- [PULL 05/34] virtio-iommu: Implement RESV_MEM probe request, Peter Maydell, 2020/07/03
- [PULL 06/34] virtio-iommu: Handle reserved regions in the translation process, Peter Maydell, 2020/07/03
- [PULL 08/34] hw/arm/virt: Let the virtio-iommu bypass MSIs, Peter Maydell, 2020/07/03
- [PULL 07/34] virtio-iommu-pci: Add array of Interval properties, Peter Maydell, 2020/07/03
- [PULL 09/34] target/arm: kvm: Handle DABT with no valid ISS, Peter Maydell, 2020/07/03
- [PULL 10/34] target/arm: kvm: Handle misconfigured dabt injection, Peter Maydell, 2020/07/03
- [PULL 12/34] tests/acpi: virt: allow DSDT acpi table changes, Peter Maydell, 2020/07/03
- [PULL 13/34] hw/arm/virt-acpi-build: Only expose flash on older machine types,
Peter Maydell <=
- [PULL 11/34] tests/acpi: remove stale allowed tables, Peter Maydell, 2020/07/03
- [PULL 14/34] tests/acpi: virt: update golden masters for DSDT, Peter Maydell, 2020/07/03
- [PULL 15/34] target/arm: Fix temp double-free in sve ldr/str, Peter Maydell, 2020/07/03
- [PULL 16/34] hw/display/bcm2835_fb.c: Initialize all fields of struct, Peter Maydell, 2020/07/03
- [PULL 17/34] hw/arm/spitz: Detabify, Peter Maydell, 2020/07/03
- [PULL 19/34] hw/arm/spitz: Keep pointers to MPU and SSI devices in SpitzMachineState, Peter Maydell, 2020/07/03
- [PULL 18/34] hw/arm/spitz: Create SpitzMachineClass abstract base class, Peter Maydell, 2020/07/03
- [PULL 20/34] hw/arm/spitz: Keep pointers to scp0, scp1 in SpitzMachineState, Peter Maydell, 2020/07/03
- [PULL 21/34] hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals, Peter Maydell, 2020/07/03
- [PULL 22/34] hw/misc/max111x: provide QOM properties for setting initial values, Peter Maydell, 2020/07/03