Skip to content

Commit a3ed353

Browse files
ShirishShalexdeucher
authored andcommitted
amdgpu/gmc_v9: save/restore sdpif regs during S3
fixes S3 issue with IOMMU + S/G enabled @ 64M VRAM. Suggested-by: Alex Deucher <[email protected]> Signed-off-by: Shirish S <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 4829f89 commit a3ed353

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ struct amdgpu_gmc {
195195
uint32_t srbm_soft_reset;
196196
bool prt_warning;
197197
uint64_t stolen_size;
198+
uint32_t sdpif_register;
198199
/* apertures */
199200
u64 shared_aperture_start;
200201
u64 shared_aperture_end;

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,19 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
12711271
}
12721272
}
12731273

1274+
/**
1275+
* gmc_v9_0_restore_registers - restores regs
1276+
*
1277+
* @adev: amdgpu_device pointer
1278+
*
1279+
* This restores register values, saved at suspend.
1280+
*/
1281+
static void gmc_v9_0_restore_registers(struct amdgpu_device *adev)
1282+
{
1283+
if (adev->asic_type == CHIP_RAVEN)
1284+
WREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0, adev->gmc.sdpif_register);
1285+
}
1286+
12741287
/**
12751288
* gmc_v9_0_gart_enable - gart enable
12761289
*
@@ -1376,6 +1389,20 @@ static int gmc_v9_0_hw_init(void *handle)
13761389
return r;
13771390
}
13781391

1392+
/**
1393+
* gmc_v9_0_save_registers - saves regs
1394+
*
1395+
* @adev: amdgpu_device pointer
1396+
*
1397+
* This saves potential register values that should be
1398+
* restored upon resume
1399+
*/
1400+
static void gmc_v9_0_save_registers(struct amdgpu_device *adev)
1401+
{
1402+
if (adev->asic_type == CHIP_RAVEN)
1403+
adev->gmc.sdpif_register = RREG32(mmDCHUBBUB_SDPIF_MMIO_CNTRL_0);
1404+
}
1405+
13791406
/**
13801407
* gmc_v9_0_gart_disable - gart disable
13811408
*
@@ -1412,16 +1439,24 @@ static int gmc_v9_0_hw_fini(void *handle)
14121439

14131440
static int gmc_v9_0_suspend(void *handle)
14141441
{
1442+
int r;
14151443
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
14161444

1417-
return gmc_v9_0_hw_fini(adev);
1445+
r = gmc_v9_0_hw_fini(adev);
1446+
if (r)
1447+
return r;
1448+
1449+
gmc_v9_0_save_registers(adev);
1450+
1451+
return 0;
14181452
}
14191453

14201454
static int gmc_v9_0_resume(void *handle)
14211455
{
14221456
int r;
14231457
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
14241458

1459+
gmc_v9_0_restore_registers(adev);
14251460
r = gmc_v9_0_hw_init(adev);
14261461
if (r)
14271462
return r;

drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7376,6 +7376,8 @@
73767376
#define mmCRTC4_CRTC_DRR_CONTROL 0x0f3e
73777377
#define mmCRTC4_CRTC_DRR_CONTROL_BASE_IDX 2
73787378

7379+
#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 0x395d
7380+
#define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX 2
73797381

73807382
// addressBlock: dce_dc_fmt4_dispdec
73817383
// base address: 0x2000

0 commit comments

Comments
 (0)