Repository navigation
nvme: apple: keep bounced segments aligned to the controller page - #2094
RyanTheTide merged 1 commit into
Conversation
|
Blockers: 1. The fix is right. dma-direct bounces the sub-cache-line tail of a non-coherent mapping through swiotlb. Without a min_align_mask, the slot keeps only IO_TLB_SIZE alignment, so a bounced PRP entry can start at offset 0x800. drivers/nvme/host/apple.c:2584 sets the same mask as nvme-pci, before any queue or PRP pool is set up and right after the DMA mask. The device is an OF platform device, so it has
HW row: the body describes the failure on T8142 and the passing run on J704. Please give the J704's SoC and the kernel build. Also run the same uutils Assisted-by: LLM (Claude:Opus 5.5) |
PRP list entries must be NVME_CTRL_PAGE_SIZE aligned. When dma-direct
bounces a segment through swiotlb (the ANS is not DMA-coherent, so
segments smaller than the cache line are bounced), the bounce slot can
start at any IO_TLB_SIZE (2 KiB) boundary, and a bounced segment that
ends up as a PRP list entry is then misaligned.
This happens with O_DIRECT buffers that are not page aligned (e.g. the
uutils dd in Ubuntu 26.04 uses buffers at page offset 0x10): every 1 MiB
command ends in a 16-byte tail segment that gets bounced. On T8142 (M5)
a tail bounced to a slot at page offset 0x800 made the ANS firmware
assert ("SLL idx 0 F2H error 0x200 - PRP_DDR_ERR") and the controller
could not be recovered without a reboot.
Set the DMA min_align_mask to NVME_CTRL_PAGE_SIZE - 1, as nvme-pci does,
so swiotlb preserves the offset within the controller page. With this,
the same 2 MiB unaligned read 30 times, 4 MiB direct reads and 4 GiB
sequential reads complete without errors.
Signed-off-by: termg <[email protected]>
215e339 to
2cb43fe
Compare
|
Thanks. HW row details: the J704 is the 14-inch MacBook Pro M5, SoC T8142 ( We have no M1 or M2, so I can't give the SART row myself; it needs someone with one of those Macs. Trailer: gone. I rewrote the branch once for it (same tree, new hash), so the commit carries only my Signed-off-by, and the PR body ends with the Assisted-by: LLM (Claude:Opus 5.5) |
|
J704 row with this commit: MacBook Pro 14-inch M5 (J704, SoC T8142), Fedora 44, kernel
No ANS assert (no The M1/M2 (SART) row still needs someone with one of those Macs. Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-review of 2cb43fe: No blockers. From the last comment:
The only row still open is a SART-based ANS. That needs a tester with the hardware; it doesn't block the change. HW row: M1 or M2 (SART ANS), the same kernel plus 2cb43fe, and the same O_DIRECT read script at page offset 0x10. Pass: no controller assert, the reads complete, and the regression line shows 0 failed units, 0 AVC denials and 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
a6d0a19
into
aurora-silicon:integration/aurora
PRP list entries must be NVME_CTRL_PAGE_SIZE aligned. The ANS is not DMA-coherent, so dma-direct bounces segments smaller than a cache line through swiotlb, and a bounce slot can start at any 2 KiB boundary. With O_DIRECT buffers that are not page aligned (Ubuntu 26.04's uutils dd uses page offset 0x10), every 1 MiB command ends in a 16-byte tail that gets bounced; on T8142 a tail bounced to page offset 0x800 made the ANS firmware assert ("SLL idx 0 F2H error 0x200 - PRP_DDR_ERR") and the controller could not recover without a reboot.
Set the DMA min_align_mask to NVME_CTRL_PAGE_SIZE - 1, as nvme-pci does. With it, the same unaligned 2 MiB read 30 times, 4 MiB direct reads and 4 GiB sequential reads complete.
Tested on J704 (read-only tests of the internal SSD). Written with an AI assistant and tested on the hardware by me.
Assisted-by: LLM (Claude:Opus 5.5)