linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Jinpu Wang <jinpu.wang@ionos.com>,
	Viswas G <Viswas.G@microchip.com>,
	Ajish Koshy <Ajish.Koshy@microchip.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [issue report] pm8001 driver crashes with IOMMU enabled
Date: Wed, 24 Nov 2021 16:22:12 +0000	[thread overview]
Message-ID: <00505633-c8c0-8213-8909-482bf43661cd@huawei.com> (raw)
In-Reply-To: <CAMGffEkvrAxhrsL=azkVzQHHyDczZwJ3uiNWydSA6o2K+Xh_Jw@mail.gmail.com>

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


  reply	other threads:[~2021-11-24 16:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 12:28 [issue report] pm8001 driver crashes with IOMMU enabled John Garry
2021-11-24 12:43 ` Jinpu Wang
2021-11-24 16:22   ` John Garry [this message]
2021-12-24  9:02     ` [issue report] pm8001 issues (was driver crashes with IOMMU enabled) John Garry
2021-12-24 11:58       ` John Garry
2021-12-27 13:26         ` Ajish.Koshy
2022-01-06 15:49           ` John Garry
2022-01-07 11:12             ` Ajish.Koshy
2022-01-10 20:21               ` John Garry
2022-01-11 12:40                 ` Ajish.Koshy
2022-01-11 13:23                   ` John Garry
2022-01-13 12:52                     ` Ajish.Koshy
2022-01-13 14:17                       ` John Garry
2022-01-14 18:21                         ` John Garry
2022-01-17 13:56                           ` Ajish.Koshy
2022-01-17 14:02                         ` Ajish.Koshy
2022-01-18 15:49                           ` John Garry
2022-01-19 13:49                             ` Ajish.Koshy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00505633-c8c0-8213-8909-482bf43661cd@huawei.com \
    --to=john.garry@huawei.com \
    --cc=Ajish.Koshy@microchip.com \
    --cc=Viswas.G@microchip.com \
    --cc=jinpu.wang@ionos.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).