[RFC v3 1/2] target/loongarch: Add loongson binary translation feature

2024-05-30 Thread Bibo Mao
is added with OnOffAuto type, If lbt feature is not supported with KVM host, it reports error if there is lbt=on command line. If there is no any command line about lbt parameter, it checks whether KVM host supports lbt feature and set the corresponding value in cpucfg. Signed-off-by: Bibo Mao

[RFC v3 0/2] target/loongarch: Add loongson binary translation feature

2024-05-30 Thread Bibo Mao
flags default_features and forced_features v1 ... v2: 1. Add LBT register saving and restoring in vmstate 2. Add two pseudo feature flags: default_features and forced_features --- Bibo Mao (2): target/loongarch: Add loongson binary translation feature target/loongarch: Implement lbt

[RFC v3 2/2] target/loongarch: Implement lbt registers save/restore function

2024-05-30 Thread Bibo Mao
Six registers scr0 - scr3, eflags and ftop are added in percpu vmstate. And two functions kvm_loongarch_get_lbt/kvm_loongarch_put_lbt are added to save/restore lbt registers. Signed-off-by: Bibo Mao --- target/loongarch/cpu.h | 12 + target/loongarch/kvm/kvm.c | 52

[PATCH v2] tests/libqos: Add loongarch virt machine node

2024-05-29 Thread Bibo Mao
addresses. Also hotplug handle checking about TYPE_VIRTIO_IOMMU_PCI device is added on loongarch virt machine, since virtio_mmu_pci device requires it. Signed-off-by: Bibo Mao Acked-by: Thomas Huth --- v1 ... v2: 1. Update copyright licence notation with file loongarch-virt-machine.c --- hw

[PATCH] tests/qtest: Add numa test for loongarch system

2024-05-28 Thread Bibo Mao
Add numa test case for loongarch system, it passes to run with command "make check-qtest". Signed-off-by: Bibo Mao --- tests/qtest/meson.build | 2 +- tests/qtest/numa-test.c | 53 + 2 files changed, 54 insertions(+), 1 deletion(-) diff --g

[PATCH] tests/libqos: Add loongarch virt machine node

2024-05-28 Thread Bibo Mao
addresses. Also hotplug handle checking about TYPE_VIRTIO_IOMMU_PCI device is added on loongarch virt machine, since virtio_mmu_pci device requires it. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 2 + tests/qtest/libqos/loongarch-virt-machine.c | 114

[RFC ] target/loongarch: Add steal time physical address in vmstate

2024-05-27 Thread Bibo Mao
With pv steal time supported, VM machine needs get physical address of each vcpu and notify to new host during migration. Here two functions kvm_loongarch_get_stealtime/kvm_loongarch_put_stealtime are provided and they are called in cpu_pre_save/cpu_post_load separately. Signed-off-by: Bibo Mao

[RFC v2 1/2] target/loongarch: Add loongson binary translation feature

2024-05-27 Thread Bibo Mao
if there is no command line option for LBT feature. If the feature is not supported with KVM host, it reports error and exits if forced_features is set, else it disables feature and continues if default_features is set. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c| 69

[RFC v2 0/2] target/loongarch: Add loongson binary translation feature

2024-05-27 Thread Bibo Mao
in KVM kernel --- v1 ... v2: 1. Add LBT register saving and restoring in vmstate 2. Add two pseudo feature flags: default_features and forced_features. --- Bibo Mao (2): target/loongarch: Add loongson binary translation feature target/loongarch: Implement lbt registers save/restore function

[RFC v2 2/2] target/loongarch: Implement lbt registers save/restore function

2024-05-27 Thread Bibo Mao
Six registers scr0 - scr3, eflags and ftop are added in percpu vmstate. And two functions kvm_loongarch_get_lbt/kvm_loongarch_put_lbt are added to save/restore lbt registers. Signed-off-by: Bibo Mao --- target/loongarch/cpu.h | 12 + target/loongarch/kvm/kvm.c | 52

[PATCH 2/2] target/loongarch: Add loongson binary translation feature

2024-05-21 Thread Bibo Mao
is added here, LBT register saving and restoring is not supported since it depeeds on LBT feautre implemented in KVM kernel. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c| 32 +++ target/loongarch/cpu.h| 1 + target/loongarch/loongarch

[PATCH 0/2] target/loongarch: Add loongson binary translation feature

2024-05-21 Thread Bibo Mao
in KVM kernel Bibo Mao (2): target/loongarch: Add loongarch vector property unconditionally target/loongarch: Add loongson binary translation feature target/loongarch/cpu.c| 42 ++- target/loongarch/cpu.h| 1 + target/loongarch/loongarch

[PATCH 1/2] target/loongarch: Add loongarch vector property unconditionally

2024-05-21 Thread Bibo Mao
Currently LSX/LASX vector property is decided by the default value. Instead vector property should be added unconditionally, and it is irrelative with its default value. If vector is disabled by default, vector also can be enabled from command line. Signed-off-by: Bibo Mao --- target/loongarch

[PATCH] ui/console: Fix compiling issue

2024-05-16 Thread Bibo Mao
Local variable fence_fd is defined but not used if CONFIG_GBM is not enabled, and there is compiling problem. Signed-off-by: Bibo Mao --- ui/gtk-egl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 0473f689c9..9831c10e1b 100644 --- a/ui/gtk

[RFC v2] target/loongarch/kvm: Add software breakpoint support

2024-05-16 Thread Bibo Mao
with gdb method after kernel is loaded, hardware breakpoint will be added in later. Signed-off-by: Bibo Mao --- v1 ... v2: 1. Enable TARGET_KVM_HAVE_GUEST_DEBUG on loongarch64 platform --- configs/targets/loongarch64-softmmu.mak | 1 + target/loongarch/kvm/kvm.c | 76

[PATCH v3 0/6] hw/loongarch: Refine numa memory map

2024-05-15 Thread Bibo Mao
the patch based on the latest version. v1 ... v2: 1. Refresh the patch based on the latest qemu version, solve the confliction issue. 2. Add numa test case for loongarch system. --- Bibo Mao (6): hw/loongarch: Refine acpi srat table for numa memory hw/loongarch: Refine fadt memory table for numa

[PATCH v3 3/6] hw/loongarch: Refine fwcfg memory map

2024-05-15 Thread Bibo Mao
is part of numa node0, so that runtime memory of UEFI which is allocated from the first memory HOB is located at numa node0. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 ++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/hw

[PATCH v3 1/6] hw/loongarch: Refine acpi srat table for numa memory

2024-05-15 Thread Bibo Mao
memory and numa node0 is removed for acpi srat table creation. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 58 +++ 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index

[PATCH v3 4/6] hw/loongarch: Refine system dram memory region

2024-05-15 Thread Bibo Mao
For system dram memory region, it is not necessary to use numa node information. There is only low memory region and high memory region. Remove numa node information for ddr memory region here, it can reduce memory region number on LoongArch virt machine. Signed-off-by: Bibo Mao --- hw

[PATCH v3 5/6] hw/loongarch: Remove minimum and default memory size

2024-05-15 Thread Bibo Mao
Some qtest test cases such as numa use default memory size of generic machine class, which is 128M by fault. Here generic default memory size is used, and also remove minimum memory size which is 1G originally. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 5 - 1 file changed, 5

[PATCH v3 6/6] tests/qtest: Add numa test for loongarch system

2024-05-15 Thread Bibo Mao
Add numa test case for loongarch system, it passes to run with command "make check-qtest". Signed-off-by: Bibo Mao --- tests/qtest/meson.build | 2 +- tests/qtest/numa-test.c | 53 + 2 files changed, 54 insertions(+), 1 deletion(-) diff --g

[PATCH v3 2/6] hw/loongarch: Refine fadt memory table for numa memory

2024-05-15 Thread Bibo Mao
memory and numa node0 is removed for fadt numa memory table creation. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 46 ++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index f0640d2d80

[PATCH] tests/libqos: Add loongarch virt machine node

2024-05-14 Thread Bibo Mao
addresses. Also hotplug handle checking about TYPE_VIRTIO_IOMMU_PCI device is added on loongarch virt machine, since virtio_mmu_pci device requires it. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 2 + tests/qtest/libqos/loongarch-virt-machine.c | 114

[PATCH] hw/loongarch: Add VM mode in IOCSR feature register in kvm mode

2024-05-13 Thread Bibo Mao
If VM runs in kvm mode, VM mode is added in IOCSR feature register. So guest can detect kvm hypervisor type and enable possible pv functions. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH v5 3/3] tests: Add migration test for loongarch64

2024-05-10 Thread Bibo Mao
in tests/migration/loongarch64. So users can change the source and/or re-compile the binary as they wish. Signed-off-by: Bibo Mao Acked-by: Thomas Huth Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/Makefile | 2 +- tests/migration/loongarch64/Makefile | 18

[PATCH v5 0/3] Add migration test for loongarch64

2024-05-10 Thread Bibo Mao
based on the latest qemu version, solve the confliction issue. v1 ... v2: 1. Keep the default memory size unchanged with 1GB, only modify minimum memory size with 256MB 2. Remove tab char in file tests/migration/loongarch64/a-b-kernel.S --- Bibo Mao (3): hw/loongarch: Add compat machine for 9.1

[PATCH v5 2/3] hw/loongarch: Remove minimum and default memory size

2024-05-10 Thread Bibo Mao
Some qtest test cases such as numa use default memory size of generic machine class, which is 128M by fault. Here generic default memory size is used, and also remove minimum memory size which is 1G originally. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 5 - 1 file changed, 5

[PATCH v5 1/3] hw/loongarch: Add compat machine for 9.1

2024-05-10 Thread Bibo Mao
Since migration test case requires compat machine type support, compat machine is added for qemu 9.1 here. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 61 +++-- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH v2] tests/qtest: Add some test cases support on LoongArch

2024-05-09 Thread Bibo Mao
Add boot-serial-test and filter test cases support on LoongArch system. Signed-off-by: Bibo Mao --- v1 ... v2: 1. Refresh the changelog, adding filter test case support also. 2. Adjust order of loongarch qtest in alphabetical order. --- tests/qtest/boot-serial-test.c | 10 ++ tests

[PATCH] tests/qtest/boot-serial-test: Add support on LoongArch system

2024-05-08 Thread Bibo Mao
Add boot-serial-test test case support on LoongArch system. Signed-off-by: Bibo Mao --- tests/qtest/boot-serial-test.c | 10 ++ tests/qtest/meson.build| 4 2 files changed, 14 insertions(+) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index

[PATCH v4 0/5] Add migration test for loongarch64

2024-05-07 Thread Bibo Mao
modify minimum memory size with 256MB 2. Remove tab char in file tests/migration/loongarch64/a-b-kernel.S --- Bibo Mao (5): hw/loongarch: Rename LOONGARCH_MACHINE with LOONGARCH_VIRT_MACHINE hw/loongarch: Rename LoongArchMachineState with LoongArchVirtMachineState hw/loongarch: Add compat

[PATCH v4 4/5] hw/loongarch: Set minimium memory size as 256M

2024-05-07 Thread Bibo Mao
The minimum memory size for LoongArch UEFI bios is 256M, also some test cases such as migration and qos use 256M memory by default. Here set minimum memory size for Loongarch VirtMachine with 256M rather than 1G, so that test cases with 256M memory can pass to run. Signed-off-by: Bibo Mao

[PATCH v4 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with LOONGARCH_VIRT_MACHINE

2024-05-07 Thread Bibo Mao
On LoongArch system, there is only virt machine type now, name LOONGARCH_MACHINE is confused, rename it with LOONGARCH_VIRT_MACHINE. Machine name about Other real hw boards can be added in future. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 8 hw/loongarch/boot.c

[PATCH v4 2/5] hw/loongarch: Rename LoongArchMachineState with LoongArchVirtMachineState

2024-05-07 Thread Bibo Mao
such as loongarch_acpi_setup()/loongarch_load_kernel(), since there functions can be used for real hw boards. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 89 +- hw/loongarch/boot.c | 10 +- hw/loongarch/fw_cfg.c | 2 +- hw/loongarch/fw_cfg.h | 2 +- hw/loongarch/virt.c

[PATCH v4 5/5] tests: Add migration test for loongarch64

2024-05-07 Thread Bibo Mao
in tests/migration/loongarch64. So users can change the source and/or re-compile the binary as they wish. Signed-off-by: Bibo Mao Acked-by: Thomas Huth Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/Makefile | 2 +- tests/migration/loongarch64/Makefile | 18

[PATCH v4 3/5] hw/loongarch: Add compat machine for 9.0

2024-05-07 Thread Bibo Mao
Since migration test case requires compat machine type support, compat machine is added for qemu 9.0 here. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 61 +++-- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH v2 1/6] hw/loongarch: Refine acpi srat table for numa memory

2024-05-06 Thread Bibo Mao
memory and numa node0 is removed for acpi srat table creation. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 58 +++ 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index

[PATCH v2 6/6] tests/qtest: Add numa test for loongarch system

2024-05-06 Thread Bibo Mao
Add numa test case for loongarch system, it passes to run with command "make check-qtest", after the following patch is applied. https://lore.kernel.org/all/20240319022606.2994565-1-maob...@loongson.cn/ Signed-off-by: Bibo Mao --- tests/qtest/meson.build | 2 ++ 1 file changed, 2

[PATCH v2 4/6] hw/loongarch: Refine system dram memory region

2024-05-06 Thread Bibo Mao
For system dram memory region, it is not necessary to use numa node information. There is only low memory region and high memory region. Remove numa node information for ddr memory region here, it can reduce memory region number about LoongArch virt machine. Signed-off-by: Bibo Mao --- hw

[PATCH v2 3/6] hw/loongarch: Refine fwcfg memory map

2024-05-06 Thread Bibo Mao
is part of numa node0, so that runtime memory of UEFI which is allocated from the first memory HOB is located at numa node0. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 ++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/hw

[PATCH v2 5/6] hw/loongarch: Remove minimum and default memory size

2024-05-06 Thread Bibo Mao
Some qtest test cases such as numa use default memory size of generic machine class, which is 128M by fault. Here generic default memory size is used, and also remove minimum memory size which is 1G originally. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 5 - 1 file changed, 5

[PATCH v2 0/6] hw/loongarch: Refine numa memory map

2024-05-06 Thread Bibo Mao
the confliction issue. 2. Add numa test case for loongarch system. --- Bibo Mao (6): hw/loongarch: Refine acpi srat table for numa memory hw/loongarch: Refine fadt memory table for numa memory hw/loongarch: Refine fwcfg memory map hw/loongarch: Refine system dram memory region hw/loongarch

[PATCH v2 2/6] hw/loongarch: Refine fadt memory table for numa memory

2024-05-06 Thread Bibo Mao
memory and numa node0 is removed for fadt numa memory table creation. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 47 ++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index c0999878df

[PATCH v3 0/5] Add migration test for loongarch64

