target/mips: Remove gen_helper_0e3i()
[qemu/ar7.git] / docs / system / target-riscv.rst
blob89a866e4f4f192242efc11bece2478c6f0850ab6
1 .. _RISC-V-System-emulator:
3 RISC-V System emulator
4 ======================
6 QEMU can emulate both 32-bit and 64-bit RISC-V CPUs. Use the
7 ``qemu-system-riscv64`` executable to simulate a 64-bit RISC-V machine,
8 ``qemu-system-riscv32`` executable to simulate a 32-bit RISC-V machine.
10 QEMU has generally good support for RISC-V guests. It has support for
11 several different machines. The reason we support so many is that
12 RISC-V hardware is much more widely varying than x86 hardware. RISC-V
13 CPUs are generally built into "system-on-chip" (SoC) designs created by
14 many different companies with different devices, and these SoCs are
15 then built into machines which can vary still further even if they use
16 the same SoC.
18 For most boards the CPU type is fixed (matching what the hardware has),
19 so typically you don't need to specify the CPU type by hand, except for
20 special cases like the ``virt`` board.
22 Choosing a board model
23 ----------------------
25 For QEMU's RISC-V system emulation, you must specify which board
26 model you want to use with the ``-M`` or ``--machine`` option;
27 there is no default.
29 Because RISC-V systems differ so much and in fundamental ways, typically
30 operating system or firmware images intended to run on one machine
31 will not run at all on any other. This is often surprising for new
32 users who are used to the x86 world where every system looks like a
33 standard PC. (Once the kernel has booted, most user space software
34 cares much less about the detail of the hardware.)
36 If you already have a system image or a kernel that works on hardware
37 and you want to boot with QEMU, check whether QEMU lists that machine
38 in its ``-machine help`` output. If it is listed, then you can probably
39 use that board model. If it is not listed, then unfortunately your image
40 will almost certainly not boot on QEMU. (You might be able to
41 extract the file system and use that with a different kernel which
42 boots on a system that QEMU does emulate.)
44 If you don't care about reproducing the idiosyncrasies of a particular
45 bit of hardware, such as small amount of RAM, no PCI or other hard
46 disk, etc., and just want to run Linux, the best option is to use the
47 ``virt`` board. This is a platform which doesn't correspond to any
48 real hardware and is designed for use in virtual machines. You'll
49 need to compile Linux with a suitable configuration for running on
50 the ``virt`` board. ``virt`` supports PCI, virtio, recent CPUs and
51 large amounts of RAM. It also supports 64-bit CPUs.
53 Board-specific documentation
54 ----------------------------
56 Unfortunately many of the RISC-V boards QEMU supports are currently
57 undocumented; you can get a complete list by running
58 ``qemu-system-riscv64 --machine help``, or
59 ``qemu-system-riscv32 --machine help``.
62    This table of contents should be kept sorted alphabetically
63    by the title text of each file, which isn't the same ordering
64    as an alphabetical sort by filename.
66 .. toctree::
67    :maxdepth: 1
69    riscv/microchip-icicle-kit
70    riscv/shakti-c
71    riscv/sifive_u
72    riscv/virt
74 RISC-V CPU firmware
75 -------------------
77 When using the ``sifive_u`` or ``virt`` machine there are three different
78 firmware boot options:
79 1. ``-bios default`` - This is the default behaviour if no -bios option
80 is included. This option will load the default OpenSBI firmware automatically.
81 The firmware is included with the QEMU release and no user interaction is
82 required. All a user needs to do is specify the kernel they want to boot
83 with the -kernel option
84 2. ``-bios none`` - QEMU will not automatically load any firmware. It is up
85 to the user to load all the images they need.
86 3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmware.