On 24/11/2021 12:43, Jinpu Wang wrote:
I notice that the driver is calling virt_to_phys() on a dma_addr_t,
which is broken:
phys_to_virt you meant.
Right
static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb)
{
char *preq_dma_addr = NULL;
__le64 tmp_addr;
tmp_addr = cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req));
preq_dma_addr = (char *)phys_to_virt(tmp_addr);
The code was there since the initial support in 2013.
f5860992db55 ("[SCSI] pm80xx: Added SPCv/ve specific hardware
functionalities and relevant changes in common files")
How is this supposed to work? I assume that someone has enabled the
IOMMU on a system with one of these cards before.
One thing to note is that a long time ago I had to fix libsas for broken
DMA API usage which was exposed when the IOMMU enabled, which also seems
strange not to be noticed then.
See commit 9702c67c6066 ("scsi: libsas: fix ata xfer length")
I guess it's due to the unaligned access to memory on ARM? AFAIK most
of the user are on x86_64.
I doubt it, especially since !IOMMU seems ok.
I have encountered some other RAID cards which bypasses the IOMMU to
access host memory - is that the case here potentially?
I don't know, maybe guys from microchip can answer.
Hopefully.
Thanks,
John