1 | The following changes since commit 63011373ad22c794a013da69663c03f1297a5c56: | 1 | The following changes since commit 922582ace2df59572a671f5c0c5c6c5c706995e5: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-riscv-to-apply-20231012-1' of https://github.com/alistair23/qemu into staging (2023-10-12 10:24:44 -0400) | 3 | Merge tag 'pull-hppa-20240515' of https://gitlab.com/rth7680/qemu into staging (2024-05-15 11:46:58 +0200) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20231013 | 7 | https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240516 |
8 | 8 | ||
9 | for you to fetch changes up to 1bea6930ca7b9587ea8d8fbb77069b6a13aa031a: | 9 | for you to fetch changes up to d55d16700a2e2b36c7e34724d4d77f4a75c5243a: |
10 | 10 | ||
11 | LoongArch: step down as general arch maintainer (2023-10-13 10:05:32 +0800) | 11 | target/loongarch/kvm: fpu save the vreg registers high 192bit (2024-05-16 16:32:35 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | pull-loongarch-20231013 | 14 | pull-loongarch-20240516 |
15 | |||
16 | *Fix ASXE flag conflict | ||
17 | *Add preldx instruction | ||
18 | *Add preldx instruction | ||
19 | *Remove unused region | ||
20 | *Xiao juan step down as general arch maintainer | ||
21 | 15 | ||
22 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
23 | Jiajie Chen (1): | 17 | Bibo Mao (3): |
24 | target/loongarch: fix ASXE flag conflict | 18 | hw/loongarch: Add compat machine for 9.1 |
25 | 19 | hw/loongarch: Remove minimum and default memory size | |
26 | Philippe Mathieu-Daudé (2): | 20 | tests: Add migration test for loongarch64 |
27 | hw/loongarch/virt: Remove unused ISA UART | ||
28 | hw/loongarch/virt: Remove unused ISA Bus | ||
29 | 21 | ||
30 | Song Gao (2): | 22 | Song Gao (2): |
31 | target/loongarch: Add preldx instruction | 23 | target/loongarch/kvm: Fix VM recovery from disk failures |
32 | hw/loongarch/virt: Remove unused 'loongarch_virt_pm' region | 24 | target/loongarch/kvm: fpu save the vreg registers high 192bit |
33 | 25 | ||
34 | Thomas Weißschuh (1): | 26 | hw/loongarch/virt.c | 66 +++++++++++++++++++++++--------- |
35 | hw/loongarch: remove global loaderparams variable | 27 | target/loongarch/kvm/kvm.c | 6 +++ |
36 | 28 | target/loongarch/machine.c | 6 ++- | |
37 | Xiaojuan Yang (1): | 29 | tests/migration/Makefile | 2 +- |
38 | LoongArch: step down as general arch maintainer | 30 | tests/migration/loongarch64/Makefile | 18 +++++++++ |
39 | 31 | tests/migration/loongarch64/a-b-kernel.S | 49 ++++++++++++++++++++++++ | |
40 | MAINTAINERS | 2 - | 32 | tests/migration/loongarch64/a-b-kernel.h | 16 ++++++++ |
41 | hw/loongarch/Kconfig | 2 - | 33 | tests/migration/migration-test.h | 3 ++ |
42 | hw/loongarch/virt.c | 103 +++++++------------------ | 34 | tests/qtest/meson.build | 2 +- |
43 | include/hw/loongarch/virt.h | 3 - | 35 | tests/qtest/migration-test.c | 10 +++++ |
44 | target/loongarch/cpu.h | 4 +- | 36 | 10 files changed, 156 insertions(+), 22 deletions(-) |
45 | target/loongarch/disas.c | 7 ++ | 37 | create mode 100644 tests/migration/loongarch64/Makefile |
46 | target/loongarch/insn_trans/trans_memory.c.inc | 5 ++ | 38 | create mode 100644 tests/migration/loongarch64/a-b-kernel.S |
47 | target/loongarch/insns.decode | 3 + | 39 | create mode 100644 tests/migration/loongarch64/a-b-kernel.h |
48 | tests/tcg/loongarch64/system/boot.S | 7 +- | ||
49 | 9 files changed, 49 insertions(+), 87 deletions(-) | ||
50 | |||
51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Jiajie Chen <c@jia.je> | ||
2 | 1 | ||
3 | HW_FLAGS_EUEN_ASXE acccidentally conflicts with HW_FLAGS_CRMD_PG, | ||
4 | enabling LASX instructions even when CSR_EUEN.ASXE=0. | ||
5 | |||
6 | Closes: https://gitlab.com/qemu-project/qemu/-/issues/1907 | ||
7 | Signed-off-by: Jiajie Chen <c@jia.je> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
10 | Message-Id: <20230930112837.1871691-1-c@jia.je> | ||
11 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
12 | --- | ||
13 | target/loongarch/cpu.h | 4 ++-- | ||
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/loongarch/cpu.h | ||
19 | +++ b/target/loongarch/cpu.h | ||
20 | @@ -XXX,XX +XXX,XX @@ static inline void set_pc(CPULoongArchState *env, uint64_t value) | ||
21 | * LoongArch CPUs hardware flags. | ||
22 | */ | ||
23 | #define HW_FLAGS_PLV_MASK R_CSR_CRMD_PLV_MASK /* 0x03 */ | ||
24 | -#define HW_FLAGS_CRMD_PG R_CSR_CRMD_PG_MASK /* 0x10 */ | ||
25 | #define HW_FLAGS_EUEN_FPE 0x04 | ||
26 | #define HW_FLAGS_EUEN_SXE 0x08 | ||
27 | -#define HW_FLAGS_EUEN_ASXE 0x10 | ||
28 | +#define HW_FLAGS_CRMD_PG R_CSR_CRMD_PG_MASK /* 0x10 */ | ||
29 | #define HW_FLAGS_VA32 0x20 | ||
30 | +#define HW_FLAGS_EUEN_ASXE 0x40 | ||
31 | |||
32 | static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc, | ||
33 | uint64_t *cs_base, uint32_t *flags) | ||
34 | -- | ||
35 | 2.25.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Resolve the issue of starting the Loongnix 20.5[1] system failure. | ||
2 | 1 | ||
3 | Logs: | ||
4 | Loading Linux 4.19.0-19-loongson-3 ... | ||
5 | Loading initial ramdisk ... | ||
6 | PROGRESS CODE: V02010004 I0 | ||
7 | PROGRESS CODE: V03101019 I0 | ||
8 | Error: unknown opcode. 90000000003a3e6c: 0x382c6d82 | ||
9 | |||
10 | [1] http://pkg.loongnix.cn/loongnix/isos/Loongnix-20.5/Loongnix-20.5.cartoon.gui.loongarch64.en.qcow2 | ||
11 | |||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
13 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
14 | Message-Id: <20230905123910.3052023-1-gaosong@loongson.cn> | ||
15 | --- | ||
16 | target/loongarch/disas.c | 7 +++++++ | ||
17 | target/loongarch/insn_trans/trans_memory.c.inc | 5 +++++ | ||
18 | target/loongarch/insns.decode | 3 +++ | ||
19 | 3 files changed, 15 insertions(+) | ||
20 | |||
21 | diff --git a/target/loongarch/disas.c b/target/loongarch/disas.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/loongarch/disas.c | ||
24 | +++ b/target/loongarch/disas.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void output_hint_r_i(DisasContext *ctx, arg_hint_r_i *a, | ||
26 | output(ctx, mnemonic, "%d, r%d, %d", a->hint, a->rj, a->imm); | ||
27 | } | ||
28 | |||
29 | +static void output_hint_rr(DisasContext *ctx, arg_hint_rr *a, | ||
30 | + const char *mnemonic) | ||
31 | +{ | ||
32 | + output(ctx, mnemonic, "%d, r%d, r%d", a->hint, a->rj, a->rk); | ||
33 | +} | ||
34 | + | ||
35 | static void output_i(DisasContext *ctx, arg_i *a, const char *mnemonic) | ||
36 | { | ||
37 | output(ctx, mnemonic, "%d", a->imm); | ||
38 | @@ -XXX,XX +XXX,XX @@ INSN(ld_bu, rr_i) | ||
39 | INSN(ld_hu, rr_i) | ||
40 | INSN(ld_wu, rr_i) | ||
41 | INSN(preld, hint_r_i) | ||
42 | +INSN(preldx, hint_rr) | ||
43 | INSN(fld_s, fr_i) | ||
44 | INSN(fst_s, fr_i) | ||
45 | INSN(fld_d, fr_i) | ||
46 | diff --git a/target/loongarch/insn_trans/trans_memory.c.inc b/target/loongarch/insn_trans/trans_memory.c.inc | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/loongarch/insn_trans/trans_memory.c.inc | ||
49 | +++ b/target/loongarch/insn_trans/trans_memory.c.inc | ||
50 | @@ -XXX,XX +XXX,XX @@ static bool trans_preld(DisasContext *ctx, arg_preld *a) | ||
51 | return true; | ||
52 | } | ||
53 | |||
54 | +static bool trans_preldx(DisasContext *ctx, arg_preldx * a) | ||
55 | +{ | ||
56 | + return true; | ||
57 | +} | ||
58 | + | ||
59 | static bool trans_dbar(DisasContext *ctx, arg_dbar * a) | ||
60 | { | ||
61 | tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); | ||
62 | diff --git a/target/loongarch/insns.decode b/target/loongarch/insns.decode | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/target/loongarch/insns.decode | ||
65 | +++ b/target/loongarch/insns.decode | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | &rrr rd rj rk | ||
68 | &rr_i rd rj imm | ||
69 | &hint_r_i hint rj imm | ||
70 | +&hint_rr hint rj rk | ||
71 | &rrr_sa rd rj rk sa | ||
72 | &rr_ms_ls rd rj ms ls | ||
73 | &ff fd fj | ||
74 | @@ -XXX,XX +XXX,XX @@ | ||
75 | @rr_i16 .... .. imm:s16 rj:5 rd:5 &rr_i | ||
76 | @rr_i16s2 .... .. ................ rj:5 rd:5 &rr_i imm=%offs16 | ||
77 | @hint_r_i12 .... ...... imm:s12 rj:5 hint:5 &hint_r_i | ||
78 | +@hint_rr .... ........ ..... rk:5 rj:5 hint:5 &hint_rr | ||
79 | @rrr_sa2p1 .... ........ ... .. rk:5 rj:5 rd:5 &rrr_sa sa=%sa2p1 | ||
80 | @rrr_sa2 .... ........ ... sa:2 rk:5 rj:5 rd:5 &rrr_sa | ||
81 | @rrr_sa3 .... ........ .. sa:3 rk:5 rj:5 rd:5 &rrr_sa | ||
82 | @@ -XXX,XX +XXX,XX @@ ldx_bu 0011 10000010 00000 ..... ..... ..... @rrr | ||
83 | ldx_hu 0011 10000010 01000 ..... ..... ..... @rrr | ||
84 | ldx_wu 0011 10000010 10000 ..... ..... ..... @rrr | ||
85 | preld 0010 101011 ............ ..... ..... @hint_r_i12 | ||
86 | +preldx 0011 10000010 11000 ..... ..... ..... @hint_rr | ||
87 | dbar 0011 10000111 00100 ............... @i15 | ||
88 | ibar 0011 10000111 00101 ............... @i15 | ||
89 | ldptr_w 0010 0100 .............. ..... ..... @rr_i14s2 | ||
90 | -- | ||
91 | 2.25.1 | ||
92 | |||
93 | diff view generated by jsdifflib |
1 | The system test shutdown uses the 'loongarch_virt_pm' region. | 1 | From: Bibo Mao <maobibo@loongson.cn> |
---|---|---|---|
2 | We can use the write AcpiFadtData.sleep_clt register to realize the shutdown. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 3 | Since migration test case requires compat machine type support, |
5 | Signed-off-by: Song Gao <gaosong@loongson.cn> | 4 | compat machine is added for qemu 9.1 here. |
6 | Message-ID: <20231012072351.1409344-1-gaosong@loongson.cn> | 5 | |
6 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
7 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
8 | Message-Id: <20240511034220.3030560-2-maobibo@loongson.cn> | ||
7 | Signed-off-by: Song Gao <gaosong@loongson.cn> | 9 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
8 | --- | 10 | --- |
9 | hw/loongarch/virt.c | 48 +---------------------------- | 11 | hw/loongarch/virt.c | 61 +++++++++++++++++++++++++++++++++++---------- |
10 | tests/tcg/loongarch64/system/boot.S | 7 +++-- | 12 | 1 file changed, 48 insertions(+), 13 deletions(-) |
11 | 2 files changed, 5 insertions(+), 50 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | 14 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/loongarch/virt.c | 16 | --- a/hw/loongarch/virt.c |
16 | +++ b/hw/loongarch/virt.c | 17 | +++ b/hw/loongarch/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_memory_node(MachineState *ms, | 18 | @@ -XXX,XX +XXX,XX @@ static void virt_class_init(ObjectClass *oc, void *data) |
18 | g_free(nodename); | 19 | #endif |
19 | } | 20 | } |
20 | 21 | ||
21 | -#define PM_BASE 0x10080000 | 22 | -static const TypeInfo virt_machine_types[] = { |
22 | -#define PM_SIZE 0x100 | 23 | - { |
23 | -#define PM_CTRL 0x10 | 24 | - .name = TYPE_LOONGARCH_VIRT_MACHINE, |
24 | - | 25 | - .parent = TYPE_MACHINE, |
25 | static void virt_build_smbios(LoongArchMachineState *lams) | 26 | - .instance_size = sizeof(LoongArchVirtMachineState), |
26 | { | 27 | - .class_init = virt_class_init, |
27 | MachineState *ms = MACHINE(lams); | 28 | - .instance_init = virt_initfn, |
28 | @@ -XXX,XX +XXX,XX @@ static void memmap_add_entry(uint64_t address, uint64_t length, uint32_t type) | 29 | - .interfaces = (InterfaceInfo[]) { |
29 | memmap_entries++; | 30 | - { TYPE_HOTPLUG_HANDLER }, |
30 | } | 31 | - { } |
31 | 32 | - }, | |
32 | -/* | ||
33 | - * This is a placeholder for missing ACPI, | ||
34 | - * and will eventually be replaced. | ||
35 | - */ | ||
36 | -static uint64_t loongarch_virt_pm_read(void *opaque, hwaddr addr, unsigned size) | ||
37 | -{ | ||
38 | - return 0; | ||
39 | -} | ||
40 | - | ||
41 | -static void loongarch_virt_pm_write(void *opaque, hwaddr addr, | ||
42 | - uint64_t val, unsigned size) | ||
43 | -{ | ||
44 | - if (addr != PM_CTRL) { | ||
45 | - return; | ||
46 | - } | 33 | - } |
47 | - | 34 | +#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ |
48 | - switch (val) { | 35 | + static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ |
49 | - case 0x00: | 36 | + void *data) \ |
50 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | 37 | + { \ |
51 | - return; | 38 | + MachineClass *mc = MACHINE_CLASS(oc); \ |
52 | - case 0xff: | 39 | + virt_machine_##major##_##minor##_options(mc); \ |
53 | - qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | 40 | + mc->desc = "QEMU " # major "." # minor " LoongArch Virtual Machine"; \ |
54 | - return; | 41 | + if (latest) { \ |
55 | - default: | 42 | + mc->alias = "virt"; \ |
56 | - return; | 43 | + } \ |
57 | - } | 44 | + } \ |
58 | -} | 45 | + static const TypeInfo machvirt_##major##_##minor##_info = { \ |
59 | - | 46 | + .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ |
60 | -static const MemoryRegionOps loongarch_virt_pm_ops = { | 47 | + .parent = TYPE_LOONGARCH_VIRT_MACHINE, \ |
61 | - .read = loongarch_virt_pm_read, | 48 | + .class_init = virt_##major##_##minor##_class_init, \ |
62 | - .write = loongarch_virt_pm_write, | 49 | + }; \ |
63 | - .endianness = DEVICE_NATIVE_ENDIAN, | 50 | + static void machvirt_machine_##major##_##minor##_init(void) \ |
64 | - .valid = { | 51 | + { \ |
65 | - .min_access_size = 1, | 52 | + type_register_static(&machvirt_##major##_##minor##_info); \ |
66 | - .max_access_size = 1 | 53 | + } \ |
67 | - } | 54 | + type_init(machvirt_machine_##major##_##minor##_init); |
68 | -}; | ||
69 | - | ||
70 | static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr) | ||
71 | { | ||
72 | return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS); | ||
73 | @@ -XXX,XX +XXX,XX @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState * | ||
74 | SysBusDevice *d; | ||
75 | PCIBus *pci_bus; | ||
76 | MemoryRegion *ecam_alias, *ecam_reg, *pio_alias, *pio_reg; | ||
77 | - MemoryRegion *mmio_alias, *mmio_reg, *pm_mem; | ||
78 | + MemoryRegion *mmio_alias, *mmio_reg; | ||
79 | int i; | ||
80 | |||
81 | gpex_dev = qdev_new(TYPE_GPEX_HOST); | ||
82 | @@ -XXX,XX +XXX,XX @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState * | ||
83 | VIRT_RTC_IRQ - VIRT_GSI_BASE)); | ||
84 | fdt_add_rtc_node(lams); | ||
85 | |||
86 | - pm_mem = g_new(MemoryRegion, 1); | ||
87 | - memory_region_init_io(pm_mem, NULL, &loongarch_virt_pm_ops, | ||
88 | - NULL, "loongarch_virt_pm", PM_SIZE); | ||
89 | - memory_region_add_subregion(get_system_memory(), PM_BASE, pm_mem); | ||
90 | /* acpi ged */ | ||
91 | lams->acpi_ged = create_acpi_ged(pch_pic, lams); | ||
92 | /* platform bus */ | ||
93 | diff --git a/tests/tcg/loongarch64/system/boot.S b/tests/tcg/loongarch64/system/boot.S | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/tests/tcg/loongarch64/system/boot.S | ||
96 | +++ b/tests/tcg/loongarch64/system/boot.S | ||
97 | @@ -XXX,XX +XXX,XX @@ _start: | ||
98 | .align 16 | ||
99 | _exit: | ||
100 | 2: /* QEMU ACPI poweroff */ | ||
101 | - li.w t0, 0xff | ||
102 | - li.w t1, 0x10080010 | ||
103 | - st.w t0, t1, 0 | ||
104 | + li.w t0, 0x34 | ||
105 | + li.w t1, 0x100e001c | ||
106 | + st.b t0, t1, 0 | ||
107 | + | 55 | + |
108 | idle 0 | 56 | +#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ |
109 | bl 2b | 57 | + DEFINE_VIRT_MACHINE_LATEST(major, minor, true) |
110 | 58 | +#define DEFINE_VIRT_MACHINE(major, minor) \ | |
59 | + DEFINE_VIRT_MACHINE_LATEST(major, minor, false) | ||
60 | + | ||
61 | +static const TypeInfo virt_machine_info = { | ||
62 | + .name = TYPE_LOONGARCH_VIRT_MACHINE, | ||
63 | + .parent = TYPE_MACHINE, | ||
64 | + .abstract = true, | ||
65 | + .instance_size = sizeof(LoongArchVirtMachineState), | ||
66 | + .class_init = virt_class_init, | ||
67 | + .instance_init = virt_initfn, | ||
68 | + .interfaces = (InterfaceInfo[]) { | ||
69 | + { TYPE_HOTPLUG_HANDLER }, | ||
70 | + { } | ||
71 | + }, | ||
72 | }; | ||
73 | |||
74 | -DEFINE_TYPES(virt_machine_types) | ||
75 | +static void machvirt_machine_init(void) | ||
76 | +{ | ||
77 | + type_register_static(&virt_machine_info); | ||
78 | +} | ||
79 | +type_init(machvirt_machine_init); | ||
80 | + | ||
81 | +static void virt_machine_9_1_options(MachineClass *mc) | ||
82 | +{ | ||
83 | +} | ||
84 | +DEFINE_VIRT_MACHINE_AS_LATEST(9, 1) | ||
111 | -- | 85 | -- |
112 | 2.25.1 | 86 | 2.34.1 |
113 | |||
114 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | 1 | From: Bibo Mao <maobibo@loongson.cn> |
---|---|---|---|
2 | 2 | ||
3 | The LoongArch 'virt' machine doesn't use its ISA I/O region. | 3 | Some qtest test cases such as numa use default memory size of generic |
4 | machine class, which is 128M by fault. | ||
4 | 5 | ||
5 | If a ISA device were to be mapped there, there is no support | 6 | Here generic default memory size is used, and also remove minimum memory |
6 | for ISA IRQ. Unlikely useful. Simply remove. | 7 | size which is 1G originally. |
7 | 8 | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 9 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> |
9 | Reviewed-by: Song Gao <gaosong@loongson.cn> | 10 | Reviewed-by: Song Gao <gaosong@loongson.cn> |
10 | Message-Id: <20231010135342.40219-3-philmd@linaro.org> | 11 | Message-Id: <20240511034220.3030560-3-maobibo@loongson.cn> |
11 | Signed-off-by: Song Gao <gaosong@loongson.cn> | 12 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
12 | --- | 13 | --- |
13 | hw/loongarch/Kconfig | 1 - | 14 | hw/loongarch/virt.c | 5 ----- |
14 | hw/loongarch/virt.c | 5 ----- | 15 | 1 file changed, 5 deletions(-) |
15 | include/hw/loongarch/virt.h | 3 --- | ||
16 | 3 files changed, 9 deletions(-) | ||
17 | 16 | ||
18 | diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/loongarch/Kconfig | ||
21 | +++ b/hw/loongarch/Kconfig | ||
22 | @@ -XXX,XX +XXX,XX @@ config LOONGARCH_VIRT | ||
23 | imply VIRTIO_VGA | ||
24 | imply PCI_DEVICES | ||
25 | imply NVDIMM | ||
26 | - select ISA_BUS | ||
27 | select SERIAL | ||
28 | select VIRTIO_PCI | ||
29 | select PLATFORM_BUS | ||
30 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | 17 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c |
31 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/loongarch/virt.c | 19 | --- a/hw/loongarch/virt.c |
33 | +++ b/hw/loongarch/virt.c | 20 | +++ b/hw/loongarch/virt.c |
34 | @@ -XXX,XX +XXX,XX @@ static void loongarch_init(MachineState *machine) | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_init(MachineState *machine) |
35 | machine_memory_devices_init(machine, device_mem_base, device_mem_size); | 22 | cpu_model = LOONGARCH_CPU_TYPE_NAME("la464"); |
36 | } | 23 | } |
37 | 24 | ||
38 | - /* Add isa io region */ | 25 | - if (ram_size < 1 * GiB) { |
39 | - memory_region_init_alias(&lams->isa_io, NULL, "isa-io", | 26 | - error_report("ram_size must be greater than 1G."); |
40 | - get_system_io(), 0, VIRT_ISA_IO_SIZE); | 27 | - exit(1); |
41 | - memory_region_add_subregion(address_space_mem, VIRT_ISA_IO_BASE, | 28 | - } |
42 | - &lams->isa_io); | 29 | create_fdt(lvms); |
43 | /* load the BIOS image. */ | 30 | |
44 | loongarch_firmware_init(lams); | 31 | /* Create IOCSR space */ |
45 | 32 | @@ -XXX,XX +XXX,XX @@ static void virt_class_init(ObjectClass *oc, void *data) | |
46 | diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h | 33 | HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); |
47 | index XXXXXXX..XXXXXXX 100644 | 34 | |
48 | --- a/include/hw/loongarch/virt.h | 35 | mc->init = virt_init; |
49 | +++ b/include/hw/loongarch/virt.h | 36 | - mc->default_ram_size = 1 * GiB; |
50 | @@ -XXX,XX +XXX,XX @@ | 37 | mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464"); |
51 | 38 | mc->default_ram_id = "loongarch.ram"; | |
52 | #define LOONGARCH_MAX_CPUS 256 | 39 | mc->max_cpus = LOONGARCH_MAX_CPUS; |
53 | |||
54 | -#define VIRT_ISA_IO_BASE 0x18000000UL | ||
55 | -#define VIRT_ISA_IO_SIZE 0x0004000 | ||
56 | #define VIRT_FWCFG_BASE 0x1e020000UL | ||
57 | #define VIRT_BIOS_BASE 0x1c000000UL | ||
58 | #define VIRT_BIOS_SIZE (4 * MiB) | ||
59 | @@ -XXX,XX +XXX,XX @@ struct LoongArchMachineState { | ||
60 | |||
61 | MemoryRegion lowmem; | ||
62 | MemoryRegion highmem; | ||
63 | - MemoryRegion isa_io; | ||
64 | MemoryRegion bios; | ||
65 | bool bios_loaded; | ||
66 | /* State for other subsystems/APIs: */ | ||
67 | -- | 40 | -- |
68 | 2.25.1 | 41 | 2.34.1 |
69 | |||
70 | diff view generated by jsdifflib |
1 | From: Xiaojuan Yang <yangxiaojuan@loongson.cn> | 1 | From: Bibo Mao <maobibo@loongson.cn> |
---|---|---|---|
2 | 2 | ||
3 | I haven't really been working on LoongArch for some time now, | 3 | This patch adds migration test support for loongarch64. The test code |
4 | so let's remove myself from this entry. | 4 | comes from aarch64 mostly, only that it booted as bios in qemu since |
5 | 5 | kernel requires elf format and bios uses binary format. | |
6 | Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> | 6 | |
7 | Acked-by: Song Gao <gaosong@loongson.cn> | 7 | In addition to providing the binary, this patch also includes the source |
8 | Message-Id: <20231012095135.1423071-1-yangxiaojuan@loongson.cn> | 8 | code and the build script in tests/migration/loongarch64. So users can |
9 | change the source and/or re-compile the binary as they wish. | ||
10 | |||
11 | Signed-off-by: Bibo Mao <maobibo@loongson.cn> | ||
12 | Acked-by: Thomas Huth <thuth@redhat.com> | ||
13 | Acked-by: Peter Xu <peterx@redhat.com> | ||
14 | Reviewed-by: Fabiano Rosas <farosas@suse.de> | ||
15 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
16 | Tested-by: Song Gao <gaosong@loongson.cn> | ||
17 | Message-Id: <20240511034220.3030560-4-maobibo@loongson.cn> | ||
9 | Signed-off-by: Song Gao <gaosong@loongson.cn> | 18 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
10 | --- | 19 | --- |
11 | MAINTAINERS | 2 -- | 20 | tests/migration/Makefile | 2 +- |
12 | 1 file changed, 2 deletions(-) | 21 | tests/migration/loongarch64/Makefile | 18 +++++++++ |
13 | 22 | tests/migration/loongarch64/a-b-kernel.S | 49 ++++++++++++++++++++++++ | |
14 | diff --git a/MAINTAINERS b/MAINTAINERS | 23 | tests/migration/loongarch64/a-b-kernel.h | 16 ++++++++ |
15 | index XXXXXXX..XXXXXXX 100644 | 24 | tests/migration/migration-test.h | 3 ++ |
16 | --- a/MAINTAINERS | 25 | tests/qtest/meson.build | 2 +- |
17 | +++ b/MAINTAINERS | 26 | tests/qtest/migration-test.c | 10 +++++ |
18 | @@ -XXX,XX +XXX,XX @@ F: disas/hppa.c | 27 | 7 files changed, 98 insertions(+), 2 deletions(-) |
19 | 28 | create mode 100644 tests/migration/loongarch64/Makefile | |
20 | LoongArch TCG CPUs | 29 | create mode 100644 tests/migration/loongarch64/a-b-kernel.S |
21 | M: Song Gao <gaosong@loongson.cn> | 30 | create mode 100644 tests/migration/loongarch64/a-b-kernel.h |
22 | -M: Xiaojuan Yang <yangxiaojuan@loongson.cn> | 31 | |
23 | S: Maintained | 32 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile |
24 | F: target/loongarch/ | 33 | index XXXXXXX..XXXXXXX 100644 |
25 | F: tests/tcg/loongarch64/ | 34 | --- a/tests/migration/Makefile |
26 | @@ -XXX,XX +XXX,XX @@ F: pc-bios/hppa-firmware.img | 35 | +++ b/tests/migration/Makefile |
27 | LoongArch Machines | 36 | @@ -XXX,XX +XXX,XX @@ |
28 | ------------------ | 37 | # See the COPYING file in the top-level directory. |
29 | Virt | 38 | # |
30 | -M: Xiaojuan Yang <yangxiaojuan@loongson.cn> | 39 | |
31 | M: Song Gao <gaosong@loongson.cn> | 40 | -TARGET_LIST = i386 aarch64 s390x |
32 | S: Maintained | 41 | +TARGET_LIST = i386 aarch64 s390x loongarch64 |
33 | F: docs/system/loongarch/virt.rst | 42 | |
43 | SRC_PATH = ../.. | ||
44 | |||
45 | diff --git a/tests/migration/loongarch64/Makefile b/tests/migration/loongarch64/Makefile | ||
46 | new file mode 100644 | ||
47 | index XXXXXXX..XXXXXXX | ||
48 | --- /dev/null | ||
49 | +++ b/tests/migration/loongarch64/Makefile | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | +# To specify cross compiler prefix, use CROSS_PREFIX= | ||
52 | +# $ make CROSS_PREFIX=loongarch64-linux-gnu- | ||
53 | + | ||
54 | +.PHONY: all clean | ||
55 | +all: a-b-kernel.h | ||
56 | + | ||
57 | +a-b-kernel.h: loongarch64.kernel | ||
58 | + echo "$$__note" > $@ | ||
59 | + xxd -i $< | sed -e 's/.*int.*//' >> $@ | ||
60 | + | ||
61 | +loongarch64.kernel: loongarch64.elf | ||
62 | + $(CROSS_PREFIX)objcopy -j .text -O binary $< $@ | ||
63 | + | ||
64 | +loongarch64.elf: a-b-kernel.S | ||
65 | + $(CROSS_PREFIX)gcc -o $@ -nostdlib -Wl,--build-id=none $< | ||
66 | + | ||
67 | +clean: | ||
68 | + $(RM) *.kernel *.elf | ||
69 | diff --git a/tests/migration/loongarch64/a-b-kernel.S b/tests/migration/loongarch64/a-b-kernel.S | ||
70 | new file mode 100644 | ||
71 | index XXXXXXX..XXXXXXX | ||
72 | --- /dev/null | ||
73 | +++ b/tests/migration/loongarch64/a-b-kernel.S | ||
74 | @@ -XXX,XX +XXX,XX @@ | ||
75 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
76 | +/* | ||
77 | + * Copyright (c) 2024 Loongson Technology Corporation Limited | ||
78 | + */ | ||
79 | +#include "../migration-test.h" | ||
80 | + | ||
81 | +#define LOONGARCH_CSR_CRMD 0 | ||
82 | +#define LOONGARCH_VIRT_UART 0x1FE001E0 | ||
83 | +.section .text | ||
84 | + | ||
85 | + .globl _start | ||
86 | +_start: | ||
87 | + /* output char 'A' to UART16550 */ | ||
88 | + li.d $t0, LOONGARCH_VIRT_UART | ||
89 | + li.w $t1, 'A' | ||
90 | + st.b $t1, $t0, 0 | ||
91 | + | ||
92 | + /* traverse test memory region */ | ||
93 | + li.d $t0, LOONGARCH_TEST_MEM_START | ||
94 | + li.d $t1, LOONGARCH_TEST_MEM_END | ||
95 | + li.d $t2, TEST_MEM_PAGE_SIZE | ||
96 | + li.d $t4, LOONGARCH_VIRT_UART | ||
97 | + li.w $t5, 'B' | ||
98 | + | ||
99 | +clean: | ||
100 | + st.b $zero, $t0, 0 | ||
101 | + add.d $t0, $t0, $t2 | ||
102 | + bne $t0, $t1, clean | ||
103 | + /* keeps a counter so we can limit the output speed */ | ||
104 | + addi.d $t6, $zero, 0 | ||
105 | + | ||
106 | +mainloop: | ||
107 | + li.d $t0, LOONGARCH_TEST_MEM_START | ||
108 | + | ||
109 | +innerloop: | ||
110 | + ld.bu $t3, $t0, 0 | ||
111 | + addi.w $t3, $t3, 1 | ||
112 | + ext.w.b $t3, $t3 | ||
113 | + st.b $t3, $t0, 0 | ||
114 | + add.d $t0, $t0, $t2 | ||
115 | + bne $t0, $t1, innerloop | ||
116 | + | ||
117 | + addi.d $t6, $t6, 1 | ||
118 | + andi $t6, $t6, 31 | ||
119 | + bnez $t6, mainloop | ||
120 | + | ||
121 | + st.b $t5, $t4, 0 | ||
122 | + b mainloop | ||
123 | + nop | ||
124 | diff --git a/tests/migration/loongarch64/a-b-kernel.h b/tests/migration/loongarch64/a-b-kernel.h | ||
125 | new file mode 100644 | ||
126 | index XXXXXXX..XXXXXXX | ||
127 | --- /dev/null | ||
128 | +++ b/tests/migration/loongarch64/a-b-kernel.h | ||
129 | @@ -XXX,XX +XXX,XX @@ | ||
130 | +/* This file is automatically generated from the assembly file in | ||
131 | +* tests/migration/loongarch64. Edit that file and then run "make all" | ||
132 | +* inside tests/migration to update, and then remember to send both | ||
133 | +* the header and the assembler differences in your patch submission. | ||
134 | +*/ | ||
135 | +unsigned char loongarch64_kernel[] = { | ||
136 | + 0x0c, 0xc0, 0x3f, 0x14, 0x8c, 0x81, 0x87, 0x03, 0x0d, 0x04, 0x81, 0x03, | ||
137 | + 0x8d, 0x01, 0x00, 0x29, 0x0c, 0x00, 0x04, 0x14, 0x0d, 0x80, 0x0c, 0x14, | ||
138 | + 0x2e, 0x00, 0x00, 0x14, 0x10, 0xc0, 0x3f, 0x14, 0x10, 0x82, 0x87, 0x03, | ||
139 | + 0x11, 0x08, 0x81, 0x03, 0x80, 0x01, 0x00, 0x29, 0x8c, 0xb9, 0x10, 0x00, | ||
140 | + 0x8d, 0xf9, 0xff, 0x5f, 0x12, 0x00, 0xc0, 0x02, 0x0c, 0x00, 0x04, 0x14, | ||
141 | + 0x8f, 0x01, 0x00, 0x2a, 0xef, 0x05, 0x80, 0x02, 0xef, 0x5d, 0x00, 0x00, | ||
142 | + 0x8f, 0x01, 0x00, 0x29, 0x8c, 0xb9, 0x10, 0x00, 0x8d, 0xed, 0xff, 0x5f, | ||
143 | + 0x52, 0x06, 0xc0, 0x02, 0x52, 0x7e, 0x40, 0x03, 0x5f, 0xde, 0xff, 0x47, | ||
144 | + 0x11, 0x02, 0x00, 0x29, 0xff, 0xd7, 0xff, 0x53, 0x00, 0x00, 0x40, 0x03 | ||
145 | +}; | ||
146 | diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/tests/migration/migration-test.h | ||
149 | +++ b/tests/migration/migration-test.h | ||
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | */ | ||
152 | #define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024) | ||
153 | |||
154 | +/* LoongArch64 */ | ||
155 | +#define LOONGARCH_TEST_MEM_START (32 * 1024 * 1024) | ||
156 | +#define LOONGARCH_TEST_MEM_END (100 * 1024 * 1024) | ||
157 | #endif /* MIGRATION_TEST_H */ | ||
158 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/tests/qtest/meson.build | ||
161 | +++ b/tests/qtest/meson.build | ||
162 | @@ -XXX,XX +XXX,XX @@ qtests_hppa = ['boot-serial-test'] + \ | ||
163 | (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) | ||
164 | |||
165 | qtests_loongarch64 = qtests_filter + \ | ||
166 | - ['boot-serial-test'] | ||
167 | + ['boot-serial-test', 'migration-test'] | ||
168 | |||
169 | qtests_m68k = ['boot-serial-test'] + \ | ||
170 | qtests_filter | ||
171 | diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c | ||
172 | index XXXXXXX..XXXXXXX 100644 | ||
173 | --- a/tests/qtest/migration-test.c | ||
174 | +++ b/tests/qtest/migration-test.c | ||
175 | @@ -XXX,XX +XXX,XX @@ static char *bootpath; | ||
176 | #include "tests/migration/i386/a-b-bootblock.h" | ||
177 | #include "tests/migration/aarch64/a-b-kernel.h" | ||
178 | #include "tests/migration/s390x/a-b-bios.h" | ||
179 | +#include "tests/migration/loongarch64/a-b-kernel.h" | ||
180 | |||
181 | static void bootfile_create(char *dir, bool suspend_me) | ||
182 | { | ||
183 | @@ -XXX,XX +XXX,XX @@ static void bootfile_create(char *dir, bool suspend_me) | ||
184 | content = aarch64_kernel; | ||
185 | len = sizeof(aarch64_kernel); | ||
186 | g_assert(sizeof(aarch64_kernel) <= ARM_TEST_MAX_KERNEL_SIZE); | ||
187 | + } else if (strcmp(arch, "loongarch64") == 0) { | ||
188 | + content = loongarch64_kernel; | ||
189 | + len = sizeof(loongarch64_kernel); | ||
190 | } else { | ||
191 | g_assert_not_reached(); | ||
192 | } | ||
193 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, | ||
194 | arch_opts = g_strdup_printf("-cpu max -kernel %s", bootpath); | ||
195 | start_address = ARM_TEST_MEM_START; | ||
196 | end_address = ARM_TEST_MEM_END; | ||
197 | + } else if (strcmp(arch, "loongarch64") == 0) { | ||
198 | + memory_size = "256M"; | ||
199 | + machine_alias = "virt"; | ||
200 | + arch_opts = g_strdup_printf("-cpu la464 -bios %s", bootpath); | ||
201 | + start_address = LOONGARCH_TEST_MEM_START; | ||
202 | + end_address = LOONGARCH_TEST_MEM_END; | ||
203 | } else { | ||
204 | g_assert_not_reached(); | ||
205 | } | ||
34 | -- | 206 | -- |
35 | 2.25.1 | 207 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Thomas Weißschuh <thomas@t-8ch.de> | 1 | vmstate does not save kvm_state_conter, |
---|---|---|---|
2 | which can cause VM recovery from disk to fail. | ||
2 | 3 | ||
3 | Passing the struct around explicitly makes the control-flow more | 4 | Cc: qemu-stable@nongnu.org |
4 | obvious. | 5 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
6 | Acked-by: Peter Xu <peterx@redhat.com> | ||
7 | Message-Id: <20240508024732.3127792-1-gaosong@loongson.cn> | ||
8 | --- | ||
9 | target/loongarch/machine.c | 6 ++++-- | ||
10 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
5 | 11 | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 12 | diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c |
7 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
8 | Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> | ||
9 | Message-Id: <20231010-loongarch-loader-params-v2-1-512cc7959683@t-8ch.de> | ||
10 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
11 | --- | ||
12 | hw/loongarch/virt.c | 50 ++++++++++++++++++++++++--------------------- | ||
13 | 1 file changed, 27 insertions(+), 23 deletions(-) | ||
14 | |||
15 | diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/loongarch/virt.c | 14 | --- a/target/loongarch/machine.c |
18 | +++ b/hw/loongarch/virt.c | 15 | +++ b/target/loongarch/machine.c |
19 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tlb = { |
20 | #include "qemu/error-report.h" | 17 | /* LoongArch CPU state */ |
21 | 18 | const VMStateDescription vmstate_loongarch_cpu = { | |
22 | 19 | .name = "cpu", | |
23 | +struct loaderparams { | 20 | - .version_id = 1, |
24 | + uint64_t ram_size; | 21 | - .minimum_version_id = 1, |
25 | + const char *kernel_filename; | 22 | + .version_id = 2, |
26 | + const char *kernel_cmdline; | 23 | + .minimum_version_id = 2, |
27 | + const char *initrd_filename; | 24 | .fields = (const VMStateField[]) { |
28 | +}; | 25 | VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32), |
26 | VMSTATE_UINTTL(env.pc, LoongArchCPU), | ||
27 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_loongarch_cpu = { | ||
28 | VMSTATE_UINT64(env.CSR_DERA, LoongArchCPU), | ||
29 | VMSTATE_UINT64(env.CSR_DSAVE, LoongArchCPU), | ||
30 | |||
31 | + VMSTATE_UINT64(kvm_state_counter, LoongArchCPU), | ||
29 | + | 32 | + |
30 | static void virt_flash_create(LoongArchMachineState *lams) | 33 | VMSTATE_END_OF_LIST() |
31 | { | 34 | }, |
32 | DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01); | 35 | .subsections = (const VMStateDescription * const []) { |
33 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps loongarch_virt_pm_ops = { | ||
34 | } | ||
35 | }; | ||
36 | |||
37 | -static struct _loaderparams { | ||
38 | - uint64_t ram_size; | ||
39 | - const char *kernel_filename; | ||
40 | - const char *kernel_cmdline; | ||
41 | - const char *initrd_filename; | ||
42 | -} loaderparams; | ||
43 | - | ||
44 | static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr) | ||
45 | { | ||
46 | return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS); | ||
47 | } | ||
48 | |||
49 | -static int64_t load_kernel_info(void) | ||
50 | +static int64_t load_kernel_info(const struct loaderparams *loaderparams) | ||
51 | { | ||
52 | uint64_t kernel_entry, kernel_low, kernel_high; | ||
53 | ssize_t kernel_size; | ||
54 | |||
55 | - kernel_size = load_elf(loaderparams.kernel_filename, NULL, | ||
56 | + kernel_size = load_elf(loaderparams->kernel_filename, NULL, | ||
57 | cpu_loongarch_virt_to_phys, NULL, | ||
58 | &kernel_entry, &kernel_low, | ||
59 | &kernel_high, NULL, 0, | ||
60 | @@ -XXX,XX +XXX,XX @@ static int64_t load_kernel_info(void) | ||
61 | |||
62 | if (kernel_size < 0) { | ||
63 | error_report("could not load kernel '%s': %s", | ||
64 | - loaderparams.kernel_filename, | ||
65 | + loaderparams->kernel_filename, | ||
66 | load_elf_strerror(kernel_size)); | ||
67 | exit(1); | ||
68 | } | ||
69 | @@ -XXX,XX +XXX,XX @@ static void reset_load_elf(void *opaque) | ||
70 | } | ||
71 | } | ||
72 | |||
73 | -static void fw_cfg_add_kernel_info(FWCfgState *fw_cfg) | ||
74 | +static void fw_cfg_add_kernel_info(const struct loaderparams *loaderparams, | ||
75 | + FWCfgState *fw_cfg) | ||
76 | { | ||
77 | /* | ||
78 | * Expose the kernel, the command line, and the initrd in fw_cfg. | ||
79 | @@ -XXX,XX +XXX,XX @@ static void fw_cfg_add_kernel_info(FWCfgState *fw_cfg) | ||
80 | */ | ||
81 | load_image_to_fw_cfg(fw_cfg, | ||
82 | FW_CFG_KERNEL_SIZE, FW_CFG_KERNEL_DATA, | ||
83 | - loaderparams.kernel_filename, | ||
84 | + loaderparams->kernel_filename, | ||
85 | false); | ||
86 | |||
87 | - if (loaderparams.initrd_filename) { | ||
88 | + if (loaderparams->initrd_filename) { | ||
89 | load_image_to_fw_cfg(fw_cfg, | ||
90 | FW_CFG_INITRD_SIZE, FW_CFG_INITRD_DATA, | ||
91 | - loaderparams.initrd_filename, false); | ||
92 | + loaderparams->initrd_filename, false); | ||
93 | } | ||
94 | |||
95 | - if (loaderparams.kernel_cmdline) { | ||
96 | + if (loaderparams->kernel_cmdline) { | ||
97 | fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, | ||
98 | - strlen(loaderparams.kernel_cmdline) + 1); | ||
99 | + strlen(loaderparams->kernel_cmdline) + 1); | ||
100 | fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, | ||
101 | - loaderparams.kernel_cmdline); | ||
102 | + loaderparams->kernel_cmdline); | ||
103 | } | ||
104 | } | ||
105 | |||
106 | -static void loongarch_firmware_boot(LoongArchMachineState *lams) | ||
107 | +static void loongarch_firmware_boot(LoongArchMachineState *lams, | ||
108 | + const struct loaderparams *loaderparams) | ||
109 | { | ||
110 | - fw_cfg_add_kernel_info(lams->fw_cfg); | ||
111 | + fw_cfg_add_kernel_info(loaderparams, lams->fw_cfg); | ||
112 | } | ||
113 | |||
114 | -static void loongarch_direct_kernel_boot(LoongArchMachineState *lams) | ||
115 | +static void loongarch_direct_kernel_boot(LoongArchMachineState *lams, | ||
116 | + const struct loaderparams *loaderparams) | ||
117 | { | ||
118 | MachineState *machine = MACHINE(lams); | ||
119 | int64_t kernel_addr = 0; | ||
120 | LoongArchCPU *lacpu; | ||
121 | int i; | ||
122 | |||
123 | - kernel_addr = load_kernel_info(); | ||
124 | + kernel_addr = load_kernel_info(loaderparams); | ||
125 | if (!machine->firmware) { | ||
126 | for (i = 0; i < machine->smp.cpus; i++) { | ||
127 | lacpu = LOONGARCH_CPU(qemu_get_cpu(i)); | ||
128 | @@ -XXX,XX +XXX,XX @@ static void loongarch_init(MachineState *machine) | ||
129 | MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
130 | CPUState *cpu; | ||
131 | char *ramName = NULL; | ||
132 | + struct loaderparams loaderparams = { }; | ||
133 | |||
134 | if (!cpu_model) { | ||
135 | cpu_model = LOONGARCH_CPU_TYPE_NAME("la464"); | ||
136 | @@ -XXX,XX +XXX,XX @@ static void loongarch_init(MachineState *machine) | ||
137 | /* load the kernel. */ | ||
138 | if (loaderparams.kernel_filename) { | ||
139 | if (lams->bios_loaded) { | ||
140 | - loongarch_firmware_boot(lams); | ||
141 | + loongarch_firmware_boot(lams, &loaderparams); | ||
142 | } else { | ||
143 | - loongarch_direct_kernel_boot(lams); | ||
144 | + loongarch_direct_kernel_boot(lams, &loaderparams); | ||
145 | } | ||
146 | } | ||
147 | fdt_add_flash_node(lams); | ||
148 | -- | 36 | -- |
149 | 2.25.1 | 37 | 2.34.1 |
150 | |||
151 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | 1 | On kvm side, get_fpu/set_fpu save the vreg registers high 192bits, |
---|---|---|---|
2 | but QEMU missing. | ||
2 | 3 | ||
3 | The LoongArch 'virt' machine doesn't use any ISA UART. | 4 | Signed-off-by: Song Gao <gaosong@loongson.cn> |
4 | No need to build the device model, remove its Kconfig entry. | 5 | Reviewed-by: Bibo Mao <maobibo@loongson.cn> |
6 | Message-Id: <20240514110752.989572-1-gaosong@loongson.cn> | ||
7 | --- | ||
8 | target/loongarch/kvm/kvm.c | 6 ++++++ | ||
9 | 1 file changed, 6 insertions(+) | ||
5 | 10 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 11 | diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c |
7 | Reviewed-by: Song Gao <gaosong@loongson.cn> | ||
8 | Message-Id: <20231010135342.40219-2-philmd@linaro.org> | ||
9 | Signed-off-by: Song Gao <gaosong@loongson.cn> | ||
10 | --- | ||
11 | hw/loongarch/Kconfig | 1 - | ||
12 | 1 file changed, 1 deletion(-) | ||
13 | |||
14 | diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig | ||
15 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/loongarch/Kconfig | 13 | --- a/target/loongarch/kvm/kvm.c |
17 | +++ b/hw/loongarch/Kconfig | 14 | +++ b/target/loongarch/kvm/kvm.c |
18 | @@ -XXX,XX +XXX,XX @@ config LOONGARCH_VIRT | 15 | @@ -XXX,XX +XXX,XX @@ static int kvm_loongarch_get_regs_fp(CPUState *cs) |
19 | imply NVDIMM | 16 | env->fcsr0 = fpu.fcsr; |
20 | select ISA_BUS | 17 | for (i = 0; i < 32; i++) { |
21 | select SERIAL | 18 | env->fpr[i].vreg.UD[0] = fpu.fpr[i].val64[0]; |
22 | - select SERIAL_ISA | 19 | + env->fpr[i].vreg.UD[1] = fpu.fpr[i].val64[1]; |
23 | select VIRTIO_PCI | 20 | + env->fpr[i].vreg.UD[2] = fpu.fpr[i].val64[2]; |
24 | select PLATFORM_BUS | 21 | + env->fpr[i].vreg.UD[3] = fpu.fpr[i].val64[3]; |
25 | select LOONGARCH_IPI | 22 | } |
23 | for (i = 0; i < 8; i++) { | ||
24 | env->cf[i] = fpu.fcc & 0xFF; | ||
25 | @@ -XXX,XX +XXX,XX @@ static int kvm_loongarch_put_regs_fp(CPUState *cs) | ||
26 | fpu.fcc = 0; | ||
27 | for (i = 0; i < 32; i++) { | ||
28 | fpu.fpr[i].val64[0] = env->fpr[i].vreg.UD[0]; | ||
29 | + fpu.fpr[i].val64[1] = env->fpr[i].vreg.UD[1]; | ||
30 | + fpu.fpr[i].val64[2] = env->fpr[i].vreg.UD[2]; | ||
31 | + fpu.fpr[i].val64[3] = env->fpr[i].vreg.UD[3]; | ||
32 | } | ||
33 | |||
34 | for (i = 0; i < 8; i++) { | ||
26 | -- | 35 | -- |
27 | 2.25.1 | 36 | 2.34.1 |
28 | |||
29 | diff view generated by jsdifflib |