]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/loongarch/virt: Add property highmem_mmio with virt machine
authorBibo Mao <maobibo@loongson.cn>
Fri, 17 Oct 2025 06:45:21 +0000 (14:45 +0800)
committerBibo Mao <maobibo@loongson.cn>
Mon, 12 Jan 2026 06:54:18 +0000 (14:54 +0800)
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 <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
hw/loongarch/virt.c
include/hw/loongarch/virt.h

index 203a13a9634bcc7fe49bb3b64684fd0f81fcb1c2..1e29f93a1f14849b40c5d06b24c31fac73933f42 100644 (file)
@@ -89,6 +89,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)
@@ -1380,6 +1394,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[] = {
index cdc03f4c876c0b6450a394aec2e0e95e0211471c..d39a9bbf5ddd7297ff5d64802467a0a799793cff 100644 (file)
@@ -127,6 +127,7 @@ struct LoongArchVirtMachineState {
     DeviceState *dintc;
     hwaddr ram_end;
     struct GPEXConfig gpex;
+    bool highmem_mmio;
 };
 
 #define TYPE_LOONGARCH_VIRT_MACHINE  MACHINE_TYPE_NAME("virt")