All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Jaundrew <david@jaundrew.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH] Avoid FLR for AMD Starship/Matisse Cryptographic Coprocessor
Date: Tue, 28 Sep 2021 17:16:49 -0700	[thread overview]
Message-ID: <9e85bcad-a73c-cccd-4522-a45e599309d7@jaundrew.com> (raw)
In-Reply-To: <20210928214558.GA736874@bhelgaas>

This patch fixes another FLR bug for the Starship/Matisse controller:

AMD Starship/Matisse Cryptogrpahic Coprocessor PSPCPP

This patch allows functions on the same Starship/Matisse device (such as
USB controller,sound card) to properly pass through to a guest OS using
vfio-pc. Without this patch, the virtual machine does not boot and
eventually times out.

Excerpt from lspci -nn showing crypto function on same device as USB and
sound card (which are already listed in quirks.c):

0e:00.1 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD]
  Starship/Matisse Cryptographic Coprocessor PSPCPP [1022:1486]
0e:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD]
  Matisse USB 3.0 Host Controller [1022:149c]
0e:00.4 Audio device [0403]: Advanced Micro Devices, Inc. [AMD]
  Starship/Matisse HD Audio Controller [1022:1487]

Fix tested successfully on an Asus ROG STRIX X570-E GAMING motherboard
with AMD Ryzen 9 3900X.

Signed-off-by: David Jaundrew <david@jaundrew.com>
---
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6d74386eadc2..0d19e7aa219a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5208,6 +5208,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);
 /*
  * FLR may cause the following to devices to hang:
  *
+ * AMD Starship/Matisse Cryptographic Coprocessor PSPCPP 0x1486
  * AMD Starship/Matisse HD Audio Controller 0x1487
  * AMD Starship USB 3.0 Host Controller 0x148c
  * AMD Matisse USB 3.0 Host Controller 0x149c
@@ -5219,6 +5220,7 @@ static void quirk_no_flr(struct pci_dev *dev)
 {
        dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET;
 }
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x1486, quirk_no_flr);
 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);

On 2021-09-28 2:45 p.m., Bjorn Helgaas wrote:
> On Mon, Aug 30, 2021 at 10:17:15PM -0700, David Jaundrew wrote:
>> This patch fixes another FLR bug for the Starship/Matisse controller:
>>
>> AMD Starship/Matisse Cryptogrpahic Coprocessor PSPCPP
>>
>> This patch allows functions on the same Starship/Matisse device (such as USB controller,sound card) to properly pass through to a guest OS using vfio-pc. Without this patch, the virtual machine does not boot and eventually times out.
>>
>> Excerpt from lspci -nn showing crypto function on same device as USB and sound card (which are already listed in quirks.c):
>> 0e:00.1 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Cryptographic Coprocessor PSPCPP [1022:1486]
>> 0e:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller [1022:149c]
>> 0e:00.4 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller [1022:1487]
>>
>> Fix tested successfully on an Asus ROG STRIX X570-E GAMING motherboard with AMD Ryzen 9 3900X.
> This is missing a signed-off-by and the patch is corrupted somehow:
>
>   04:44:29 ~/linux (pci/virtualization)$ git am m/20210830_david_avoid_flr_for_amd_starship_matisse_cryptographic_coprocessor.mbx
>   Applying: Avoid FLR for AMD Starship/Matisse Cryptographic Coprocessor
>   error: corrupt patch at line 4
>   Patch failed at 0001 Avoid FLR for AMD Starship/Matisse Cryptographic Coprocessor
>
> Can you fix?  If you can add least supply a signed-off-by, I can apply
> it manually if necessary.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v5.11#n361
>
>> --- a/drivers/pci/quirks.c      2021-08-30 21:19:25.365738689 -0700
>> +++ b/drivers/pci/quirks.c      2021-08-30 21:21:25.802031789 -0700
>> @@ -5208,6 +5208,7 @@
>>  /*
>>   * FLR may cause the following to devices to hang:
>>   *
>> + * AMD Starship/Matisse Cryptographic Coprocessor PSPCPP 0x1486
>>   * AMD Starship/Matisse HD Audio Controller 0x1487
>>   * AMD Starship USB 3.0 Host Controller 0x148c
>>   * AMD Matisse USB 3.0 Host Controller 0x149c
>> @@ -5219,6 +5220,7 @@
>>  {
>>         dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET;
>>  }
>> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x1486, quirk_no_flr);
>>  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);

  reply	other threads:[~2021-09-29  0:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  5:17 [PATCH] Avoid FLR for AMD Starship/Matisse Cryptographic Coprocessor David Jaundrew
2021-09-28 21:45 ` Bjorn Helgaas
2021-09-29  0:16   ` David Jaundrew [this message]
2021-09-29  0:21     ` Krzysztof Wilczyński
2021-09-29  1:59     ` Bjorn Helgaas
2021-09-29 13:09       ` Deucher, Alexander
2021-09-29 18:26       ` Alex Williamson
2021-09-29 18:50         ` Bjorn Helgaas
2021-09-29 19:34           ` Alex Williamson
2021-09-29 20:07           ` Deucher, Alexander

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=9e85bcad-a73c-cccd-4522-a45e599309d7@jaundrew.com \
    --to=david@jaundrew.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.