Skip to contentSkip to conversation

drm/amd: Exclude dGPUs in eGPU enclosures from DPM quirks

PATCH In review Mario Limonciello 2 participants 3 messages Nov 6, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Exclude dGPUs in eGPU enclosures from DPM quirks

DPM should be enabled on dGPUs that are used in eGPU enclosures regardless of the host support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -2
index e2199d8fd30e..29d5820e912b 100644
@@ -1466,11 +1466,15 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
  * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
  * https://gitlab.freedesktop.org/drm/amd/-/issues/2663
  */
-static bool amdgpu_device_pcie_dynamic_switching_supported(void)
+static bool amdgpu_device_pcie_dynamic_switching_supported(struct amdgpu_device *adev)
 {
 #if IS_ENABLED(CONFIG_X86)
 	struct cpuinfo_x86 *c = &cpu_data(0);
 
+	/* don't worry about external dGPUs */
+	if (dev_is_removable(adev->dev))
+		return true;
+
 	if (c->x86_vendor == X86_VENDOR_INTEL)
 		return false;
 #endif
@@ -2310,7 +2314,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 		adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
 	if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)
 		adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK;
-	if (!amdgpu_device_pcie_dynamic_switching_supported())
+	if (!amdgpu_device_pcie_dynamic_switching_supported(adev))
 		adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK;
 
 	total = true;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Mario Limonciello

DPM should be enabled on dGPUs that are used in eGPU enclosures regardless of the host support.

Are you sure? Seems like this would be dependent on whether the eGPU bridge supports dynamic switching or not.

Alex

Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -3
index e2199d8fd30e..29d5820e912b 100644
@@ -1466,11 +1466,15 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
  * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
  * https://gitlab.freedesktop.org/drm/amd/-/issues/2663
  */
-static bool amdgpu_device_pcie_dynamic_switching_supported(void)
+static bool amdgpu_device_pcie_dynamic_switching_supported(struct amdgpu_device *adev)
 {
 #if IS_ENABLED(CONFIG_X86)
        struct cpuinfo_x86 *c = &cpu_data(0);
 
+       /* don't worry about external dGPUs */
+       if (dev_is_removable(adev->dev))
+               return true;
+
        if (c->x86_vendor == X86_VENDOR_INTEL)
                return false;
 #endif
@@ -2310,7 +2314,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
        if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)
                adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK;
-       if (!amdgpu_device_pcie_dynamic_switching_supported())
+       if (!amdgpu_device_pcie_dynamic_switching_supported(adev))
                adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK;
 
        total = true;
--

2.34.1

#2 lore raw
Quoted 8 lines · Alex Deucher
Quoted 3 lines · Mario Limonciello

DPM should be enabled on dGPUs that are used in eGPU enclosures regardless of the host support.

Are you sure? Seems like this would be dependent on whether the eGPU bridge supports dynamic switching or not.

Right; but the bridge the eGPU is connected to is "outside" the host.

We shouldn't be blocking the bridge 100% of the time if it's connected to an Intel host.

I *believe* right now the way the code is put together if you take an otherwise identical OS image with amd-staging-drm-next and connect an eGPU to an Intel USB4 host you'll end up with DPM turned off and an AMD USB4 host will have it enabled.

Quoted 42 lines

Alex

Quoted 39 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -3
index e2199d8fd30e..29d5820e912b 100644
@@ -1466,11 +1466,15 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
   * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
   * https://gitlab.freedesktop.org/drm/amd/-/issues/2663
   */
-static bool amdgpu_device_pcie_dynamic_switching_supported(void)
+static bool amdgpu_device_pcie_dynamic_switching_supported(struct amdgpu_device *adev)
  {
  #if IS_ENABLED(CONFIG_X86)
         struct cpuinfo_x86 *c = &cpu_data(0);
 
+       /* don't worry about external dGPUs */
+       if (dev_is_removable(adev->dev))
+               return true;
+
         if (c->x86_vendor == X86_VENDOR_INTEL)
                 return false;
  #endif
@@ -2310,7 +2314,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
         if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)
                 adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK;
-       if (!amdgpu_device_pcie_dynamic_switching_supported())
+       if (!amdgpu_device_pcie_dynamic_switching_supported(adev))
                 adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK;
 
         total = true;
--

2.34.1