[PATCH v2 3/5] target/loongarch: Add do_fill_tlb_entry()

2024-10-09 Thread Song Gao
do_fill_tlb_entry is used to fill a tlb entry. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 43 ++- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c index

[PATCH v2 0/5] LoongArch/tcg: Add hardware page table walker support

2024-10-09 Thread Song Gao
ew pte_val, patch5. Song Gao (5): target/loongarch: Add a new cpu_type la664 target/loongarch: Add do_lddir/ldpte() target/loongarch: Add do_fill_tlb_entry() target/loongarch: Add get_random_tlb_index() target/loongarch/tcg: Add hardware page table walker support target/loongarch

[PATCH v2 5/5] target/loongarch/tcg: Add hardware page table walker support

2024-10-09 Thread Song Gao
Add hardware page table walker (HPTW) feature for la664. Set CPUCFG2.HPTW = 1 to indicate that HPTW is implemented on this CPU. Set PWCH.HPTW_EN = 1 to enable HPTW. Signed-off-by: Song Gao --- target/loongarch/cpu-csr.h| 3 + target/loongarch/cpu.c| 1 + target/loongarch

[PATCH v2 1/5] target/loongarch: Add a new cpu_type la664

2024-10-09 Thread Song Gao
Add a new LoongArch cpu type la664. The la664 has many new features, such as new atomic instructions, hardware page table walk, etc. We will implement them later. Signed-off-by: Song Gao --- target/loongarch/cpu.c | 50 +- 1 file changed, 35 insertions

[PATCH v2 4/5] target/loongarch: Add get_random_tlb_index()

2024-10-09 Thread Song Gao
get_random_tlb_index() is used to get a random tlb index. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 34 +-- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c

[PATCH v2 2/5] target/loongarch: Add do_lddir/ldpte()

2024-10-09 Thread Song Gao
do_lddir is used for accessing directory entries during page table walking, do_ldpte is used for page table entry accesses during page table walking. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 53 --- 1 file changed, 34 insertions(+), 19

[PULL 7/7] hw/loongarch/fw_cfg: Build in common_ss[]

2024-09-29 Thread Song Gao
From: Philippe Mathieu-Daudé Nothing in LoongArch fw_cfg.c requires target specific definitions. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Song Gao Message-Id: <20240927213254.17552-3-phi...@linaro.org> Signed-off-by: Song Gao --- hw/loongarch/meson.build | 2 +- 1 file chan

[PULL 5/7] target/loongarch: Avoid bits shift exceeding width of bool type

2024-09-29 Thread Song Gao
it can be used to dump fp registers into coredump note segment. Resolves: Coverity CID 1561133 Signed-off-by: Bibo Mao Reviewed-by: Richard Henderson Message-Id: <20240914064645.2099169-1-maob...@loongson.cn> Signed-off-by: Song Gao --- target/loongarch/arch_dump.c | 6 +- 1 file c

[PULL 4/7] hw/loongarch/boot: Rework boot code generation

2024-09-29 Thread Song Gao
From: Jiaxun Yang Use stl_p to write instructions so that host endian conversion will be performed. Replace mailbox read/write on LoongArch32 systems with 32bit IOCSR instructions to prevent illegal instructions. Signed-off-by: Jiaxun Yang Reviewed-by: Song Gao Message-Id: <20240

[PULL 3/7] hw/loongarch/boot: Refactor EFI booting protocol generation

2024-09-29 Thread Song Gao
various problems in old implementation such as null pointer on empty string, memory desc map_size not set, incorrect memory map definition and so on. Signed-off-by: Jiaxun Yang Reviewed-by: Song Gao Message-Id: <20240914-loongarch-booting-v1-1-1517cae11...@flygoat.com> Signed-off-by: So

[PULL 6/7] hw/loongarch/virt: Remove unnecessary 'cpu.h' inclusion

2024-09-29 Thread Song Gao
From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Song Gao Message-Id: <20240927213254.17552-2-phi...@linaro.org> Signed-off-by: Song Gao --- include/hw/loongarch/virt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/loongarch/virt.h b/incl

[PULL 0/7] loongarch-to-apply queue

2024-09-29 Thread Song Gao
The following changes since commit 3b14a767eaca3df5534a162851f04787b363670e: Merge tag 'qemu-openbios-20240924' of https://github.com/mcayland/qemu into staging (2024-09-28 12:34:44 +0100) are available in the Git repository at: https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-202409

[PULL 2/7] hw/loongarch/virt: Add FDT table support with acpi ged pm register

2024-09-29 Thread Song Gao
compatbile with syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather with 32-bit mode. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Tested-by: Song Gao Message-Id: <20240918014206.2165821-3-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loo

[PULL 1/7] acpi: ged: Add macro for acpi sleep control register

