Internships/ProjectIdeas/MIPS support to RISU

From QEMU
Revision as of 09:48, 4 February 2021 by Ajb (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MIPS support to RISU

Summary: Push decodetree improvements back to RISU and add support for MIPS architecture.

  • RISU and decodetree

RISU (Random Instruction Sequence generator for Userspace testing) is a tool intended to assist in testing the implementation of models of architectures such as QEMU and Valgrind. In particular it restricts itself to considering the parts of the architecture visible from Linux userspace, so it can be used to test programs which only implement userspace, like Valgrind and QEMU's linux-user mode. RISU generators are written in Perl.

RISU inspired the decodetree specification describing instruction patterns. QEMU uses a script written in Python to generates instruction decoder for some (or all) instruction set architectures (ARM, AVR, HPPA, Microblaze, MIPS, OpenRISC, RISC-V, RX).

The decodetree field extraction logic is more nuanced than RISU. There could be a fair amount of benefit to pushing decodetree improvements back to RISU.

  • MIPS

MIPS architecture has a long trajectory. Some old CPUs are still regularly emulated in QEMU (R4000, VR5432), but very recent models are also added (I7200 with nanoMIPS, Loongson-3A4000). It would be beneficial for the emulation community to run RISU on the dying MIPS hardware and the trendy new hardware, not widely available.

  • Possible Roadmap
  1. Fill gaps in decodetree format to express same logic as .risu format, or generate in this format. Suggestion, t16.decode -> thumb.risu.
    1. constraints (range of valid values for a field), address mode (used to calculate offsets for ld/st ops)
  2. Write risugen.py based on decodetree.py
  3. Write risugen_mips.py
  4. Write test_mips.s to run on user-land
  5. Test MIPS MSA/SIMD/LoongsonMMI with RISU
  6. Convert QEMU MIPSr6 to decodetree/RISU
  • Possible follow up

If the student is motivated, it is possible to investigate how to test privileged instructions out of user-land, eventually using a JTAG probe (or gdbstub?).

Links:

* Peter Maydell's RISU repository
* KVM Forum 2014 presentation by Alex Bennée
* Decodetree Specification
* Decodetree script

Details:

* Skill level: advanced
* Language: C, Python, Perl
* Mentor: Philippe Mathieu-Daudé <f4bug@amsat.org> ("f4bug" on IRC)
* Special requirements: Having MIPS hardware able to run Linux could be helpful, otherwise (slow) remote access will be provided.