aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSong Gao <gaosong@loongson.cn>2023-10-12 14:41:23 +0800
committerSong Gao <gaosong@loongson.cn>2023-10-13 10:04:52 +0800
commit89daabe385a58f52ee902c203bb9560f8c914e8f (patch)
treecdfa50e66a064223e0b651dbde61d5acea584acc
parent3866e2f98ef4f9b84d920af31a98c4c642ff8d77 (diff)
downloadqemu-89daabe385a58f52ee902c203bb9560f8c914e8f.zip
qemu-89daabe385a58f52ee902c203bb9560f8c914e8f.tar.gz
qemu-89daabe385a58f52ee902c203bb9560f8c914e8f.tar.bz2
hw/loongarch/virt: Remove unused 'loongarch_virt_pm' region
The system test shutdown uses the 'loongarch_virt_pm' region. We can use the write AcpiFadtData.sleep_clt register to realize the shutdown. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-ID: <20231012072351.1409344-1-gaosong@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
-rw-r--r--hw/loongarch/virt.c48
-rw-r--r--tests/tcg/loongarch64/system/boot.S7
2 files changed, 5 insertions, 50 deletions
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index c1791f8..2952fe4 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -308,10 +308,6 @@ static void fdt_add_memory_node(MachineState *ms,
g_free(nodename);
}
-#define PM_BASE 0x10080000
-#define PM_SIZE 0x100
-#define PM_CTRL 0x10
-
static void virt_build_smbios(LoongArchMachineState *lams)
{
MachineState *ms = MACHINE(lams);
@@ -380,44 +376,6 @@ static void memmap_add_entry(uint64_t address, uint64_t length, uint32_t type)
memmap_entries++;
}
-/*
- * This is a placeholder for missing ACPI,
- * and will eventually be replaced.
- */
-static uint64_t loongarch_virt_pm_read(void *opaque, hwaddr addr, unsigned size)
-{
- return 0;
-}
-
-static void loongarch_virt_pm_write(void *opaque, hwaddr addr,
- uint64_t val, unsigned size)
-{
- if (addr != PM_CTRL) {
- return;
- }
-
- switch (val) {
- case 0x00:
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
- return;
- case 0xff:
- qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
- return;
- default:
- return;
- }
-}
-
-static const MemoryRegionOps loongarch_virt_pm_ops = {
- .read = loongarch_virt_pm_read,
- .write = loongarch_virt_pm_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
- .valid = {
- .min_access_size = 1,
- .max_access_size = 1
- }
-};
-
static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr)
{
return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS);
@@ -500,7 +458,7 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *
SysBusDevice *d;
PCIBus *pci_bus;
MemoryRegion *ecam_alias, *ecam_reg, *pio_alias, *pio_reg;
- MemoryRegion *mmio_alias, *mmio_reg, *pm_mem;
+ MemoryRegion *mmio_alias, *mmio_reg;
int i;
gpex_dev = qdev_new(TYPE_GPEX_HOST);
@@ -560,10 +518,6 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *
VIRT_RTC_IRQ - VIRT_GSI_BASE));
fdt_add_rtc_node(lams);
- pm_mem = g_new(MemoryRegion, 1);
- memory_region_init_io(pm_mem, NULL, &loongarch_virt_pm_ops,
- NULL, "loongarch_virt_pm", PM_SIZE);
- memory_region_add_subregion(get_system_memory(), PM_BASE, pm_mem);
/* acpi ged */
lams->acpi_ged = create_acpi_ged(pch_pic, lams);
/* platform bus */
diff --git a/tests/tcg/loongarch64/system/boot.S b/tests/tcg/loongarch64/system/boot.S
index 67eb1c0..37a81ba 100644
--- a/tests/tcg/loongarch64/system/boot.S
+++ b/tests/tcg/loongarch64/system/boot.S
@@ -21,9 +21,10 @@ _start:
.align 16
_exit:
2: /* QEMU ACPI poweroff */
- li.w t0, 0xff
- li.w t1, 0x10080010
- st.w t0, t1, 0
+ li.w t0, 0x34
+ li.w t1, 0x100e001c
+ st.b t0, t1, 0
+
idle 0
bl 2b