[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/loongarch: Add virtio-mmio bus support
From: |
bibo mao |
Subject: |
Re: [PATCH] hw/loongarch: Add virtio-mmio bus support |
Date: |
Wed, 6 Sep 2023 11:09:53 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
在 2023/9/6 10:50, Tianrui Zhao 写道:
> Add virtio-mmio bus support for LoongArch, so that devices
> could be added in the virtio-mmio bus.
>
> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
> ---
> hw/loongarch/Kconfig | 1 +
> hw/loongarch/virt.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig
> index 1e7c5b43c5..01ab8ce8e7 100644
> --- a/hw/loongarch/Kconfig
> +++ b/hw/loongarch/Kconfig
> @@ -22,3 +22,4 @@ config LOONGARCH_VIRT
> select DIMM
> select PFLASH_CFI01
> select ACPI_HMAT
> + select VIRTIO_MMIO
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index 2629128aed..06f4bc3a5e 100644
> --- a/hw/loongarch/virt.c
> +++ b/hw/loongarch/virt.c
> @@ -560,6 +560,9 @@ static void loongarch_devices_init(DeviceState *pch_pic,
> LoongArchMachineState *
> VIRT_RTC_IRQ - VIRT_GSI_BASE));
> fdt_add_rtc_node(lams);
>
> + /* virtio-mmio device */
> + sysbus_create_simple("virtio-mmio", 0x1e200000,
> qdev_get_gpio_in(pch_pic, 7));
It had better use macro rather than hardcoded value like 0x1e200000/7.
Another way multiple virtio-mmio devices should be added like other arches.
And there should be fdt/acpi table added for the device so that users can use
it.
Regards
Bibo Mao
> +
> pm_mem = g_new(MemoryRegion, 1);
> memory_region_init_io(pm_mem, NULL, &loongarch_virt_pm_ops,
> NULL, "loongarch_virt_pm", PM_SIZE);