2024-09-29 Thread Song Gao
.cn> Signed-off-by: Song Gao --- hw/acpi/generic_event_device.c | 6 +++--- include/hw/acpi/generic_event_device.h | 7 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 15b4c3ebbf..d00f5a6c1c 100644

[PULL 6/7] hw/loongarch: virt: pass random seed to fdt

2024-09-12 Thread Song Gao
ed on snapshot load, but the LoongArch code somehow already does that, despite not having this patch here, presumably due to some lucky copy and pasting. Signed-off-by: Jason A. Donenfeld Reviewed-by: Song Gao Message-Id: <20240905153316.2038769-1-ja...@zx2c4.com> Signed-off-by: Song G

[PULL 3/7] target/loongarch/kvm: Add vCPU reset function

2024-09-12 Thread Song Gao
From: Bibo Mao KVM provides interface KVM_REG_LOONGARCH_VCPU_RESET to reset vCPU, it can be used to clear internal state about kvm kernel. vCPU reset function is added here for kvm mode. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240822022827.2273534-1-maob...@loongson

[PULL 2/7] hw/loongarch: Remove default enable with VIRTIO_VGA device

2024-09-12 Thread Song Gao
support for VIRTIO_VGA device, VIRTIO_GPU is prefered on LoongArch system. For frame buffer video card support, standard VGA can be used. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240823073050.2619484-1-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/K

[PULL 5/7] hw/loongarch: virt: support up to 4 serial ports

