All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andre Eikmeyer" <dev@deq.rocks>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/3] drm/amdgpu: add Apple GMUX runtime PM support
Date: Wed, 12 Aug 2026 15:30:21 +0000	[thread overview]
Message-ID: <20260812153022.620691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812144750.36797-3-dev@deq.rocks>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The system suspend and hibernation poweroff callbacks fail to handle the runtime-suspended state for GMUX devices, leading to unhandled MMIO accesses on powered-off hardware if `direct_complete` is aborted.
--

--- Patch [2]: [PATCH v3 2/3] drm/amdgpu: add Apple GMUX runtime PM support ---
commit bd409ba52fe58e23b69e9e8883bcbcd307329cae
Author: Andre Eikmeyer <dev@deq.rocks>
Subject: drm/amdgpu: add Apple GMUX runtime PM support

The MacBookPro15,1 uses Apple GMUX to control power to the discrete GPU,
but it does not expose the ATPX or ACPI power-resource interfaces currently
recognized by amdgpu. A dedicated GMUX runtime PM mode uses the existing
vga_switcheroo PM domain to sequence GPU power. A runtime-suspended GMUX GPU
can remain powered off across system sleep, following the smart-suspend
handling already used by BOCO devices.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0ab380ca7e645..a231a002831bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

[ ... ]

> @@ -2494,11 +2494,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>  		DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
>  
>  	if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
> -		/* only need to skip on ATPX */
> +		/* ATPX requires a full system-sleep transition. */
>  		if (amdgpu_device_supports_px(adev))
>  			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
> -		/* we want direct complete for BOCO */
> -		if (amdgpu_device_supports_boco(adev))
> +		/* BOCO and GMUX can remain runtime suspended across system sleep. */
> +		if (amdgpu_device_supports_boco(adev) ||
> +		    adev->pm.rpm_mode == AMDGPU_RUNPM_GMUX)
>  			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
>  						DPM_FLAG_SMART_SUSPEND |
>  						DPM_FLAG_MAY_SKIP_RESUME);

[Severity: High]
Does this setup require handling the runtime-suspended state in the system
suspend and hibernation callbacks for GMUX devices?

If a child device like the HDA audio controller aborts direct_complete for
the GPU, or if the GPU supports PME from D3cold, the PCI PM core will skip
runtime-resuming the GPU during system suspend.

This causes amdgpu_pmops_suspend() and amdgpu_pmops_poweroff() in
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c to be called while the GPU is still
in the D3cold state powered off by GMUX.

Since these callbacks unconditionally fall through to amdgpu_device_suspend()
without checking the runtime PM state:

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:amdgpu_pmops_suspend() {
    ...
    return amdgpu_device_suspend(drm_dev, true);
}

and

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:amdgpu_pmops_poweroff() {
    ...
    if (adev->in_s4 && adev->in_suspend)
        return 0;

    return amdgpu_device_suspend(drm_dev, true);
}

Could this lead to unhandled MMIO accesses on the powered-off hardware
during the suspension phase and cause system hangs?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812144750.36797-1-dev@deq.rocks?part=2

  reply	other threads:[~2026-08-12 15:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 12:22 [PATCH 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 12:22 ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 dGPU power sequence Andre Eikmeyer
2026-08-12 12:22   ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " Andre Eikmeyer
2026-08-12 12:38   ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 " sashiko-bot
2026-08-12 12:22 ` [PATCH 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 12:48   ` sashiko-bot
2026-08-12 12:22 ` [PATCH 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 13:01   ` sashiko-bot
2026-08-12 13:45   ` Takashi Iwai
2026-08-12 13:53     ` Takashi Iwai
2026-08-12 14:03   ` [PATCH v2 " Andre Eikmeyer
2026-08-12 14:23     ` [PATCH v3 " Andre Eikmeyer
2026-08-12 14:30       ` Takashi Iwai
2026-08-12 14:04   ` [PATCH " Christian König
2026-08-12 14:42 ` [PATCH v2 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 14:42   ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 dGPU power sequence Andre Eikmeyer
2026-08-12 14:42     ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 " Andre Eikmeyer
2026-08-12 15:11     ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " sashiko-bot
2026-08-12 14:42   ` [PATCH v2 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 15:24     ` sashiko-bot
2026-08-12 14:42   ` [PATCH v2 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 15:36     ` sashiko-bot
2026-08-12 14:47   ` [PATCH v3 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 14:47     ` [PATCH v3 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 dGPU power sequence Andre Eikmeyer
2026-08-12 14:47       ` [PATCH v3 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " Andre Eikmeyer
2026-08-12 15:07       ` sashiko-bot
2026-08-12 14:47     ` [PATCH v3 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 15:30       ` sashiko-bot [this message]
2026-08-12 14:47     ` [PATCH v3 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 15:46       ` sashiko-bot

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=20260812153022.620691F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dev@deq.rocks \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.