1
The following changes since commit 4a4efae44f19528589204581e9e2fab69c5d39aa:
1
The following changes since commit 1dae461a913f9da88df05de6e2020d3134356f2e:
2
2
3
Merge tag 'pull-hex-20240121' of https://github.com/quic/qemu into staging (2024-01-23 13:40:45 +0000)
3
Update version for v10.0.0-rc0 release (2025-03-18 10:18:14 -0400)
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-20240125
7
https://gitlab.com/bibo-mao/qemu.git tags/pull-loongarch-20250321
8
8
9
for you to fetch changes up to fc70099621fe7002d30fc1509456d1ae57264aa6:
9
for you to fetch changes up to b8d5503a3ecf8bcf75e4960d04215f71dbfd5dd2:
10
10
11
target/loongarch/kvm: Enable LSX/LASX extension (2024-01-25 15:25:31 +0800)
11
target/loongarch: fix bad shift in check_ps() (2025-03-21 11:31:56 +0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
pull-loongarch-20240125
14
pull-loongarch-20250321 queue
15
15
16
----------------------------------------------------------------
16
----------------------------------------------------------------
17
Bibo Mao (1):
17
Bibo Mao (1):
18
target/loongarch: Set cpuid CSR register only once with kvm mode
18
docs/system: Add entry for LoongArch system
19
19
20
Song Gao (1):
20
Song Gao (1):
21
target/loongarch/kvm: Enable LSX/LASX extension
21
target/loongarch: fix bad shift in check_ps()
22
22
23
linux-headers/asm-loongarch/kvm.h | 1 +
23
Yao Zi (1):
24
target/loongarch/kvm/kvm.c | 54 +++++++++++++++++++++++++++++++--------
24
host/include/loongarch64: Fix inline assembly compatibility with Clang
25
2 files changed, 45 insertions(+), 10 deletions(-)
25
26
docs/system/loongarch/virt.rst | 31 +++++++---------------
27
docs/system/target-loongarch.rst | 19 +++++++++++++
28
docs/system/targets.rst | 1 +
29
host/include/loongarch64/host/atomic128-ldst.h.inc | 4 +--
30
host/include/loongarch64/host/bufferiszero.c.inc | 6 +++--
31
.../loongarch64/host/load-extract-al16-al8.h.inc | 2 +-
32
target/loongarch/internals.h | 2 +-
33
target/loongarch/tcg/csr_helper.c | 2 +-
34
target/loongarch/tcg/tlb_helper.c | 10 +++----
35
9 files changed, 44 insertions(+), 33 deletions(-)
36
create mode 100644 docs/system/target-loongarch.rst
diff view generated by jsdifflib
New patch
1
From: Yao Zi <ziyao@disroot.org>
1
2
3
Clang on LoongArch only accepts fp register names in the dollar-prefixed
4
form, while GCC allows omitting the dollar. Change registers in ASM
5
clobbers to the dollar-prefixed form to make user emulators buildable
6
with Clang on loongarch64. No functional change invovled.
7
8
Cc: qemu-stable@nongnu.org
9
Fixes: adc8467e697 ("host/include/loongarch64: Add atomic16 load and store")
10
Signed-off-by: Yao Zi <ziyao@disroot.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
13
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
14
---
15
host/include/loongarch64/host/atomic128-ldst.h.inc | 4 ++--
16
host/include/loongarch64/host/bufferiszero.c.inc | 6 ++++--
17
host/include/loongarch64/host/load-extract-al16-al8.h.inc | 2 +-
18
3 files changed, 7 insertions(+), 5 deletions(-)
19
20
diff --git a/host/include/loongarch64/host/atomic128-ldst.h.inc b/host/include/loongarch64/host/atomic128-ldst.h.inc
21
index XXXXXXX..XXXXXXX 100644
22
--- a/host/include/loongarch64/host/atomic128-ldst.h.inc
23
+++ b/host/include/loongarch64/host/atomic128-ldst.h.inc
24
@@ -XXX,XX +XXX,XX @@ static inline Int128 atomic16_read_ro(const Int128 *ptr)
25
asm("vld $vr0, %2, 0\n\t"
26
"vpickve2gr.d %0, $vr0, 0\n\t"
27
"vpickve2gr.d %1, $vr0, 1"
28
-    : "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "f0");
29
+ : "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "$f0");
30
31
return int128_make128(l, h);
32
}
33
@@ -XXX,XX +XXX,XX @@ static inline void atomic16_set(Int128 *ptr, Int128 val)
34
asm("vinsgr2vr.d $vr0, %1, 0\n\t"
35
"vinsgr2vr.d $vr0, %2, 1\n\t"
36
"vst $vr0, %3, 0"
37
-    : "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "f0");
38
+ : "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "$f0");
39
}
40
41
#endif /* LOONGARCH_ATOMIC128_LDST_H */
42
diff --git a/host/include/loongarch64/host/bufferiszero.c.inc b/host/include/loongarch64/host/bufferiszero.c.inc
43
index XXXXXXX..XXXXXXX 100644
44
--- a/host/include/loongarch64/host/bufferiszero.c.inc
45
+++ b/host/include/loongarch64/host/bufferiszero.c.inc
46
@@ -XXX,XX +XXX,XX @@ static bool buffer_is_zero_lsx(const void *buf, size_t len)
47
"2:"
48
: "=&r"(ret), "+r"(p)
49
: "r"(buf), "r"(e), "r"(l)
50
- : "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
51
+ : "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
52
+ "$fcc0");
53
54
return ret;
55
}
56
@@ -XXX,XX +XXX,XX @@ static bool buffer_is_zero_lasx(const void *buf, size_t len)
57
"3:"
58
: "=&r"(ret), "+r"(p)
59
: "r"(buf), "r"(e), "r"(l)
60
- : "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
61
+ : "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
62
+ "$fcc0");
63
64
return ret;
65
}
66
diff --git a/host/include/loongarch64/host/load-extract-al16-al8.h.inc b/host/include/loongarch64/host/load-extract-al16-al8.h.inc
67
index XXXXXXX..XXXXXXX 100644
68
--- a/host/include/loongarch64/host/load-extract-al16-al8.h.inc
69
+++ b/host/include/loongarch64/host/load-extract-al16-al8.h.inc
70
@@ -XXX,XX +XXX,XX @@ static inline uint64_t load_atom_extract_al16_or_al8(void *pv, int s)
71
asm("vld $vr0, %2, 0\n\t"
72
"vpickve2gr.d %0, $vr0, 0\n\t"
73
"vpickve2gr.d %1, $vr0, 1"
74
-    : "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "f0");
75
+ : "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "$f0");
76
77
return (l >> shr) | (h << (-shr & 63));
78
}
79
--
80
2.43.5
diff view generated by jsdifflib
New patch
1
Add index entry for LoongArch system and do some small modification
2
with LoongArch document with rst syntax.
1
3
4
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
5
Reviewed-by: Song Gao <gaosong@loongson.cn>
6
---
7
docs/system/loongarch/virt.rst | 31 ++++++++++---------------------
8
docs/system/target-loongarch.rst | 19 +++++++++++++++++++
9
docs/system/targets.rst | 1 +
10
3 files changed, 30 insertions(+), 21 deletions(-)
11
create mode 100644 docs/system/target-loongarch.rst
12
13
diff --git a/docs/system/loongarch/virt.rst b/docs/system/loongarch/virt.rst
14
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/loongarch/virt.rst
16
+++ b/docs/system/loongarch/virt.rst
17
@@ -XXX,XX +XXX,XX @@ Supported devices
18
-----------------
19
20
The ``virt`` machine supports:
21
-- Gpex host bridge
22
-- Ls7a RTC device
23
-- Ls7a IOAPIC device
24
-- ACPI GED device
25
-- Fw_cfg device
26
-- PCI/PCIe devices
27
-- Memory device
28
-- CPU device. Type: la464.
29
+
30
+* Gpex host bridge
31
+* Ls7a RTC device
32
+* Ls7a IOAPIC device
33
+* ACPI GED device
34
+* Fw_cfg device
35
+* PCI/PCIe devices
36
+* Memory device
37
+* CPU device. Type: la464.
38
39
CPU and machine Type
40
--------------------
41
@@ -XXX,XX +XXX,XX @@ can be accessed by following steps.
42
43
.. code-block:: bash
44
45
- ./configure --disable-rdma --prefix=/usr \
46
- --target-list="loongarch64-softmmu" \
47
- --disable-libiscsi --disable-libnfs --disable-libpmem \
48
- --disable-glusterfs --enable-libusb --enable-usb-redir \
49
- --disable-opengl --disable-xen --enable-spice \
50
- --enable-debug --disable-capstone --disable-kvm \
51
- --enable-profiler
52
+ ./configure --target-list="loongarch64-softmmu"
53
make -j8
54
55
(2) Set cross tools:
56
@@ -XXX,XX +XXX,XX @@ can be accessed by following steps.
57
.. code-block:: bash
58
59
wget https://github.com/loongson/build-tools/releases/download/2022.09.06/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz
60
-
61
tar -vxf loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz -C /opt
62
-
63
export PATH=/opt/cross-tools/bin:$PATH
64
export LD_LIBRARY_PATH=/opt/cross-tools/lib:$LD_LIBRARY_PATH
65
export LD_LIBRARY_PATH=/opt/cross-tools/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
66
@@ -XXX,XX +XXX,XX @@ Note: To build the release version of the bios, set --buildtarget=RELEASE,
67
.. code-block:: bash
68
69
git clone https://github.com/loongson/linux.git
70
-
71
cd linux
72
-
73
git checkout loongarch-next
74
-
75
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- loongson3_defconfig
76
-
77
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- -j32
78
79
Note: The branch of linux source code is loongarch-next.
80
diff --git a/docs/system/target-loongarch.rst b/docs/system/target-loongarch.rst
81
new file mode 100644
82
index XXXXXXX..XXXXXXX
83
--- /dev/null
84
+++ b/docs/system/target-loongarch.rst
85
@@ -XXX,XX +XXX,XX @@
86
+.. _LoongArch-System-emulator:
87
+
88
+LoongArch System emulator
89
+-------------------------
90
+
91
+QEMU can emulate loongArch 64 bit systems via the
92
+``qemu-system-loongarch64`` binary. Only one machine type ``virt`` is
93
+supported.
94
+
95
+When using KVM as accelerator, QEMU can emulate la464 cpu model. And when
96
+using the default cpu model with TCG as accelerator, QEMU will emulate a
97
+subset of la464 cpu features that should be enough to run distributions
98
+built for the la464.
99
+
100
+Board-specific documentation
101
+============================
102
+
103
+.. toctree::
104
+ loongarch/virt
105
diff --git a/docs/system/targets.rst b/docs/system/targets.rst
106
index XXXXXXX..XXXXXXX 100644
107
--- a/docs/system/targets.rst
108
+++ b/docs/system/targets.rst
109
@@ -XXX,XX +XXX,XX @@ Contents:
110
111
target-arm
112
target-avr
113
+ target-loongarch
114
target-m68k
115
target-mips
116
target-ppc
117
--
118
2.43.5
diff view generated by jsdifflib
New patch
1
From: Song Gao <gaosong@loongson.cn>
1
2
3
In expression 1ULL << tlb_ps, left shifting by more than 63 bits has
4
undefined behavior. The shift amount, tlb_ps, is as much as 64. check
5
"tlb_ps >=64" to fix.
6
7
Resolves: Coverity CID 1593475
8
9
Fixes: d882c284a3 ("target/loongarch: check tlb_ps")
10
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Song Gao <gaosong@loongson.cn>
12
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
13
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
14
---
15
target/loongarch/internals.h | 2 +-
16
target/loongarch/tcg/csr_helper.c | 2 +-
17
target/loongarch/tcg/tlb_helper.c | 10 +++++-----
18
3 files changed, 7 insertions(+), 7 deletions(-)
19
20
diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/loongarch/internals.h
23
+++ b/target/loongarch/internals.h
24
@@ -XXX,XX +XXX,XX @@ enum {
25
TLBRET_PE = 7,
26
};
27
28
-bool check_ps(CPULoongArchState *ent, int ps);
29
+bool check_ps(CPULoongArchState *ent, uint8_t ps);
30
31
extern const VMStateDescription vmstate_loongarch_cpu;
32
33
diff --git a/target/loongarch/tcg/csr_helper.c b/target/loongarch/tcg/csr_helper.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/loongarch/tcg/csr_helper.c
36
+++ b/target/loongarch/tcg/csr_helper.c
37
@@ -XXX,XX +XXX,XX @@ target_ulong helper_csrwr_ticlr(CPULoongArchState *env, target_ulong val)
38
39
target_ulong helper_csrwr_pwcl(CPULoongArchState *env, target_ulong val)
40
{
41
- int shift, ptbase;
42
+ uint8_t shift, ptbase;
43
int64_t old_v = env->CSR_PWCL;
44
45
/*
46
diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/target/loongarch/tcg/tlb_helper.c
49
+++ b/target/loongarch/tcg/tlb_helper.c
50
@@ -XXX,XX +XXX,XX @@
51
#include "exec/log.h"
52
#include "cpu-csr.h"
53
54
-bool check_ps(CPULoongArchState *env, int tlb_ps)
55
+bool check_ps(CPULoongArchState *env, uint8_t tlb_ps)
56
{
57
- if (tlb_ps > 64) {
58
- return false;
59
- }
60
- return BIT_ULL(tlb_ps) & (env->CSR_PRCFG2);
61
+ if (tlb_ps >= 64) {
62
+ return false;
63
+ }
64
+ return BIT_ULL(tlb_ps) & (env->CSR_PRCFG2);
65
}
66
67
void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base,
68
--
69
2.43.5
diff view generated by jsdifflib