2024-09-12 Thread Song Gao
y: Jason A. Donenfeld Tested-by: Bibo Mao [gaosong: ACPI uart need't reverse order] Signed-off-by: Song Gao Message-Id: <20240907143439.2792924-1-ja...@zx2c4.com> --- hw/loongarch/acpi-build.c | 23 +++ hw/loongarch/virt.c| 27 +-- inclu

[PULL 1/7] target/loongarch: Add compatible support about VM reboot

2024-09-12 Thread Song Gao
function loongarch_cpu_reset_hold(), so that VM can reboot with edk2-stable202408 UEFI bios. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240827035807.3326293-1-maob...@loongson.cn> Signed-off-by: Song Gao --- target/loongarch/cpu.c | 14 ++ 1 file chang

[PULL 7/7] hw/loongarch: Add acpi SPCR table support

2024-09-12 Thread Song Gao
,mmio,0x1fe001e0 Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240907073037.243353-1-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/acpi-build.c | 40 +++ 1 file changed, 40 insertions(+) diff --git a/hw/loongarch/acpi-build.

[PULL 4/7] target/loongarch: Support QMP dump-guest-memory

2024-09-12 Thread Song Gao
: Song Gao Tested-by: Song Gao Message-Id: <20240822065245.2286214-1-maob...@loongson.cn> Signed-off-by: Song Gao --- target/loongarch/arch_dump.c | 167 +++ target/loongarch/cpu.c | 1 + target/loongarch/internals.h | 2 + target/loongarch/meson.build

[PULL 0/7] loongarch-to-apply queue

2024-09-12 Thread Song Gao
The following changes since commit 4b7ea33074450bc6148c8e1545d78f179e64adb4: Merge tag 'pull-request-2024-09-11' of https://gitlab.com/thuth/qemu into staging (2024-09-11 19:28:23 +0100) are available in the Git repository at: https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240912

[PULL 1/1] hw/loongarch: Fix length for lowram in ACPI SRAT

2024-08-20 Thread Song Gao
RAT: Node 1 PXM 1 [mem 0x17000-0x26fff] [0.00] Warning: node 0 [mem 0x-0x] overlaps with itself [mem 0x8000-0x16fff] Fixes: fc100011f38d ("hw/loongarch: Refine acpi srat table for numa memory") Signed-off-by: Jiaxun Yang Reviewed-by: Bibo Mao

[PULL 0/1] LoongArch: Fix for 9.1

2024-08-20 Thread Song Gao
The following changes since commit 4220ebde107c44412755d593fb46e168eeaed936: Merge tag 'migration-20240820-pull-request' of https://gitlab.com/farosas/qemu into staging (2024-08-21 08:46:45 +1000) are available in the Git repository at: https://gitlab.com/gaosong/qemu.git tags/pull-loongarc

[PATCH 5/5] target/loongarch/tcg: Add hardware page table walker support

2024-07-28 Thread Song Gao
Add hardware page table walker (HPTW) feature for la664. Set CPUCFG2.HPTW = 1 to indicate that HPTW is implemented on this CPU. Set PWCH.HPTW_EN = 1 to enable HPTW. Signed-off-by: Song Gao --- target/loongarch/cpu-csr.h| 3 + target/loongarch/cpu.c| 1 + target/loongarch

[PATCH 1/5] target/loongarch: Add a new cpu_type la664

2024-07-28 Thread Song Gao
Add a new LoongArch cpu type la664. The la664 has many new features, such as new atomic instructions, hardware page table walk, etc. We will implement them later. Signed-off-by: Song Gao --- target/loongarch/cpu.c | 48 +++--- 1 file changed, 36 insertions

[PATCH 4/5] target/loongarch: Add get_random_tlb_index()

2024-07-28 Thread Song Gao
get_random_tlb_index() is used to get a random tlb index. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 34 +-- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c

[PATCH 3/5] target/loongarch: Add do_fill_tlb_entry()

2024-07-28 Thread Song Gao
do_fill_tlb_entry is used to fill a tlb entry. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 43 ++- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c index

[PATCH 2/5] target/loongarch: Add do_lddir/ldpte()

2024-07-28 Thread Song Gao
do_lddir is used for accessing directory entries during page table walking, do_ldpte is used for page table entry accesses during page table walking. Signed-off-by: Song Gao --- target/loongarch/tcg/tlb_helper.c | 53 --- 1 file changed, 34 insertions(+), 19

[PATCH 0/5] LoongArch/tcg: Add hardware page table walker support

2024-07-28 Thread Song Gao
Loongson-3A6000 and newer processors have hardware page table walker (PTW) support. PTW can handle all fastpaths of PIL/PIS/PIF/PIE exceptions by hardware, Song Gao (5): target/loongarch: Add a new cpu_type la664 target/loongarch: Add do_lddir/ldpte() target/loongarch: Add do_fill_tlb_entry

[PULL 1/1] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue

2024-07-24 Thread Song Gao
When the lddir level is 4 and the base is a HugePage, we may try to put value 4 into a field in the TLBENTRY that is only 2 bits wide. Fixes: Coverity CID 1547717 Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue") Signed-off-by: Song Gao Reviewed-by: Richard

[PULL 0/1] LoongArch fix for 9.1

2024-07-24 Thread Song Gao
ix for 9.1 -------- Song Gao (1): target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue target/loongarch/tcg/tlb_helper.c | 1 + 1 file changed, 1 insertion(+)

[PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue

2024-07-23 Thread Song Gao
When the lddir level is 4 and the base is a HugePage, we may try to put value 4 into a field in the TLBENTRY that is only 2 bits wide. Fixes: Coverity CID 1547717 Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue") Signed-off-by: Song Gao --- target/loo

[PULL 1/3] target/loongarch/gdbstub: Add vector registers support

2024-07-18 Thread Song Gao
2e Signed-off-by: Song Gao Reviewed-by: Philippe Mathieu-Daudé Reviewd-by: Bibo Mao Message-Id: <20240711024454.3075183-1-gaos...@loongson.cn> --- configs/targets/loongarch64-linux-user.mak | 2 +- configs/targets/loongarch64-softmmu.mak| 2 +- gdb-xml/loongarch-lasx.xml

[PULL 2/3] hw/loongarch: Remove unimplemented extioi INT_encode mode

2024-07-18 Thread Song Gao
Remove extioi INT_encode encode mode, because we don't emulate it. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240718083254.748179-1-gaos...@loongson.cn> --- include/hw/intc/loongarch_extioi.h | 1 - 1 file changed, 1 deletion(-) diff --git a/incl

[PULL 3/3] hw/loongarch: Modify flash block size to 256K

2024-07-18 Thread Song Gao
From: Xianglai Li loongarch added a common library for edk2 to parse flash base addresses through fdt. For compatibility with other architectures, the flash block size in qemu is now changed to 256k. Signed-off-by: Xianglai Li Reviewed-by: Song Gao Message-Id: <20240624033319.999631-1-lixi

[PULL 0/3] loongarch-to-apply queue

2024-07-18 Thread Song Gao
h-20240719 -------- Song Gao (2): target/loongarch/gdbstub: Add vector registers support hw/loongarch: Remove unimplemented extioi INT_encode mode Xianglai Li (1): hw/loongarch: Modify flash block size to 256K configs/targets/loongarch64-linux-user.mak | 2 +

[PATCH v2] hw/loongarch: Remove unimplemented extioi INT_encode mode

2024-07-18 Thread Song Gao
Remove extioi INT_encode encode mode, because we don't emulate it. Signed-off-by: Song Gao --- include/hw/intc/loongarch_extioi.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h index eccc2e0d18..626a37dfa1 100644

[PATCH] hw/loongarch: Remove unimplemented extioi INT_encode mode

2024-07-18 Thread Song Gao
Remove extioi INT_encode encode mode, because we don't emulate it. Signed-off-by: Song Gao --- hw/loongarch/virt.c| 6 -- include/hw/intc/loongarch_extioi.h | 1 - 2 files changed, 7 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index e592b

[PATCH] qemu/timer: Add host ticks function for LoongArch

2024-07-15 Thread Song Gao
Signed-off-by: Song Gao --- include/qemu/timer.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 5ce83c7911..fa56ec9481 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -1016,6 +1016,15 @@ static inline int64_t

[PULL v2 4/8] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine

2024-07-11 Thread Song Gao
es on that machine. Signed-off-by: Jiaxun Yang Reviewed-by: Song Gao Message-Id: <20240627-ipi-fixes-v1-2-9b061dc28...@flygoat.com> Signed-off-by: Song Gao --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6725913c8b..41bece23c1 100644 --- a/

[PULL v2 1/8] hw/loongarch/boot.c: fix out-of-bound reading

2024-07-11 Thread Song Gao
From: Dmitry Frolov memcpy() is trying to READ 512 bytes from memory, pointed by info->kernel_cmdline, which was (presumable) allocated by g_strdup(""); Found with ASAN, making check with enabled sanitizers. Signed-off-by: Dmitry Frolov Reviewed-by: Song Gao Message-Id: <20240

[PULL v2 3/8] hw/loongarch/virt: Remove unused assignment

2024-07-11 Thread Song Gao
From: Bibo Mao There is abuse usage about local variable gap. Remove duplicated assignment and solve Coverity reported error. Resolves: Coverity CID 1546441 Fixes: 3cc451cbce ("hw/loongarch: Refine fwcfg memory map") Signed-off-by: Bibo Mao Reviewed-by: Song Gao

[PULL v2 8/8] target/loongarch: Fix cpu_reset set wrong CSR_CRMD

2024-07-11 Thread Song Gao
After cpu_reset, DATF in CSR_CRMD is 0, DATM is 0. See the manual[1] 6.4. [1]: https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240705021839.1004374-2-gaos...@loongson

[PULL v2 7/8] target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values

2024-07-11 Thread Song Gao
We set the value of register CSR_PRCFG3, but left out CSR_PRCFG1 and CSR_PRCFG2. Set CSR_PRCFG1 and CSR_PRCFG2 according to the default values of the physical machine. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240705021839.1004374-1-gaos...@loongson.cn> --- target/loo

[PULL v2 2/8] hw/loongarch: Change the tpm support by default

2024-07-11 Thread Song Gao
From: Xianglai Li Add devices that support tpm by default, Fixed incomplete tpm acpi table information. Signed-off-by: Xianglai Li Reviewed-by: Song Gao Message-Id: <20240624032300.999157-1-lixiang...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/Kconfig | 1 + hw/loo

[PULL v2 0/8] loongarch-to-apply queue

2024-07-11 Thread Song Gao
out-of-bound reading Feiyang Chen (1): target/loongarch: Remove avail_64 in trans_srai_w() and simplify it Jiaxun Yang (1): MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Song Gao (2): target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values target/loongarch: Fix

[PULL v2 5/8] target/loongarch/kvm: Add software breakpoint support

2024-07-11 Thread Song Gao
KVM_REG_LOONGARCH_DEBUG_INST. Now only software breakpoint is supported, and it is allowed to insert/remove software breakpoint. We can debug guest kernel with gdb method after kernel is loaded, hardware breakpoint will be added in later. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Tested-by: Song Gao Message-Id

[PULL v2 6/8] target/loongarch: Remove avail_64 in trans_srai_w() and simplify it

2024-07-11 Thread Song Gao
Message-Id: <20240628033357.50027-1-chris.chenfeiy...@gmail.com> Signed-off-by: Song Gao --- target/loongarch/tcg/insn_trans/trans_shift.c.inc | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_shift.c.inc b/target/loongarc

[PULL 7/9] target/loongarch: Remove avail_64 in trans_srai_w() and simplify it

2024-07-11 Thread Song Gao
Message-Id: <20240628033357.50027-1-chris.chenfeiy...@gmail.com> Signed-off-by: Song Gao --- target/loongarch/tcg/insn_trans/trans_shift.c.inc | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_shift.c.inc b/target/loongarc

[PULL 2/9] hw/loongarch: Change the tpm support by default

2024-07-11 Thread Song Gao
From: Xianglai Li Add devices that support tpm by default, Fixed incomplete tpm acpi table information. Signed-off-by: Xianglai Li Reviewed-by: Song Gao Message-Id: <20240624032300.999157-1-lixiang...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/Kconfig | 1 + hw/loo

[PULL 8/9] target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values

2024-07-11 Thread Song Gao
We set the value of register CSR_PRCFG3, but left out CSR_PRCFG1 and CSR_PRCFG2. Set CSR_PRCFG1 and CSR_PRCFG2 according to the default values of the physical machine. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240705021839.1004374-1-gaos...@loongson.cn> --- target/loo

[PULL 9/9] target/loongarch: Fix cpu_reset set wrong CSR_CRMD

2024-07-11 Thread Song Gao
After cpu_reset, DATF in CSR_CRMD is 0, DATM is 0. See the manual[1] 6.4. [1]: https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240705021839.1004374-2-gaos...@loongson

[PULL 4/9] hw/loongarch/virt: Remove unused assignment

2024-07-11 Thread Song Gao
From: Bibo Mao There is abuse usage about local variable gap. Remove duplicated assignment and solve Coverity reported error. Resolves: Coverity CID 1546441 Fixes: 3cc451cbce ("hw/loongarch: Refine fwcfg memory map") Signed-off-by: Bibo Mao Reviewed-by: Song Gao

[PULL 1/9] hw/loongarch/boot.c: fix out-of-bound reading

2024-07-11 Thread Song Gao
From: Dmitry Frolov memcpy() is trying to READ 512 bytes from memory, pointed by info->kernel_cmdline, which was (presumable) allocated by g_strdup(""); Found with ASAN, making check with enabled sanitizers. Signed-off-by: Dmitry Frolov Reviewed-by: Song Gao Message-Id: <20240

[PULL 5/9] MAINTAINERS: Add myself as a reviewer of LoongArch virt machine

2024-07-11 Thread Song Gao
es on that machine. Signed-off-by: Jiaxun Yang Reviewed-by: Song Gao Message-Id: <20240627-ipi-fixes-v1-2-9b061dc28...@flygoat.com> Signed-off-by: Song Gao --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6725913c8b..41bece23c1 100644 --- a/

[PULL 3/9] hw/loongarch: Modify flash block size to 256K

2024-07-11 Thread Song Gao
From: Xianglai Li loongarch added a common library for edk2 to parse flash base addresses through fdt. For compatibility with other architectures, the flash block size in qemu is now changed to 256k. Signed-off-by: Xianglai Li Reviewed-by: Song Gao Message-Id: <20240624033319.999631-1-lixi

[PULL 6/9] target/loongarch/kvm: Add software breakpoint support

2024-07-11 Thread Song Gao
KVM_REG_LOONGARCH_DEBUG_INST. Now only software breakpoint is supported, and it is allowed to insert/remove software breakpoint. We can debug guest kernel with gdb method after kernel is loaded, hardware breakpoint will be added in later. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Tested-by: Song Gao Message-Id

[PULL 0/9] loongarch-to-apply queue

2024-07-11 Thread Song Gao
d simplify it Jiaxun Yang (1): MAINTAINERS: Add myself as a reviewer of LoongArch virt machine Song Gao (2): target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values target/loongarch: Fix cpu_reset set wrong CSR_CRMD Xianglai Li (2): hw/loongarch: Change the tpm support

[PATCH v2] target/loongarch/gdbstub: Add vector registers support

2024-07-10 Thread Song Gao
2e Signed-off-by: Song Gao --- based-on: https://patchew.org/QEMU/20240607035016.2975799-1-maob...@loongson.cn/ v2: - fix tab line wrapper issue. - Link to v1: https://patchew.org/QEMU/20240621065406.864232-1-gaos...@loongson.cn/ configs/targets/loongarch64-linux-user.mak | 2 +- confi

[PATCH v2 1/2] target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values

2024-07-04 Thread Song Gao
We set the value of register CSR_PRCFG3, but left out CSR_PRCFG1 and CSR_PRCFG2. Set CSR_PRCFG1 and CSR_PRCFG2 according to the default values of the physical machine. Signed-off-by: Song Gao --- v2: - Add a new patch fix set CSR_CRMD wrong value; - Set PRCFG1-PRCFG3 values in

[PATCH v2 2/2] target/loongarch: Fix cpu_reset set wrong CSR_CRMD

2024-07-04 Thread Song Gao
After cpu_reset, DATF in CSR_CRMD is 0, DATM is 0. See the manual[1] 6.4. [1]: https://github.com/loongson/LoongArch-Documentation/releases/download/2023.04.20/LoongArch-Vol1-v1.10-EN.pdf Signed-off-by: Song Gao --- target/loongarch/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH] target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values

2024-07-04 Thread Song Gao
We set the value of register CSR_PRCFG3, but left out CSR_PRCFG1 and CSR_PRCFG2. Set CSR_PRCFG1 and CSR_PRCFG2 according to the default values of the physical machine. Signed-off-by: Song Gao --- target/loongarch/cpu.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/loongarch

[RESEND PATCH 0/2] hw/intc: Restore loongarch_ipi for LoongArch

2024-06-27 Thread Song Gao
restore loongarch_ipi. Song Gao (2): Revert "hw/intc: Remove loongarch_ipi.c" hw/intc: Restore loongarch_ipi for LoongArch MAINTAINERS | 2 - include/hw/intc/loongarch_ipi.h | 54 + include/hw/loongarch/virt.h | 2 +- hw/intc/loongarch_ipi.c

[RESEND PATCH 1/2] Revert "hw/intc: Remove loongarch_ipi.c"

2024-06-27 Thread Song Gao
Restore 'loongarch_ipi.c' for LoongArch. This reverts commit 5f82fb2a3a71bb510b3e1b7229929d468c01740a. --- hw/intc/loongarch_ipi.c | 347 1 file changed, 347 insertions(+) create mode 100644 hw/intc/loongarch_ipi.c diff --git a/hw/intc/loongarch_ipi.c b/

[RESEND PATCH 2/2] hw/intc: Restore loongarch_ipi for LoongArch

2024-06-27 Thread Song Gao
restore loongarch_ipi. Signed-off-by: Song Gao --- MAINTAINERS | 2 -- include/hw/intc/loongarch_ipi.h | 54 + include/hw/loongarch/virt.h | 2 +- hw/loongarch/virt.c | 4 +-- hw/intc/Kconfig | 3 ++ hw/intc

[PATCH] target/loongarch/gdbstub: Add vector registers support

2024-06-21 Thread Song Gao
2e Signed-off-by: Song Gao --- based-on: https://patchew.org/QEMU/20240607035016.2975799-1-maob...@loongson.cn/ configs/targets/loongarch64-linux-user.mak | 2 +- configs/targets/loongarch64-softmmu.mak| 2 +- gdb-xml/loongarch-lasx.xml | 60 +++ gdb-xml

[PATCH] tcg/loongarch64: Fix tcg_out_movi tcg_debug_assert() error

2024-06-18 Thread Song Gao
8 sextreg(offset_hi, 0, 20) is fff8 offset_hi is 8 sextreg(offset_hi, 0, 20) is fff8 ..." When pcalau12i + ori is not satisfied, we should use other methods instead, instead of generating an assertion error. Cc: qemu-sta...@nongnu.org Rep

[RFC PATCH v3] target/loongarch/kvm: Implement LoongArch PMU extension.

2024-06-13 Thread Song Gao
the PMU Feature and set the corresponding value in cpucfg. Signed-off-by: Song Gao --- v3: - Use OnOffAuto type variable pmu to check the PMU feature. - Link to v2: https://patchew.org/QEMU/20240515040611.998507-1-gaos...@loongson.cn/ v2: - Drop the property 'pmnum'. - Link to

[PULL 0/6] loongarch-to-apply queue

2024-06-05 Thread Song Gao
h-20240606 Bibo Mao (2): tests/libqos: Add loongarch virt machine node tests/qtest: Add numa test for loongarch system Song Gao (3): hw/intc/loongarch_extioi: Add extioi virt extension definition hw/loongarch/virt: Use MemTxAttrs interface for misc ops hw/loon

[PULL 4/6] hw/loongarch/virt: Use MemTxAttrs interface for misc ops

2024-06-05 Thread Song Gao
Use MemTxAttrs interface read_with_attrs/write_with_attrs for virt_iocsr_misc_ops. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240528083855.1912757-3-gaos...@loongson.cn> --- hw/loongarch/virt.c | 36 1 file changed, 24 insertions(

[PULL 2/6] tests/qtest: Add numa test for loongarch system

2024-06-05 Thread Song Gao
From: Bibo Mao Add numa test case for loongarch system, it passes to run with command "make check-qtest". Signed-off-by: Bibo Mao Acked-by: Thomas Huth Tested-by: Song Gao Message-Id: <20240528082155.938586-1-maob...@loongson.cn> Signed-off-by: Song Gao --- tests/qtest/

[PULL 5/6] hw/loongarch/virt: Enable extioi virt extension

2024-06-05 Thread Song Gao
This patch adds a new board attribute 'v-eiointc'. A value of true enables the virt extended I/O interrupt controller. VMs working in kvm mode have 'v-eiointc' enabled by default. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240528083855.1912757-4-gaos.

[PULL 1/6] tests/libqos: Add loongarch virt machine node

2024-06-05 Thread Song Gao
pio_base 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 Message-Id: <20240528082053.938564-1-maob...@loongson.cn> Signed-off-by: So

[PULL 3/6] hw/intc/loongarch_extioi: Add extioi virt extension definition

2024-06-05 Thread Song Gao
| | PCH-MSI | +-+ +-+ ^ ^ ^ | | | ++ +-+ +-+ | UARTs | | Devices | | Devices | ++ +-+ +-+ Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240528083855

[PULL 6/6] target/loongarch: fix a wrong print in cpu dump

2024-06-05 Thread Song Gao
From: lanyanzhi description: loongarch_cpu_dump_state() want to dump all loongarch cpu state registers, but there is a tiny typographical error when printing "PRCFG2". Cc: qemu-sta...@nongnu.org Signed-off-by: lanyanzhi Reviewed-by: Richard Henderson Reviewed-by: Song Gao

[PATCH v2] tests/avocado: Update LoongArch bios file

2024-06-03 Thread Song Gao
The VM uses old bios to boot up only 1 cpu, causing the test case to fail. Update the bios to solve this problem. Reported-by: Thomas Huth Signed-off-by: Song Gao --- v2: Use a fixed release version for kernel/initrd/bios_url. tests/avocado/machine_loongarch.py | 8 1 file changed

[PATCH] tests/avocado: Update LoongArch bios file

2024-05-30 Thread Song Gao
The VM uses old bios to boot up only 1 cpu, causing the test case to fail. Update the bios to solve this problem. Reported-by: Thomas Huth Signed-off-by: Song Gao --- tests/avocado/machine_loongarch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/avocado

[PATCH v4 0/3] Add extioi virt extension support

2024-05-28 Thread Song Gao
.cn/#r [1]: https://gitee.com/openeuler/kernel/commit/5d97cff72f91f4f20a536efd60eca75bfcb78a64 Thanks. Song Gao Song Gao (3): hw/intc/loongarch_extioi: Add extioi virt extension definition hw/loongarch/virt: Use MemTxAttrs interface for misc ops hw/loongarch/virt: Enable extioi virt

[PATCH v4 2/3] hw/loongarch/virt: Use MemTxAttrs interface for misc ops

2024-05-28 Thread Song Gao
Use MemTxAttrs interface read_with_attrs/write_with_attrs for virt_iocsr_misc_ops. Signed-off-by: Song Gao --- hw/loongarch/virt.c | 36 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index

[PATCH v4 1/3] hw/intc/loongarch_extioi: Add extioi virt extension definition

2024-05-28 Thread Song Gao
| | PCH-MSI | +-+ +-+ ^ ^ ^ | | | ++ +-+ +-+ | UARTs | | Devices | | Devices | ++ +-+ +-+ Signed-off-by: Song Gao Reviewed-by: Bibo Mao --- include/hw/intc/loongarch_e

[PATCH v4 3/3] hw/loongarch/virt: Enable extioi virt extension

2024-05-28 Thread Song Gao
This patch adds a new board attribute 'v-eiointc'. A value of true enables the virt extended I/O interrupt controller. VMs working in kvm mode have 'v-eiointc' enabled by default. Signed-off-by: Song Gao --- include/hw/loongarch/virt.h | 1 + target/loongarch/cpu.h

[PULL 10/10] hw/loongarch/virt: Fix FDT memory node address width

2024-05-22 Thread Song Gao
From: Jiaxun Yang Higher bits for memory nodes were omitted at qemu_fdt_setprop_cells. Cc: qemu-sta...@nongnu.org Signed-off-by: Jiaxun Yang Reviewed-by: Song Gao Message-Id: <20240520-loongarch-fdt-memnode-v1-1-5ea9be939...@flygoat.com> Signed-off-by: Song Gao --- hw/loongarch/virt

[PULL 04/10] hw/loongarch: Refine acpi srat table for numa memory

2024-05-22 Thread Song Gao
size for both total memory and numa node0 is removed for acpi srat table creation. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240515093927.3453674-2-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/acpi-build.c | 58 +++

[PULL 02/10] target/loongarch/kvm: fpu save the vreg registers high 192bit

2024-05-22 Thread Song Gao
On kvm side, get_fpu/set_fpu save the vreg registers high 192bits, but QEMU missing. Cc: qemu-sta...@nongnu.org Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240514110752.989572-1-gaos...@loongson.cn> --- target/loongarch/kvm/kvm.c | 6 ++ 1 file changed, 6 inse

[PULL 09/10] target/loongarch: Add loongarch vector property unconditionally

2024-05-22 Thread Song Gao
Reviewed-by: Song Gao Message-Id: <20240521080549.434197-2-maob...@loongson.cn> Signed-off-by: Song Gao --- target/loongarch/cpu.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index a0cad53676..b5c1ec94af

[PULL 07/10] hw/loongarch: Refine system dram memory region

2024-05-22 Thread Song Gao
Reviewed-by: Song Gao Message-Id: <20240515093927.3453674-5-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/virt.c | 53 +++-- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c

[PULL 05/10] hw/loongarch: Refine fadt memory table for numa memory

2024-05-22 Thread Song Gao
size for both total memory and numa node0 is removed for fadt numa memory table creation. Signed-off-by: Bibo Mao Reviewed-by: Song Gao Message-Id: <20240515093927.3453674-3-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/virt.c | 46 ++

[PULL 01/10] target/loongarch/kvm: Fix VM recovery from disk failures

2024-05-22 Thread Song Gao
vmstate does not save kvm_state_conter, which can cause VM recovery from disk to fail. Cc: qemu-sta...@nongnu.org Signed-off-by: Song Gao Acked-by: Peter Xu Message-Id: <20240508024732.3127792-1-gaos...@loongson.cn> --- target/loongarch/machine.c | 6 -- 1 file changed, 4 insertions

[PULL 08/10] hw/loongarch: Remove minimum and default memory size

2024-05-22 Thread Song Gao
From: 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 Reviewed-by: Song Gao Message-Id

[PULL 03/10] hw/loongarch: Add VM mode in IOCSR feature register in kvm mode

2024-05-22 Thread Song Gao
From: 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 Reviewed-by: Song Gao Message-Id: <20240514025109.3238398-1-maob...@loongson.cn> Signed-off-by: So

[PULL 06/10] hw/loongarch: Refine fwcfg memory map

2024-05-22 Thread Song Gao
first memory HOB 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 Reviewed-by: Song Gao Message-Id: <20240515093927.3453674-4-maob...@loongson.cn> Signed-off-by: Song Gao --- hw/loongarch/

[PULL 00/10] loongarch-to-apply queue

2024-05-22 Thread Song Gao
ine system dram memory region hw/loongarch: Remove minimum and default memory size target/loongarch: Add loongarch vector property unconditionally Jiaxun Yang (1): hw/loongarch/virt: Fix FDT memory node address width Song Gao (2): target/loongarch/kvm: Fix VM recovery from dis

[PATCH v3 3/3] hw/loongarch/virt: Use MemTxAttrs interface for misc ops

2024-05-21 Thread Song Gao
Use MemTxAttrs interface read_with_attrs/write_with_attrs for virt_iocsr_misc_ops. Signed-off-by: Song Gao --- hw/loongarch/virt.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index e7edc6c9f9

[PATCH v3 1/3] hw/intc/loongarch_extioi: Add extioi virt extension definition

2024-05-21 Thread Song Gao
On LoongArch, IRQs can be routed to four vcpus with hardware extioi. This patch adds the extioi virt extension definition so that the IRQ can route to 256 vcpus. Signed-off-by: Song Gao --- include/hw/intc/loongarch_extioi.h | 21 +++ hw/intc/loongarch_extioi.c | 88

[PATCH v3 2/3] hw/loongarch/virt: Enable extioi virt extension

2024-05-21 Thread Song Gao
This patch adds a new board attribute 'v-eiointc'. A value of true enables the virt extended I/O interrupt controller. VMs working in kvm mode have 'v-eiointc' enabled by default. Signed-off-by: Song Gao --- include/hw/loongarch/virt.h | 1 + target/loongarch/cpu.h |

[PATCH v3 0/3] Add extioi virt extension support

2024-05-21 Thread Song Gao
des in any way. - Link to v1: https://lore.kernel.org/all/20240116022526.498613-1-gaos...@loongson.cn/#r [1]: https://gitee.com/openeuler/kernel/commit/5d97cff72f91f4f20a536efd60eca75bfcb78a64 Thanks. Song Gao Song Gao (3): hw/intc/loongarch_extioi: Add extioi virt extension definition hw/loon

[PULL 4/5] target/loongarch/kvm: Fix VM recovery from disk failures

2024-05-16 Thread Song Gao
vmstate does not save kvm_state_conter, which can cause VM recovery from disk to fail. Cc: qemu-sta...@nongnu.org Signed-off-by: Song Gao Acked-by: Peter Xu Message-Id: <20240508024732.3127792-1-gaos...@loongson.cn> --- target/loongarch/machine.c | 6 -- 1 file changed, 4 insertions

[PULL 5/5] target/loongarch/kvm: fpu save the vreg registers high 192bit

2024-05-16 Thread Song Gao
On kvm side, get_fpu/set_fpu save the vreg registers high 192bits, but QEMU missing. Signed-off-by: Song Gao Reviewed-by: Bibo Mao Message-Id: <20240514110752.989572-1-gaos...@loongson.cn> --- target/loongarch/kvm/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/loo

[PULL 0/5] loongarch-to-apply queue

2024-05-16 Thread Song Gao
h-20240516 Bibo Mao (3): hw/loongarch: Add compat machine for 9.1 hw/loongarch: Remove minimum and default memory size tests: Add migration test for loongarch64 Song Gao (2): target/loongarch/kvm: Fix VM recovery from disk failures target/loongarc

  1   2   3   4   5   6   7   8   9   10   >