ZU+ Example - Typical Power States

This tutorial explains procedure to measure transition times and respected power values when either PS or PL suspends or wake up. By following below procedure, suspend and wake up time of APU, These procedures are for 2017.1 and later releases.  There are some differences for later releases which are indicated when appropriate.

Table of Contents

Different power states and measure transition time of APU and PL

Prebuilt binaries for reference

For 2017.1-4

For 2018.2 and above

To generate binaries on your own please refer below steps for generating required images/binaries.

Generating required images/binaries

Steps to build Linux images

Create petalinux project

  • Run below commands from bash terminal to create petalinux project.

    source <petalinux-install-dir>/settings.sh petalinux-create -t project -s xilinx-zcu102-v20xx.x.bsp

Apply Linux kernel patch to signal wakeup

  • Create directory <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/ (if not present)

    • Copy below patch files to <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/.  (v2018.x - later)

    • Rename the downloaded patch file to pm_wakeup_latency.patch.

    • Open file <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend (create if not present)

    • Add below lines in file:

      • For v2017.x - v2018.1

        FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI_append = " file://pm_wakeup_latency.patch"
      • For v2018.2 only

        FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI_append = " file://mailbox.patch" SRC_URI_append = " file://pm_wakeup_latency.patch"
      • For v2018.3 - 2019.1

      • For v2019.2-later

Minimum kernel configuration (v2017.x - v2018.2)

  • Copy kernel min config file (defconfig) to project-spec/meta-user/recipes-kernel/linux/files/defconfig.  (v2018.1 & v2018.2) Rename the downloaded config file to 'defconfig'.
    defconfig (for v2017.1-4)
    defconfig_2018_x (for v2018.1 & v2018.2)

  • Add below line in project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend file:

Default kernel configuration (v2018.3 - later)

  • Isolate SATA node from Linux use by removing its node from device tree.  Add the following to <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi.

Build petalinux

  • First enable ECC  in FSBL code:

    • Create directory <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/files/ (if not present)

    • Copy patch file to <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/files/ (Patch attached here: ecc_fsbl.patch)

    • Open file <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend (create if not present)

    • Add below lines in file:

      • For 2017.x-2019.1

      • For 2019.2-later

    • Now build petalinux using below command

Steps to build RPU_0 baremetal

Steps to run the images

Boot Linux with RPU

  • Create RPU_0 application rpu_0.elf from SDK as described in above section.

  • Create a new folder and copy pmufw.elf, zynqmp_fsbl.elf, bl31.elf and u-boot.elf from petalinux generated images (present at <plnx-proj-root>/images/linux/). Also copy rpu_0.elf into same folder.

  • Create boot.bif file in same folder as shown below.

    • for 2017.x-2019.2

    • For 2020.1-later

  • Create BOOT.BIN file using following command.

  • Create a boot partition in SD card and copy BOOT.BIN and image.ub file (present at <plnx-proj-root>/images/linux/) to boot partition.

  • Boot the ZCU102 board in SD boot mode.

  • Once boot start U-boot prompt will appear on serial. Press Enter again and again to interrupt u-boot till ZynqMP prompt appear. Run below command from u-boot to disable cpuidle.

  • After that start the linux by writing "boot" on the U-boot prompt

Measure the power and transition times

Use Power Advantage tool for measuring power values.

All on (PS + PL)

  • Run below command to load all APU from Linux terminal on board and measure the power using Power Advantage Tool. That will give power values for All on (PS+PL).

PS all ON

  • Turn OFF PL
    Run below command from Linux terminal on board to power off PL.
    (For v2017.1-4)

    (For v2018.2 and above)

  • Turn ON PL
    Run below command from Linux terminal on board to power on PL.
    (For v2017.1-4)

    (For v2018.2 and above)

3 APUs on/off

  • Power OFF 3 APUs
    Run below command from Linux terminal on board to power off 3 APUs. Use Power Advantage Tool to measure power for PS all OFF.

  • Power ON 3 APUs
    Run below command from Linux terminal on board to power on 3 APUs. Use Power Advantage Tool to measure power for PS all ON.

Frequency scaling (min frequency)

  • Run following command to get available frequencies.

  • Set minimum frequency
    Run following command to set minimum frequency

  • Set maximum frequency
    Run following command to set maximum frequency

Suspend to RAM and FPD off

  1. Power off all 3 secondary APUs and set frequency of primary APU0 to minimum using above commands for minimum latency measurement.

  2. Run following command from Linux terminal to release unnecessary nodes and signal the RPU_0:

    • (For v2017.1-4)

    • (For v2018.2)

    • (For v2018.3)

    • (For v2019.1 - v2021.2)

    • (For v2022.1 - Later)

       

  3. Now, Linux will be suspended and it will be resumed by RPU after suspend. RPU has requested NODE_SATA from FPD, so Linux will be suspended with FPD on.

  4. After 10 second of Linux suspend, RPU application will release NODE_SATA. Once NODE_SATA is released, FPD will be off. Use Power Advantage Tool in these 10 seconds to get power value for Suspend to RAM.
    Following are print messages to identify these 10 second window.

  5. Once FPD is off, RPU will resume APU after 10 second of FPD off. To measure power with FPD off, Use Power Advantage Tool in these 10 seconds.
    Following are two print messages to identify these 10 second window.

  6. Above loop will run for 3 times and print minimum, maximum and average values for latency. On console, you should able to see suspend/wakeup latency of APU from RPU print message as shown below.

    • Here,
      RPU0: Request Suspend Latency in useconds of Node NODE_APU_0: Latency for power state transition from "3 APU off (min frequency)" to "Suspend to RAM".
      RPU0: FPD off Latency in useconds of Node NODE_APU_0:                  Latency for power state transition from "Suspend to RAM" to "FPD off".
      RPU0: FPD on Latency in useconds of Node NODE_APU_0:                  Latency for power state transition from FPD off to "Suspend to RAM".
      RPU0: APU0 Wakeup Latency in useconds of Node NODE_APU_0:       Time require to wakeup APU_0 after RequestWakeup call.
      RPU0: Wakeup Latency in useconds of Node NODE_APU_0:                 Latency for power state transition from "Suspend to RAM" to "3 APU off (min frequency).

  7. R5 Sleep and Deep-Sleep mode

  8. Once above measurements are done, RPU puts FPD in off state and goes to idle mode (wfi state) for 10 seconds.

  9. To measure power with R5 sleep mode, Use Power Advantage Tool in these 10 seconds.
    Following are two print messages to identify these 10 second window.

  10. After 10 seconds RPU gets timer interrupt after that it suspend itself and goes to deep sleep mode for 10 seconds.

  11. After RPU goes to deep sleep, Use Power Advantage tool for measuring power values within these 10 seconds.
    Following are print messages to identify these 10 second window.

  12. After 10 seconds timer will generate interrupt and Resumes RPU. Then RPU resumes APU. This state is same as 3 APU off with minimum frequency.

  13. Now to measure latency/power from left to right of dimmer mode table, use below commands:

    1. Set max APU0 frequency using frequency scaling.

    2. Power on all 3 secondary APUs.

    3. Power on PL.

  14. To re-run demo execute from step 1 (This will work in 2019.2 and higher versions only).

Measure transition time of RPU

Prebuilt binaries for reference

To generate images on your own please refer below steps for generating required images/binaries.

Generating required images/binaries

Steps to build RPU_0 baremetal

Steps to build APU baremetal

  • Start with an empty APU application (like the Hello World example here).

  • Replace the main.c with this file (apu_host.c)

  • Build apu application elf.

Steps to run the images

  • Create rpu_0.elf and apu.elf from SDK as described in above section.

  • Create a new folder and copy pmufw.elf and zynqmp_fsbl.elf from petalinux generated images (present at <plnx-proj-root>/images/linux/). Also copy rpu_0.elf and apu.elf into same folder.

  • Create boot.bif file in same folder as shown below.

  • Create BOOT.BIN file using following command.

  • Create a boot partition in SD card and copy BOOT.BIN to boot partition.

  • Boot the ZCU102 board in SD boot mode and observe the output on uart console.

  • APU suspends and resumes RPU and measures its transition time.

Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy