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