hw/arm: versal: Add support for the XRAMs
[qemu/ar7.git] / docs / system / arm / xlnx-versal-virt.rst
blob27f73500d95dc2f3a2351ee702555fe9112e27bd
1 Xilinx Versal Virt (``xlnx-versal-virt``)
2 =========================================
4 Xilinx Versal is a family of heterogeneous multi-core SoCs
5 (System on Chip) that combine traditional hardened CPUs and I/O
6 peripherals in a Processing System (PS) with runtime programmable
7 FPGA logic (PL) and an Artificial Intelligence Engine (AIE).
9 More details here:
10 https://www.xilinx.com/products/silicon-devices/acap/versal.html
12 The family of Versal SoCs share a single architecture but come in
13 different parts with different speed grades, amounts of PL and
14 other differences.
16 The Xilinx Versal Virt board in QEMU is a model of a virtual board
17 (does not exist in reality) with a virtual Versal SoC without I/O
18 limitations. Currently, we support the following cores and devices:
20 Implemented CPU cores:
22 - 2 ACPUs (ARM Cortex-A72)
24 Implemented devices:
26 - Interrupt controller (ARM GICv3)
27 - 2 UARTs (ARM PL011)
28 - An RTC (Versal built-in)
29 - 2 GEMs (Cadence MACB Ethernet MACs)
30 - 8 ADMA (Xilinx zDMA) channels
31 - 2 SD Controllers
32 - OCM (256KB of On Chip Memory)
33 - XRAM (4MB of on chip Accelerator RAM)
34 - DDR memory
36 QEMU does not yet model any other devices, including the PL and the AI Engine.
38 Other differences between the hardware and the QEMU model:
40 - QEMU allows the amount of DDR memory provided to be specified with the
41   ``-m`` argument. If a DTB is provided on the command line then QEMU will
42   edit it to include suitable entries describing the Versal DDR memory ranges.
44 - QEMU provides 8 virtio-mmio virtio transports; these start at
45   address ``0xa0000000`` and have IRQs from 111 and upwards.
47 Running
48 """""""
49 If the user provides an Operating System to be loaded, we expect users
50 to use the ``-kernel`` command line option.
52 Users can load firmware or boot-loaders with the ``-device loader`` options.
54 When loading an OS, QEMU generates a DTB and selects an appropriate address
55 where it gets loaded. This DTB will be passed to the kernel in register x0.
57 If there's no ``-kernel`` option, we generate a DTB and place it at 0x1000
58 for boot-loaders or firmware to pick it up.
60 If users want to provide their own DTB, they can use the ``-dtb`` option.
61 These DTBs will have their memory nodes modified to match QEMU's
62 selected ram_size option before they get passed to the kernel or FW.
64 When loading an OS, we turn on QEMU's PSCI implementation with SMC
65 as the PSCI conduit. When there's no ``-kernel`` option, we assume the user
66 provides EL3 firmware to handle PSCI.
68 A few examples:
70 Direct Linux boot of a generic ARM64 upstream Linux kernel:
72 .. code-block:: bash
74   $ qemu-system-aarch64 -M xlnx-versal-virt -m 2G \
75       -serial mon:stdio -display none \
76       -kernel arch/arm64/boot/Image \
77       -nic user -nic user \
78       -device virtio-rng-device,bus=virtio-mmio-bus.0 \
79       -drive if=none,index=0,file=hd0.qcow2,id=hd0,snapshot \
80       -drive file=qemu_sd.qcow2,if=sd,index=0,snapshot \
81       -device virtio-blk-device,drive=hd0 -append root=/dev/vda
83 Direct Linux boot of PetaLinux 2019.2:
85 .. code-block:: bash
87   $ qemu-system-aarch64  -M xlnx-versal-virt -m 2G \
88       -serial mon:stdio -display none \
89       -kernel petalinux-v2019.2/Image \
90       -append "rdinit=/sbin/init console=ttyAMA0,115200n8 earlycon=pl011,mmio,0xFF000000,115200n8" \
91       -net nic,model=cadence_gem,netdev=net0 -netdev user,id=net0 \
92       -device virtio-rng-device,bus=virtio-mmio-bus.0,rng=rng0 \
93       -object rng-random,filename=/dev/urandom,id=rng0
95 Boot PetaLinux 2019.2 via ARM Trusted Firmware (2018.3 because the 2019.2
96 version of ATF tries to configure the CCI which we don't model) and U-boot:
98 .. code-block:: bash
100   $ qemu-system-aarch64 -M xlnx-versal-virt -m 2G \
101       -serial stdio -display none \
102       -device loader,file=petalinux-v2018.3/bl31.elf,cpu-num=0 \
103       -device loader,file=petalinux-v2019.2/u-boot.elf \
104       -device loader,addr=0x20000000,file=petalinux-v2019.2/Image \
105       -nic user -nic user \
106       -device virtio-rng-device,bus=virtio-mmio-bus.0,rng=rng0 \
107       -object rng-random,filename=/dev/urandom,id=rng0
109 Run the following at the U-Boot prompt:
111 .. code-block:: bash
113   Versal>
114   fdt addr $fdtcontroladdr
115   fdt move $fdtcontroladdr 0x40000000
116   fdt set /timer clock-frequency <0x3dfd240>
117   setenv bootargs "rdinit=/sbin/init maxcpus=1 console=ttyAMA0,115200n8 earlycon=pl011,mmio,0xFF000000,115200n8"
118   booti 20000000 - 40000000
119   fdt addr $fdtcontroladdr
121 Boot Linux as DOM0 on Xen via U-Boot:
123 .. code-block:: bash
125   $ qemu-system-aarch64 -M xlnx-versal-virt -m 4G \
126       -serial stdio -display none \
127       -device loader,file=petalinux-v2019.2/u-boot.elf,cpu-num=0 \
128       -device loader,addr=0x30000000,file=linux/2018-04-24/xen \
129       -device loader,addr=0x40000000,file=petalinux-v2019.2/Image \
130       -nic user -nic user \
131       -device virtio-rng-device,bus=virtio-mmio-bus.0,rng=rng0 \
132       -object rng-random,filename=/dev/urandom,id=rng0
134 Run the following at the U-Boot prompt:
136 .. code-block:: bash
138   Versal>
139   fdt addr $fdtcontroladdr
140   fdt move $fdtcontroladdr 0x20000000
141   fdt set /timer clock-frequency <0x3dfd240>
142   fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/uart@ff000000 dom0_mem=640M bootscrub=0 maxcpus=1 timer_slop=0"
143   fdt set /chosen xen,dom0-bootargs "rdinit=/sbin/init clk_ignore_unused console=hvc0 maxcpus=1"
144   fdt mknode /chosen dom0
145   fdt set /chosen/dom0 compatible "xen,multiboot-module"
146   fdt set /chosen/dom0 reg <0x00000000 0x40000000 0x0 0x03100000>
147   booti 30000000 - 20000000
149 Boot Linux as Dom0 on Xen via ARM Trusted Firmware and U-Boot:
151 .. code-block:: bash
153   $ qemu-system-aarch64 -M xlnx-versal-virt -m 4G \
154       -serial stdio -display none \
155       -device loader,file=petalinux-v2018.3/bl31.elf,cpu-num=0 \
156       -device loader,file=petalinux-v2019.2/u-boot.elf \
157       -device loader,addr=0x30000000,file=linux/2018-04-24/xen \
158       -device loader,addr=0x40000000,file=petalinux-v2019.2/Image \
159       -nic user -nic user \
160       -device virtio-rng-device,bus=virtio-mmio-bus.0,rng=rng0 \
161       -object rng-random,filename=/dev/urandom,id=rng0
163 Run the following at the U-Boot prompt:
165 .. code-block:: bash
167   Versal>
168   fdt addr $fdtcontroladdr
169   fdt move $fdtcontroladdr 0x20000000
170   fdt set /timer clock-frequency <0x3dfd240>
171   fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/uart@ff000000 dom0_mem=640M bootscrub=0 maxcpus=1 timer_slop=0"
172   fdt set /chosen xen,dom0-bootargs "rdinit=/sbin/init clk_ignore_unused console=hvc0 maxcpus=1"
173   fdt mknode /chosen dom0
174   fdt set /chosen/dom0 compatible "xen,multiboot-module"
175   fdt set /chosen/dom0 reg <0x00000000 0x40000000 0x0 0x03100000>
176   booti 30000000 - 20000000