linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	Brijesh Singh <brijesh.singh@amd.com>
Subject: Re: [PATCH] pci: Avoid FLR for AMD FCH AHCI adapters
Date: Mon, 30 Jan 2023 15:46:06 +0000	[thread overview]
Message-ID: <Y9fmPef6PyBfcqt1@x1-carbon> (raw)
In-Reply-To: <20230130152111.GA1673431@bhelgaas>

On Mon, Jan 30, 2023 at 09:21:11AM -0600, Bjorn Helgaas wrote:
> [+cc Mario, Shyam, Brijesh]
> 
> On Sat, Jan 28, 2023 at 10:39:51AM +0900, Damien Le Moal wrote:
> > PCI passthrough to VMs does not work with AMD FCH AHCI adapters: the
> > guest OS fails to correctly probe devices attached to the controller due
> > to FIS communication failures. 
> 
> What does a FIS communication failure look like?  Can we include a
> line or two of dmesg output here to help users find this fix?

Hello Bjorn,

It looks like this:

[   22.402368] ata4: softreset failed (1st FIS failed)
[   32.417855] ata4: softreset failed (1st FIS failed)
[   67.441641] ata4: softreset failed (1st FIS failed)
[   67.453227] ata4: limiting SATA link speed to 3.0 Gbps
[   72.661738] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[   78.121263] ata4.00: qc timeout after 5000 msecs (cmd 0xec)
[   78.134413] ata4.00: failed to IDENTIFY (I/O error, err_mask=0x4)

Basically, we can read and write MMIO registers in the AHCI HBA,
but the communication between the AHCI HBA and the ATA device does
not work properly.

(Because the AHCI HBA did not get reset when binding/unbinding the
device.)

The exact same kernel, using the same generic AHCI driver within the VM,
can communicate perfectly fine when using e.g. an Intel AHCI HBA.

(With both the AMD and Intel AHCI HBAs being bound to the vfio-pci driver
in the host.)

We can send a v2 with the above dmesg output.


Kind regards,
Niklas

> 
> AMD folks: Can you confirm/deny that this is a hardware erratum in
> this device?  Do you know of any other devices that need a similar
> workaround?
> 
> > Forcing the "bus" reset method before
> > unbinding & binding the adapter to the vfio-pci driver solves this
> > issue. I.e.:
> > 
> > echo "bus" > /sys/bus/pci/devices/<ID>/reset_method
> > 
> > gives a working guest OS, thus indicating that the default flr reset
> > method is defective, resulting in the adapter not being reset correctly.
> > 
> > This patch applies the no_flr quirk to AMD FCH AHCI devices to
> > permanently solve this issue.
> > 
> > Reported-by: Niklas Cassel <niklas.cassel@wdc.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> > ---
> >  drivers/pci/quirks.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index 285acc4aaccc..20ac67d59034 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -5340,6 +5340,7 @@ static void quirk_no_flr(struct pci_dev *dev)
> >  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x1487, quirk_no_flr);
> >  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x148c, quirk_no_flr);
> >  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x149c, quirk_no_flr);
> > +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x7901, quirk_no_flr);
> >  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_no_flr);
> >  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_no_flr);
> >  
> > -- 
> > 2.39.1
> > 

  reply	other threads:[~2023-01-30 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  1:39 [PATCH] pci: Avoid FLR for AMD FCH AHCI adapters Damien Le Moal
2023-01-30 15:21 ` Bjorn Helgaas
2023-01-30 15:46   ` Niklas Cassel [this message]
2023-01-30 16:04     ` Bjorn Helgaas
2023-01-31  0:36       ` Damien Le Moal
2023-01-30 16:12   ` Shyam Sundar S K
2023-01-30 16:33     ` Niklas Cassel

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=Y9fmPef6PyBfcqt1@x1-carbon \
    --to=niklas.cassel@wdc.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=bhelgaas@google.com \
    --cc=brijesh.singh@amd.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    /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).