Skip to content

Commit 105c425

Browse files
artmoty-devfloatious
authored andcommitted
ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585
The JMicron JMB585 (and JMB582) SATA controllers advertise 64-bit DMA support via the S64A bit in the AHCI CAP register, but their 64-bit DMA implementation is defective. Under sustained I/O, DMA transfers targeting addresses above 4GB silently corrupt data -- writes land at incorrect memory addresses with no errors logged. The failure pattern is similar to the ASMedia ASM1061 (commit 20730e9 ("ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers")), which also falsely advertised full 64-bit DMA support. However, the JMB585 requires a stricter 32-bit DMA mask rather than 43-bit, as corruption occurs with any address above 4GB. On the Minisforum N5 Pro specifically, the combination of the JMB585's broken 64-bit DMA with the AMD Family 1Ah (Strix Point) IOMMU causes silent data corruption that is only detectable via checksumming filesystems (BTRFS/ZFS scrub). The corruption occurs when 32-bit IOVA space is exhausted and the kernel transparently switches to 64-bit DMA addresses. Add device-specific PCI ID entries for the JMB582 (0x0582) and JMB585 (0x0585) before the generic JMicron class match, using a new board type that combines AHCI_HFLAG_IGN_IRQ_IF_ERR (preserving existing behavior) with AHCI_HFLAG_32BIT_ONLY to force 32-bit DMA masks. Signed-off-by: Arthur Husband <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Signed-off-by: Niklas Cassel <[email protected]>
1 parent e6d7eba commit 105c425

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/ata/ahci.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ enum board_ids {
6868
/* board IDs for specific chipsets in alphabetical order */
6969
board_ahci_al,
7070
board_ahci_avn,
71+
board_ahci_jmb585,
7172
board_ahci_mcp65,
7273
board_ahci_mcp77,
7374
board_ahci_mcp89,
@@ -212,6 +213,15 @@ static const struct ata_port_info ahci_port_info[] = {
212213
.udma_mask = ATA_UDMA6,
213214
.port_ops = &ahci_avn_ops,
214215
},
216+
/* JMicron JMB582/585: 64-bit DMA is broken, force 32-bit */
217+
[board_ahci_jmb585] = {
218+
AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR |
219+
AHCI_HFLAG_32BIT_ONLY),
220+
.flags = AHCI_FLAG_COMMON,
221+
.pio_mask = ATA_PIO4,
222+
.udma_mask = ATA_UDMA6,
223+
.port_ops = &ahci_ops,
224+
},
215225
[board_ahci_mcp65] = {
216226
AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP |
217227
AHCI_HFLAG_YES_NCQ),
@@ -439,6 +449,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
439449
/* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */
440450
{ PCI_VDEVICE(INTEL, 0x4b63), board_ahci_pcs_quirk }, /* Elkhart Lake AHCI */
441451

452+
/* JMicron JMB582/585: force 32-bit DMA (broken 64-bit implementation) */
453+
{ PCI_VDEVICE(JMICRON, 0x0582), board_ahci_jmb585 },
454+
{ PCI_VDEVICE(JMICRON, 0x0585), board_ahci_jmb585 },
455+
442456
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
443457
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
444458
PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },

0 commit comments

Comments
 (0)