From: Shanker R Donthineni <sdonthineni@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>,
Sinan Kaya <okaya@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>, <linux-pci@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Vikram Sethi <vsethi@nvidia.com>
Subject: Re: [PATCH 1/1] PCI: Add pci reset quirk for Nvidia GPUs
Date: Fri, 23 Apr 2021 16:45:15 -0500 [thread overview]
Message-ID: <c758d8a8-4f8b-c505-118e-b364e93ae539@nvidia.com> (raw)
In-Reply-To: <20210423093701.594efd86@redhat.com>
On 4/23/21 10:37 AM, Alex Williamson wrote:
> External email: Use caution opening links or attachments
>
>
> On Fri, 23 Apr 2021 11:12:05 -0400
> Sinan Kaya <okaya@kernel.org> wrote:
>
>> +Alex,
>>
>> On 4/23/2021 10:54 AM, Shanker Donthineni wrote:
>>> +static int reset_nvidia_gpu_quirk(struct pci_dev *dev, int probe)
>>> +{
>>> +#ifdef CONFIG_ACPI
>>> + acpi_handle handle = ACPI_HANDLE(&dev->dev);
>>> +
>>> + /*
>>> + * Check for the affected devices' ID range. If device is not in
>>> + * the affected range, return -ENOTTY indicating no device
>>> + * specific reset method is available.
>>> + */
>>> + if ((dev->device & 0xffc0) != 0x2340)
>>> + return -ENOTTY;
>>> +
>>> + /*
>>> + * Return -ENOTTY indicating no device-specific reset method if _RST
>>> + * method is not defined
>>> + */
>>> + if (!handle || !acpi_has_method(handle, "_RST"))
>>> + return -ENOTTY;
>>> +
>>> + /* Return 0 for probe phase indicating that we can reset this device */
>>> + if (probe)
>>> + return 0;
>>> +
>>> + /* Invoke _RST() method to perform the device-specific reset */
>>> + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_RST", NULL, NULL))) {
>>> + pci_warn(dev, "Failed to reset the device\n");
>>> + return -EINVAL;
>>> + }
>>> + return 0;
>>> +#else
>>> + return -ENOTTY;
>>> +#endif
>>> +}
>> Interesting, some pieces of this function (especially the ACPI _RST)
>> could be generalized.
> Agreed, we should add a new function level reset method for this rather
> than a device specific reset. At that point the extent of the device
> specific quirk could be to restrict SBR.
Thanks Sinan/Alex, Agree ACPI _RST is a generic method applicable
to all PCI-ACPI-DEVICE objects. I'll define a new helper function
pci_dev_acpi_reset() and move common code to it. I've one question
before posting a v2 patch, should I call pci_dev_acpi_reset() from
the reset_nvidia_gpu_quirk() or always apply _RST method if exists?
Option-1:
static int reset_nvidia_gpu_quirk(struct pci_dev *dev, int probe)
{
/* Check for the affected devices' ID range */
if ((dev->device & 0xffc0) != 0x2340)
return -ENOTTY;
return pci_dev_acpi_reset(dev, probe);
}
OR
Option-2
int pci_dev_specific_reset(struct pci_dev *dev, int probe)
{
const struct pci_dev_reset_methods *i;
if (!pci_dev_acpi_reset(dev, probe))
return 0;
...
}
> It'd be useful to know what
> these devices are (not in pciids yet), why we expect to only see them in
> specific platforms (embedded device?), and the failure mode of the SBR.
These are not plug-in PCIe GPU cards, will exist on upcoming
server baseboards. Triggering SBR without firmware notification
would leave the device inoperable for the current system boot.
It requires a system hard-reboot to get the GPU device back to
normal operating condition post-SBR.
> Thanks,
>
> Alex
>
next prev parent reply other threads:[~2021-04-23 21:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 14:54 [PATCH 1/1] PCI: Add pci reset quirk for Nvidia GPUs Shanker Donthineni
2021-04-23 15:12 ` Sinan Kaya
2021-04-23 15:37 ` Alex Williamson
2021-04-23 21:45 ` Shanker R Donthineni [this message]
2021-04-26 18:19 ` Christoph Hellwig
2021-04-26 19:15 ` Alex Williamson
2021-04-26 19:02 ` Alex Williamson
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=c758d8a8-4f8b-c505-118e-b364e93ae539@nvidia.com \
--to=sdonthineni@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=okaya@kernel.org \
--cc=vsethi@nvidia.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).