Skip to content

Commit 2e4e9de

Browse files
committed
Merge tag 'amd-drm-fixes-6.3-2023-03-23' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.3-2023-03-23: amdgpu: - S4 fix - Soft reset fixes - SR-IOV fix - Remove an out of date comment in the DC code - ASPM fix - DCN 3.2 fixes Signed-off-by: Daniel Vetter <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents e37fef7 + f9537b1 commit 2e4e9de

File tree

11 files changed

+72
-41
lines changed

11 files changed

+72
-41
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
12721272
int amdgpu_device_pci_reset(struct amdgpu_device *adev);
12731273
bool amdgpu_device_need_post(struct amdgpu_device *adev);
12741274
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
1275+
bool amdgpu_device_aspm_support_quirk(void);
12751276

12761277
void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
12771278
u64 num_vis_bytes);
@@ -1391,10 +1392,12 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta
13911392
int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
13921393

13931394
void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1395+
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
13941396
void amdgpu_acpi_detect(void);
13951397
#else
13961398
static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
13971399
static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1400+
static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return false; }
13981401
static inline void amdgpu_acpi_detect(void) { }
13991402
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
14001403
static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
@@ -1405,11 +1408,9 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
14051408

14061409
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
14071410
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
1408-
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
14091411
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
14101412
#else
14111413
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1412-
static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return false; }
14131414
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
14141415
#endif
14151416

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,29 @@ static bool amdgpu_atcs_pci_probe_handle(struct pci_dev *pdev)
971971
return true;
972972
}
973973

974+
975+
/**
976+
* amdgpu_acpi_should_gpu_reset
977+
*
978+
* @adev: amdgpu_device_pointer
979+
*
980+
* returns true if should reset GPU, false if not
981+
*/
982+
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
983+
{
984+
if (adev->flags & AMD_IS_APU)
985+
return false;
986+
987+
if (amdgpu_sriov_vf(adev))
988+
return false;
989+
990+
#if IS_ENABLED(CONFIG_SUSPEND)
991+
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
992+
#else
993+
return true;
994+
#endif
995+
}
996+
974997
/*
975998
* amdgpu_acpi_detect - detect ACPI ATIF/ATCS methods
976999
*
@@ -1042,24 +1065,6 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
10421065
(pm_suspend_target_state == PM_SUSPEND_MEM);
10431066
}
10441067

1045-
/**
1046-
* amdgpu_acpi_should_gpu_reset
1047-
*
1048-
* @adev: amdgpu_device_pointer
1049-
*
1050-
* returns true if should reset GPU, false if not
1051-
*/
1052-
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
1053-
{
1054-
if (adev->flags & AMD_IS_APU)
1055-
return false;
1056-
1057-
if (amdgpu_sriov_vf(adev))
1058-
return false;
1059-
1060-
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
1061-
}
1062-
10631068
/**
10641069
* amdgpu_acpi_is_s0ix_active
10651070
*

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080

8181
#include <drm/drm_drv.h>
8282

83+
#if IS_ENABLED(CONFIG_X86)
84+
#include <asm/intel-family.h>
85+
#endif
86+
8387
MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
8488
MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
8589
MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");
@@ -1356,6 +1360,17 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
13561360
return pcie_aspm_enabled(adev->pdev);
13571361
}
13581362

1363+
bool amdgpu_device_aspm_support_quirk(void)
1364+
{
1365+
#if IS_ENABLED(CONFIG_X86)
1366+
struct cpuinfo_x86 *c = &cpu_data(0);
1367+
1368+
return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
1369+
#else
1370+
return true;
1371+
#endif
1372+
}
1373+
13591374
/* if we get transitioned to only one device, take VGA back */
13601375
/**
13611376
* amdgpu_device_vga_set_decode - enable/disable vga decode

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,10 @@ static int amdgpu_pmops_freeze(struct device *dev)
24672467
adev->in_s4 = false;
24682468
if (r)
24692469
return r;
2470-
return amdgpu_asic_reset(adev);
2470+
2471+
if (amdgpu_acpi_should_gpu_reset(adev))
2472+
return amdgpu_asic_reset(adev);
2473+
return 0;
24712474
}
24722475

24732476
static int amdgpu_pmops_thaw(struct device *dev)

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,15 @@ void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring)
678678
ptr = &ring->fence_drv.fences[i];
679679
old = rcu_dereference_protected(*ptr, 1);
680680
if (old && old->ops == &amdgpu_job_fence_ops) {
681+
struct amdgpu_job *job;
682+
683+
/* For non-scheduler bad job, i.e. failed ib test, we need to signal
684+
* it right here or we won't be able to track them in fence_drv
685+
* and they will remain unsignaled during sa_bo free.
686+
*/
687+
job = container_of(old, struct amdgpu_job, hw_fence);
688+
if (!job->base.s_fence && !dma_fence_is_signaled(old))
689+
dma_fence_signal(old);
681690
RCU_INIT_POINTER(*ptr, NULL);
682691
dma_fence_put(old);
683692
}

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,11 @@ static int gfx_v11_0_sw_init(void *handle)
12871287
break;
12881288
}
12891289

1290+
/* Enable CG flag in one VF mode for enabling RLC safe mode enter/exit */
1291+
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(11, 0, 3) &&
1292+
amdgpu_sriov_is_pp_one_vf(adev))
1293+
adev->cg_flags = AMD_CG_SUPPORT_GFX_CGCG;
1294+
12901295
/* EOP Event */
12911296
r = amdgpu_irq_add_id(adev, SOC21_IH_CLIENTID_GRBM_CP,
12921297
GFX_11_0_0__SRCID__CP_EOP_INTERRUPT,
@@ -4655,6 +4660,14 @@ static bool gfx_v11_0_check_soft_reset(void *handle)
46554660
return false;
46564661
}
46574662

4663+
static int gfx_v11_0_post_soft_reset(void *handle)
4664+
{
4665+
/**
4666+
* GFX soft reset will impact MES, need resume MES when do GFX soft reset
4667+
*/
4668+
return amdgpu_mes_resume((struct amdgpu_device *)handle);
4669+
}
4670+
46584671
static uint64_t gfx_v11_0_get_gpu_clock_counter(struct amdgpu_device *adev)
46594672
{
46604673
uint64_t clock;
@@ -6166,6 +6179,7 @@ static const struct amd_ip_funcs gfx_v11_0_ip_funcs = {
61666179
.wait_for_idle = gfx_v11_0_wait_for_idle,
61676180
.soft_reset = gfx_v11_0_soft_reset,
61686181
.check_soft_reset = gfx_v11_0_check_soft_reset,
6182+
.post_soft_reset = gfx_v11_0_post_soft_reset,
61696183
.set_clockgating_state = gfx_v11_0_set_clockgating_state,
61706184
.set_powergating_state = gfx_v11_0_set_powergating_state,
61716185
.get_clockgating_state = gfx_v11_0_get_clockgating_state,

drivers/gpu/drm/amd/amdgpu/nv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ static void nv_pcie_gen3_enable(struct amdgpu_device *adev)
578578

579579
static void nv_program_aspm(struct amdgpu_device *adev)
580580
{
581-
if (!amdgpu_device_should_use_aspm(adev))
581+
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
582582
return;
583583

584584
if (!(adev->flags & AMD_IS_APU) &&

drivers/gpu/drm/amd/amdgpu/vi.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@
8181
#include "mxgpu_vi.h"
8282
#include "amdgpu_dm.h"
8383

84-
#if IS_ENABLED(CONFIG_X86)
85-
#include <asm/intel-family.h>
86-
#endif
87-
8884
#define ixPCIE_LC_L1_PM_SUBSTATE 0x100100C6
8985
#define PCIE_LC_L1_PM_SUBSTATE__LC_L1_SUBSTATES_OVERRIDE_EN_MASK 0x00000001L
9086
#define PCIE_LC_L1_PM_SUBSTATE__LC_PCI_PM_L1_2_OVERRIDE_MASK 0x00000002L
@@ -1138,24 +1134,13 @@ static void vi_enable_aspm(struct amdgpu_device *adev)
11381134
WREG32_PCIE(ixPCIE_LC_CNTL, data);
11391135
}
11401136

1141-
static bool aspm_support_quirk_check(void)
1142-
{
1143-
#if IS_ENABLED(CONFIG_X86)
1144-
struct cpuinfo_x86 *c = &cpu_data(0);
1145-
1146-
return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
1147-
#else
1148-
return true;
1149-
#endif
1150-
}
1151-
11521137
static void vi_program_aspm(struct amdgpu_device *adev)
11531138
{
11541139
u32 data, data1, orig;
11551140
bool bL1SS = false;
11561141
bool bClkReqSupport = true;
11571142

1158-
if (!amdgpu_device_should_use_aspm(adev) || !aspm_support_quirk_check())
1143+
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
11591144
return;
11601145

11611146
if (adev->flags & AMD_IS_APU ||

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7244,7 +7244,6 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
72447244
if (!aconnector->mst_root)
72457245
drm_connector_attach_max_bpc_property(&aconnector->base, 8, 16);
72467246

7247-
/* This defaults to the max in the range, but we want 8bpc for non-edp. */
72487247
aconnector->base.state->max_bpc = 16;
72497248
aconnector->base.state->max_requested_bpc = aconnector->base.state->max_bpc;
72507249

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,7 @@ static void dccg32_set_dpstreamclk(
271271
dccg32_set_dtbclk_p_src(dccg, src, otg_inst);
272272

273273
/* enabled to select one of the DTBCLKs for pipe */
274-
switch (otg_inst)
275-
{
274+
switch (dp_hpo_inst) {
276275
case 0:
277276
REG_UPDATE_2(DPSTREAMCLK_CNTL,
278277
DPSTREAMCLK0_EN,

0 commit comments

Comments
 (0)