Linux ATA/IDE development
 help / color / mirror / Atom feed
* iommu/vt-d: data corruption, AHCI gets IOVAs inside its RMRR (HP Gen8)
@ 2026-11-24 18:08 Pe3k
  2026-11-24 21:19 ` Niklas Cassel
  0 siblings, 1 reply; 2+ messages in thread
From: Pe3k @ 2026-11-24 18:08 UTC (permalink / raw)
  To: iommu
  Cc: Lu Baolu, David Woodhouse, Joerg Roedel, Will Deacon,
	Robin Murphy, Damien Le Moal, Niklas Cassel, linux-ide

Hi,

On the HP ProLiant MicroServer Gen8 (Xeon E3-1265L V2, C204, BIOS J06
04/04/2019) the AHCI controller is handed IOVAs inside an RMRR that the
firmware declares for it. With the default translated DMA domain this
corrupts disk data on every boot under write load. iommu=pt avoids it.
Seen on two machines of this model, on 6.12.118, 7.3.4 and 7.4-rc4.

Topology
--------
00:1f.0 ISA bridge [8086:1c54] and 00:1f.2 AHCI [8086:1c02] share IOMMU
group 10 (DMA-FQ), probed in that order. The group's reserved_regions
include "0xf1f7e000 0xf1f94fff direct". The DMAR RMRRs covering that
range list 00:1f.2 in their device scope, but not 00:1f.0.

6.12.118 (default cmdline)
--------------------------
Once per boot, ~20 min into sustained writes, 23 errors (21 + 2):

  DMAR: ERROR: DMA PTE for vPFN 0xf1f80 already set (to f1f80003 not 167119001)

from AHCI writeback (ata_qc_issue -> iommu_dma_map_sg). Each one is a
4 KiB page that reaches the disk with wrong content: mostly zeros, some
with firmware data from the RMRR. No I/O error is reported.

7.3.4 and 7.4-rc4 (default cmdline)
-----------------------------------
No DMAR errors. Instead 64-84 writes per boot fail before reaching the
device:

  ata2.00: failed command: WRITE FPDMA QUEUED
  ... res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x40 (internal error)

followed by I/O errors and 4-8 MiB of zeros in written files. In one
7.3.4 run the machine also took an NMI (iLO: "Unrecoverable System
Error (NMI)"). An iommu:map trace filtered to the RMRR shows the cause:

  map: IOMMU: iova=0x00000000f1f7e000 - 0x00000000f1f7e000
paddr=0x00000001c94d6000 size=0
   => iommu_map_nosync <= iommu_map_sg <= iommu_dma_map_sg
   <= dma_map_sg_attrs <= ata_qc_issue

With iommu=pt both 6.12 and 7.3.4 run clean.

Suspected cause (not verified in the source)
--------------------------------------------
The domain's IOVA reservations seem to come from the device that
initialises it (00:1f.0, no RMRR). When 00:1f.2 joins the domain, its
RMRRs are identity-mapped but never reserved in the IOVA allocator.

Reproducer
----------
Fresh boot, ext4 on an AHCI disk, 6 parallel cp of a 10 GiB random
file, sync, drop_caches, compare hashes. Fails within ~25 minutes.

I can test patches on a spare machine of this model. Full logs, the
DMAR table and traces are available on request.

I used Claude Code to run the tests, analyse the
logs and draft this report. The results and logs are from my own
machines, and I have reviewed the report.

Thanks,
Peter Nouza

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 18:08 iommu/vt-d: data corruption, AHCI gets IOVAs inside its RMRR (HP Gen8) Pe3k
2026-11-24 21:19 ` Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox