Re: [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 dGPU power sequence

[email protected]
Newsgroups org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Connecting an external GPU (eGPU) overwrites the internal discrete GPU reference, permanently breaking internal GPU power management.
--

--- Patch [1]: [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 dGPU power sequence ---
commit 469501c98c440969c62cc4d684e58812e4f65cfa
Author: Atharva Tiwari <[email protected]>

platform/x86: apple-gmux: add MacBookPro15,1 dGPU power sequence

The discrete GPU on the MacBookPro15,1 does not return after the legacy
GMUX power-on sequence. Evaluate the firmware PWG1 and PWG3 link methods
around the GMUX transition and wait for PCI configuration space before
completing power-on.

> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index fbc30f1f8abdf..ce926a10131e8 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c

[ ... ]

> @@ -549,11 +607,16 @@ static enum vga_switcheroo_client_id gmux_get_client_id(struct pci_dev *pdev)
>  	 */
>  	if (pdev->vendor == PCI_VENDOR_ID_INTEL)
>  		return VGA_SWITCHEROO_IGD;
> -	else if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
> -		 pdev->device == 0x0863)
> +	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA && pdev->device == 0x0863)
>  		return VGA_SWITCHEROO_IGD;
> -	else
> -		return VGA_SWITCHEROO_DIS;
> +
> +	if (apple_gmux_data->use_pwg_power_sequence &&
> +	    apple_gmux_data->discrete_pdev != pdev) {
> +		pci_dev_put(apple_gmux_data->discrete_pdev);
> +		apple_gmux_data->discrete_pdev = pci_dev_get(pdev);
> +	}
> +
> +	return VGA_SWITCHEROO_DIS;
>  }

[Severity: High]
Does connecting an external GPU (eGPU) overwrite the internal discrete GPU
reference here and break internal GPU power management?

When an eGPU is connected via Thunderbolt, its audio controller is probed by
the snd_hda_intel driver. This driver unconditionally calls
vga_switcheroo_register_audio_client(), passing the eGPU as the bound VGA
device.

vga_switcheroo then invokes the gmux_get_client_id() callback with the eGPU's
pdev to resolve the audio client's ID. Because the eGPU is not an integrated
GPU, this new check executes and overwrites apple_gmux_data->discrete_pdev
with the eGPU's pci_dev.

If this happens, subsequent power state changes might attempt to evaluate ACPI
methods like PWG1 and PWG3 on the eGPU instead of the internal dGPU, which
could leave the internal dGPU in an undefined power state and break hybrid
graphics.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.