[PATCH v3 0/7] hw/loongarch/virt: Add high MMIO support with GPEX host bridge

Bibo Mao posted 7 patches 3 months, 3 weeks ago
Failed in applying to current master (apply log)
Maintainers: Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>
hw/loongarch/virt-acpi-build.c |  17 +---
hw/loongarch/virt-fdt-build.c  |  43 +++++---
hw/loongarch/virt.c            | 175 ++++++++++++++++++++++++++++++---
include/hw/loongarch/virt.h    |   5 +-
4 files changed, 200 insertions(+), 40 deletions(-)
[PATCH v3 0/7] hw/loongarch/virt: Add high MMIO support with GPEX host bridge
Posted by Bibo Mao 3 months, 3 weeks ago
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
with -device virtio-gpu-gl,hostmem=4G. The PCIE MMIO region is not enough,
64-bit high MMIO region is required.

Like other architectures, here property highmem-mmio is added on virt
machine to add 64-bit high MMIO region supported. With high MMIO region
added, it is not compatible with old machine, so property highmem-mmio is
disabled by default.

---
v2 ... v3:
  1. Fix high MMIO space access failure with UEFI BIOS on TCG mode, since
     there is 1:1 identified mapping with UEFI bios, virtual address
     space is 47 bit actually with PGDL root page table, where fail to
     setup mapping table for 48 bit physical address. Here set physical
     address width smaller than virtual address width.

v1 ... v2:
  1. Solve some code conflict and refresh the patch on the latest version.
  2. Base address of GPEX high MMIO starts from end of max physical
     address region rather than adjacent with DRAM, since it is fixed with
     the previous method.
---
Bibo Mao (7):
  hw/loongarch/virt: Add field ram_end in LoongArchVirtMachineState
  hw/loongarch/virt: Add field gpex in LoongArchVirtMachineState
  hw/loongarch/virt: Get irq number from gpex config info
  hw/loongarch/virt: Get PCI info from gpex config info
  hw/loongarch/virt: Add property highmem_mmio with virt machine
  hw/loongarch/virt: Add high MMIO support with GPEX host
  hw/loongarch/virt: Add property highmem-mmio-size with virt machine

 hw/loongarch/virt-acpi-build.c |  17 +---
 hw/loongarch/virt-fdt-build.c  |  43 +++++---
 hw/loongarch/virt.c            | 175 ++++++++++++++++++++++++++++++---
 include/hw/loongarch/virt.h    |   5 +-
 4 files changed, 200 insertions(+), 40 deletions(-)


base-commit: 18f6f30b0089b470f3e737637a86dfb81ebd6eae
-- 
2.39.3
Re: [PATCH v3 0/7] hw/loongarch/virt: Add high MMIO support with GPEX host bridge
Posted by gaosong 1 month, 1 week ago
在 2025/10/17 下午2:45, Bibo Mao 写道:
> 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
> with -device virtio-gpu-gl,hostmem=4G. The PCIE MMIO region is not enough,
> 64-bit high MMIO region is required.
>
> Like other architectures, here property highmem-mmio is added on virt
> machine to add 64-bit high MMIO region supported. With high MMIO region
> added, it is not compatible with old machine, so property highmem-mmio is
> disabled by default.
>
> ---
> v2 ... v3:
>    1. Fix high MMIO space access failure with UEFI BIOS on TCG mode, since
>       there is 1:1 identified mapping with UEFI bios, virtual address
>       space is 47 bit actually with PGDL root page table, where fail to
>       setup mapping table for 48 bit physical address. Here set physical
>       address width smaller than virtual address width.
>
> v1 ... v2:
>    1. Solve some code conflict and refresh the patch on the latest version.
>    2. Base address of GPEX high MMIO starts from end of max physical
>       address region rather than adjacent with DRAM, since it is fixed with
>       the previous method.
> ---
> Bibo Mao (7):
>    hw/loongarch/virt: Add field ram_end in LoongArchVirtMachineState
>    hw/loongarch/virt: Add field gpex in LoongArchVirtMachineState
>    hw/loongarch/virt: Get irq number from gpex config info
>    hw/loongarch/virt: Get PCI info from gpex config info
>    hw/loongarch/virt: Add property highmem_mmio with virt machine
>    hw/loongarch/virt: Add high MMIO support with GPEX host
>    hw/loongarch/virt: Add property highmem-mmio-size with virt machine
>
>   hw/loongarch/virt-acpi-build.c |  17 +---
>   hw/loongarch/virt-fdt-build.c  |  43 +++++---
>   hw/loongarch/virt.c            | 175 ++++++++++++++++++++++++++++++---
>   include/hw/loongarch/virt.h    |   5 +-
>   4 files changed, 200 insertions(+), 40 deletions(-)
>
>
> base-commit: 18f6f30b0089b470f3e737637a86dfb81ebd6eae
HI,  this series need  rebase .

Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao