[PATCH v14 00/26] Add LoongArch linux-user emulation support

Song Gao posted 26 patches 2 years, 2 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220106094200.1801206-1-gaosong@loongson.cn
Maintainers: Laurent Vivier <laurent@vivier.eu>, Song Gao <gaosong@loongson.cn>
There is a newer version of this series
MAINTAINERS                                   |   5 +
configs/targets/loongarch64-linux-user.mak    |   3 +
configure                                     |   3 +
include/disas/dis-asm.h                       |   2 +
linux-user/elfload.c                          |  53 ++
linux-user/loongarch64/cpu_loop.c             |  94 ++
linux-user/loongarch64/signal.c               | 198 ++++
linux-user/loongarch64/sockbits.h             |  11 +
linux-user/loongarch64/syscall_nr.h           | 313 +++++++
linux-user/loongarch64/target_cpu.h           |  34 +
linux-user/loongarch64/target_elf.h           |  12 +
linux-user/loongarch64/target_errno_defs.h    |  12 +
linux-user/loongarch64/target_fcntl.h         |  11 +
linux-user/loongarch64/target_signal.h        |  13 +
linux-user/loongarch64/target_structs.h       |  47 +
linux-user/loongarch64/target_syscall.h       |  48 +
linux-user/loongarch64/termbits.h             |  11 +
linux-user/syscall_defs.h                     |  10 +-
meson.build                                   |   1 +
scripts/gensyscalls.sh                        |   1 +
scripts/qemu-binfmt-conf.sh                   |   6 +-
target/loongarch/README                       |  77 ++
target/loongarch/cpu-param.h                  |  18 +
target/loongarch/cpu.c                        | 315 +++++++
target/loongarch/cpu.h                        | 252 +++++
target/loongarch/disas.c                      | 612 +++++++++++++
target/loongarch/fpu_helper.c                 | 862 ++++++++++++++++++
target/loongarch/helper.h                     |  94 ++
target/loongarch/insn_trans/trans_arith.c.inc | 304 ++++++
.../loongarch/insn_trans/trans_atomic.c.inc   | 114 +++
target/loongarch/insn_trans/trans_bit.c.inc   | 212 +++++
.../loongarch/insn_trans/trans_branch.c.inc   |  83 ++
target/loongarch/insn_trans/trans_extra.c.inc |  86 ++
.../loongarch/insn_trans/trans_farith.c.inc   | 105 +++
target/loongarch/insn_trans/trans_fcmp.c.inc  |  56 ++
target/loongarch/insn_trans/trans_fcnv.c.inc  |  33 +
.../loongarch/insn_trans/trans_fmemory.c.inc  | 153 ++++
target/loongarch/insn_trans/trans_fmov.c.inc  | 157 ++++
.../loongarch/insn_trans/trans_memory.c.inc   | 229 +++++
target/loongarch/insn_trans/trans_shift.c.inc | 106 +++
target/loongarch/insns.decode                 | 442 +++++++++
target/loongarch/internals.h                  |  28 +
target/loongarch/meson.build                  |  19 +
target/loongarch/op_helper.c                  |  85 ++
target/loongarch/translate.c                  | 268 ++++++
target/loongarch/translate.h                  |  45 +
target/meson.build                            |   1 +
tests/tcg/configure.sh                        |   1 +
48 files changed, 5640 insertions(+), 5 deletions(-)
create mode 100644 configs/targets/loongarch64-linux-user.mak
create mode 100644 linux-user/loongarch64/cpu_loop.c
create mode 100644 linux-user/loongarch64/signal.c
create mode 100644 linux-user/loongarch64/sockbits.h
create mode 100644 linux-user/loongarch64/syscall_nr.h
create mode 100644 linux-user/loongarch64/target_cpu.h
create mode 100644 linux-user/loongarch64/target_elf.h
create mode 100644 linux-user/loongarch64/target_errno_defs.h
create mode 100644 linux-user/loongarch64/target_fcntl.h
create mode 100644 linux-user/loongarch64/target_signal.h
create mode 100644 linux-user/loongarch64/target_structs.h
create mode 100644 linux-user/loongarch64/target_syscall.h
create mode 100644 linux-user/loongarch64/termbits.h
create mode 100644 target/loongarch/README
create mode 100644 target/loongarch/cpu-param.h
create mode 100644 target/loongarch/cpu.c
create mode 100644 target/loongarch/cpu.h
create mode 100644 target/loongarch/disas.c
create mode 100644 target/loongarch/fpu_helper.c
create mode 100644 target/loongarch/helper.h
create mode 100644 target/loongarch/insn_trans/trans_arith.c.inc
create mode 100644 target/loongarch/insn_trans/trans_atomic.c.inc
create mode 100644 target/loongarch/insn_trans/trans_bit.c.inc
create mode 100644 target/loongarch/insn_trans/trans_branch.c.inc
create mode 100644 target/loongarch/insn_trans/trans_extra.c.inc
create mode 100644 target/loongarch/insn_trans/trans_farith.c.inc
create mode 100644 target/loongarch/insn_trans/trans_fcmp.c.inc
create mode 100644 target/loongarch/insn_trans/trans_fcnv.c.inc
create mode 100644 target/loongarch/insn_trans/trans_fmemory.c.inc
create mode 100644 target/loongarch/insn_trans/trans_fmov.c.inc
create mode 100644 target/loongarch/insn_trans/trans_memory.c.inc
create mode 100644 target/loongarch/insn_trans/trans_shift.c.inc
create mode 100644 target/loongarch/insns.decode
create mode 100644 target/loongarch/internals.h
create mode 100644 target/loongarch/meson.build
create mode 100644 target/loongarch/op_helper.c
create mode 100644 target/loongarch/translate.c
create mode 100644 target/loongarch/translate.h
[PATCH v14 00/26] Add LoongArch linux-user emulation support
Posted by Song Gao 2 years, 2 months ago
Based-on: <20220106074740.1754661-1-gaosong@loongson.cn>

