[Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission

Michael Clark posted 23 patches 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1519998711-73430-1-git-send-email-mjc@sifive.com
Test checkpatch failed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
MAINTAINERS                            |   11 +
arch_init.c                            |    2 +
configure                              |   13 +
cpus.c                                 |    6 +
default-configs/riscv32-linux-user.mak |    1 +
default-configs/riscv32-softmmu.mak    |    4 +
default-configs/riscv64-linux-user.mak |    1 +
default-configs/riscv64-softmmu.mak    |    4 +
disas.c                                |    2 +
disas/Makefile.objs                    |    1 +
disas/riscv.c                          | 3048 ++++++++++++++++++++++++++++++++
fpu/softfloat-specialize.h             |    7 +-
hw/core/loader.c                       |   18 +-
hw/riscv/Makefile.objs                 |   11 +
hw/riscv/riscv_hart.c                  |   89 +
hw/riscv/riscv_htif.c                  |  258 +++
hw/riscv/sifive_clint.c                |  254 +++
hw/riscv/sifive_e.c                    |  234 +++
hw/riscv/sifive_plic.c                 |  505 ++++++
hw/riscv/sifive_prci.c                 |   89 +
hw/riscv/sifive_test.c                 |   93 +
hw/riscv/sifive_u.c                    |  339 ++++
hw/riscv/sifive_uart.c                 |  176 ++
hw/riscv/spike.c                       |  376 ++++
hw/riscv/virt.c                        |  420 +++++
include/disas/bfd.h                    |    2 +
include/elf.h                          |    2 +
include/hw/elf_ops.h                   |   34 +-
include/hw/loader.h                    |   17 +-
include/hw/riscv/riscv_hart.h          |   39 +
include/hw/riscv/riscv_htif.h          |   61 +
include/hw/riscv/sifive_clint.h        |   50 +
include/hw/riscv/sifive_e.h            |   79 +
include/hw/riscv/sifive_plic.h         |   85 +
include/hw/riscv/sifive_prci.h         |   37 +
include/hw/riscv/sifive_test.h         |   42 +
include/hw/riscv/sifive_u.h            |   69 +
include/hw/riscv/sifive_uart.h         |   71 +
include/hw/riscv/spike.h               |   53 +
include/hw/riscv/virt.h                |   74 +
include/sysemu/arch_init.h             |    1 +
linux-user/elfload.c                   |   22 +
linux-user/main.c                      |   99 ++
linux-user/riscv/syscall_nr.h          |  287 +++
linux-user/riscv/target_cpu.h          |   18 +
linux-user/riscv/target_elf.h          |   14 +
linux-user/riscv/target_signal.h       |   23 +
linux-user/riscv/target_structs.h      |   46 +
linux-user/riscv/target_syscall.h      |   56 +
linux-user/riscv/termbits.h            |  222 +++
linux-user/signal.c                    |  203 ++-
linux-user/syscall.c                   |    2 +
linux-user/syscall_defs.h              |   13 +-
qapi-schema.json                       |   17 +-
scripts/qemu-binfmt-conf.sh            |   13 +-
target/riscv/Makefile.objs             |    1 +
target/riscv/cpu.c                     |  432 +++++
target/riscv/cpu.h                     |  296 ++++
target/riscv/cpu_bits.h                |  411 +++++
target/riscv/cpu_user.h                |   13 +
target/riscv/fpu_helper.c              |  373 ++++
target/riscv/gdbstub.c                 |   62 +
target/riscv/helper.c                  |  503 ++++++
target/riscv/helper.h                  |   78 +
target/riscv/instmap.h                 |  364 ++++
target/riscv/op_helper.c               |  669 +++++++
target/riscv/pmp.c                     |  380 ++++
target/riscv/pmp.h                     |   64 +
target/riscv/translate.c               | 1978 +++++++++++++++++++++
69 files changed, 13310 insertions(+), 27 deletions(-)
create mode 100644 default-configs/riscv32-linux-user.mak
create mode 100644 default-configs/riscv32-softmmu.mak
create mode 100644 default-configs/riscv64-linux-user.mak
create mode 100644 default-configs/riscv64-softmmu.mak
create mode 100644 disas/riscv.c
create mode 100644 hw/riscv/Makefile.objs
create mode 100644 hw/riscv/riscv_hart.c
create mode 100644 hw/riscv/riscv_htif.c
create mode 100644 hw/riscv/sifive_clint.c
create mode 100644 hw/riscv/sifive_e.c
create mode 100644 hw/riscv/sifive_plic.c
create mode 100644 hw/riscv/sifive_prci.c
create mode 100644 hw/riscv/sifive_test.c
create mode 100644 hw/riscv/sifive_u.c
create mode 100644 hw/riscv/sifive_uart.c
create mode 100644 hw/riscv/spike.c
create mode 100644 hw/riscv/virt.c
create mode 100644 include/hw/riscv/riscv_hart.h
create mode 100644 include/hw/riscv/riscv_htif.h
create mode 100644 include/hw/riscv/sifive_clint.h
create mode 100644 include/hw/riscv/sifive_e.h
create mode 100644 include/hw/riscv/sifive_plic.h
create mode 100644 include/hw/riscv/sifive_prci.h
create mode 100644 include/hw/riscv/sifive_test.h
create mode 100644 include/hw/riscv/sifive_u.h
create mode 100644 include/hw/riscv/sifive_uart.h
create mode 100644 include/hw/riscv/spike.h
create mode 100644 include/hw/riscv/virt.h
create mode 100644 linux-user/riscv/syscall_nr.h
create mode 100644 linux-user/riscv/target_cpu.h
create mode 100644 linux-user/riscv/target_elf.h
create mode 100644 linux-user/riscv/target_signal.h
create mode 100644 linux-user/riscv/target_structs.h
create mode 100644 linux-user/riscv/target_syscall.h
create mode 100644 linux-user/riscv/termbits.h
create mode 100644 target/riscv/Makefile.objs
create mode 100644 target/riscv/cpu.c
create mode 100644 target/riscv/cpu.h
create mode 100644 target/riscv/cpu_bits.h
create mode 100644 target/riscv/cpu_user.h
create mode 100644 target/riscv/fpu_helper.c
create mode 100644 target/riscv/gdbstub.c
create mode 100644 target/riscv/helper.c
create mode 100644 target/riscv/helper.h
create mode 100644 target/riscv/instmap.h
create mode 100644 target/riscv/op_helper.c
create mode 100644 target/riscv/pmp.c
create mode 100644 target/riscv/pmp.h
create mode 100644 target/riscv/translate.c
[Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Michael Clark 6 years, 1 month ago
QEMU RISC-V Emulation Support (RV64GC, RV32GC)

This release renames the SiFive machines to sifive_e and sifive_u
to represent the SiFive Everywhere and SiFive Unleashed platforms.
SiFive has configurable soft-core IP, so it is intended that these
machines will be extended to enable a variety of SiFive IP blocks.
The CPU definition infrastructure has been improved and there are
now vendor CPU modules including the SiFiVe E31, E51, U34 and U54
cores. The emulation accuracy for the E series has been improved
by disabling the MMU for the E series. S mode has been disabled on
cores that only support M mode and U mode. The two Spike machines
that support two privileged ISA versions have been coalesced into
one file. This series has Signed-off-by from the core contributors.

The git tree for the v8 patch series tree (squashed and rebased):

- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v8

The git tree for the v1-v7 patch series with review commit history:

- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v7
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v6
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v5
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v4
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v3
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v2
- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v1

*** Known Issues ***

- Disassembler has some checkpatch warnings for the sake of code brevity
- scripts/qemu-binfmt-conf.sh has checkpatch warnings due to line length
- PMP (Physical Memory Protection) is as-of-yet unused and needs testing

*** Changelog ***

v8

- Added linux-user/riscv/target_elf.h during rebase
- Make resetvec configurable and clear mpp and mie on reset
- Use SiFive E31, E51, U34 and U54 cores in SiFive machines
- Define SiFive E31, E51, U34 and U54 cores
- Refactor CPU core definition in preparation for vendor cores
- Prevent S or U mode unless S or U extensions are present
- SiFive E Series cores have no MMU
- SiFive E Series cores have U mode
- Make privileged ISA v1.10 implicit in CPU types
- Remove DRAM_BASE and EXT_IO_BASE as they vary by machine
- Correctly handle mtvec and stvec alignment with respect to RVC
- Print more machine mode state in riscv_cpu_dump_state
- Make riscv_isa_string use compact extension order method
- Fix bug introduced in v6 RISCV_CPU_TYPE_NAME macro change
- Parameterize spike v1.9.1 config string
- Coalesce spike_v1.9.1 and spike_v1.10 machines
- Rename sifive_e300 to sifive_e, and sifive_u500 to sifive_u

v7

- Make spike_v1.10 the default machine
- Rename spike_v1.9 to spike_v1.9.1 to match privileged spec version
- Remove empty target/riscv/trace-events file
- Monitor ROM 32-bit reset code needs to be target endian
- Add TARGET_TIOCGPTPEER to linux-user/riscv/termbits.h
- Add -initrd support to the virt board
- Fix naming in spike machine interface header
- Update copyright notice on RISC-V Spike machines
- Update copyright notice on RISC-V HTIF Console device
- Change CPU Core and translator to GPLv2+
- Change RISC-V Disassembler to GPLv2+
- Change SiFive Test Finisher to GPLv2+
- Change SiFive CLINT to GPLv2+
- Change SiFive PRCI to GPLv2+
- Change SiFive PLIC to GPLv2+
- Change RISC-V spike machines to GPLv2+
- Change RISC-V virt machine to GPLv2+
- Change SiFive E300 machine to GPLv2+
- Change SiFive U500 machine to GPLv2+
- Change RISC-V Hart Array to GPLv2+
- Change RISC-V HTIF device to GPLv2+
- Change SiFiveUART device to GPLv2+

v6

- Drop IEEE 754-201x minimumNumber/maximumNumber for fmin/fmax
- Remove some unnecessary commented debug statements
- Change RISCV_CPU_TYPE_NAME to use riscv-cpu suffix
- Define all CPU variants for linux-user
- qemu_log calls require trailing \n
- Replace PLIC printfs with qemu_log
- Tear out unused HTIF code and eliminate shouting debug messages
- Fix illegal instruction when sfence.vma is passed (rs2) arguments
- Make updates to PTE accessed and dirty bits atomic
- Only require atomic PTE updates on MTTCG enabled guests
- Page fault if accessed or dirty bits can't be updated
- Fix get_physical_address PTE reads and writes on riscv32
- Remove erroneous comments from the PLIC
- Default enable MTTCG
- Make WFI less conservative
- Unify local interrupt handling
- Expunge HTIF interrupts
- Always access mstatus.mip under a lock
- Don't implement rdtime/rdtimeh in system mode (bbl emulates them)
- Implement insreth/cycleh for rv32 and always enable user-mode counters
- Add GDB stub support for reading and writing CSRs
- Rename ENABLE_CHARDEV #ifdef from HTIF code
- Replace bad HTIF ELF code with load_elf symbol callback
- Convert chained if else fault handlers to switch statements
- Use RISCV exception codes for linux-user page faults

v5

- Implement NaN-boxing for flw, set high order bits to 1
- Use float_muladd_negate_* flags to floatXX_muladd
- Use IEEE 754-201x minimumNumber/maximumNumber for fmin/fmax
- Fix TARGET_NR_syscalls
- Update linux-user/riscv/syscall_nr.h
- Fix FENCE.I, needs to terminate translation block
- Adjust unusual convention for interruptno >= 0

v4

- Add @riscv: since 2.12 to CpuInfoArch
- Remove misleading little-endian comment from load_kernel
- Rename cpu-model property to cpu-type
- Drop some unnecessary inline function attributes
- Don't allow GDB to set value of x0 register
- Remove unnecessary empty property lists
- Add Test Finisher device to implement poweroff in virt machine
- Implement priv ISA v1.10 trap and sret/mret xPIE/xIE behavior
- Store fflags data in fp_status
- Purge runtime users of helper_raise_exception
- Fix validate_csr
- Tidy gen_jalr
- Tidy immediate shifts
- Add gen_exception_inst_addr_mis
- Add gen_exception_debug
- Add gen_exception_illegal
- Tidy helper_fclass_*
- Split rounding mode setting to a new function
- Enforce MSTATUS_FS via TB flags
- Implement acquire/release barrier semantics
- Use atomic operations as required
- Fix FENCE and FENCE_I
- Remove commented code from spike machines
- PAGE_WRITE permissions can be set on loads if page is already dirty
- The result of format conversion on an NaN must be a quiet NaN
- Add missing process_queued_cpu_work to riscv linux-user
- Remove float(32|64)_classify from cpu.h
- Removed nonsensical unions aliasing the same type
- Use uintN_t instead of uintN_fast_t in fpu_helper.c
- Use macros for FPU exception values in softfloat_flags_to_riscv
- Move code to set round mode into set_fp_round_mode function
- Convert set_fp_exceptions from a macro to an inline function
- Convert round mode helper into an inline function
- Make fpu_helper ieee_rm array static const
- Include cpu_mmu_index in cpu_get_tb_cpu_state flags
- Eliminate MPRV influence on mmu_index
- Remove unrecoverable do_unassigned_access function
- Only update PTE accessed and dirty bits if necessary
- Remove unnecessary tlb_flush in set_mode as mode is in mmu_idx
- Remove buggy support for misa writes. misa writes are optional
  and are not implemented in any known hardware
- Always set PTE read or execute permissions during page walk
- Reorder helper function declarations to match order in helper.c
- Remove redundant variable declaration in get_physical_address
- Remove duplicated code from get_physical_address
- Use mmu_idx instead of mem_idx in riscv_cpu_get_phys_page_debug

v3

- Fix indentation in PMP and HTIF debug macros
- Fix disassembler checkpatch open brace '{' on next line errors
- Fix trailing statements on next line in decode_inst_decompress
- NOTE: the other checkpatch issues have been reviewed previously

v2

- Remove redundant NULL terminators from disassembler register arrays
- Change disassembler register name arrays to const
- Refine disassembler internal function names
- Update dates in disassembler copyright message
- Remove #ifdef CONFIG_USER_ONLY version of cpu_has_work
- Use ULL suffix on 64-bit constants
- Move riscv_cpu_mmu_index from cpu.h to helper.c
- Move riscv_cpu_hw_interrupts_pending from cpu.h to helper.c
- Remove redundant TARGET_HAS_ICE from cpu.h
- Use qemu_irq instead of void* for irq definition in cpu.h
- Remove duplicate typedef from struct CPURISCVState
- Remove redundant g_strdup from cpu_register
- Remove redundant tlb_flush from riscv_cpu_reset
- Remove redundant mode calculation from get_physical_address
- Remove redundant debug mode printf and dcsr comment
- Remove redundant clearing of MSB for bare physical addresses
- Use g_assert_not_reached for invalid mode in get_physical_address
- Use g_assert_not_reached for unreachable checks in get_physical_address
- Use g_assert_not_reached for unreachable type in raise_mmu_exception
- Return exception instead of aborting for misaligned fetches
- Move exception defines from cpu.h to cpu_bits.h
- Remove redundant breakpoint control definitions from cpu_bits.h
- Implement riscv_cpu_unassigned_access exception handling
- Log and raise exceptions for unimplemented CSRs
- Match Spike HTIF exit behavior - don’t print TEST-PASSED
- Make frm,fflags,fcsr writes trap when mstatus.FS is clear
- Use g_assert_not_reached for unreachable invalid mode
- Make hret,uret,dret generate illegal instructions
- Move riscv_cpu_dump_state and int/fpr regnames to cpu.c
- Lift interrupt flag and mask into constants in cpu_bits.h
- Change trap debugging to use qemu_log_mask LOG_TRACE 
- Change CSR debugging to use qemu_log_mask LOG_TRACE
- Change PMP debugging to use qemu_log_mask LOG_TRACE
- Remove commented code from pmp.c
- Change CpuInfoRISCV qapi schema docs to Since 2.12
- Change RV feature macro to use target_ulong cast
- Remove riscv_feature and instead use misa extension flags
- Make riscv_flush_icache_syscall a no-op
- Undo checkpatch whitespace fixes in unrelated linux-user code
- Remove redudant constants and tidy up cpu_bits.h
- Make helper_fence_i a no-op
- Move include "exec/cpu-all" to end of cpu.h
- Rename set_privilege to riscv_set_mode
- Move redundant forward declaration for cpu_riscv_translate_address
- Remove TCGV_UNUSED from riscv_translate_init
- Add comment to pmp.c stating the code is untested and currently unused
- Use ctz to simplify decoding of PMP NAPOT address ranges
- Change pmp_is_in_range to use than equal for end addresses
- Fix off by one error in pmp_update_rule
- Rearrange PMP_DEBUG so that formatting is compile-time checked
- Rearrange trap debugging so that formatting is compile-time checked
- Rearrange PLIC debugging so that formatting is compile-time checked
- Use qemu_log/qemu_log_mask for HTIF logging and debugging
- Move exception and interrupt names into cpu.c
- Add Palmer Dabbelt as a RISC-V Maintainer
- Rebase against current qemu master branch

v1

- initial version based on forward port from riscv-qemu repository

*** Background ***

"RISC-V is an open, free ISA enabling a new era of processor innovation
through open standard collaboration. Born in academia and research,
RISC-V ISA delivers a new level of free, extensible software and
hardware freedom on architecture, paving the way for the next 50 years
of computing design and innovation."

The QEMU RISC-V port has been developed and maintained out-of-tree for
several years by Sagar Karandikar and Bastian Koppelmann. The RISC-V
Privileged specification has evolved substantially over this period but
has recently been solidifying. The RISC-V Base ISA has been frozon for
some time and the Privileged ISA, GCC toolchain and Linux ABI are now
quite stable. I have recently joined Sagar and Bastian as a RISC-V QEMU
Maintainer and hope to support upstreaming the port. 

There are multiple vendors taping out, preparing to ship, or shipping
silicon that implements the RISC-V Privileged ISA Version 1.10. There
are also several RISC-V Soft-IP cores implementing Privileged ISA
Version 1.10 that run on FPGA such as SiFive's Freedom U500 Platform
and the U54‑MC RISC-V Core IP, among many more implementations from a
variety of vendors. See https://riscv.org/ for more details.

RISC-V support was upstreamed in binutils 2.28 and GCC 7.1 in the first
half of 2016. RISC-V support is now available in LLVM top-of-tree and
the RISC-V Linux port was accepted into Linux 4.15-rc1 late last year
and is available in the Linux 4.15 release. GLIBC 2.27 added support
for the RISC-V ISA running on Linux (requires at least binutils-2.30,
gcc-7.3.0, and linux-4.15). We believe it is timely to submit the
RISC-V QEMU port for upstream review with the goal of incorporating
RISC-V support into the upcoming QEMU 2.12 release.

The RISC-V QEMU port is still under active development, mostly with
respect to device emulation, the addition of Hypervisor support as
specified in the RISC-V Draft Privileged ISA Version 1.11, and Vector
support once the first draft is finalized later this year. We believe
now is the appropriate time for RISC-V QEMU development to be carried
out in the main QEMU repository as the code will benefit from more
rigorous review. The RISC-V QEMU port currently supports all the ISA
extensions that have been finalized and frozen in the Base ISA.

Blog post about recent additions to RISC-V QEMU: https://goo.gl/fJ4zgk

The RISC-V QEMU wiki: https://github.com/riscv/riscv-qemu/wiki

Instructions for building a busybox+dropbear root image, BBL (Berkeley
Boot Loader) and linux kernel image for use with the RISC-V QEMU
'virt' machine: https://github.com/michaeljclark/busybear-linux

*** Overview ***

The RISC-V QEMU port implements the following specifications:

- RISC-V Instruction Set Manual Volume I: User-Level ISA Version 2.2
- RISC-V Instruction Set Manual Volume II: Privileged ISA Version 1.9.1
- RISC-V Instruction Set Manual Volume II: Privileged ISA Version 1.10

The RISC-V QEMU port supports the following instruction set extensions:

- RV32GC with Supervisor-mode and User-mode (RV32IMAFDCSU)
- RV64GC with Supervisor-mode and User-mode (RV64IMAFDCSU)

The RISC-V QEMU port adds the following targets to QEMU:

- riscv32-softmmu
- riscv64-softmmu
- riscv32-linux-user
- riscv64-linux-user

The RISC-V QEMU port supports the following hardware:

- HTIF Console (Host Target Interface)
- SiFive CLINT (Core Local Interruptor) for Timer interrupts and IPIs
- SiFive PLIC (Platform Level Interrupt Controller)
- SiFive Test (Test Finisher) for exiting simulation
- SiFive UART, PRCI, AON, PWM, QSPI support is partially implemented
- VirtIO MMIO (GPEX PCI support will be added in a future patch)
- Generic 16550A UART emulation using 'hw/char/serial.c'
- MTTCG and SMP support (PLIC and CLINT) on the 'virt' machine

The RISC-V QEMU full system emulator supports 5 machines:

- 'spike_v1.9.1', CLINT, PLIC, HTIF console, config-string, Priv v1.9.1
- 'spike_v1.10', CLINT, PLIC, HTIF console, device-tree, Priv v1.10
- 'sifive_e', CLINT, PLIC, SiFive UART, HiFive1 compat, Priv v1.10
- 'sifive_u', CLINT, PLIC, SiFive UART, device-tree, Priv v1.10
- 'virt', CLINT, PLIC, 16550A UART, VirtIO, device-tree, Priv v1.10

This is a list of RISC-V QEMU Port Contributors:

- Alex Suykov
- Andreas Schwab
- Antony Pavlov
- Bastian Koppelmann
- Bruce Hoult
- Chih-Min Chao
- Daire McNamara
- Darius Rad
- David Abdurachmanov
- Hesham Almatary
- Ivan Griffin
- Jim Wilson
- Kito Cheng
- Michael Clark
- Palmer Dabbelt
- Richard Henderson
- Sagar Karandikar
- Shea Levy
- Stefan O'Rear

Notes:

- contributor email addresses available off-list on request.
- checkpatch has been run on all 23 patches.
- checkpatch exceptions are noted in patches that have errors.
- passes "make check" on full build for all targets
- tested riscv-linux-4.6.2 on 'spike_v1.9.1' machine
- tested riscv-linux-4.15 on 'spike_v1.10' and 'virt' machines
- tested SiFive HiFive1 binaries in 'sifive_e' machine
- tested RV64 on 32-bit i386

This patch series includes the following patches:

Michael Clark (23):
  RISC-V Maintainers
  RISC-V ELF Machine Definition
  RISC-V CPU Core Definition
  RISC-V Disassembler
  RISC-V CPU Helpers
  RISC-V FPU Support
  RISC-V GDB Stub
  RISC-V TCG Code Generation
  RISC-V Physical Memory Protection
  RISC-V Linux User Emulation
  Add symbol table callback interface to load_elf
  RISC-V HTIF Console
  RISC-V HART Array
  SiFive RISC-V CLINT Block
  SiFive RISC-V PLIC Block
  RISC-V Spike Machines
  SiFive RISC-V Test Finisher
  RISC-V VirtIO Machine
  SiFive RISC-V UART Device
  SiFive RISC-V PRCI Block
  SiFive Freedom E Series RISC-V Machine
  SiFive Freedom U Series RISC-V Machine
  RISC-V Build Infrastructure

 MAINTAINERS                            |   11 +
 arch_init.c                            |    2 +
 configure                              |   13 +
 cpus.c                                 |    6 +
 default-configs/riscv32-linux-user.mak |    1 +
 default-configs/riscv32-softmmu.mak    |    4 +
 default-configs/riscv64-linux-user.mak |    1 +
 default-configs/riscv64-softmmu.mak    |    4 +
 disas.c                                |    2 +
 disas/Makefile.objs                    |    1 +
 disas/riscv.c                          | 3048 ++++++++++++++++++++++++++++++++
 fpu/softfloat-specialize.h             |    7 +-
 hw/core/loader.c                       |   18 +-
 hw/riscv/Makefile.objs                 |   11 +
 hw/riscv/riscv_hart.c                  |   89 +
 hw/riscv/riscv_htif.c                  |  258 +++
 hw/riscv/sifive_clint.c                |  254 +++
 hw/riscv/sifive_e.c                    |  234 +++
 hw/riscv/sifive_plic.c                 |  505 ++++++
 hw/riscv/sifive_prci.c                 |   89 +
 hw/riscv/sifive_test.c                 |   93 +
 hw/riscv/sifive_u.c                    |  339 ++++
 hw/riscv/sifive_uart.c                 |  176 ++
 hw/riscv/spike.c                       |  376 ++++
 hw/riscv/virt.c                        |  420 +++++
 include/disas/bfd.h                    |    2 +
 include/elf.h                          |    2 +
 include/hw/elf_ops.h                   |   34 +-
 include/hw/loader.h                    |   17 +-
 include/hw/riscv/riscv_hart.h          |   39 +
 include/hw/riscv/riscv_htif.h          |   61 +
 include/hw/riscv/sifive_clint.h        |   50 +
 include/hw/riscv/sifive_e.h            |   79 +
 include/hw/riscv/sifive_plic.h         |   85 +
 include/hw/riscv/sifive_prci.h         |   37 +
 include/hw/riscv/sifive_test.h         |   42 +
 include/hw/riscv/sifive_u.h            |   69 +
 include/hw/riscv/sifive_uart.h         |   71 +
 include/hw/riscv/spike.h               |   53 +
 include/hw/riscv/virt.h                |   74 +
 include/sysemu/arch_init.h             |    1 +
 linux-user/elfload.c                   |   22 +
 linux-user/main.c                      |   99 ++
 linux-user/riscv/syscall_nr.h          |  287 +++
 linux-user/riscv/target_cpu.h          |   18 +
 linux-user/riscv/target_elf.h          |   14 +
 linux-user/riscv/target_signal.h       |   23 +
 linux-user/riscv/target_structs.h      |   46 +
 linux-user/riscv/target_syscall.h      |   56 +
 linux-user/riscv/termbits.h            |  222 +++
 linux-user/signal.c                    |  203 ++-
 linux-user/syscall.c                   |    2 +
 linux-user/syscall_defs.h              |   13 +-
 qapi-schema.json                       |   17 +-
 scripts/qemu-binfmt-conf.sh            |   13 +-
 target/riscv/Makefile.objs             |    1 +
 target/riscv/cpu.c                     |  432 +++++
 target/riscv/cpu.h                     |  296 ++++
 target/riscv/cpu_bits.h                |  411 +++++
 target/riscv/cpu_user.h                |   13 +
 target/riscv/fpu_helper.c              |  373 ++++
 target/riscv/gdbstub.c                 |   62 +
 target/riscv/helper.c                  |  503 ++++++
 target/riscv/helper.h                  |   78 +
 target/riscv/instmap.h                 |  364 ++++
 target/riscv/op_helper.c               |  669 +++++++
 target/riscv/pmp.c                     |  380 ++++
 target/riscv/pmp.h                     |   64 +
 target/riscv/translate.c               | 1978 +++++++++++++++++++++
 69 files changed, 13310 insertions(+), 27 deletions(-)
 create mode 100644 default-configs/riscv32-linux-user.mak
 create mode 100644 default-configs/riscv32-softmmu.mak
 create mode 100644 default-configs/riscv64-linux-user.mak
 create mode 100644 default-configs/riscv64-softmmu.mak
 create mode 100644 disas/riscv.c
 create mode 100644 hw/riscv/Makefile.objs
 create mode 100644 hw/riscv/riscv_hart.c
 create mode 100644 hw/riscv/riscv_htif.c
 create mode 100644 hw/riscv/sifive_clint.c
 create mode 100644 hw/riscv/sifive_e.c
 create mode 100644 hw/riscv/sifive_plic.c
 create mode 100644 hw/riscv/sifive_prci.c
 create mode 100644 hw/riscv/sifive_test.c
 create mode 100644 hw/riscv/sifive_u.c
 create mode 100644 hw/riscv/sifive_uart.c
 create mode 100644 hw/riscv/spike.c
 create mode 100644 hw/riscv/virt.c
 create mode 100644 include/hw/riscv/riscv_hart.h
 create mode 100644 include/hw/riscv/riscv_htif.h
 create mode 100644 include/hw/riscv/sifive_clint.h
 create mode 100644 include/hw/riscv/sifive_e.h
 create mode 100644 include/hw/riscv/sifive_plic.h
 create mode 100644 include/hw/riscv/sifive_prci.h
 create mode 100644 include/hw/riscv/sifive_test.h
 create mode 100644 include/hw/riscv/sifive_u.h
 create mode 100644 include/hw/riscv/sifive_uart.h
 create mode 100644 include/hw/riscv/spike.h
 create mode 100644 include/hw/riscv/virt.h
 create mode 100644 linux-user/riscv/syscall_nr.h
 create mode 100644 linux-user/riscv/target_cpu.h
 create mode 100644 linux-user/riscv/target_elf.h
 create mode 100644 linux-user/riscv/target_signal.h
 create mode 100644 linux-user/riscv/target_structs.h
 create mode 100644 linux-user/riscv/target_syscall.h
 create mode 100644 linux-user/riscv/termbits.h
 create mode 100644 target/riscv/Makefile.objs
 create mode 100644 target/riscv/cpu.c
 create mode 100644 target/riscv/cpu.h
 create mode 100644 target/riscv/cpu_bits.h
 create mode 100644 target/riscv/cpu_user.h
 create mode 100644 target/riscv/fpu_helper.c
 create mode 100644 target/riscv/gdbstub.c
 create mode 100644 target/riscv/helper.c
 create mode 100644 target/riscv/helper.h
 create mode 100644 target/riscv/instmap.h
 create mode 100644 target/riscv/op_helper.c
 create mode 100644 target/riscv/pmp.c
 create mode 100644 target/riscv/pmp.h
 create mode 100644 target/riscv/translate.c

-- 
2.7.0


Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by no-reply@patchew.org 6 years, 1 month ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1519998711-73430-1-git-send-email-mjc@sifive.com
Subject: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   427cbc7e41..2e7b766594  master     -> master
 * [new tag]               patchew/1519998711-73430-1-git-send-email-mjc@sifive.com -> patchew/1519998711-73430-1-git-send-email-mjc@sifive.com
 t [tag update]            patchew/20171228180814.9749-1-lukeshu@lukeshu.com -> patchew/20171228180814.9749-1-lukeshu@lukeshu.com
Switched to a new branch 'test'
21ffb8bdc0 RISC-V Build Infrastructure
ca5d7c8a1c SiFive Freedom U Series RISC-V Machine
da56267fc5 SiFive Freedom E Series RISC-V Machine
b78021cbc8 SiFive RISC-V PRCI Block
29220fc177 SiFive RISC-V UART Device
1b4ad0c360 RISC-V VirtIO Machine
7cbaa5fca0 SiFive RISC-V Test Finisher
1bd4951f4f RISC-V Spike Machines
21b1a969f4 SiFive RISC-V PLIC Block
20e07d9c45 SiFive RISC-V CLINT Block
6c6815bfc3 RISC-V HART Array
811ef36cf0 RISC-V HTIF Console
b802b6c3ce Add symbol table callback interface to load_elf
5c62396737 RISC-V Linux User Emulation
1989f74d4a RISC-V Physical Memory Protection
0ed6709cf3 RISC-V TCG Code Generation
e72021bda7 RISC-V GDB Stub
edc96cf22a RISC-V FPU Support
ea3e025b4c RISC-V CPU Helpers
3a84b79cb8 RISC-V Disassembler
c64a4f09ac RISC-V CPU Core Definition
1c8b9826bd RISC-V ELF Machine Definition
279429e751 RISC-V Maintainers

=== OUTPUT BEGIN ===
Checking PATCH 1/23: RISC-V Maintainers...
Checking PATCH 2/23: RISC-V ELF Machine Definition...
Checking PATCH 3/23: RISC-V CPU Core Definition...
Checking PATCH 4/23: RISC-V Disassembler...
WARNING: line over 80 characters
#649: FILE: disas/riscv.c:597:
+static const rvc_constraint rvcc_jalr[] = { rvc_rd_eq_ra, rvc_imm_eq_zero, rvc_end };

ERROR: line over 90 characters
#650: FILE: disas/riscv.c:598:
+static const rvc_constraint rvcc_nop[] = { rvc_rd_eq_x0, rvc_rs1_eq_x0, rvc_imm_eq_zero, rvc_end };

WARNING: line over 80 characters
#680: FILE: disas/riscv.c:628:
+static const rvc_constraint rvcc_ret[] = { rvc_rd_eq_x0, rvc_rs1_eq_ra, rvc_end };

WARNING: line over 80 characters
#681: FILE: disas/riscv.c:629:
+static const rvc_constraint rvcc_jr[] = { rvc_rd_eq_x0, rvc_imm_eq_zero, rvc_end };

WARNING: line over 80 characters
#682: FILE: disas/riscv.c:630:
+static const rvc_constraint rvcc_rdcycle[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc00, rvc_end };

WARNING: line over 80 characters
#683: FILE: disas/riscv.c:631:
+static const rvc_constraint rvcc_rdtime[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc01, rvc_end };

ERROR: line over 90 characters
#684: FILE: disas/riscv.c:632:
+static const rvc_constraint rvcc_rdinstret[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc02, rvc_end };

ERROR: line over 90 characters
#685: FILE: disas/riscv.c:633:
+static const rvc_constraint rvcc_rdcycleh[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc80, rvc_end };

WARNING: line over 80 characters
#686: FILE: disas/riscv.c:634:
+static const rvc_constraint rvcc_rdtimeh[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc81, rvc_end };

ERROR: line over 90 characters
#687: FILE: disas/riscv.c:635:
+static const rvc_constraint rvcc_rdinstreth[] = { rvc_rs1_eq_x0, rvc_csr_eq_0xc80, rvc_end };

WARNING: line over 80 characters
#688: FILE: disas/riscv.c:636:
+static const rvc_constraint rvcc_frcsr[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x003, rvc_end };

WARNING: line over 80 characters
#689: FILE: disas/riscv.c:637:
+static const rvc_constraint rvcc_frrm[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x002, rvc_end };

WARNING: line over 80 characters
#690: FILE: disas/riscv.c:638:
+static const rvc_constraint rvcc_frflags[] = { rvc_rs1_eq_x0, rvc_csr_eq_0x001, rvc_end };

ERROR: line over 90 characters
#1089: FILE: disas/riscv.c:1037:
+    { "c.addi4spn", rv_codec_ciw_4spn, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

WARNING: line over 80 characters
#1090: FILE: disas/riscv.c:1038:
+    { "c.fld", rv_codec_cl_ld, rv_fmt_frd_offset_rs1, NULL, rv_op_fld, rv_op_fld, 0 },

WARNING: line over 80 characters
#1091: FILE: disas/riscv.c:1039:
+    { "c.lw", rv_codec_cl_lw, rv_fmt_rd_offset_rs1, NULL, rv_op_lw, rv_op_lw, rv_op_lw },

WARNING: line over 80 characters
#1093: FILE: disas/riscv.c:1041:
+    { "c.fsd", rv_codec_cs_sd, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd, rv_op_fsd, 0 },

WARNING: line over 80 characters
#1094: FILE: disas/riscv.c:1042:
+    { "c.sw", rv_codec_cs_sw, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw, rv_op_sw, rv_op_sw },

WARNING: line over 80 characters
#1096: FILE: disas/riscv.c:1044:
+    { "c.nop", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

ERROR: line over 90 characters
#1097: FILE: disas/riscv.c:1045:
+    { "c.addi", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

ERROR: line over 90 characters
#1099: FILE: disas/riscv.c:1047:
+    { "c.li", rv_codec_ci_li, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

ERROR: line over 90 characters
#1100: FILE: disas/riscv.c:1048:
+    { "c.addi16sp", rv_codec_ci_16sp, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

WARNING: line over 80 characters
#1101: FILE: disas/riscv.c:1049:
+    { "c.lui", rv_codec_ci_lui, rv_fmt_rd_imm, NULL, rv_op_lui, rv_op_lui, rv_op_lui },

ERROR: line over 90 characters
#1102: FILE: disas/riscv.c:1050:
+    { "c.srli", rv_codec_cb_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_srli, rv_op_srli, rv_op_srli },

ERROR: line over 90 characters
#1103: FILE: disas/riscv.c:1051:
+    { "c.srai", rv_codec_cb_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_srai, rv_op_srai, rv_op_srai },

ERROR: line over 90 characters
#1104: FILE: disas/riscv.c:1052:
+    { "c.andi", rv_codec_cb_imm, rv_fmt_rd_rs1_imm, NULL, rv_op_andi, rv_op_andi, rv_op_andi },

WARNING: line over 80 characters
#1105: FILE: disas/riscv.c:1053:
+    { "c.sub", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_sub, rv_op_sub, rv_op_sub },

WARNING: line over 80 characters
#1106: FILE: disas/riscv.c:1054:
+    { "c.xor", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_xor, rv_op_xor, rv_op_xor },

WARNING: line over 80 characters
#1107: FILE: disas/riscv.c:1055:
+    { "c.or", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_or, rv_op_or, rv_op_or },

WARNING: line over 80 characters
#1108: FILE: disas/riscv.c:1056:
+    { "c.and", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_and, rv_op_and, rv_op_and },

ERROR: line over 90 characters
#1109: FILE: disas/riscv.c:1057:
+    { "c.subw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_subw, rv_op_subw, rv_op_subw },

ERROR: line over 90 characters
#1110: FILE: disas/riscv.c:1058:
+    { "c.addw", rv_codec_cs, rv_fmt_rd_rs1_rs2, NULL, rv_op_addw, rv_op_addw, rv_op_addw },

WARNING: line over 80 characters
#1111: FILE: disas/riscv.c:1059:
+    { "c.j", rv_codec_cj, rv_fmt_rd_offset, NULL, rv_op_jal, rv_op_jal, rv_op_jal },

ERROR: line over 90 characters
#1112: FILE: disas/riscv.c:1060:
+    { "c.beqz", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_beq, rv_op_beq, rv_op_beq },

ERROR: line over 90 characters
#1113: FILE: disas/riscv.c:1061:
+    { "c.bnez", rv_codec_cb, rv_fmt_rs1_rs2_offset, NULL, rv_op_bne, rv_op_bne, rv_op_bne },

ERROR: line over 90 characters
#1114: FILE: disas/riscv.c:1062:
+    { "c.slli", rv_codec_ci_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_slli, rv_op_slli, rv_op_slli },

ERROR: line over 90 characters
#1115: FILE: disas/riscv.c:1063:
+    { "c.fldsp", rv_codec_ci_ldsp, rv_fmt_frd_offset_rs1, NULL, rv_op_fld, rv_op_fld, rv_op_fld },

ERROR: line over 90 characters
#1116: FILE: disas/riscv.c:1064:
+    { "c.lwsp", rv_codec_ci_lwsp, rv_fmt_rd_offset_rs1, NULL, rv_op_lw, rv_op_lw, rv_op_lw },

WARNING: line over 80 characters
#1117: FILE: disas/riscv.c:1065:
+    { "c.flwsp", rv_codec_ci_lwsp, rv_fmt_frd_offset_rs1, NULL, rv_op_flw, 0, 0 },

ERROR: line over 90 characters
#1118: FILE: disas/riscv.c:1066:
+    { "c.jr", rv_codec_cr_jr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr, rv_op_jalr, rv_op_jalr },

ERROR: line over 90 characters
#1119: FILE: disas/riscv.c:1067:
+    { "c.mv", rv_codec_cr_mv, rv_fmt_rd_rs1_rs2, NULL, rv_op_addi, rv_op_addi, rv_op_addi },

ERROR: line over 90 characters
#1120: FILE: disas/riscv.c:1068:
+    { "c.ebreak", rv_codec_ci_none, rv_fmt_none, NULL, rv_op_ebreak, rv_op_ebreak, rv_op_ebreak },

ERROR: line over 90 characters
#1121: FILE: disas/riscv.c:1069:
+    { "c.jalr", rv_codec_cr_jalr, rv_fmt_rd_rs1_offset, NULL, rv_op_jalr, rv_op_jalr, rv_op_jalr },

WARNING: line over 80 characters
#1122: FILE: disas/riscv.c:1070:
+    { "c.add", rv_codec_cr, rv_fmt_rd_rs1_rs2, NULL, rv_op_add, rv_op_add, rv_op_add },

ERROR: line over 90 characters
#1123: FILE: disas/riscv.c:1071:
+    { "c.fsdsp", rv_codec_css_sdsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsd, rv_op_fsd, rv_op_fsd },

ERROR: line over 90 characters
#1124: FILE: disas/riscv.c:1072:
+    { "c.swsp", rv_codec_css_swsp, rv_fmt_rs2_offset_rs1, NULL, rv_op_sw, rv_op_sw, rv_op_sw },

WARNING: line over 80 characters
#1125: FILE: disas/riscv.c:1073:
+    { "c.fswsp", rv_codec_css_swsp, rv_fmt_frs2_offset_rs1, NULL, rv_op_fsw, 0, 0 },

WARNING: line over 80 characters
#1126: FILE: disas/riscv.c:1074:
+    { "c.ld", rv_codec_cl_ld, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld, rv_op_ld },

WARNING: line over 80 characters
#1127: FILE: disas/riscv.c:1075:
+    { "c.sd", rv_codec_cs_sd, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd, rv_op_sd },

WARNING: line over 80 characters
#1128: FILE: disas/riscv.c:1076:
+    { "c.addiw", rv_codec_ci, rv_fmt_rd_rs1_imm, NULL, 0, rv_op_addiw, rv_op_addiw },

WARNING: line over 80 characters
#1129: FILE: disas/riscv.c:1077:
+    { "c.ldsp", rv_codec_ci_ldsp, rv_fmt_rd_offset_rs1, NULL, 0, rv_op_ld, rv_op_ld },

WARNING: line over 80 characters
#1130: FILE: disas/riscv.c:1078:
+    { "c.sdsp", rv_codec_css_sdsp, rv_fmt_rs2_offset_rs1, NULL, 0, rv_op_sd, rv_op_sd },

WARNING: line over 80 characters
#1134: FILE: disas/riscv.c:1082:
+    { "c.sqsp", rv_codec_css_sqsp, rv_fmt_rs2_offset_rs1, NULL, 0, 0, rv_op_sq },

ERROR: trailing statements should be on next line
#1399: FILE: disas/riscv.c:1347:
+        case 0: op = rv_op_c_addi4spn; break;

ERROR: trailing statements should be on next line
#1407: FILE: disas/riscv.c:1355:
+        case 2: op = rv_op_c_lw; break;

ERROR: trailing statements should be on next line
#1422: FILE: disas/riscv.c:1370:
+        case 6: op = rv_op_c_sw; break;

ERROR: trailing statements should be on next line
#1436: FILE: disas/riscv.c:1384:
+            case 0: op = rv_op_c_nop; break;

ERROR: trailing statements should be on next line
#1437: FILE: disas/riscv.c:1385:
+            default: op = rv_op_c_addi; break;

ERROR: trailing statements should be on next line
#1447: FILE: disas/riscv.c:1395:
+        case 2: op = rv_op_c_li; break;

ERROR: trailing statements should be on next line
#1450: FILE: disas/riscv.c:1398:
+            case 2: op = rv_op_c_addi16sp; break;

ERROR: trailing statements should be on next line
#1451: FILE: disas/riscv.c:1399:
+            default: op = rv_op_c_lui; break;

ERROR: trailing statements should be on next line
#1462: FILE: disas/riscv.c:1410:
+            case 2: op = rv_op_c_andi; break;

ERROR: trailing statements should be on next line
#1465: FILE: disas/riscv.c:1413:
+                case 0: op = rv_op_c_sub; break;

ERROR: trailing statements should be on next line
#1466: FILE: disas/riscv.c:1414:
+                case 1: op = rv_op_c_xor; break;

ERROR: trailing statements should be on next line
#1467: FILE: disas/riscv.c:1415:
+                case 2: op = rv_op_c_or; break;

ERROR: trailing statements should be on next line
#1468: FILE: disas/riscv.c:1416:
+                case 3: op = rv_op_c_and; break;

ERROR: trailing statements should be on next line
#1469: FILE: disas/riscv.c:1417:
+                case 4: op = rv_op_c_subw; break;

ERROR: trailing statements should be on next line
#1470: FILE: disas/riscv.c:1418:
+                case 5: op = rv_op_c_addw; break;

ERROR: trailing statements should be on next line
#1475: FILE: disas/riscv.c:1423:
+        case 5: op = rv_op_c_j; break;

ERROR: trailing statements should be on next line
#1476: FILE: disas/riscv.c:1424:
+        case 6: op = rv_op_c_beqz; break;

ERROR: trailing statements should be on next line
#1477: FILE: disas/riscv.c:1425:
+        case 7: op = rv_op_c_bnez; break;

ERROR: trailing statements should be on next line
#1492: FILE: disas/riscv.c:1440:
+        case 2: op = rv_op_c_lwsp; break;

ERROR: trailing statements should be on next line
#1504: FILE: disas/riscv.c:1452:
+                case 0: op = rv_op_c_jr; break;

ERROR: trailing statements should be on next line
#1505: FILE: disas/riscv.c:1453:
+                default: op = rv_op_c_mv; break;

ERROR: trailing statements should be on next line
#1512: FILE: disas/riscv.c:1460:
+                    case 0: op = rv_op_c_ebreak; break;

ERROR: trailing statements should be on next line
#1513: FILE: disas/riscv.c:1461:
+                    default: op = rv_op_c_jalr; break;

ERROR: trailing statements should be on next line
#1516: FILE: disas/riscv.c:1464:
+                default: op = rv_op_c_add; break;

ERROR: trailing statements should be on next line
#1527: FILE: disas/riscv.c:1475:
+        case 6: op = rv_op_c_swsp; break;

ERROR: trailing statements should be on next line
#1541: FILE: disas/riscv.c:1489:
+            case 0: op = rv_op_lb; break;

ERROR: trailing statements should be on next line
#1542: FILE: disas/riscv.c:1490:
+            case 1: op = rv_op_lh; break;

ERROR: trailing statements should be on next line
#1543: FILE: disas/riscv.c:1491:
+            case 2: op = rv_op_lw; break;

ERROR: trailing statements should be on next line
#1544: FILE: disas/riscv.c:1492:
+            case 3: op = rv_op_ld; break;

ERROR: trailing statements should be on next line
#1545: FILE: disas/riscv.c:1493:
+            case 4: op = rv_op_lbu; break;

ERROR: trailing statements should be on next line
#1546: FILE: disas/riscv.c:1494:
+            case 5: op = rv_op_lhu; break;

ERROR: trailing statements should be on next line
#1547: FILE: disas/riscv.c:1495:
+            case 6: op = rv_op_lwu; break;

ERROR: trailing statements should be on next line
#1548: FILE: disas/riscv.c:1496:
+            case 7: op = rv_op_ldu; break;

ERROR: trailing statements should be on next line
#1553: FILE: disas/riscv.c:1501:
+            case 2: op = rv_op_flw; break;

ERROR: trailing statements should be on next line
#1554: FILE: disas/riscv.c:1502:
+            case 3: op = rv_op_fld; break;

ERROR: trailing statements should be on next line
#1555: FILE: disas/riscv.c:1503:
+            case 4: op = rv_op_flq; break;

ERROR: trailing statements should be on next line
#1560: FILE: disas/riscv.c:1508:
+            case 0: op = rv_op_fence; break;

ERROR: trailing statements should be on next line
#1561: FILE: disas/riscv.c:1509:
+            case 1: op = rv_op_fence_i; break;

ERROR: trailing statements should be on next line
#1562: FILE: disas/riscv.c:1510:
+            case 2: op = rv_op_lq; break;

ERROR: trailing statements should be on next line
#1567: FILE: disas/riscv.c:1515:
+            case 0: op = rv_op_addi; break;

ERROR: trailing statements should be on next line
#1570: FILE: disas/riscv.c:1518:
+                case 0: op = rv_op_slli; break;

ERROR: trailing statements should be on next line
#1573: FILE: disas/riscv.c:1521:
+            case 2: op = rv_op_slti; break;

ERROR: trailing statements should be on next line
#1574: FILE: disas/riscv.c:1522:
+            case 3: op = rv_op_sltiu; break;

ERROR: trailing statements should be on next line
#1575: FILE: disas/riscv.c:1523:
+            case 4: op = rv_op_xori; break;

ERROR: trailing statements should be on next line
#1578: FILE: disas/riscv.c:1526:
+                case 0: op = rv_op_srli; break;

ERROR: trailing statements should be on next line
#1579: FILE: disas/riscv.c:1527:
+                case 8: op = rv_op_srai; break;

ERROR: trailing statements should be on next line
#1582: FILE: disas/riscv.c:1530:
+            case 6: op = rv_op_ori; break;

ERROR: trailing statements should be on next line
#1583: FILE: disas/riscv.c:1531:
+            case 7: op = rv_op_andi; break;

ERROR: trailing statements should be on next line
#1586: FILE: disas/riscv.c:1534:
+        case 5: op = rv_op_auipc; break;

ERROR: trailing statements should be on next line
#1589: FILE: disas/riscv.c:1537:
+            case 0: op = rv_op_addiw; break;

ERROR: trailing statements should be on next line
#1592: FILE: disas/riscv.c:1540:
+                case 0: op = rv_op_slliw; break;

ERROR: trailing statements should be on next line
#1597: FILE: disas/riscv.c:1545:
+                case 0: op = rv_op_srliw; break;

ERROR: trailing statements should be on next line
#1598: FILE: disas/riscv.c:1546:
+                case 32: op = rv_op_sraiw; break;

ERROR: trailing statements should be on next line
#1605: FILE: disas/riscv.c:1553:
+            case 0: op = rv_op_sb; break;

ERROR: trailing statements should be on next line
#1606: FILE: disas/riscv.c:1554:
+            case 1: op = rv_op_sh; break;

ERROR: trailing statements should be on next line
#1607: FILE: disas/riscv.c:1555:
+            case 2: op = rv_op_sw; break;

ERROR: trailing statements should be on next line
#1608: FILE: disas/riscv.c:1556:
+            case 3: op = rv_op_sd; break;

ERROR: trailing statements should be on next line
#1609: FILE: disas/riscv.c:1557:
+            case 4: op = rv_op_sq; break;

ERROR: trailing statements should be on next line
#1614: FILE: disas/riscv.c:1562:
+            case 2: op = rv_op_fsw; break;

ERROR: trailing statements should be on next line
#1615: FILE: disas/riscv.c:1563:
+            case 3: op = rv_op_fsd; break;

ERROR: trailing statements should be on next line
#1616: FILE: disas/riscv.c:1564:
+            case 4: op = rv_op_fsq; break;

ERROR: trailing statements should be on next line
#1621: FILE: disas/riscv.c:1569:
+            case 2: op = rv_op_amoadd_w; break;

ERROR: trailing statements should be on next line
#1622: FILE: disas/riscv.c:1570:
+            case 3: op = rv_op_amoadd_d; break;

ERROR: trailing statements should be on next line
#1623: FILE: disas/riscv.c:1571:
+            case 4: op = rv_op_amoadd_q; break;

ERROR: trailing statements should be on next line
#1624: FILE: disas/riscv.c:1572:
+            case 10: op = rv_op_amoswap_w; break;

ERROR: trailing statements should be on next line
#1625: FILE: disas/riscv.c:1573:
+            case 11: op = rv_op_amoswap_d; break;

ERROR: trailing statements should be on next line
#1626: FILE: disas/riscv.c:1574:
+            case 12: op = rv_op_amoswap_q; break;

ERROR: trailing statements should be on next line
#1629: FILE: disas/riscv.c:1577:
+                case 0: op = rv_op_lr_w; break;

ERROR: trailing statements should be on next line
#1634: FILE: disas/riscv.c:1582:
+                case 0: op = rv_op_lr_d; break;

ERROR: trailing statements should be on next line
#1639: FILE: disas/riscv.c:1587:
+                case 0: op = rv_op_lr_q; break;

ERROR: trailing statements should be on next line
#1642: FILE: disas/riscv.c:1590:
+            case 26: op = rv_op_sc_w; break;

ERROR: trailing statements should be on next line
#1643: FILE: disas/riscv.c:1591:
+            case 27: op = rv_op_sc_d; break;

ERROR: trailing statements should be on next line
#1644: FILE: disas/riscv.c:1592:
+            case 28: op = rv_op_sc_q; break;

ERROR: trailing statements should be on next line
#1645: FILE: disas/riscv.c:1593:
+            case 34: op = rv_op_amoxor_w; break;

ERROR: trailing statements should be on next line
#1646: FILE: disas/riscv.c:1594:
+            case 35: op = rv_op_amoxor_d; break;

ERROR: trailing statements should be on next line
#1647: FILE: disas/riscv.c:1595:
+            case 36: op = rv_op_amoxor_q; break;

ERROR: trailing statements should be on next line
#1648: FILE: disas/riscv.c:1596:
+            case 66: op = rv_op_amoor_w; break;

ERROR: trailing statements should be on next line
#1649: FILE: disas/riscv.c:1597:
+            case 67: op = rv_op_amoor_d; break;

ERROR: trailing statements should be on next line
#1650: FILE: disas/riscv.c:1598:
+            case 68: op = rv_op_amoor_q; break;

ERROR: trailing statements should be on next line
#1651: FILE: disas/riscv.c:1599:
+            case 98: op = rv_op_amoand_w; break;

ERROR: trailing statements should be on next line
#1652: FILE: disas/riscv.c:1600:
+            case 99: op = rv_op_amoand_d; break;

ERROR: trailing statements should be on next line
#1653: FILE: disas/riscv.c:1601:
+            case 100: op = rv_op_amoand_q; break;

ERROR: trailing statements should be on next line
#1654: FILE: disas/riscv.c:1602:
+            case 130: op = rv_op_amomin_w; break;

ERROR: trailing statements should be on next line
#1655: FILE: disas/riscv.c:1603:
+            case 131: op = rv_op_amomin_d; break;

ERROR: trailing statements should be on next line
#1656: FILE: disas/riscv.c:1604:
+            case 132: op = rv_op_amomin_q; break;

ERROR: trailing statements should be on next line
#1657: FILE: disas/riscv.c:1605:
+            case 162: op = rv_op_amomax_w; break;

ERROR: trailing statements should be on next line
#1658: FILE: disas/riscv.c:1606:
+            case 163: op = rv_op_amomax_d; break;

ERROR: trailing statements should be on next line
#1659: FILE: disas/riscv.c:1607:
+            case 164: op = rv_op_amomax_q; break;

ERROR: trailing statements should be on next line
#1660: FILE: disas/riscv.c:1608:
+            case 194: op = rv_op_amominu_w; break;

ERROR: trailing statements should be on next line
#1661: FILE: disas/riscv.c:1609:
+            case 195: op = rv_op_amominu_d; break;

ERROR: trailing statements should be on next line
#1662: FILE: disas/riscv.c:1610:
+            case 196: op = rv_op_amominu_q; break;

ERROR: trailing statements should be on next line
#1663: FILE: disas/riscv.c:1611:
+            case 226: op = rv_op_amomaxu_w; break;

ERROR: trailing statements should be on next line
#1664: FILE: disas/riscv.c:1612:
+            case 227: op = rv_op_amomaxu_d; break;

ERROR: trailing statements should be on next line
#1665: FILE: disas/riscv.c:1613:
+            case 228: op = rv_op_amomaxu_q; break;

WARNING: line over 80 characters
#1669: FILE: disas/riscv.c:1617:
+            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {

ERROR: trailing statements should be on next line
#1670: FILE: disas/riscv.c:1618:
+            case 0: op = rv_op_add; break;

ERROR: trailing statements should be on next line
#1671: FILE: disas/riscv.c:1619:
+            case 1: op = rv_op_sll; break;

ERROR: trailing statements should be on next line
#1672: FILE: disas/riscv.c:1620:
+            case 2: op = rv_op_slt; break;

ERROR: trailing statements should be on next line
#1673: FILE: disas/riscv.c:1621:
+            case 3: op = rv_op_sltu; break;

ERROR: trailing statements should be on next line
#1674: FILE: disas/riscv.c:1622:
+            case 4: op = rv_op_xor; break;

ERROR: trailing statements should be on next line
#1675: FILE: disas/riscv.c:1623:
+            case 5: op = rv_op_srl; break;

ERROR: trailing statements should be on next line
#1676: FILE: disas/riscv.c:1624:
+            case 6: op = rv_op_or; break;

ERROR: trailing statements should be on next line
#1677: FILE: disas/riscv.c:1625:
+            case 7: op = rv_op_and; break;

ERROR: trailing statements should be on next line
#1678: FILE: disas/riscv.c:1626:
+            case 8: op = rv_op_mul; break;

ERROR: trailing statements should be on next line
#1679: FILE: disas/riscv.c:1627:
+            case 9: op = rv_op_mulh; break;

ERROR: trailing statements should be on next line
#1680: FILE: disas/riscv.c:1628:
+            case 10: op = rv_op_mulhsu; break;

ERROR: trailing statements should be on next line
#1681: FILE: disas/riscv.c:1629:
+            case 11: op = rv_op_mulhu; break;

ERROR: trailing statements should be on next line
#1682: FILE: disas/riscv.c:1630:
+            case 12: op = rv_op_div; break;

ERROR: trailing statements should be on next line
#1683: FILE: disas/riscv.c:1631:
+            case 13: op = rv_op_divu; break;

ERROR: trailing statements should be on next line
#1684: FILE: disas/riscv.c:1632:
+            case 14: op = rv_op_rem; break;

ERROR: trailing statements should be on next line
#1685: FILE: disas/riscv.c:1633:
+            case 15: op = rv_op_remu; break;

ERROR: trailing statements should be on next line
#1686: FILE: disas/riscv.c:1634:
+            case 256: op = rv_op_sub; break;

ERROR: trailing statements should be on next line
#1687: FILE: disas/riscv.c:1635:
+            case 261: op = rv_op_sra; break;

ERROR: trailing statements should be on next line
#1690: FILE: disas/riscv.c:1638:
+        case 13: op = rv_op_lui; break;

WARNING: line over 80 characters
#1692: FILE: disas/riscv.c:1640:
+            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {

ERROR: trailing statements should be on next line
#1693: FILE: disas/riscv.c:1641:
+            case 0: op = rv_op_addw; break;

ERROR: trailing statements should be on next line
#1694: FILE: disas/riscv.c:1642:
+            case 1: op = rv_op_sllw; break;

ERROR: trailing statements should be on next line
#1695: FILE: disas/riscv.c:1643:
+            case 5: op = rv_op_srlw; break;

ERROR: trailing statements should be on next line
#1696: FILE: disas/riscv.c:1644:
+            case 8: op = rv_op_mulw; break;

ERROR: trailing statements should be on next line
#1697: FILE: disas/riscv.c:1645:
+            case 12: op = rv_op_divw; break;

ERROR: trailing statements should be on next line
#1698: FILE: disas/riscv.c:1646:
+            case 13: op = rv_op_divuw; break;

ERROR: trailing statements should be on next line
#1699: FILE: disas/riscv.c:1647:
+            case 14: op = rv_op_remw; break;

ERROR: trailing statements should be on next line
#1700: FILE: disas/riscv.c:1648:
+            case 15: op = rv_op_remuw; break;

ERROR: trailing statements should be on next line
#1701: FILE: disas/riscv.c:1649:
+            case 256: op = rv_op_subw; break;

ERROR: trailing statements should be on next line
#1702: FILE: disas/riscv.c:1650:
+            case 261: op = rv_op_sraw; break;

ERROR: trailing statements should be on next line
#1707: FILE: disas/riscv.c:1655:
+            case 0: op = rv_op_fmadd_s; break;

ERROR: trailing statements should be on next line
#1708: FILE: disas/riscv.c:1656:
+            case 1: op = rv_op_fmadd_d; break;

ERROR: trailing statements should be on next line
#1709: FILE: disas/riscv.c:1657:
+            case 3: op = rv_op_fmadd_q; break;

ERROR: trailing statements should be on next line
#1714: FILE: disas/riscv.c:1662:
+            case 0: op = rv_op_fmsub_s; break;

ERROR: trailing statements should be on next line
#1715: FILE: disas/riscv.c:1663:
+            case 1: op = rv_op_fmsub_d; break;

ERROR: trailing statements should be on next line
#1716: FILE: disas/riscv.c:1664:
+            case 3: op = rv_op_fmsub_q; break;

ERROR: trailing statements should be on next line
#1721: FILE: disas/riscv.c:1669:
+            case 0: op = rv_op_fnmsub_s; break;

ERROR: trailing statements should be on next line
#1722: FILE: disas/riscv.c:1670:
+            case 1: op = rv_op_fnmsub_d; break;

ERROR: trailing statements should be on next line
#1723: FILE: disas/riscv.c:1671:
+            case 3: op = rv_op_fnmsub_q; break;

ERROR: trailing statements should be on next line
#1728: FILE: disas/riscv.c:1676:
+            case 0: op = rv_op_fnmadd_s; break;

ERROR: trailing statements should be on next line
#1729: FILE: disas/riscv.c:1677:
+            case 1: op = rv_op_fnmadd_d; break;

ERROR: trailing statements should be on next line
#1730: FILE: disas/riscv.c:1678:
+            case 3: op = rv_op_fnmadd_q; break;

ERROR: trailing statements should be on next line
#1735: FILE: disas/riscv.c:1683:
+            case 0: op = rv_op_fadd_s; break;

ERROR: trailing statements should be on next line
#1736: FILE: disas/riscv.c:1684:
+            case 1: op = rv_op_fadd_d; break;

ERROR: trailing statements should be on next line
#1737: FILE: disas/riscv.c:1685:
+            case 3: op = rv_op_fadd_q; break;

ERROR: trailing statements should be on next line
#1738: FILE: disas/riscv.c:1686:
+            case 4: op = rv_op_fsub_s; break;

ERROR: trailing statements should be on next line
#1739: FILE: disas/riscv.c:1687:
+            case 5: op = rv_op_fsub_d; break;

ERROR: trailing statements should be on next line
#1740: FILE: disas/riscv.c:1688:
+            case 7: op = rv_op_fsub_q; break;

ERROR: trailing statements should be on next line
#1741: FILE: disas/riscv.c:1689:
+            case 8: op = rv_op_fmul_s; break;

ERROR: trailing statements should be on next line
#1742: FILE: disas/riscv.c:1690:
+            case 9: op = rv_op_fmul_d; break;

ERROR: trailing statements should be on next line
#1743: FILE: disas/riscv.c:1691:
+            case 11: op = rv_op_fmul_q; break;

ERROR: trailing statements should be on next line
#1744: FILE: disas/riscv.c:1692:
+            case 12: op = rv_op_fdiv_s; break;

ERROR: trailing statements should be on next line
#1745: FILE: disas/riscv.c:1693:
+            case 13: op = rv_op_fdiv_d; break;

ERROR: trailing statements should be on next line
#1746: FILE: disas/riscv.c:1694:
+            case 15: op = rv_op_fdiv_q; break;

ERROR: trailing statements should be on next line
#1749: FILE: disas/riscv.c:1697:
+                case 0: op = rv_op_fsgnj_s; break;

ERROR: trailing statements should be on next line
#1750: FILE: disas/riscv.c:1698:
+                case 1: op = rv_op_fsgnjn_s; break;

ERROR: trailing statements should be on next line
#1751: FILE: disas/riscv.c:1699:
+                case 2: op = rv_op_fsgnjx_s; break;

ERROR: trailing statements should be on next line
#1756: FILE: disas/riscv.c:1704:
+                case 0: op = rv_op_fsgnj_d; break;

ERROR: trailing statements should be on next line
#1757: FILE: disas/riscv.c:1705:
+                case 1: op = rv_op_fsgnjn_d; break;

ERROR: trailing statements should be on next line
#1758: FILE: disas/riscv.c:1706:
+                case 2: op = rv_op_fsgnjx_d; break;

ERROR: trailing statements should be on next line
#1763: FILE: disas/riscv.c:1711:
+                case 0: op = rv_op_fsgnj_q; break;

ERROR: trailing statements should be on next line
#1764: FILE: disas/riscv.c:1712:
+                case 1: op = rv_op_fsgnjn_q; break;

ERROR: trailing statements should be on next line
#1765: FILE: disas/riscv.c:1713:
+                case 2: op = rv_op_fsgnjx_q; break;

ERROR: trailing statements should be on next line
#1770: FILE: disas/riscv.c:1718:
+                case 0: op = rv_op_fmin_s; break;

ERROR: trailing statements should be on next line
#1771: FILE: disas/riscv.c:1719:
+                case 1: op = rv_op_fmax_s; break;

ERROR: trailing statements should be on next line
#1776: FILE: disas/riscv.c:1724:
+                case 0: op = rv_op_fmin_d; break;

ERROR: trailing statements should be on next line
#1777: FILE: disas/riscv.c:1725:
+                case 1: op = rv_op_fmax_d; break;

ERROR: trailing statements should be on next line
#1782: FILE: disas/riscv.c:1730:
+                case 0: op = rv_op_fmin_q; break;

ERROR: trailing statements should be on next line
#1783: FILE: disas/riscv.c:1731:
+                case 1: op = rv_op_fmax_q; break;

ERROR: trailing statements should be on next line
#1788: FILE: disas/riscv.c:1736:
+                case 1: op = rv_op_fcvt_s_d; break;

ERROR: trailing statements should be on next line
#1789: FILE: disas/riscv.c:1737:
+                case 3: op = rv_op_fcvt_s_q; break;

ERROR: trailing statements should be on next line
#1794: FILE: disas/riscv.c:1742:
+                case 0: op = rv_op_fcvt_d_s; break;

ERROR: trailing statements should be on next line
#1795: FILE: disas/riscv.c:1743:
+                case 3: op = rv_op_fcvt_d_q; break;

ERROR: trailing statements should be on next line
#1800: FILE: disas/riscv.c:1748:
+                case 0: op = rv_op_fcvt_q_s; break;

ERROR: trailing statements should be on next line
#1801: FILE: disas/riscv.c:1749:
+                case 1: op = rv_op_fcvt_q_d; break;

ERROR: trailing statements should be on next line
#1806: FILE: disas/riscv.c:1754:
+                case 0: op = rv_op_fsqrt_s; break;

ERROR: trailing statements should be on next line
#1811: FILE: disas/riscv.c:1759:
+                case 0: op = rv_op_fsqrt_d; break;

ERROR: trailing statements should be on next line
#1816: FILE: disas/riscv.c:1764:
+                case 0: op = rv_op_fsqrt_q; break;

ERROR: trailing statements should be on next line
#1821: FILE: disas/riscv.c:1769:
+                case 0: op = rv_op_fle_s; break;

ERROR: trailing statements should be on next line
#1822: FILE: disas/riscv.c:1770:
+                case 1: op = rv_op_flt_s; break;

ERROR: trailing statements should be on next line
#1823: FILE: disas/riscv.c:1771:
+                case 2: op = rv_op_feq_s; break;

ERROR: trailing statements should be on next line
#1828: FILE: disas/riscv.c:1776:
+                case 0: op = rv_op_fle_d; break;

ERROR: trailing statements should be on next line
#1829: FILE: disas/riscv.c:1777:
+                case 1: op = rv_op_flt_d; break;

ERROR: trailing statements should be on next line
#1830: FILE: disas/riscv.c:1778:
+                case 2: op = rv_op_feq_d; break;

ERROR: trailing statements should be on next line
#1835: FILE: disas/riscv.c:1783:
+                case 0: op = rv_op_fle_q; break;

ERROR: trailing statements should be on next line
#1836: FILE: disas/riscv.c:1784:
+                case 1: op = rv_op_flt_q; break;

ERROR: trailing statements should be on next line
#1837: FILE: disas/riscv.c:1785:
+                case 2: op = rv_op_feq_q; break;

ERROR: trailing statements should be on next line
#1842: FILE: disas/riscv.c:1790:
+                case 0: op = rv_op_fcvt_w_s; break;

ERROR: trailing statements should be on next line
#1843: FILE: disas/riscv.c:1791:
+                case 1: op = rv_op_fcvt_wu_s; break;

ERROR: trailing statements should be on next line
#1844: FILE: disas/riscv.c:1792:
+                case 2: op = rv_op_fcvt_l_s; break;

ERROR: trailing statements should be on next line
#1845: FILE: disas/riscv.c:1793:
+                case 3: op = rv_op_fcvt_lu_s; break;

ERROR: trailing statements should be on next line
#1850: FILE: disas/riscv.c:1798:
+                case 0: op = rv_op_fcvt_w_d; break;

ERROR: trailing statements should be on next line
#1851: FILE: disas/riscv.c:1799:
+                case 1: op = rv_op_fcvt_wu_d; break;

ERROR: trailing statements should be on next line
#1852: FILE: disas/riscv.c:1800:
+                case 2: op = rv_op_fcvt_l_d; break;

ERROR: trailing statements should be on next line
#1853: FILE: disas/riscv.c:1801:
+                case 3: op = rv_op_fcvt_lu_d; break;

ERROR: trailing statements should be on next line
#1858: FILE: disas/riscv.c:1806:
+                case 0: op = rv_op_fcvt_w_q; break;

ERROR: trailing statements should be on next line
#1859: FILE: disas/riscv.c:1807:
+                case 1: op = rv_op_fcvt_wu_q; break;

ERROR: trailing statements should be on next line
#1860: FILE: disas/riscv.c:1808:
+                case 2: op = rv_op_fcvt_l_q; break;

ERROR: trailing statements should be on next line
#1861: FILE: disas/riscv.c:1809:
+                case 3: op = rv_op_fcvt_lu_q; break;

ERROR: trailing statements should be on next line
#1866: FILE: disas/riscv.c:1814:
+                case 0: op = rv_op_fcvt_s_w; break;

ERROR: trailing statements should be on next line
#1867: FILE: disas/riscv.c:1815:
+                case 1: op = rv_op_fcvt_s_wu; break;

ERROR: trailing statements should be on next line
#1868: FILE: disas/riscv.c:1816:
+                case 2: op = rv_op_fcvt_s_l; break;

ERROR: trailing statements should be on next line
#1869: FILE: disas/riscv.c:1817:
+                case 3: op = rv_op_fcvt_s_lu; break;

ERROR: trailing statements should be on next line
#1874: FILE: disas/riscv.c:1822:
+                case 0: op = rv_op_fcvt_d_w; break;

ERROR: trailing statements should be on next line
#1875: FILE: disas/riscv.c:1823:
+                case 1: op = rv_op_fcvt_d_wu; break;

ERROR: trailing statements should be on next line
#1876: FILE: disas/riscv.c:1824:
+                case 2: op = rv_op_fcvt_d_l; break;

ERROR: trailing statements should be on next line
#1877: FILE: disas/riscv.c:1825:
+                case 3: op = rv_op_fcvt_d_lu; break;

ERROR: trailing statements should be on next line
#1882: FILE: disas/riscv.c:1830:
+                case 0: op = rv_op_fcvt_q_w; break;

ERROR: trailing statements should be on next line
#1883: FILE: disas/riscv.c:1831:
+                case 1: op = rv_op_fcvt_q_wu; break;

ERROR: trailing statements should be on next line
#1884: FILE: disas/riscv.c:1832:
+                case 2: op = rv_op_fcvt_q_l; break;

ERROR: trailing statements should be on next line
#1885: FILE: disas/riscv.c:1833:
+                case 3: op = rv_op_fcvt_q_lu; break;

WARNING: line over 80 characters
#1889: FILE: disas/riscv.c:1837:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1890: FILE: disas/riscv.c:1838:
+                case 0: op = rv_op_fmv_x_s; break;

ERROR: trailing statements should be on next line
#1891: FILE: disas/riscv.c:1839:
+                case 1: op = rv_op_fclass_s; break;

WARNING: line over 80 characters
#1895: FILE: disas/riscv.c:1843:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1896: FILE: disas/riscv.c:1844:
+                case 0: op = rv_op_fmv_x_d; break;

ERROR: trailing statements should be on next line
#1897: FILE: disas/riscv.c:1845:
+                case 1: op = rv_op_fclass_d; break;

WARNING: line over 80 characters
#1901: FILE: disas/riscv.c:1849:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1902: FILE: disas/riscv.c:1850:
+                case 0: op = rv_op_fmv_x_q; break;

ERROR: trailing statements should be on next line
#1903: FILE: disas/riscv.c:1851:
+                case 1: op = rv_op_fclass_q; break;

WARNING: line over 80 characters
#1907: FILE: disas/riscv.c:1855:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1908: FILE: disas/riscv.c:1856:
+                case 0: op = rv_op_fmv_s_x; break;

WARNING: line over 80 characters
#1912: FILE: disas/riscv.c:1860:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1913: FILE: disas/riscv.c:1861:
+                case 0: op = rv_op_fmv_d_x; break;

WARNING: line over 80 characters
#1917: FILE: disas/riscv.c:1865:
+                switch (((inst >> 17) & 0b11111000) | ((inst >> 12) & 0b00000111)) {

ERROR: trailing statements should be on next line
#1918: FILE: disas/riscv.c:1866:
+                case 0: op = rv_op_fmv_q_x; break;

ERROR: trailing statements should be on next line
#1925: FILE: disas/riscv.c:1873:
+            case 0: op = rv_op_addid; break;

ERROR: trailing statements should be on next line
#1928: FILE: disas/riscv.c:1876:
+                case 0: op = rv_op_sllid; break;

ERROR: trailing statements should be on next line
#1933: FILE: disas/riscv.c:1881:
+                case 0: op = rv_op_srlid; break;

ERROR: trailing statements should be on next line
#1934: FILE: disas/riscv.c:1882:
+                case 16: op = rv_op_sraid; break;

ERROR: trailing statements should be on next line
#1941: FILE: disas/riscv.c:1889:
+            case 0: op = rv_op_beq; break;

ERROR: trailing statements should be on next line
#1942: FILE: disas/riscv.c:1890:
+            case 1: op = rv_op_bne; break;

ERROR: trailing statements should be on next line
#1943: FILE: disas/riscv.c:1891:
+            case 4: op = rv_op_blt; break;

ERROR: trailing statements should be on next line
#1944: FILE: disas/riscv.c:1892:
+            case 5: op = rv_op_bge; break;

ERROR: trailing statements should be on next line
#1945: FILE: disas/riscv.c:1893:
+            case 6: op = rv_op_bltu; break;

ERROR: trailing statements should be on next line
#1946: FILE: disas/riscv.c:1894:
+            case 7: op = rv_op_bgeu; break;

ERROR: trailing statements should be on next line
#1951: FILE: disas/riscv.c:1899:
+            case 0: op = rv_op_jalr; break;

ERROR: trailing statements should be on next line
#1954: FILE: disas/riscv.c:1902:
+        case 27: op = rv_op_jal; break;

ERROR: line over 90 characters
#1958: FILE: disas/riscv.c:1906:
+                switch (((inst >> 20) & 0b111111100000) | ((inst >> 7) & 0b000000011111)) {

ERROR: trailing statements should be on next line
#1961: FILE: disas/riscv.c:1909:
+                    case 0: op = rv_op_ecall; break;

ERROR: trailing statements should be on next line
#1962: FILE: disas/riscv.c:1910:
+                    case 32: op = rv_op_ebreak; break;

ERROR: trailing statements should be on next line
#1963: FILE: disas/riscv.c:1911:
+                    case 64: op = rv_op_uret; break;

ERROR: trailing statements should be on next line
#1970: FILE: disas/riscv.c:1918:
+                        case 0: op = rv_op_sret; break;

ERROR: trailing statements should be on next line
#1973: FILE: disas/riscv.c:1921:
+                    case 4: op = rv_op_sfence_vm; break;

ERROR: trailing statements should be on next line
#1976: FILE: disas/riscv.c:1924:
+                        case 0: op = rv_op_wfi; break;

ERROR: trailing statements should be on next line
#1981: FILE: disas/riscv.c:1929:
+                case 288: op = rv_op_sfence_vma; break;

ERROR: trailing statements should be on next line
#1984: FILE: disas/riscv.c:1932:
+                    case 64: op = rv_op_hret; break;

ERROR: trailing statements should be on next line
#1989: FILE: disas/riscv.c:1937:
+                    case 64: op = rv_op_mret; break;

ERROR: trailing statements should be on next line
#1994: FILE: disas/riscv.c:1942:
+                    case 576: op = rv_op_dret; break;

ERROR: trailing statements should be on next line
#1999: FILE: disas/riscv.c:1947:
+            case 1: op = rv_op_csrrw; break;

ERROR: trailing statements should be on next line
#2000: FILE: disas/riscv.c:1948:
+            case 2: op = rv_op_csrrs; break;

ERROR: trailing statements should be on next line
#2001: FILE: disas/riscv.c:1949:
+            case 3: op = rv_op_csrrc; break;

ERROR: trailing statements should be on next line
#2002: FILE: disas/riscv.c:1950:
+            case 5: op = rv_op_csrrwi; break;

ERROR: trailing statements should be on next line
#2003: FILE: disas/riscv.c:1951:
+            case 6: op = rv_op_csrrsi; break;

ERROR: trailing statements should be on next line
#2004: FILE: disas/riscv.c:1952:
+            case 7: op = rv_op_csrrci; break;

WARNING: line over 80 characters
#2008: FILE: disas/riscv.c:1956:
+            switch (((inst >> 22) & 0b1111111000) | ((inst >> 12) & 0b0000000111)) {

ERROR: trailing statements should be on next line
#2009: FILE: disas/riscv.c:1957:
+            case 0: op = rv_op_addd; break;

ERROR: trailing statements should be on next line
#2010: FILE: disas/riscv.c:1958:
+            case 1: op = rv_op_slld; break;

ERROR: trailing statements should be on next line
#2011: FILE: disas/riscv.c:1959:
+            case 5: op = rv_op_srld; break;

ERROR: trailing statements should be on next line
#2012: FILE: disas/riscv.c:1960:
+            case 8: op = rv_op_muld; break;

ERROR: trailing statements should be on next line
#2013: FILE: disas/riscv.c:1961:
+            case 12: op = rv_op_divd; break;

ERROR: trailing statements should be on next line
#2014: FILE: disas/riscv.c:1962:
+            case 13: op = rv_op_divud; break;

ERROR: trailing statements should be on next line
#2015: FILE: disas/riscv.c:1963:
+            case 14: op = rv_op_remd; break;

ERROR: trailing statements should be on next line
#2016: FILE: disas/riscv.c:1964:
+            case 15: op = rv_op_remud; break;

ERROR: trailing statements should be on next line
#2017: FILE: disas/riscv.c:1965:
+            case 256: op = rv_op_subd; break;

ERROR: trailing statements should be on next line
#2018: FILE: disas/riscv.c:1966:
+            case 261: op = rv_op_srad; break;

ERROR: trailing statements should be on next line
#2781: FILE: disas/riscv.c:2729:
+        default: break;

ERROR: space prohibited between function name and open parenthesis '('
#3109: FILE: include/disas/bfd.h:432:
+int print_insn_riscv32          (bfd_vma, disassemble_info*);

ERROR: space prohibited between function name and open parenthesis '('
#3110: FILE: include/disas/bfd.h:433:
+int print_insn_riscv64          (bfd_vma, disassemble_info*);

total: 279 errors, 38 warnings, 3071 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/23: RISC-V CPU Helpers...
Checking PATCH 6/23: RISC-V FPU Support...
Checking PATCH 7/23: RISC-V GDB Stub...
Checking PATCH 8/23: RISC-V TCG Code Generation...
ERROR: spaces required around that ':' (ctx:VxE)
#633: FILE: target/riscv/translate.c:238:
+    CASE_OP_32_64(OPC_RISC_ADD):
                                ^

ERROR: spaces required around that ':' (ctx:VxE)
#636: FILE: target/riscv/translate.c:241:
+    CASE_OP_32_64(OPC_RISC_SUB):
                                ^

ERROR: spaces required around that ':' (ctx:VxE)
#690: FILE: target/riscv/translate.c:295:
+    CASE_OP_32_64(OPC_RISC_MUL):
                                ^

total: 3 errors, 0 warnings, 2342 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 9/23: RISC-V Physical Memory Protection...
Checking PATCH 10/23: RISC-V Linux User Emulation...
Checking PATCH 11/23: Add symbol table callback interface to load_elf...
Checking PATCH 12/23: RISC-V HTIF Console...
Checking PATCH 13/23: RISC-V HART Array...
Checking PATCH 14/23: SiFive RISC-V CLINT Block...
Checking PATCH 15/23: SiFive RISC-V PLIC Block...
Checking PATCH 16/23: RISC-V Spike Machines...
Checking PATCH 17/23: SiFive RISC-V Test Finisher...
Checking PATCH 18/23: RISC-V VirtIO Machine...
Checking PATCH 19/23: SiFive RISC-V UART Device...
Checking PATCH 20/23: SiFive RISC-V PRCI Block...
Checking PATCH 21/23: SiFive Freedom E Series RISC-V Machine...
Checking PATCH 22/23: SiFive Freedom U Series RISC-V Machine...
Checking PATCH 23/23: RISC-V Build Infrastructure...
WARNING: line over 80 characters
#227: FILE: scripts/qemu-binfmt-conf.sh:103:
+riscv32_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'

ERROR: line over 90 characters
#228: FILE: scripts/qemu-binfmt-conf.sh:104:
+riscv32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'

WARNING: line over 80 characters
#231: FILE: scripts/qemu-binfmt-conf.sh:107:
+riscv64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'

ERROR: line over 90 characters
#232: FILE: scripts/qemu-binfmt-conf.sh:108:
+riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'

total: 2 errors, 2 warnings, 155 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Richard W.M. Jones 6 years, 1 month ago
The attached patch is also needed to avoid crashes during various
math-heavy test suites.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
From 8465cbda688cdc65dfe4037608c14cac087eae03 Mon Sep 17 00:00:00 2001
From: Stef O'Rear <sorear2@gmail.com>
Date: Sat, 3 Mar 2018 03:46:00 -0800
Subject: [PATCH] softfloat: fix crash on int conversion of SNaN

Signed-off-by: Stef O'Rear <sorear2@gmail.com>
---
 fpu/softfloat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e7fb0d357a..1da1db377e 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
     switch (p.cls) {
     case float_class_snan:
     case float_class_qnan:
+    case float_class_dnan:
+    case float_class_msnan:
         return max;
     case float_class_inf:
         return p.sign ? min : max;
@@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max,
     switch (p.cls) {
     case float_class_snan:
     case float_class_qnan:
+    case float_class_dnan:
+    case float_class_msnan:
         s->float_exception_flags = orig_flags | float_flag_invalid;
         return max;
     case float_class_inf:
-- 
2.15.1

Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Alex Bennée 6 years, 1 month ago
Richard W.M. Jones <rjones@redhat.com> writes:

> The attached patch is also needed to avoid crashes during various
> math-heavy test suites.
>
> Rich.
>
> --
<snip>
> From: Stef O'Rear <sorear2@gmail.com>
> Date: Sat, 3 Mar 2018 03:46:00 -0800
> Subject: [PATCH] softfloat: fix crash on int conversion of SNaN
>
> Signed-off-by: Stef O'Rear <sorear2@gmail.com>
> ---
>  fpu/softfloat.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index e7fb0d357a..1da1db377e 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
>      switch (p.cls) {
>      case float_class_snan:
>      case float_class_qnan:
> +    case float_class_dnan:
> +    case float_class_msnan:
>          return max;
>      case float_class_inf:
>          return p.sign ? min : max;
> @@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max,
>      switch (p.cls) {
>      case float_class_snan:
>      case float_class_qnan:
> +    case float_class_dnan:
> +    case float_class_msnan:
>          s->float_exception_flags = orig_flags | float_flag_invalid;
>          return max;
>      case float_class_inf:

Obviously I wasn't exercising the NaN exit paths enough and we added the
return_nan() common code fairly late in the series.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

--
Alex Bennée

Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Michael Clark 6 years, 1 month ago
On Mon, Mar 5, 2018 at 9:41 PM, Richard W.M. Jones <rjones@redhat.com>
wrote:

>
> The attached patch is also needed to avoid crashes during various
> math-heavy test suites.
>

Thanks. I missed your email.

I've integrated this and the other outstanding patches into the `riscv-all`
branch in the riscv repo here.

- https://github.com/riscv/riscv-qemu/commits/riscv-all

This also triggered aborts on riscv-tests, which is all the more reason to
get riscv-tests running in the CI so we spot these things early.

Thanks,
Michael.

Rich.
>
> From: Stef O'Rear <address@hidden>
>
> Date: Sat, 3 Mar 2018 03:46:00 -0800
>
> Subject: [PATCH] softfloat: fix crash on int conversion of SNaN
>
>
>> Signed-off-by: Stef O'Rear <address@hidden>
>
>
Signed-off-by: Michael Clark <mjc@sifive.com>


> ---
>
>  fpu/softfloat.c | 4 ++++
>
>  1 file changed, 4 insertions(+)
>
>
>> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
>
> index e7fb0d357a..1da1db377e 100644
>
> --- a/fpu/softfloat.c
>
> +++ b/fpu/softfloat.c
>
> @@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in,
>> int rmode,
>
>      switch (p.cls) {
>
>      case float_class_snan:
>
>      case float_class_qnan:
>
> +    case float_class_dnan:
>
> +    case float_class_msnan:
>
>          return max;
>
>      case float_class_inf:
>
>          return p.sign ? min : max;
>
> @@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts
>> in, int rmode, uint64_t max,
>
>      switch (p.cls) {
>
>      case float_class_snan:
>
>      case float_class_qnan:
>
> +    case float_class_dnan:
>
> +    case float_class_msnan:
>
>          s->float_exception_flags = orig_flags | float_flag_invalid;
>
>          return max;
>
>      case float_class_inf:
>
> --
>
> 2.15.1
>
>
>
Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Peter Maydell 6 years, 1 month ago
On 5 March 2018 at 08:41, Richard W.M. Jones <rjones@redhat.com> wrote:
>
> The attached patch is also needed to avoid crashes during various
> math-heavy test suites.

Applied to master, thanks.

FYI, sending patches as attachments in the middle of a long
thread on something else is a good way to cause them to get
lost. Luckily Michael ran into the same bug again and that
reminded me to fish this one out.

thanks
-- PMM

Re: [Qemu-devel] [PATCH v8 00/23] RISC-V QEMU Port Submission
Posted by Richard W.M. Jones 6 years, 1 month ago
On Fri, Mar 09, 2018 at 04:43:34PM +0000, Peter Maydell wrote:
> On 5 March 2018 at 08:41, Richard W.M. Jones <rjones@redhat.com> wrote:
> >
> > The attached patch is also needed to avoid crashes during various
> > math-heavy test suites.
> 
> Applied to master, thanks.
> 
> FYI, sending patches as attachments in the middle of a long
> thread on something else is a good way to cause them to get
> lost. Luckily Michael ran into the same bug again and that
> reminded me to fish this one out.

Yup sorry I thought that the patch had been separately submitted,
but apparently it never was.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html