nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Karol Herbst <kherbst@redhat.com>
To: Ratchanan Srirattanamet <peathot@hotmail.com>
Cc: nouveau@lists.freedesktop.org, bskeggs@redhat.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [Nouveau] [PATCH v2] drm/nouveau: don't detect DSM for non-NVIDIA device
Date: Mon, 5 Jun 2023 12:21:18 +0200	[thread overview]
Message-ID: <CACO55ttutaud0zO-aw=x9i-++jhsOBmDJKiFE9NT=1tYc1GXuQ@mail.gmail.com> (raw)
In-Reply-To: <DM6PR19MB2780805D4BE1E3F9B3AC96D0BC409@DM6PR19MB2780.namprd19.prod.outlook.com>

On Tue, May 23, 2023 at 11:12 PM Ratchanan Srirattanamet
<peathot@hotmail.com> wrote:
>
> The call site of nouveau_dsm_pci_probe() uses single set of output
> variables for all invocations. So, we must not write anything to them
> unless it's an NVIDIA device. Otherwise, if we are called with another
> device after the NVIDIA device, we'll clober the result of the NVIDIA
> device.
>
> For example, if the other device doesn't have _PR3 resources, the
> detection later would miss the presence of power resource support, and
> the rest of the code will keep using Optimus DSM, breaking power
> management for that machine.
>
> Also, because we're detecting NVIDIA's DSM, it doesn't make sense to run
> this detection on a non-NVIDIA device anyway. Thus, check at the
> beginning of the detection code if this is an NVIDIA card, and just
> return if it isn't.
>
> This, together with commit d22915d22ded ("drm/nouveau/devinit/tu102-:
> wait for GFW_BOOT_PROGRESS == COMPLETED") developed independently and
> landed earlier, fixes runtime power management of the NVIDIA card in
> Lenovo Legion 5-15ARH05. Without this patch, the GPU resumption code
> will "timeout", sometimes hanging userspace.
>
> As a bonus, we'll also stop preventing _PR3 usage from the bridge for
> unrelated devices, which is always nice, I guess.
>
> Signed-off-by: Ratchanan Srirattanamet <peathot@hotmail.com>
> Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/79
> ---
> V1 -> V2:
> - Update the changelog to indicate that it now actually fixes the issue.
> - Add 'Closes:' tag.
>
>  drivers/gpu/drm/nouveau/nouveau_acpi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
> index 8cf096f841a9..a2ae8c21e4dc 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
> @@ -220,6 +220,9 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out
>         int optimus_funcs;
>         struct pci_dev *parent_pdev;
>
> +       if (pdev->vendor != PCI_VENDOR_ID_NVIDIA)
> +               return;
> +
>         *has_pr3 = false;
>         parent_pdev = pci_upstream_bridge(pdev);
>         if (parent_pdev) {
>
> base-commit: 5fe326b4467689ef3690491ee2ad25ff4d81fe59
> --
> 2.34.1
>

Reviewed-by: Karol Herbst <kherbst@redhat.com>

I'll add a Cc: <stable@vger.kernel.org> when pushing the change as
I'll also think about how far in the past to get it applied. Though it
shouldn't hurt as it shouldn't make things worse on any system.


      reply	other threads:[~2023-06-05 10:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 21:11 [Nouveau] [PATCH v2] drm/nouveau: don't detect DSM for non-NVIDIA device Ratchanan Srirattanamet
2023-06-05 10:21 ` Karol Herbst [this message]

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='CACO55ttutaud0zO-aw=x9i-++jhsOBmDJKiFE9NT=1tYc1GXuQ@mail.gmail.com' \
    --to=kherbst@redhat.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=peathot@hotmail.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).