2024-05-05 Thread Bibo Mao
seconds. --- v2 ... v3: 1. Refresh the patch based on the latest qemu version, solve the confliction issue. v1 ... v2: 1. Keep the default memory size unchanged with 1GB, only modify minimum memory size with 256MB 2. Remove tab char in file tests/migration/loongarch64/a-b-kernel.S --- Bibo Mao (5

[PATCH v3 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE

2024-05-05 Thread Bibo Mao
On LoongArch system, there is only virt machine type now, name LOONGARCH_MACHINE is confused, rename it with VIRT_MACHINE. Machine name about Other real hw boards can be added in future. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 8 hw/loongarch/boot.c | 2

[PATCH v3 4/5] hw/loongarch: Set minimium memory size as 256M

2024-05-05 Thread Bibo Mao
The minimum memory size for LoongArch UEFI bios is 256M, also some test cases such as migration and qos use 256M memory by default. Here set minimum memory size for Loongarch VirtMachine with 256M rather than 1G, so that test cases with 256M memory can pass to run. Signed-off-by: Bibo Mao

[PATCH v3 2/5] hw/loongarch: Rename LoongArchMachineState with VirtMachineState

2024-05-05 Thread Bibo Mao
Rename LoongArchMachineState with VirtMachineState, and change variable name LoongArchMachineState *lams with VirtMachineState *vms, and rename function loongarch_xxx() with virt_xxx() also. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 80 +- hw/loongarch/boot.c

[PATCH v3 3/5] hw/loongarch: Add compat machine for 9.0

2024-05-05 Thread Bibo Mao
Since migration test case requires compat machine type support, compat machine is added for qemu 9.0 here. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 +++-- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH v3 5/5] tests: Add migration test for loongarch64

2024-05-05 Thread Bibo Mao
in tests/migration/loongarch64. So users can change the source and/or re-compile the binary as they wish. Signed-off-by: Bibo Mao Acked-by: Thomas Huth Acked-by: Peter Xu Reviewed-by: Fabiano Rosas --- tests/migration/Makefile | 2 +- tests/migration/loongarch64/Makefile | 18

[PATCH v4] target/loongarch: Add TCG macro in structure CPUArchState

2024-05-05 Thread Bibo Mao
are not used and do not need migrate. It is only useful when it runs in TCG mode. Signed-off-by: Bibo Mao Reviewed-by: Richard Henderson --- v3 --> v4: - Refresh the patch based on the latest mainline version. v2 --> v3: - Remove print info about fp_status in loongarch_cpu_dump_state()

[PATCH] target/loongarch: Put cpucfg operation before CSR register

2024-04-27 Thread Bibo Mao
-by: Bibo Mao --- target/loongarch/kvm/kvm.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c index 8224d94333..bc75552d0f 100644 --- a/target/loongarch/kvm/kvm.c +++ b/target/loongarch/kvm/kvm.c @@ -587,22

[PATCH] hw/loongarch: Refine default numa id calculation

2024-03-18 Thread Bibo Mao
test fails on LoongArch, since the actual result is: node 0 cpus: 0 1 2 3 node 1 cpus: 4 5 6 7 It will be better if all the cpus in one socket share the same numa node. Here socket id is used to calculate numa id in function virt_get_default_cpu_node_id(). Signed-off-by: Bibo Mao --- hw/loonga

[PATCH 1/5] hw/loongarch: Refine acpi srat table for numa memory

2024-03-18 Thread Bibo Mao
memory and numa node0 is removed for acpi srat table creation. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 58 +++ 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index

[PATCH 4/5] hw/loongarch: Refine system dram memory region

2024-03-18 Thread Bibo Mao
For system dram memory region, it is not necessary to use numa node information. There is only low memory region and high memory region. Remove numa node information for ddr memory region here, it can reduce memory region number about LoongArch virt machine. Signed-off-by: Bibo Mao --- hw

[PATCH 5/5] hw/loongarch: Remove minimum and default memory size

2024-03-18 Thread Bibo Mao
Some qtest test cases such as numa use default memory size of generic machine class, which is 128M by fault. Here generic default memory size is used, and also remove minimum memory size which is 1G originally. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 5 - 1 file changed, 5

[PATCH 0/5] hw/loongarch: Refine numa memory map

2024-03-18 Thread Bibo Mao
memory and numa node0 is removed here, including acpi srat table, fadt memory map table and fw_cfg memory map table. Also remove numa node about memory region, there is only low memory region and how memory region. Bibo Mao (5): hw/loongarch: Refine acpi srat table for numa memory hw

[PATCH 3/5] hw/loongarch: Refine fwcfg memory map

2024-03-18 Thread Bibo Mao
is part of numa node0, so that runtime memory of UEFI which is allocated from the first memory HOB is located at numa node0. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 ++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/hw

[PATCH 2/5] hw/loongarch: Refine fadt memory table for numa memory

2024-03-18 Thread Bibo Mao
memory and numa node0 is removed for fadt numa memory table creation. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 47 ++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index efce112310

[PATCH] hw/intc/loongarch_extioi: Fix interrupt routing update

2024-03-13 Thread Bibo Mao
Interrupt number in loop sentence should be base irq plus loop index, it is missing on checking whether the irq is pending. Fixes: 428a6ef4396 ("Add vmstate post_load support") Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[PATCH v3] target/loongarch: Add TCG macro in structure CPUArchState

2024-03-04 Thread Bibo Mao
are not used and do not need migrate. It is only useful when it runs in TCG mode. Signed-off-by: Bibo Mao --- v2 --> v3: - Remove print info about fp_status in loongarch_cpu_dump_state() since it is always zero. - Return tcg_enabled() directly in tlb_needed() v1 --> v2: - Add field needed in str

[PATCH v2] target/loongarch: Add TCG macro in structure CPUArchState

2024-03-03 Thread Bibo Mao
are not used and do not need migrate. It is only useful when it runs in TCG mode. Signed-off-by: Bibo Mao Change-Id: Id30d663f5d7bc3436520638f606f99d93926eb2e --- v1 --> v2: - Add field needed in structure vmstate_tlb, dynamically judge whether tlb should be migrated, since mostly qemu-system-loongarc

[PATCH] target/loongarch: Add TCG macro in structure CPUArchState

2024-02-28 Thread Bibo Mao
are not necessary to save in VMState. It is only useful when it runs in TCG mode, macro CONFIG_TCG is also added. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c| 14 +++--- target/loongarch/cpu.h| 16 ++-- target/loongarch/cpu_helper.c | 9 + target

[PATCH v2 5/5] tests: Add migration test for loongarch64

2024-02-26 Thread Bibo Mao
in tests/migration/loongarch64. So users can change the source and/or re-compile the binary as they wish. Signed-off-by: Bibo Mao Reviewed-by: Fabiano Rosas Acked-by: Thomas Huth Acked-by: Peter Xu --- tests/migration/Makefile | 2 +- tests/migration/loongarch64/Makefile | 18

[PATCH v2 0/5] Add migration test for loongarch64

2024-02-26 Thread Bibo Mao
to avoid confliction --- Bibo Mao (5): hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE. hw/loongarch: Rename LoongArchMachineState with VirtMachineState hw/loongarch: Add compat machine for 9.0 hw/loongarch: Set minimium memory size as 256M tests: Add migration test for loongarch64

[PATCH v2 3/5] hw/loongarch: Add compat machine for 9.0

2024-02-26 Thread Bibo Mao
Since migration test case requires compat machine type support, compat machine is added for qemu 9.0 here. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 +++-- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH v2 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE.

2024-02-26 Thread Bibo Mao
On LoongArch system, there is only virt machine type now, name LOONGARCH_MACHINE is confused, rename it with VIRT_MACHINE. Machine name about Other real hw boards can be added in future. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 8 hw/loongarch/virt.c | 19

[PATCH v2 4/5] hw/loongarch: Set minimium memory size as 256M

2024-02-26 Thread Bibo Mao
The minimum memory size for LoongArch UEFI bios is 256M, also some test cases such as migration and qos use 256M memory by default. Here set minimum memory size for Loongarch VirtMachine with 256M rather than 1G, so that test cases with 256M memory can pass to run. Signed-off-by: Bibo Mao

[PATCH v2 2/5] hw/loongarch: Rename LoongArchMachineState with VirtMachineState

2024-02-26 Thread Bibo Mao
Rename LoongArchMachineState with VirtMachineState, and change variable name LoongArchMachineState *lams with VirtMachineState *vms, and rename function loongarch_xxx() with virt_xxx() also. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 80 +- hw/loongarch/fw_cfg.c

[PATCH 3/5] hw/loongarch: Add compat machine for 9.0

2024-02-20 Thread Bibo Mao
Since migration test case requires compat machine type support, compat machine is added for qemu 9.0 here. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 60 +++-- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/hw/loongarch/virt.c b/hw

[PATCH 5/5] tests: Add migration test for loongarch64

2024-02-20 Thread Bibo Mao
in tests/migration/loongarch64. So users can change the source and/or re-compile the binary as they wish. Signed-off-by: Bibo Mao --- tests/migration/Makefile | 2 +- tests/migration/loongarch64/Makefile | 18 ++ tests/migration/loongarch64/a-b-kernel.S | 46

[PATCH 4/5] hw/loongarch: Set minimium memory size as 256M

2024-02-20 Thread Bibo Mao
The minium memory size for LoongArch UEFI bios is 256M, also some test cases such as migration and qos uses parameter 256M. Here set minium memory size for Loongarch VirtMachine with 256M, also default memory size is changed with 256M. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 6

[PATCH 2/5] hw/loongarch: Rename LoongArchMachineState with VirtMachineState

2024-02-20 Thread Bibo Mao
Rename LoongArchMachineState with VirtMachineState, also change variable name lams with vms. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 76 +- hw/loongarch/fw_cfg.c | 2 +- hw/loongarch/fw_cfg.h | 2 +- hw/loongarch/virt.c | 276

[PATCH 0/5] Add migration test for loongarch64

2024-02-20 Thread Bibo Mao
Migration test case is added for loongarch64 here. Since compat machine type is required for migration test case, also compat machine qemu 9.0 is added for loongarch virt machine. Bibo Mao (5): hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE. hw/loongarch: Rename

[PATCH 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE.

2024-02-20 Thread Bibo Mao
On LoongArch system, there is only virt machine type now, name LOONGARCH_MACHINE is confused, rename it with VIRT_MACHINE. Name about Other real hw boards can be added in future. Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 8 hw/loongarch/virt.c | 19

[RFC PATCH] target/loongarch/kvm: Add software breakpoint support

2024-02-17 Thread Bibo Mao
hardware breakpoint will be added. Signed-off-by: Bibo Mao --- target/loongarch/kvm/kvm.c | 77 ++ 1 file changed, 77 insertions(+) diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c index c19978a970..49d02076ad 100644 --- a/target/loongarch/kvm

[PATCH v2] tests/cdrom-test: Add cdrom test for LoongArch virt machine

2024-02-17 Thread Bibo Mao
The cdrom test skips to execute on LoongArch system with command "make check", this patch enables cdrom test for LoongArch virt machine platform. With this patch, cdrom test passes to run on LoongArch virt machine type. Signed-off-by: Bibo Mao --- Add virtio-blk-pci checking since

[PATCH] tests/cdrom-test: Add cdrom test for LoongArch virt machine

2024-02-04 Thread Bibo Mao
The cdrom test skips to execute on LoongArch system with command "make check", this patch enables cdrom test for LoongArch virt machine platform. With this patch, cdrom test passes to run on LoongArch virt machine type. Signed-off-by: Bibo Mao --- tests/qtest/cdrom-test.c | 3 +

[PATCH v2] configure: Add linux header compile support for LoongArch

2024-01-15 Thread Bibo Mao
system so that header files in directory linux-headers/asm-loongarch can be included. Fixes: 714b03c125 ("target/loongarch: Add loongarch kvm into meson build") Signed-off-by: Bibo Mao Reviewed-by: Philippe Mathieu-Daudé --- Changes in v2: 1. Add Fixes label for commit 714b03c125 ---

[PATCH] target/loongarch: Set cpuid CSR register only once with kvm mode

2024-01-15 Thread Bibo Mao
CSR cpuid register is used for routing irq to different vcpus, its value is kept unchanged since poweron. So it is not necessary to set CSR cpuid register after system resets, and it is only set at vm creation stage. Signed-off-by: Bibo Mao --- target/loongarch/kvm/kvm.c | 9 ++--- 1 file

[PATCH] qemu/osdep: Add huge page aligned support on LoongArch platform

2024-01-14 Thread Bibo Mao
-off-by: Bibo Mao --- include/qemu/osdep.h | 8 1 file changed, 8 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 9a405bed89..c9692cc314 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -547,6 +547,14 @@ int madvise(char *, size_t, int

[PATCH] configure: Add linux header compile support for LoongArch

2024-01-14 Thread Bibo Mao
system so that header files in directory linux-headers/asm-loongarch can be included. Signed-off-by: Bibo Mao --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 21ab9a64e9..3d8e24ae01 100755 --- a/configure +++ b/configure @@ -445,6 +445,7 @@ case "

[PATCH v2 0/4] hw/loongarch/virt: Set iocsr address space per-board rather percpu

2023-12-15 Thread Bibo Mao
. Add num-cpu property for extioi interrupt controller 2. Add post_load support for extioi vmstate to calculate sw_ipmap/sw_coremap info --- Bibo Mao (4): hw/intc/loongarch_ipi: Use MemTxAttrs interface for ipi ops hw/loongarch/virt: Set iocsr address space per-board rather than percpu hw

[PATCH v2 1/4] hw/intc/loongarch_ipi: Use MemTxAttrs interface for ipi ops

2023-12-15 Thread Bibo Mao
it is to forward message to another vcpu. Signed-off-by: Bibo Mao --- hw/intc/loongarch_ipi.c | 136 +++- 1 file changed, 77 insertions(+), 59 deletions(-) diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c index 67858b521c..1d3449e77d 100644 --- a/hw/intc

[PATCH v2 3/4] hw/intc/loongarch_extioi: Add dynamic cpu number support

2023-12-15 Thread Bibo Mao
, however kernel can detect and choose new route method in future, so that interrupt can be routed to all vcpus. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 107 +++-- hw/loongarch/virt.c| 3 +- include/hw/intc/loongarch_extioi.h | 11

[PATCH v2 4/4] hw/intc/loongarch_extioi: Add vmstate post_load support

2023-12-15 Thread Bibo Mao
There are elements sw_ipmap and sw_coremap, which is usd to speed up irq injection flow. They are saved and restored in vmstate during migration, indeed they can calculated from hw registers. Here post_load is added for get sw_ipmap and sw_coremap from extioi hw state. Signed-off-by: Bibo Mao

[PATCH v2 2/4] hw/loongarch/virt: Set iocsr address space per-board rather than percpu

2023-12-15 Thread Bibo Mao
per-board rather percpu, for iocsr registers specified for cpu, MemTxAttrs.requester_id can be parsed for the cpu. With this patches, the total address space on board will be simple, only iocsr address space and system memory, rather than the number of cpu and system memory. Signed-off-by: Bibo Mao

[PATCH v1 1/2] hw/intc/loongarch_ipi: Use MemTxAttrs interface for ipi ops

2023-12-12 Thread Bibo Mao
it is to forward message to another vcpu. Signed-off-by: Bibo Mao --- hw/intc/loongarch_ipi.c | 136 +++- 1 file changed, 77 insertions(+), 59 deletions(-) diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c index 67858b521c..1d3449e77d 100644 --- a/hw/intc

[PATCH v1 0/2] hw/loongarch/virt: Set iocsr address space per-board rather percpu

2023-12-12 Thread Bibo Mao
On LoongArch system, there is iocsr address space simliar system io address space on x86. And each cpu has its separate iocsr address space now, with this patch, iocsr address space is changed with per-board, and MemTxAttrs.requester_id is used to differentiate cpu cores. Bibo Mao (2): hw/intc

[PATCH v1 2/2] hw/loongarch/virt: Set iocsr address space per-board rather percpu

2023-12-12 Thread Bibo Mao
per-board rather percpu, for iocsr registers specified for cpu, MemTxAttrs.requester_id can be parsed for the cpu. With this patches, the total address space on board will be simple, only iocsr address space and system memory, rather than the number of cpu and system memory. Signed-off-by: Bibo Mao

[PATCH] target/loongarch: Add timer information dump support

2023-12-06 Thread Bibo Mao
Timer emulation sometimes is problematic especially when vm is running in kvm mode. This patch adds registers dump support relative with timer hardware, so that it is easier to find the problems. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH] hw/loongarch/virt: Align high memory base address with super page size

2023-11-26 Thread Bibo Mao
bios has no limitation with high memory base address, it is ok to set high memory base address with 0x8000. Signed-off-by: Bibo Mao Change-Id: Iac1af728bf6fd35c9c2f4e7dbdae6e3c0fbab623 --- include/hw/loongarch/virt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include

Re: [PATCH] hw/loongarch: Add virtio-mmio bus support

2023-09-05 Thread bibo mao
value like 0x1e20/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, _virt_pm_ops, >NULL, "loongarch_virt_pm", PM_SIZE);

Re: [PATCH v3 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-04 Thread bibo mao
>>>> store. >>> >>> Is this really guaranteed to be an atomic 128-bit operation? >>> >> >> Song Gao, please check this. >> >> > Could you explain this issue?  Thanks. If address is aligned with 16-bytes, the 128-bi

[PATCH v2] target/loongarch: cpu: Implement get_arch_id callback

2023-08-23 Thread Bibo Mao
Implement the callback for getting the architecture-dependent CPU ID, the cpu ID is physical id described in ACPI MADT table, this will be used for cpu hotplug. Signed-off-by: Bibo Mao Reviewed-by: Song Gao --- v1->v2: remove unuseful changeid. --- hw/loongarch/virt.c| 2 ++ tar

Re: [PATCH] target/loongarch: cpu: Implement get_arch_id callback

2023-08-22 Thread bibo mao
在 2023/8/23 09:14, gaosong 写道: > 在 2023/8/22 下午8:26, Bibo Mao 写道: >> Implement the callback for getting the architecture-dependent CPU >> ID, the cpu ID is physical id described in ACPI MADT table, this >> will be used for cpu hotplug. >> >> Sign

[PATCH] target/loongarch: cpu: Implement get_arch_id callback

2023-08-22 Thread Bibo Mao
Implement the callback for getting the architecture-dependent CPU ID, the cpu ID is physical id described in ACPI MADT table, this will be used for cpu hotplug. Signed-off-by: Bibo Mao Change-Id: I53bcfb9f4279e491f33e8b99a9102534ad53409e --- hw/loongarch/virt.c| 2 ++ target/loongarch/cpu.c

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-21 Thread bibo mao
在 2023/8/21 09:29, Jiajie Chen 写道: > > On 2023/8/21 09:24, bibo mao wrote: >> + Add xianglai >> >> Good catch. >> >> In theory, it is logical id, and it can be not equal to physical id. >> However it must be equal to _UID in cpu dsdt table which is mi

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread bibo mao
在 2023/8/21 09:29, Jiajie Chen 写道: > > On 2023/8/21 09:24, bibo mao wrote: >> + Add xianglai >> >> Good catch. >> >> In theory, it is logical id, and it can be not equal to physical id. >> However it must be equal to _UID in cpu dsdt table which is mi

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread bibo mao
+ Add xianglai Good catch. In theory, it is logical id, and it can be not equal to physical id. However it must be equal to _UID in cpu dsdt table which is missing now. Can pptt table parse error be fixed if cpu dsdt table is added? Regards Bibo Mao 在 2023/8/20 18:56, Jiajie Chen 写道: > In

Re: [PATCH] roms: Support compile the efi bios for loongarch

2023-08-10 Thread bibo mao
quot;Philippe Mathieu-Daudé" > Cc: Gerd Hoffmann > Cc: Xiaojuan Yang > Cc: Song Gao > Cc: Bibo Mao > Signed-off-by: xianglai li > --- > .gitmodules| 3 +++ > meson.build| 2 +- > pc-bios/meson.build| 2 ++ > roms/edk2-build.con

  1   2   >