Hi all,

This series only support linux-user emulation.
More about LoongArch at: https://github.com/loongson/

The latest kernel:
  * https://github.com/loongson/linux/tree/loongarch-next

Patches need review:
  * 0018-linux-user-Add-LoongArch-specific-structures.patch
  * 0019-linux-user-Add-LoongArch-signal-support.patch

Changes for v14:
  * Rebase;
  * Update README, use new clfs-system/cross-tools test.

V13:
https://patchew.org/QEMU/1638610165-15036-1-git-send-email-gaosong@loongson.cn/

Please review! Thanks.

Song Gao (26):
  target/loongarch: Add README
  target/loongarch: Add core definition
  target/loongarch: Add main translation routines
  target/loongarch: Add fixed point arithmetic instruction translation
  target/loongarch: Add fixed point shift instruction translation
  target/loongarch: Add fixed point bit instruction translation
  target/loongarch: Add fixed point load/store instruction translation
  target/loongarch: Add fixed point atomic instruction translation
  target/loongarch: Add fixed point extra instruction translation
  target/loongarch: Add floating point arithmetic instruction
    translation
  target/loongarch: Add floating point comparison instruction
    translation
  target/loongarch: Add floating point conversion instruction
    translation
  target/loongarch: Add floating point move instruction translation
  target/loongarch: Add floating point load/store instruction
    translation
  target/loongarch: Add branch instruction translation
  target/loongarch: Add disassembler
  linux-user: Add LoongArch generic header files
  linux-user: Add LoongArch specific structures
  linux-user: Add LoongArch signal support
  linux-user: Add LoongArch elf support
  linux-user: Add LoongArch syscall support
  linux-user: Add LoongArch cpu_loop support
  default-configs: Add loongarch linux-user support
  target/loongarch: Add target build suport
  target/loongarch: 'make check-tcg' support
  scripts: add loongarch64 binfmt config

 MAINTAINERS                                   |   5 +
 configs/targets/loongarch64-linux-user.mak    |   3 +
 configure                                     |   3 +
 include/disas/dis-asm.h                       |   2 +
 linux-user/elfload.c                          |  53 ++
 linux-user/loongarch64/cpu_loop.c             |  94 ++
 linux-user/loongarch64/signal.c               | 198 ++++
 linux-user/loongarch64/sockbits.h             |  11 +
 linux-user/loongarch64/syscall_nr.h           | 313 +++++++
 linux-user/loongarch64/target_cpu.h           |  34 +
 linux-user/loongarch64/target_elf.h           |  12 +
 linux-user/loongarch64/target_errno_defs.h    |  12 +
 linux-user/loongarch64/target_fcntl.h         |  11 +
 linux-user/loongarch64/target_signal.h        |  13 +
 linux-user/loongarch64/target_structs.h       |  47 +
 linux-user/loongarch64/target_syscall.h       |  48 +
 linux-user/loongarch64/termbits.h             |  11 +
 linux-user/syscall_defs.h                     |  10 +-
 meson.build                                   |   1 +
 scripts/gensyscalls.sh                        |   1 +
 scripts/qemu-binfmt-conf.sh                   |   6 +-
 target/loongarch/README                       |  77 ++
 target/loongarch/cpu-param.h                  |  18 +
 target/loongarch/cpu.c                        | 315 +++++++
 target/loongarch/cpu.h                        | 252 +++++
 target/loongarch/disas.c                      | 612 +++++++++++++
 target/loongarch/fpu_helper.c                 | 862 ++++++++++++++++++
 target/loongarch/helper.h                     |  94 ++
 target/loongarch/insn_trans/trans_arith.c.inc | 304 ++++++
 .../loongarch/insn_trans/trans_atomic.c.inc   | 114 +++
 target/loongarch/insn_trans/trans_bit.c.inc   | 212 +++++
 .../loongarch/insn_trans/trans_branch.c.inc   |  83 ++
 target/loongarch/insn_trans/trans_extra.c.inc |  86 ++
 .../loongarch/insn_trans/trans_farith.c.inc   | 105 +++
 target/loongarch/insn_trans/trans_fcmp.c.inc  |  56 ++
 target/loongarch/insn_trans/trans_fcnv.c.inc  |  33 +
 .../loongarch/insn_trans/trans_fmemory.c.inc  | 153 ++++
 target/loongarch/insn_trans/trans_fmov.c.inc  | 157 ++++
 .../loongarch/insn_trans/trans_memory.c.inc   | 229 +++++
 target/loongarch/insn_trans/trans_shift.c.inc | 106 +++
 target/loongarch/insns.decode                 | 442 +++++++++
 target/loongarch/internals.h                  |  28 +
 target/loongarch/meson.build                  |  19 +
 target/loongarch/op_helper.c                  |  85 ++
 target/loongarch/translate.c                  | 268 ++++++
 target/loongarch/translate.h                  |  45 +
 target/meson.build                            |   1 +
 tests/tcg/configure.sh                        |   1 +
 48 files changed, 5640 insertions(+), 5 deletions(-)
 create mode 100644 configs/targets/loongarch64-linux-user.mak
 create mode 100644 linux-user/loongarch64/cpu_loop.c
 create mode 100644 linux-user/loongarch64/signal.c
 create mode 100644 linux-user/loongarch64/sockbits.h
 create mode 100644 linux-user/loongarch64/syscall_nr.h
 create mode 100644 linux-user/loongarch64/target_cpu.h
 create mode 100644 linux-user/loongarch64/target_elf.h
 create mode 100644 linux-user/loongarch64/target_errno_defs.h
 create mode 100644 linux-user/loongarch64/target_fcntl.h
 create mode 100644 linux-user/loongarch64/target_signal.h
 create mode 100644 linux-user/loongarch64/target_structs.h
 create mode 100644 linux-user/loongarch64/target_syscall.h
 create mode 100644 linux-user/loongarch64/termbits.h
 create mode 100644 target/loongarch/README
 create mode 100644 target/loongarch/cpu-param.h
 create mode 100644 target/loongarch/cpu.c
 create mode 100644 target/loongarch/cpu.h
 create mode 100644 target/loongarch/disas.c
 create mode 100644 target/loongarch/fpu_helper.c
 create mode 100644 target/loongarch/helper.h
 create mode 100644 target/loongarch/insn_trans/trans_arith.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_atomic.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_bit.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_branch.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_extra.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_farith.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_fcmp.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_fcnv.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_fmemory.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_fmov.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_memory.c.inc
 create mode 100644 target/loongarch/insn_trans/trans_shift.c.inc
 create mode 100644 target/loongarch/insns.decode
 create mode 100644 target/loongarch/internals.h
 create mode 100644 target/loongarch/meson.build
 create mode 100644 target/loongarch/op_helper.c
 create mode 100644 target/loongarch/translate.c
 create mode 100644 target/loongarch/translate.h

-- 
2.27.0


Re: [PATCH v14 00/26] Add LoongArch linux-user emulation support
Posted by Richard Henderson 2 years, 2 months ago
On 1/6/22 1:41 AM, Song Gao wrote:
> Based-on:<20220106074740.1754661-1-gaosong@loongson.cn>
> 
> Hi all,
> 
> This series only support linux-user emulation.
> More about LoongArch at:https://github.com/loongson/
> 
> The latest kernel:
>    *https://github.com/loongson/linux/tree/loongarch-next
> 
> Patches need review:
>    * 0018-linux-user-Add-LoongArch-specific-structures.patch
>    * 0019-linux-user-Add-LoongArch-signal-support.patch

You're still blocked on no upstream kernel support.
As shown in patch 19, the kernel abi is still in flux.

It would be best if you could work toward getting full system emulation completed.  Then 
all of the basic cpu emulation can be merged and all you'd need to keep updating is the 
linux-user portions.


r~

Re: [PATCH v14 00/26] Add LoongArch linux-user emulation support
Posted by gaosong 2 years, 2 months ago
Hi Richard.

On 2022/1/7 下午1:01, Richard Henderson wrote:
> On 1/6/22 1:41 AM, Song Gao wrote:
>> Based-on:<20220106074740.1754661-1-gaosong@loongson.cn>
>>
>> Hi all,
>>
>> This series only support linux-user emulation.
>> More about LoongArch at:https://github.com/loongson/
>>
>> The latest kernel:
>>    *https://github.com/loongson/linux/tree/loongarch-next
>>
>> Patches need review:
>>    * 0018-linux-user-Add-LoongArch-specific-structures.patch
>>    * 0019-linux-user-Add-LoongArch-signal-support.patch
>
> You're still blocked on no upstream kernel support.
> As shown in patch 19, the kernel abi is still in flux.
>
We hope the kernel will support as soon as possible. but ...

> It would be best if you could work toward getting full system 
> emulation completed.  Then all of the basic cpu emulation can be 
> merged and all you'd need to keep updating is the linux-user portions.
>
We are going to submit V4 system emulation, maybe tommorrow or next-week, and We'll keep updating the linux-user portions.

Thanks
Song

> r~
Re: [PATCH v14 00/26] Add LoongArch linux-user emulation support
Posted by WANG Xuerui 2 years, 2 months ago
Hi,

On 1/7/22 15:59, gaosong wrote:
> Hi Richard.
> On 2022/1/7 下午1:01, Richard Henderson wrote:
>> On 1/6/22 1:41 AM, Song Gao wrote:
>>> Based-on:<20220106074740.1754661-1-gaosong@loongson.cn>
>>>
>>> Hi all,
>>>
>>> This series only support linux-user emulation.
>>> More about LoongArch at:https://github.com/loongson/
>>>
>>> The latest kernel:
>>>    *https://github.com/loongson/linux/tree/loongarch-next
>>>
>>> Patches need review:
>>>    * 0018-linux-user-Add-LoongArch-specific-structures.patch
>>>    * 0019-linux-user-Add-LoongArch-signal-support.patch
>>
>> You're still blocked on no upstream kernel support.
>> As shown in patch 19, the kernel abi is still in flux.
>>
> We hope the kernel will support as soon as possible. but ...
>> It would be best if you could work toward getting full system 
>> emulation completed.  Then all of the basic cpu emulation can be 
>> merged and all you'd need to keep updating is the linux-user portions.
>>
> We are going to submit V4 system emulation, maybe tommorrow or next-week, and We'll keep updating the linux-user portions.

I believe what Richard meant is suggesting you to re-order your patches 
so that the CPU emulation part (first half of this series) and the 
system emulation part (Xiaojuan's series) would be combined to one new 
series, to be reviewed and merged independent of the still-unstable 
Linux ABI that's blocking this series at the moment. To "keep updating 
the linux-user portions" without re-arranging the series will just delay 
inclusion further, IMO.

In case the description above is not clear enough:

We basically have 3 parts for full LoongArch target support: (a) CPU 
emulation, (b) privileged architecture & hw emulation, and (c) 
linux-user emulation. Currently this series consists of (a) and (c), 
while Xiaojuan's series has (b). And the tcg-dev branch you seem to be 
staging your work at [1] has the same ordering: (a) then (c) then (b), 
which is consistent with Xiaojuan's series cover letter.

However, because (c) is blocked by kernel port upstreaming, (a) could 
not be merged, and by re-combining (a) with (b) we can speed up review 
and inclusion of things. This would require you to coordinate with 
Xiaojuan and reorder your patches in the tcg-dev branch, so that you can 
generate the right series to send.

[1]: https://github.com/loongson/qemu/tree/tcg-dev

>
> Thanks
> Song
>> r~