diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-09-17 20:40:59 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-09-17 20:40:59 +0100 |
commit | a6a0c8394c5b0ce4cee2a1597d235d9b2b9af3c2 (patch) | |
tree | c8ea53fc15098d0e08ac06ce2ee22b190e4e6f02 /include | |
parent | 3af984709398d61ecdcd32fb61295e6332d94392 (diff) | |
parent | 63bcfe7be09787ad6425afcaab5501b53bc26095 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/microvm-20200917-pull-request' into staging
microvm: add acpi support
# gpg: Signature made Thu 17 Sep 2020 14:53:06 BST
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/microvm-20200917-pull-request: (21 commits)
microvm: enable ramfb
tests/acpi: update expected data files for microvm
tests/acpi: add microvm test
tests/acpi: allow override blkdev
tests/acpi: allow microvm test data updates.
microvm: wire up hotplug
x86: move cpu hotplug from pc to x86
x86: move acpi_dev from pc/microvm
x86: constify x86_machine_is_*_enabled
microvm/acpi: disable virtio-mmio cmdline hack
microvm/acpi: use seabios with acpi=on
microvm/acpi: use GSI 16-23 for virtio
microvm/acpi: add acpi_dsdt_add_virtio() for x86
microvm/acpi: add minimal acpi support
microvm: make virtio irq base runtime configurable
acpi: move acpi_dsdt_add_power_button() to ged
acpi: ged: add x86 device variant.
acpi: ged: add control regs
seabios: add bios-microvm.bin binary
seabios: add microvm config, update build rules
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/acpi/generic_event_device.h | 17 | ||||
-rw-r--r-- | include/hw/i386/microvm.h | 10 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 1 | ||||
-rw-r--r-- | include/hw/i386/x86.h | 15 |
4 files changed, 39 insertions, 4 deletions
diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h index 1be05a3c0f..ac921e9f0c 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -71,9 +71,24 @@ typedef struct AcpiGedState AcpiGedState; DECLARE_INSTANCE_CHECKER(AcpiGedState, ACPI_GED, TYPE_ACPI_GED) +#define TYPE_ACPI_GED_X86 "acpi-ged-x86" +#define ACPI_GED_X86(obj) \ + OBJECT_CHECK(AcpiGedX86State, (obj), TYPE_ACPI_GED_X86) + #define ACPI_GED_EVT_SEL_OFFSET 0x0 #define ACPI_GED_EVT_SEL_LEN 0x4 +#define ACPI_GED_REG_SLEEP_CTL 0x00 +#define ACPI_GED_REG_SLEEP_STS 0x01 +#define ACPI_GED_REG_RESET 0x02 +#define ACPI_GED_REG_COUNT 0x03 + +/* ACPI_GED_REG_RESET value for reset*/ +#define ACPI_GED_RESET_VALUE 0x42 + +/* ACPI_GED_REG_SLEEP_CTL.SLP_TYP value for S5 (aka poweroff) */ +#define ACPI_GED_SLP_TYP_S5 0x05 + #define GED_DEVICE "GED" #define AML_GED_EVT_REG "EREG" #define AML_GED_EVT_SEL "ESEL" @@ -89,6 +104,7 @@ DECLARE_INSTANCE_CHECKER(AcpiGedState, ACPI_GED, typedef struct GEDState { MemoryRegion evt; + MemoryRegion regs; uint32_t sel; } GEDState; @@ -104,5 +120,6 @@ struct AcpiGedState { void build_ged_aml(Aml *table, const char* name, HotplugHandler *hotplug_dev, uint32_t ged_irq, AmlRegionSpace rs, hwaddr ged_base); +void acpi_dsdt_add_power_button(Aml *scope); #endif diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index 36dbcdd123..be2d95af4d 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -24,14 +24,19 @@ #include "hw/boards.h" #include "hw/i386/x86.h" +#include "hw/acpi/acpi_dev_interface.h" #include "qom/object.h" /* Platform virtio definitions */ #define VIRTIO_MMIO_BASE 0xfeb00000 -#define VIRTIO_IRQ_BASE 5 #define VIRTIO_NUM_TRANSPORTS 8 #define VIRTIO_CMDLINE_MAXLEN 64 +#define GED_MMIO_BASE 0xfea00000 +#define GED_MMIO_BASE_MEMHP (GED_MMIO_BASE + 0x100) +#define GED_MMIO_BASE_REGS (GED_MMIO_BASE + 0x200) +#define GED_MMIO_IRQ 9 + /* Machine type options */ #define MICROVM_MACHINE_PIT "pit" #define MICROVM_MACHINE_PIC "pic" @@ -59,7 +64,10 @@ struct MicrovmMachineState { bool auto_kernel_cmdline; /* Machine state */ + uint32_t virtio_irq_base; bool kernel_cmdline_fixed; + Notifier machine_done; + Notifier powerdown_req; }; typedef struct MicrovmMachineState MicrovmMachineState; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 421a77acc2..c14e14dfe0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -30,7 +30,6 @@ struct PCMachineState { Notifier machine_done; /* Pointers to devices and objects: */ - HotplugHandler *acpi_dev; PCIBus *bus; I2CBus *smbus; PFlashCFI01 *flash[2]; diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 1a188a7dea..0eef9fb0c0 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -52,6 +52,7 @@ struct X86MachineState { FWCfgState *fw_cfg; qemu_irq *gsi; GMappedFile *initrd_mapped_file; + HotplugHandler *acpi_dev; /* RAM information (sizes, addresses, configuration): */ ram_addr_t below_4g_mem_size, above_4g_mem_size; @@ -91,6 +92,16 @@ CpuInstanceProperties x86_cpu_index_to_props(MachineState *ms, unsigned cpu_index); int64_t x86_get_default_cpu_node_id(const MachineState *ms, int idx); const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms); +CPUArchId *x86_find_cpu_slot(MachineState *ms, uint32_t id, int *idx); +void x86_rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count); +void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); +void x86_cpu_plug(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); +void x86_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); +void x86_cpu_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw); @@ -100,8 +111,8 @@ void x86_load_linux(X86MachineState *x86ms, bool pvh_enabled, bool linuxboot_dma_enabled); -bool x86_machine_is_smm_enabled(X86MachineState *x86ms); -bool x86_machine_is_acpi_enabled(X86MachineState *x86ms); +bool x86_machine_is_smm_enabled(const X86MachineState *x86ms); +bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms); /* Global System Interrupts */ |