xref: /qemu/docs/system/riscv/microchip-icicle-kit.rst (revision 143897b50140cfd7540f867edca5d658e76aa9bf)
1d4e28f0eSBin MengMicrochip PolarFire SoC Icicle Kit (``microchip-icicle-kit``)
2d4e28f0eSBin Meng=============================================================
3d4e28f0eSBin Meng
4d4e28f0eSBin MengMicrochip PolarFire SoC Icicle Kit integrates a PolarFire SoC, with one
5d4e28f0eSBin MengSiFive's E51 plus four U54 cores and many on-chip peripherals and an FPGA.
6d4e28f0eSBin Meng
7d4e28f0eSBin MengFor more details about Microchip PolarFire SoC, please see:
8d4e28f0eSBin Menghttps://www.microsemi.com/product-directory/soc-fpgas/5498-polarfire-soc-fpga
9d4e28f0eSBin Meng
10d4e28f0eSBin MengThe Icicle Kit board information can be found here:
11d4e28f0eSBin Menghttps://www.microsemi.com/existing-parts/parts/152514
12d4e28f0eSBin Meng
13d4e28f0eSBin MengSupported devices
14d4e28f0eSBin Meng-----------------
15d4e28f0eSBin Meng
16d4e28f0eSBin MengThe ``microchip-icicle-kit`` machine supports the following devices:
17d4e28f0eSBin Meng
18d4e28f0eSBin Meng* 1 E51 core
19d4e28f0eSBin Meng* 4 U54 cores
20d4e28f0eSBin Meng* Core Level Interruptor (CLINT)
21d4e28f0eSBin Meng* Platform-Level Interrupt Controller (PLIC)
22d4e28f0eSBin Meng* L2 Loosely Integrated Memory (L2-LIM)
23d4e28f0eSBin Meng* DDR memory controller
24d4e28f0eSBin Meng* 5 MMUARTs
25d4e28f0eSBin Meng* 1 DMA controller
26d4e28f0eSBin Meng* 2 GEM Ethernet controllers
27d4e28f0eSBin Meng* 1 SDHC storage controller
28d4e28f0eSBin Meng
29d4e28f0eSBin MengBoot options
30d4e28f0eSBin Meng------------
31d4e28f0eSBin Meng
32d4e28f0eSBin MengThe ``microchip-icicle-kit`` machine can start using the standard -bios
33d4e28f0eSBin Mengfunctionality for loading its BIOS image, aka Hart Software Services (HSS_).
34*143897b5SBin MengHSS loads the second stage bootloader U-Boot from an SD card. Then a kernel
35*143897b5SBin Mengcan be loaded from U-Boot. It also supports direct kernel booting via the
36*143897b5SBin Meng-kernel option along with the device tree blob via -dtb. When direct kernel
37*143897b5SBin Mengboot is used, the OpenSBI fw_dynamic BIOS image is used to boot a payload
38*143897b5SBin Menglike U-Boot or OS kernel directly.
39*143897b5SBin Meng
40*143897b5SBin MengThe user provided DTB should have the following requirements:
41*143897b5SBin Meng
42*143897b5SBin Meng* The /cpus node should contain at least one subnode for E51 and the number
43*143897b5SBin Meng  of subnodes should match QEMU's ``-smp`` option
44*143897b5SBin Meng* The /memory reg size should match QEMU’s selected ram_size via ``-m``
45*143897b5SBin Meng* Should contain a node for the CLINT device with a compatible string
46*143897b5SBin Meng  "riscv,clint0"
47*143897b5SBin Meng
48*143897b5SBin MengQEMU follows below truth table to select which payload to execute:
49*143897b5SBin Meng
50*143897b5SBin Meng=====  ========== =======
51*143897b5SBin Meng-bios     -kernel payload
52*143897b5SBin Meng=====  ========== =======
53*143897b5SBin Meng    N           N     HSS
54*143897b5SBin Meng    Y  don't care     HSS
55*143897b5SBin Meng    N           Y  kernel
56*143897b5SBin Meng=====  ========== =======
57d4e28f0eSBin Meng
58d4e28f0eSBin MengThe memory is set to 1537 MiB by default which is the minimum required high
59d4e28f0eSBin Mengmemory size by HSS. A sanity check on ram size is performed in the machine
60d4e28f0eSBin Menginit routine to prompt user to increase the RAM size to > 1537 MiB when less
61d4e28f0eSBin Mengthan 1537 MiB ram is detected.
62d4e28f0eSBin Meng
63*143897b5SBin MengRunning HSS
64*143897b5SBin Meng-----------
65d4e28f0eSBin Meng
66d4e28f0eSBin MengHSS 2020.12 release is tested at the time of writing. To build an HSS image
67d4e28f0eSBin Mengthat can be booted by the ``microchip-icicle-kit`` machine, type the following
68d4e28f0eSBin Mengin the HSS source tree:
69d4e28f0eSBin Meng
70d4e28f0eSBin Meng.. code-block:: bash
71d4e28f0eSBin Meng
72d4e28f0eSBin Meng  $ export CROSS_COMPILE=riscv64-linux-
73d4e28f0eSBin Meng  $ cp boards/mpfs-icicle-kit-es/def_config .config
74d4e28f0eSBin Meng  $ make BOARD=mpfs-icicle-kit-es
75d4e28f0eSBin Meng
76d4e28f0eSBin MengDownload the official SD card image released by Microchip and prepare it for
77d4e28f0eSBin MengQEMU usage:
78d4e28f0eSBin Meng
79d4e28f0eSBin Meng.. code-block:: bash
80d4e28f0eSBin Meng
81d4e28f0eSBin Meng  $ wget ftp://ftpsoc.microsemi.com/outgoing/core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz
82d4e28f0eSBin Meng  $ gunzip core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz
83d4e28f0eSBin Meng  $ qemu-img resize core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic 4G
84d4e28f0eSBin Meng
85d4e28f0eSBin MengThen we can boot the machine by:
86d4e28f0eSBin Meng
87d4e28f0eSBin Meng.. code-block:: bash
88d4e28f0eSBin Meng
89d4e28f0eSBin Meng  $ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 \
90d4e28f0eSBin Meng      -bios path/to/hss.bin -sd path/to/sdcard.img \
91d4e28f0eSBin Meng      -nic user,model=cadence_gem \
92d4e28f0eSBin Meng      -nic tap,ifname=tap,model=cadence_gem,script=no \
93d4e28f0eSBin Meng      -display none -serial stdio \
94d4e28f0eSBin Meng      -chardev socket,id=serial1,path=serial1.sock,server=on,wait=on \
95d4e28f0eSBin Meng      -serial chardev:serial1
96d4e28f0eSBin Meng
97d4e28f0eSBin MengWith above command line, current terminal session will be used for the first
98d4e28f0eSBin Mengserial port. Open another terminal window, and use `minicom` to connect the
99d4e28f0eSBin Mengsecond serial port.
100d4e28f0eSBin Meng
101d4e28f0eSBin Meng.. code-block:: bash
102d4e28f0eSBin Meng
103d4e28f0eSBin Meng  $ minicom -D unix\#serial1.sock
104d4e28f0eSBin Meng
105d4e28f0eSBin MengHSS output is on the first serial port (stdio) and U-Boot outputs on the
106d4e28f0eSBin Mengsecond serial port. U-Boot will automatically load the Linux kernel from
107d4e28f0eSBin Mengthe SD card image.
108d4e28f0eSBin Meng
109d4e28f0eSBin Meng.. _HSS: https://github.com/polarfire-soc/hart-software-services
110