]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd: Move helper for dynamic speed switch check out of smu13
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 19 Jul 2023 15:01:10 +0000 (23:01 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 9 Aug 2023 09:38:18 +0000 (11:38 +0200)
BugLink: https://bugs.launchpad.net/bugs/2027957
This helper is used for checking if the connected host supports
the feature, it can be moved into generic code to be used by other
smu implementations as well.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.1.x
(cherry picked from commit 188623076d0f1a500583d392b6187056bf7cc71a
linux-next)
Signed-off-by: Koba Ko <koba.ko@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index c26e350583bf6f8be2e6f668a246ecbb71bcdafb..305cebf1e83dbf5cfe92fbe7bd8ee49b916760ad 100644 (file)
@@ -1267,6 +1267,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
 int amdgpu_device_pci_reset(struct amdgpu_device *adev);
 bool amdgpu_device_need_post(struct amdgpu_device *adev);
+bool amdgpu_device_pcie_dynamic_switching_supported(void);
 bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
 bool amdgpu_device_aspm_support_quirk(void);
 
index 8a14202f8613444eacbd232c2a1b3f867e92f61e..3705c904acab8fb43d629c966fc0cd7007153ce4 100644 (file)
@@ -1334,6 +1334,25 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
        return true;
 }
 
+/*
+ * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
+ * speed switching. Until we have confirmation from Intel that a specific host
+ * supports it, it's safer that we keep it disabled for all.
+ *
+ * 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
+ */
+bool amdgpu_device_pcie_dynamic_switching_supported(void)
+{
+#if IS_ENABLED(CONFIG_X86)
+       struct cpuinfo_x86 *c = &cpu_data(0);
+
+       if (c->x86_vendor == X86_VENDOR_INTEL)
+               return false;
+#endif
+       return true;
+}
+
 /**
  * amdgpu_device_should_use_aspm - check if the device should program ASPM
  *
index 3db46205723c2298819b1416b00d91add176bd84..852b24a345da94ad7919e6c57e32c631d7213b83 100644 (file)
@@ -2490,25 +2490,6 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
        return ret;
 }
 
-/*
- * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
- * speed switching. Until we have confirmation from Intel that a specific host
- * supports it, it's safer that we keep it disabled for all.
- *
- * 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 smu_v13_0_is_pcie_dynamic_switching_supported(void)
-{
-#if IS_ENABLED(CONFIG_X86)
-       struct cpuinfo_x86 *c = &cpu_data(0);
-
-       if (c->x86_vendor == X86_VENDOR_INTEL)
-               return false;
-#endif
-       return true;
-}
-
 int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
                                     uint32_t pcie_gen_cap,
                                     uint32_t pcie_width_cap)
@@ -2520,7 +2501,7 @@ int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
        uint32_t smu_pcie_arg;
        int ret, i;
 
-       if (!smu_v13_0_is_pcie_dynamic_switching_supported()) {
+       if (!amdgpu_device_pcie_dynamic_switching_supported()) {
                if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap)
                        pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1];