Repository navigation
pieeprom-2026-11-17: 2711: nvme: Wait for CSTS.RDY to clear before enable (latest) - #928
Merged
Merged
Conversation
…able (latest) * nvme: Wait for CSTS.RDY to clear before enable The NVMe spec requires the controller to be disabled (CSTS.RDY == 0) before the admin queue registers are written and CC.EN is set. If the controller reports a fatal status during enable it will never set CSTS.RDY, so report an error instead of waiting for the full CAP.TO timeout. * Ignore gpio commands in autoboot.txt autoboot.txt is read from the boot media before boot.img is verified and is deliberately not signed, yet a gpio= line in it could set RP1 pin function, level and pulls on a secure-boot device. * Verify the GPT header CRC A corrupt primary GPT header which still passed the field checks was used instead of the backup header at the end of the device. Add a generic platform_crc32 function to util for the check. * Continue the partition walk if a ramdisk fails to boot If a boot.img loaded from an SD / NVMe partition fails after it has been mounted (e.g. a partially written A/B slot) the bootloader moved on to the next boot-mode and then retried the same slot, so it never fell back to the other slot. Re-open the block device and continue the partition walk from the partition which provided the ramdisk, keeping the retry limit of that device. * Don't retry the failed partition at the start of a partition walk The walk started at the partition selected by the reboot argument or autoboot.txt even though that partition had just failed to boot, so it was tried twice before moving on. * display: Draw cloned displays once per update With display cloning (BCM2711) both displays show the same buffer but display_update drew the whole screen into it once for each started display. Wait for every display, then draw the buffer once. * Detect small FAT32 volumes from the BPB layout FAT32 volumes with fewer than 65525 clusters, for example a 32MB partition formatted with mkfs.fat -F 32, were treated as FAT16 when the partition type did not identify the file-system (GPT or FAT16 MBR types). The root directory was then looked up as a FAT16 root area so files such as autoboot.txt were not found. Fixes: raspberrypi#818 * display: Fill rectangles with vclib_memset4 draw_filled_rect used a DMA memset for each row, which runs at about 40MB/s because it uses 32-bit transfers without bursts. Filling the 1920x1080 network install screen background took 215ms on Pi 5, so each redraw blocked the boot for about 0.23s per display. * Use vector loads to copy USB MSD data from the uncached cache buffer Pi 4 used scalar loads from the uncached alias and Pi 5 used DMA. Both are slower than vclib_memcpy. * Use vector loads to copy NVMe data from the uncached bounce buffer Scalar loads from the uncached alias limited NVMe file loads to ~25 MB/s, adding ~2s to Pi 5 NVMe boot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
The NVMe spec requires the controller to be disabled (CSTS.RDY == 0) before the admin queue registers are written and CC.EN is set. If the controller reports a fatal status during enable it will never set CSTS.RDY, so report an error instead of waiting for the full CAP.TO timeout.
autoboot.txt is read from the boot media before boot.img is verified and is deliberately not signed, yet a gpio= line in it could set RP1 pin function, level and pulls on a secure-boot device.
A corrupt primary GPT header which still passed the field checks was used instead of the backup header at the end of the device. Add a generic platform_crc32 function to util for the check.
If a boot.img loaded from an SD / NVMe partition fails after it has been mounted (e.g. a partially written A/B slot) the bootloader moved on to the next boot-mode and then retried the same slot, so it never fell back to the other slot. Re-open the block device and continue the partition walk from the partition which provided the ramdisk, keeping the retry limit of that device.
The walk started at the partition selected by the reboot argument or autoboot.txt even though that partition had just failed to boot, so it was tried twice before moving on.
With display cloning (BCM2711) both displays show the same buffer but display_update drew the whole screen into it once for each started display. Wait for every display, then draw the buffer once.
FAT32 volumes with fewer than 65525 clusters, for example a 32MB partition formatted with mkfs.fat -F 32, were treated as FAT16 when the partition type did not identify the file-system (GPT or FAT16 MBR types). The root directory was then looked up as a FAT16 root area so files such as autoboot.txt were not found. Fixes: [CM5] Bootloader does not find bootable partition when using autoboot + tryboot on GPT #818
draw_filled_rect used a DMA memset for each row, which runs at about 40MB/s because it uses 32-bit transfers without bursts. Filling the 1920x1080 network install screen background took 215ms on Pi 5, so each redraw blocked the boot for about 0.23s per display.
Pi 4 used scalar loads from the uncached alias and Pi 5 used DMA. Both are slower than vclib_memcpy.
Scalar loads from the uncached alias limited NVMe file loads to ~25 MB/s, adding ~2s to Pi 5 NVMe boot.