Skip to content

Commit 5eb0849

Browse files
committed
Merge tag 'pull-loongarch-20250321' of https://gitlab.com/bibo-mao/qemu into staging
loongarch queue # -----BEGIN PGP SIGNATURE----- # # iHUEABYKAB0WIQQNhkKjomWfgLCz0aQfewwSUazn0QUCZ9zfpQAKCRAfewwSUazn # 0VVzAQDtmH3TGh1e5hX/y9g5W733DmUlG1haJ2VNYS+FljXdZQEAkZAe3opRuuoK # FhXCHiMhCT0+bVfOuZ6sc6pVQb29Ag0= # =vJ5O # -----END PGP SIGNATURE----- # gpg: Signature made Thu 20 Mar 2025 23:40:21 EDT # gpg: using EDDSA key 0D8642A3A2659F80B0B3D1A41F7B0C1251ACE7D1 # gpg: Good signature from "bibo mao <[email protected]>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 7044 3A00 19C0 E97A 31C7 13C4 8E86 8FB7 A176 9D4C # Subkey fingerprint: 0D86 42A3 A265 9F80 B0B3 D1A4 1F7B 0C12 51AC E7D1 * tag 'pull-loongarch-20250321' of https://gitlab.com/bibo-mao/qemu: target/loongarch: fix bad shift in check_ps() docs/system: Add entry for LoongArch system host/include/loongarch64: Fix inline assembly compatibility with Clang Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 527dede + b8d5503 commit 5eb0849

File tree

9 files changed

+44
-33
lines changed

9 files changed

+44
-33
lines changed

docs/system/loongarch/virt.rst

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ Supported devices
1212
-----------------
1313

1414
The ``virt`` machine supports:
15-
- Gpex host bridge
16-
- Ls7a RTC device
17-
- Ls7a IOAPIC device
18-
- ACPI GED device
19-
- Fw_cfg device
20-
- PCI/PCIe devices
21-
- Memory device
22-
- CPU device. Type: la464.
15+
16+
* Gpex host bridge
17+
* Ls7a RTC device
18+
* Ls7a IOAPIC device
19+
* ACPI GED device
20+
* Fw_cfg device
21+
* PCI/PCIe devices
22+
* Memory device
23+
* CPU device. Type: la464.
2324

2425
CPU and machine Type
2526
--------------------
@@ -39,23 +40,15 @@ can be accessed by following steps.
3940

4041
.. code-block:: bash
4142
42-
./configure --disable-rdma --prefix=/usr \
43-
--target-list="loongarch64-softmmu" \
44-
--disable-libiscsi --disable-libnfs --disable-libpmem \
45-
--disable-glusterfs --enable-libusb --enable-usb-redir \
46-
--disable-opengl --disable-xen --enable-spice \
47-
--enable-debug --disable-capstone --disable-kvm \
48-
--enable-profiler
43+
./configure --target-list="loongarch64-softmmu"
4944
make -j8
5045
5146
(2) Set cross tools:
5247

5348
.. code-block:: bash
5449
5550
wget https://github.com/loongson/build-tools/releases/download/2022.09.06/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz
56-
5751
tar -vxf loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz -C /opt
58-
5952
export PATH=/opt/cross-tools/bin:$PATH
6053
export LD_LIBRARY_PATH=/opt/cross-tools/lib:$LD_LIBRARY_PATH
6154
export LD_LIBRARY_PATH=/opt/cross-tools/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
@@ -74,13 +67,9 @@ Note: To build the release version of the bios, set --buildtarget=RELEASE,
7467
.. code-block:: bash
7568
7669
git clone https://github.com/loongson/linux.git
77-
7870
cd linux
79-
8071
git checkout loongarch-next
81-
8272
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- loongson3_defconfig
83-
8473
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- -j32
8574
8675
Note: The branch of linux source code is loongarch-next.

