MPSoC Power Management

MPSoC Power Management

Zynq UltraScale+ MPSoC Power Management


This page describes how to build and run PMU Firmware on QEMU.

Software Tools and System Requirements

  • Xilinx Vivado 2016.3
  • Xilinx Petalinux 2016.3

Building PMU Firmware

1) Create a HW design in Vivado and export it to SDK
2) Open Xilinx SDK
3) Create a new workspace
4) Select *File->New->Application Project*
5) Select *psu_microblaze_0* from Processors List
6) Click *Next*
7) Select *ZynqMP PMU Firmware* App and click *Finish*
Now you should have a PMUFW_ELF generated.

Creating a SelfSuspend App for A53/R5

1. Open SDK and create a BSP for A53/R5 (File->New->Board Support Package)
2. From the BSP settings dialogue, select xilpm library
3. Click Finish and let the library build complete
4. Now Open the mss file and scroll down to library section
5. Select "Import Examples" link beside xilpm
6. Select xilpm_selfsuspend_example from the list and click OK to Import
7. You should have an test App elf built under the Debug section.

Running on QEMU

PMU Firmware can be executed in a QEMU MultiArch environment with two separate QEMU Instances (machines).
Following are the instructions to run PMU Firmware on QEMU.
1. Source settings.sh from the Petalinux installation
$source settings.sh
2. Create a Petalinux ZynqMP QEMU Project
$ petalinux-create -t project -s Xilinx-ZynqMP-QEMU-2016.3.bsp
3. Check for the DTBs/ROM:
These DTBs/ELFs will be used in the rest of the steps.

4. Create a qemu-tmp directory; This is used by the QEMU machines
$ mkdir qemu-tmp

5. Open two terminals, One for ARM_QEMU machine and the other for PMU_QEMU Machine

6. On PMU_QEMU, execute the following command to start PMU machine:
$qemu-system-microblazeel -M microblaze-fdt -hw-dtb <path_to_pmu_dtb> -kernel <path_to_pmu_rom_elf> -nographic -machine-path qemu-tmp
7.On ARM_QEMU , execute the following command to start ARM machine:
$qemu-system-aarch64 -M arm-generic-fdt -hw-dtb <path_to_ARM_DTB> -gdb tcp::6667 -nographic -machine-path qemu-tmp -tftp <path_to_PETALINUX_IMAGES>
8. Load PMU Firmware on PMU_QEMU:
$device_add loader,file=<path_to_pmufw_elf>,cpu=0
After executing this command, you should see a PMU-FW banner message on STDOUT:
9. Start xsdb and connect ZynqMP:
$gdbremote connect localhost:6667
Follow one of 10a or 10b to run the example application on the A53 or R5 core.
10a. Load and run the test app on A53 using xsdb:
$targets -set -filter {name =~ "Cortex-A53 #0"}
$dow <path_to_standalone_selfsuspend_app_a53_elf
$mask_write 0xfd1a0104 0x3d01 0
$con

10b.Load and run the test app on R5 using xsdb:
$targets -set -filter {name =~ "Cortex-R5 #0"}
$dow <path_to_standalone_selfsuspend_app_a53_elf>
mask_write 0xff5e023c [expr ~2] 0
con

11. You should now see the Test App output STDOUT.

CPU hotplug:


Follow Steps 1 to 9 from above instructions for loading the PMU Firmware on PMU_QEMU.
Instructions to load and run petalinux on ARM_QEMU using xsdb:

1. Execute the following to load U-Boot, ATF (bl31.elf), Linux (Image) and device tree (system.dtb):
$targets -set -filter {name =~ "Cortex-A53 #0"}
$dow <path_to_U-BOOT_ELF>
dow <path_to_ATF_ELF>
mask_write 0xfd1a0104 0x3d01 0 # release APU reset
con

After executing these, you should see a ATF banner message on ARM_QEMU and u-boot process. Let the timeout
expire and U-Boot will load Image and device tree via tftp and boot Linux as shown below.

2. Execute the following to power off a core (example: CPU 1):
$echo 0 > /sys/devices/system/cpu/cpu1/online
You should see output from PMU-FW and kernel similar to the following:

3. Execute the following to power on a core (example: CPU 1):
$echo 1 > /sys/devices/system/cpu/cpu1/online
You should see output from PMU-FW and kernel similar to the following:

4. Execute the following to check currently powered on cores:
$cat /sys/devices/system/cpu/online

Related Links

MPSoC Software Development Flow