linux/drivers/scsi/mpi3mr
Damien Le Moal 1abc900ddd scsi: mpi3mr: Avoid IOMMU page faults on REPORT ZONES
Some firmware versions of the 9600 series SAS HBA byte-swap the REPORT
ZONES command reply buffer from ATA-ZAC devices by directly accessing the
buffer in the host memory. This does not respect the default command DMA
direction and causes IOMMU page faults on architectures with an IOMMU
enforcing write-only mappings for DMA_FROM_DEVICE DMA direction (e.g. AMD
hosts), leading to the device capacity to be dropped to 0:

scsi 18:0:58:0: Direct-Access-ZBC ATA      WDC  WSH722626AL W930 PQ: 0 ANSI: 7
scsi 18:0:58:0: Power-on or device reset occurred
sd 18:0:58:0: Attached scsi generic sg9 type 20
sd 18:0:58:0: [sdj] Host-managed zoned block device
mpi3mr 0000:c1:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0xfec0c400 flags=0x0050]
mpi3mr 0000:c1:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0xfec0c500 flags=0x0050]
sd 18:0:58:0: [sdj] REPORT ZONES start lba 0 failed
sd 18:0:58:0: [sdj] REPORT ZONES: Result: hostbyte=DID_SOFT_ERROR driverbyte=DRIVER_OK
sd 18:0:58:0: [sdj] 0 4096-byte logical blocks: (0 B/0 B)
sd 18:0:58:0: [sdj] Write Protect is off
sd 18:0:58:0: [sdj] Mode Sense: 6b 00 10 08
sd 18:0:58:0: [sdj] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 18:0:58:0: [sdj] Attached SCSI disk

Avoid this issue by always mapping the buffer of REPORT ZONES commands
using DMA_BIDIRECTIONAL, that is, using a read-write IOMMU mapping.

Suggested-by: Christoph Hellwig <hch@lst.de>
Fixes: 023ab2a9b4 ("scsi: mpi3mr: Add support for queue command processing")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20240719073913.179559-2-dlemoal@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-07-22 20:37:03 -04:00
..
mpi scsi: mpi3mr: HDB allocation and posting for hardware and firmware buffers 2024-06-26 23:30:09 -04:00
Kconfig scsi: mpi3mr: Select CONFIG_SCSI_SAS_ATTRS 2022-10-22 03:14:51 +00:00
Makefile scsi: mpi3mr: Refer CONFIG_SCSI_MPI3MR in Makefile 2022-12-14 03:01:38 +00:00
mpi3mr_app.c Merge branch '6.10/scsi-fixes' into 6.11/scsi-staging 2024-07-10 22:23:30 -04:00
mpi3mr_debug.h scsi: mpi3mr: Update copyright year 2023-03-16 23:54:29 -04:00
mpi3mr_fw.c scsi: mpi3mr: Prevent PCI writes from driver during PCI error recovery 2024-07-04 23:37:07 -04:00
mpi3mr_os.c scsi: mpi3mr: Avoid IOMMU page faults on REPORT ZONES 2024-07-22 20:37:03 -04:00
mpi3mr_transport.c Merge branch '6.10/scsi-fixes' into 6.11/scsi-staging 2024-07-10 22:23:30 -04:00
mpi3mr.h scsi: mpi3mr: Driver version update 2024-07-04 23:37:07 -04:00