ZynqMP ZCU102 SD-card Linux boot: EL2 handoff, SDHCI init, QSPI hardening - #750
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
End-to-end fixes for booting Linux from an SD card on the ZynqMP ZCU102
with wolfBoot at EL2, plus QSPI-boot and large-FIT hardening uncovered
during bring-up.
EL2 handoff
src/boot_aarch64_start.S): newel2_flush_and_disable_mmucleans D-cache to PoC, invalidates I-cacheto PoU, clears
SCTLR_EL2.{M,C,I}. Required by the ARM64 Linux bootprotocol. Called from
do_boot()on the EL2 direct-jump path.config/examples/zynqmp_sdcard.config): default to EL2(comment out
BOOT_EL1) to match the PetaLinux U-Boot flow andpreserve KVM/hypervisor use of EL2.
Device-tree fixups
hal_dts_fixup()(hal/zynq.c): inject/chosen/bootargsfromLINUX_BOOTARGS; grow DTB totalsize by 512 bytes forfdt_setprop()headroom. Only defined whenMMU && __WOLFBOOT.hal_get_timer_us(): ARMv8 generic-timer read viaCNTPCT_EL0with a 100 MHz fallback when
CNTFRQ_EL0is not programmed.SDHCI reliability
so the Arasan controller consistently detects the card after the
slot-type change / soft reset.
SDHCI_DMA_THRESHOLDlowered to 4 KB so multi-block reads use SDMAinstead of PIO, sidestepping the Arasan BRR re-poll race under
-Os/-O2.SDHCI_DMA_BUFF_BOUNDARYauto-derived from the threshold; documentedoverride uses the raw register value (
0x7000) so it is safe inside#ifexpressions.QSPI hardening (
hal/zynq.c)qspi_flash_reset()(0x66RESET_ENABLE +0x99RESET_MEMORY)per chip in
qspi_init, so the flash starts from a known stateregardless of what FSBL/BootROM left behind (XIP, 4-byte addressing,
auto-boot probing).
IOU_TAPDLY_BYPASSwrites now route throughpmu_requestat EL≤2 inthe ≤40 MHz and ≤100 MHz branches (previously only the ≤150 MHz
branch handled this); the register is equally unwritable from EL2/EL1
at lower clocks.
Linker layout (
hal/zynq.ld)ORIGINmoved from0x08000000→0x10000000with a 2 MBreservation. Kernels loaded at
0x00200000with payloads >~126 MBwould otherwise memcpy across
0x08000000and clobber wolfBoot's own.textduring handoff.WOLFBOOT_ORIGINinconfig/examples/zynqmp_sdcard.configaligned to0x10000000to match the linker (sofactory.bin/factory.srecencode the correct load address).
TRACE32 tooling (
tools/scripts/zcu102/zcu102-ca53-qspi.cmm)PREPAREONLYentry, single/dual toggle,
READ_ID_TESTfor single-flash variants,separate dialogs for
BOOT.BINat offset 0 andtest-app/image_v1_signed.binat the partition boot address.FLASHFILE.Create: larger files must be split externally (e.g. viadd) and loaded in chunks.Versal alignment
hal/versal.cdefaultLINUX_BOOTARGS_ROOTrestored to/dev/mmcblk0p2(matching the prior Versal layout); a comment pointsto
/dev/mmcblk0p4for configs using the 4-partition OFP_A/OFP_Blayout.
hal_dts_fixup()no longer masksfdt_find_node_offseterrors —only
-FDT_ERR_NOTFOUNDfalls through tofdt_add_subnode()(applied to both
hal/zynq.candhal/versal.c).Docs (
docs/Targets.md)EL2 cleanup behavior for ZynqMP and Versal SD-card sections.
Behavior changes
inheriting wolfBoot's translation tables. No in-tree payload relies
on the old state leakage.
SDHCI_DMA_THRESHOLDlowered to 4 KB (was 512 KB): virtually allmulti-block reads go through SDMA.
ORIGINis 0x10000000 (was 0x08000000) onhal/zynq.ld;WOLFBOOT_ORIGINinzynqmp_sdcard.configfollows.Verification
Load address 0x10000000, kernel brings up rootfs on/dev/mmcblk0p4.zynqmp.config,zynqmp_sdcard.config,versal_vmk180.config,versal_vmk180_sdcard.configall build clean(via
.github/workflows/test-configs.yml).