On LoongArch Virt Machine, MMIO region with GPEX host bridge is 0x40000000 -- 0x7FFFFFFF. The total size is 1G bytes and it is enough for emulated virtio devices basically.
However on some conditions such as hostmem is added with virtio-gpu device, the command line is -device virtio-gpu-gl,hostmem=4G. The PCIE MMIO region is not enough, 64-bit high MMIO region is required. Here add property highmem_mmio with virt machine, however it brings out incompatible issue. Here the default value is false. Signed-off-by: Bibo Mao <[email protected]> --- hw/loongarch/virt.c | 21 +++++++++++++++++++++ include/hw/loongarch/virt.h | 1 + 2 files changed, 22 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index ad891a5972..264070e787 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -90,6 +90,20 @@ static void virt_set_veiointc(Object *obj, Visitor *v, const char *name, visit_type_OnOffAuto(v, name, &lvms->veiointc, errp); } +static bool virt_get_highmem_mmio(Object *obj, Error **errp) +{ + LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(obj); + + return lvms->highmem_mmio; +} + +static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp) +{ + LoongArchVirtMachineState *lvms = LOONGARCH_VIRT_MACHINE(obj); + + lvms->highmem_mmio = value; +} + static PFlashCFI01 *virt_flash_create1(LoongArchVirtMachineState *lvms, const char *name, const char *alias_prop_name) @@ -1381,6 +1395,13 @@ static void virt_class_init(ObjectClass *oc, const void *data) "Override the default value of field OEM Table ID " "in ACPI table header." "The string may be up to 8 bytes in size"); + + object_class_property_add_bool(oc, "highmem-mmio", + virt_get_highmem_mmio, + virt_set_highmem_mmio); + object_class_property_set_description(oc, "highmem-mmio", + "Set on/off to enable/disable high " + "memory region for PCI MMIO"); } static const TypeInfo virt_machine_types[] = { diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index 01f20a135a..8a289a49fa 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -92,6 +92,7 @@ struct LoongArchVirtMachineState { DeviceState *dintc; hwaddr ram_end; struct GPEXConfig gpex; + bool highmem_mmio; }; #define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt") -- 2.39.3