docs/system/target-loongarch.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. _LoongArch-System-emulator:
2+
3+
LoongArch System emulator
4+
-------------------------
5+
6+
QEMU can emulate loongArch 64 bit systems via the
7+
``qemu-system-loongarch64`` binary. Only one machine type ``virt`` is
8+
supported.
9+
10+
When using KVM as accelerator, QEMU can emulate la464 cpu model. And when
11+
using the default cpu model with TCG as accelerator, QEMU will emulate a
12+
subset of la464 cpu features that should be enough to run distributions
13+
built for the la464.
14+
15+
Board-specific documentation
16+
============================
17+
18+
.. toctree::
19+
loongarch/virt

docs/system/targets.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Contents:
1818

1919
target-arm
2020
target-avr
21+
target-loongarch
2122
target-m68k
2223
target-mips
2324
target-ppc

host/include/loongarch64/host/atomic128-ldst.h.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static inline Int128 atomic16_read_ro(const Int128 *ptr)
2828
asm("vld $vr0, %2, 0\n\t"
2929
"vpickve2gr.d %0, $vr0, 0\n\t"
3030
"vpickve2gr.d %1, $vr0, 1"
31-
: "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "f0");
31+
: "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "$f0");
3232

3333
return int128_make128(l, h);
3434
}
@@ -46,7 +46,7 @@ static inline void atomic16_set(Int128 *ptr, Int128 val)
4646
asm("vinsgr2vr.d $vr0, %1, 0\n\t"
4747
"vinsgr2vr.d $vr0, %2, 1\n\t"
4848
"vst $vr0, %3, 0"
49-
: "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "f0");
49+
: "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "$f0");
5050
}
5151

5252
#endif /* LOONGARCH_ATOMIC128_LDST_H */

host/include/loongarch64/host/bufferiszero.c.inc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ static bool buffer_is_zero_lsx(const void *buf, size_t len)
6161
"2:"
6262
: "=&r"(ret), "+r"(p)
6363
: "r"(buf), "r"(e), "r"(l)
64-
: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
64+
: "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
65+
"$fcc0");
6566

6667
return ret;
6768
}
@@ -119,7 +120,8 @@ static bool buffer_is_zero_lasx(const void *buf, size_t len)
119120
"3:"
120121
: "=&r"(ret), "+r"(p)
121122
: "r"(buf), "r"(e), "r"(l)
122-
: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
123+
: "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
124+
"$fcc0");
123125

124126
return ret;
125127
}

host/include/loongarch64/host/load-extract-al16-al8.h.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline uint64_t load_atom_extract_al16_or_al8(void *pv, int s)
3131
asm("vld $vr0, %2, 0\n\t"
3232
"vpickve2gr.d %0, $vr0, 0\n\t"
3333
"vpickve2gr.d %1, $vr0, 1"
34-
: "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "f0");
34+
: "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "$f0");
3535

3636
return (l >> shr) | (h << (-shr & 63));
3737
}

target/loongarch/internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum {
4343
TLBRET_PE = 7,
4444
};
4545

46-
bool check_ps(CPULoongArchState *ent, int ps);
46+
bool check_ps(CPULoongArchState *ent, uint8_t ps);
4747

4848
extern const VMStateDescription vmstate_loongarch_cpu;
4949

target/loongarch/tcg/csr_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ target_ulong helper_csrwr_ticlr(CPULoongArchState *env, target_ulong val)
115115

116116
target_ulong helper_csrwr_pwcl(CPULoongArchState *env, target_ulong val)
117117
{
118-
int shift, ptbase;
118+
uint8_t shift, ptbase;
119119
int64_t old_v = env->CSR_PWCL;
120120

121121
/*

target/loongarch/tcg/tlb_helper.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
#include "exec/log.h"
2020
#include "cpu-csr.h"
2121

22-
bool check_ps(CPULoongArchState *env, int tlb_ps)
22+
bool check_ps(CPULoongArchState *env, uint8_t tlb_ps)
2323
{
24-
if (tlb_ps > 64) {
25-
return false;
26-
}
27-
return BIT_ULL(tlb_ps) & (env->CSR_PRCFG2);
24+
if (tlb_ps >= 64) {
25+
return false;
26+
}
27+
return BIT_ULL(tlb_ps) & (env->CSR_PRCFG2);
2828
}
2929

3030
void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base,

0 commit comments

Comments
 (0)