Skip to content

Commit

Permalink
Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/l…
Browse files Browse the repository at this point in the history
…inux into drm-next

Fixes for 4.11. Highlights:
- fix >2 displays on asics with 3 or 5 crtcs
- fix SI headless asics
- powerplay fixes for new polaris variants
- misc fixes

* 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: fix warning on older gcc releases
  drm/ttm: make TTM_MAX_BO_PRIORITY unsigned
  drm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()
  drm/amd/powerplay: add didt config table for polaris kicker
  drm/amd/powerplay: modify VddcPhase value for polaris kicker
  drm/amd/powerplay: add kicker flag into smumgr
  drm/amdgpu: Initialize pipe priority order on graphic initialization
  drm/amdgpu: read hw register to check pg status.
  drm/amdgpu: Add to initialization of mmVCE_VCPU_CNTL register
  drm/amdgpu/pm: check for headless before calling compute_clocks
  drm/amdgpu: use amdgpu_gem_va_check() in amdgpu_gem_va_update_vm()
  drm/amdgpu: add more cases to DCE11 possible crtc mask setup
  • Loading branch information
Dave Airlie committed Feb 17, 2017
2 parents be3c9f5 + e841130 commit dec13c8
Show file tree
Hide file tree
Showing 24 changed files with 228 additions and 38 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,6 @@ struct amdgpu_uvd {
bool use_ctx_buf;
struct amd_sched_entity entity;
uint32_t srbm_soft_reset;
bool is_powergated;
};

/*
Expand Down Expand Up @@ -1066,7 +1065,6 @@ struct amdgpu_vce {
struct amd_sched_entity entity;
uint32_t srbm_soft_reset;
unsigned num_rings;
bool is_powergated;
};

/*
Expand Down
20 changes: 12 additions & 8 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,16 +834,18 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
case CHIP_TOPAZ:
if (((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x81)) ||
((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x83)) ||
((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87)))
((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87))) {
info->is_kicker = true;
strcpy(fw_name, "amdgpu/topaz_k_smc.bin");
else
} else
strcpy(fw_name, "amdgpu/topaz_smc.bin");
break;
case CHIP_TONGA:
if (((adev->pdev->device == 0x6939) && (adev->pdev->revision == 0xf1)) ||
((adev->pdev->device == 0x6938) && (adev->pdev->revision == 0xf1)))
((adev->pdev->device == 0x6938) && (adev->pdev->revision == 0xf1))) {
info->is_kicker = true;
strcpy(fw_name, "amdgpu/tonga_k_smc.bin");
else
} else
strcpy(fw_name, "amdgpu/tonga_smc.bin");
break;
case CHIP_FIJI:
Expand All @@ -858,9 +860,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
((adev->pdev->device == 0x67ff) &&
((adev->pdev->revision == 0xcf) ||
(adev->pdev->revision == 0xef) ||
(adev->pdev->revision == 0xff))))
(adev->pdev->revision == 0xff)))) {
info->is_kicker = true;
strcpy(fw_name, "amdgpu/polaris11_k_smc.bin");
else
} else
strcpy(fw_name, "amdgpu/polaris11_smc.bin");
} else if (type == CGS_UCODE_ID_SMU_SK) {
strcpy(fw_name, "amdgpu/polaris11_smc_sk.bin");
Expand All @@ -874,9 +877,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
(adev->pdev->revision == 0xe4) ||
(adev->pdev->revision == 0xe5) ||
(adev->pdev->revision == 0xe7) ||
(adev->pdev->revision == 0xef)))
(adev->pdev->revision == 0xef))) {
info->is_kicker = true;
strcpy(fw_name, "amdgpu/polaris10_k_smc.bin");
else
} else
strcpy(fw_name, "amdgpu/polaris10_smc.bin");
} else if (type == CGS_UCODE_ID_SMU_SK) {
strcpy(fw_name, "amdgpu/polaris10_smc_sk.bin");
Expand Down
8 changes: 1 addition & 7 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
list_for_each_entry(entry, list, head) {
struct amdgpu_bo *bo =
container_of(entry->bo, struct amdgpu_bo, tbo);

/* if anything is swapped out don't swap it in here,
just abort and wait for the next CS */
if (!amdgpu_bo_gpu_accessible(bo))
goto error;

if (bo->shadow && !amdgpu_bo_gpu_accessible(bo->shadow))
if (amdgpu_gem_va_check(NULL, bo))
goto error;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,8 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
if (!adev->pm.dpm_enabled)
return;

amdgpu_display_bandwidth_update(adev);
if (adev->mode_info.num_crtc)
amdgpu_display_bandwidth_update(adev);

for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
struct amdgpu_ring *ring = adev->rings[i];
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3737,9 +3737,15 @@ static void dce_v11_0_encoder_add(struct amdgpu_device *adev,
default:
encoder->possible_crtcs = 0x3;
break;
case 3:
encoder->possible_crtcs = 0x7;
break;
case 4:
encoder->possible_crtcs = 0xf;
break;
case 5:
encoder->possible_crtcs = 0x1f;
break;
case 6:
encoder->possible_crtcs = 0x3f;
break;
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,14 @@ static void gfx_v7_0_gpu_init(struct amdgpu_device *adev)
WREG32(mmPA_CL_ENHANCE, PA_CL_ENHANCE__CLIP_VTX_REORDER_ENA_MASK |
(3 << PA_CL_ENHANCE__NUM_CLIP_SEQ__SHIFT));
WREG32(mmPA_SC_ENHANCE, PA_SC_ENHANCE__ENABLE_PA_SC_OUT_OF_ORDER_MASK);

tmp = RREG32(mmSPI_ARB_PRIORITY);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS0, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS1, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS2, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS3, 2);
WREG32(mmSPI_ARB_PRIORITY, tmp);

mutex_unlock(&adev->grbm_idx_mutex);

udelay(50);
Expand Down
12 changes: 10 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3898,6 +3898,14 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
PA_SC_FIFO_SIZE__SC_HIZ_TILE_FIFO_SIZE__SHIFT) |
(adev->gfx.config.sc_earlyz_tile_fifo_size <<
PA_SC_FIFO_SIZE__SC_EARLYZ_TILE_FIFO_SIZE__SHIFT));

tmp = RREG32(mmSPI_ARB_PRIORITY);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS0, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS1, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS2, 2);
tmp = REG_SET_FIELD(tmp, SPI_ARB_PRIORITY, PIPE_ORDER_TS3, 2);
WREG32(mmSPI_ARB_PRIORITY, tmp);

mutex_unlock(&adev->grbm_idx_mutex);

}
Expand Down Expand Up @@ -7260,7 +7268,7 @@ static void gfx_v8_0_ring_emit_ce_meta_init(struct amdgpu_ring *ring, uint64_t c
static union {
struct amdgpu_ce_ib_state regular;
struct amdgpu_ce_ib_state_chained_ib chained;
} ce_payload = {0};
} ce_payload = {};

if (ring->adev->virt.chained_ib_support) {
ce_payload_addr = csa_addr + offsetof(struct amdgpu_gfx_meta_data_chained_ib, ce_payload);
Expand All @@ -7287,7 +7295,7 @@ static void gfx_v8_0_ring_emit_de_meta_init(struct amdgpu_ring *ring, uint64_t c
static union {
struct amdgpu_de_ib_state regular;
struct amdgpu_de_ib_state_chained_ib chained;
} de_payload = {0};
} de_payload = {};

gds_addr = csa_addr + 4096;
if (ring->adev->virt.chained_ib_support) {
Expand Down
15 changes: 10 additions & 5 deletions drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ static void uvd_v4_2_stop(struct amdgpu_device *adev)
break;
mdelay(1);
}
break;
if (status & 2)
break;
}

for (i = 0; i < 10; ++i) {
Expand All @@ -411,7 +412,8 @@ static void uvd_v4_2_stop(struct amdgpu_device *adev)
break;
mdelay(1);
}
break;
if (status & 0xf)
break;
}

/* Stall UMC and register bus before resetting VCPU */
Expand All @@ -424,7 +426,8 @@ static void uvd_v4_2_stop(struct amdgpu_device *adev)
break;
mdelay(1);
}
break;
if (status & 0x240)
break;
}

WREG32_P(0x3D49, 0, ~(1 << 2));
Expand Down Expand Up @@ -723,7 +726,8 @@ static int uvd_v4_2_set_powergating_state(void *handle,
if (state == AMD_PG_STATE_GATE) {
uvd_v4_2_stop(adev);
if (adev->pg_flags & AMD_PG_SUPPORT_UVD && amdgpu_dpm == 0) {
if (!(RREG32_SMC(ixCURRENT_PG_STATUS) & 0x4)) {
if (!(RREG32_SMC(ixCURRENT_PG_STATUS) &
CURRENT_PG_STATUS__UVD_PG_STATUS_MASK)) {
WREG32(mmUVD_PGFSM_CONFIG, (UVD_PGFSM_CONFIG__UVD_PGFSM_FSM_ADDR_MASK |
UVD_PGFSM_CONFIG__UVD_PGFSM_POWER_DOWN_MASK |
UVD_PGFSM_CONFIG__UVD_PGFSM_P1_SELECT_MASK));
Expand All @@ -733,7 +737,8 @@ static int uvd_v4_2_set_powergating_state(void *handle,
return 0;
} else {
if (adev->pg_flags & AMD_PG_SUPPORT_UVD && amdgpu_dpm == 0) {
if (RREG32_SMC(ixCURRENT_PG_STATUS) & 0x4) {
if (RREG32_SMC(ixCURRENT_PG_STATUS) &
CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
WREG32(mmUVD_PGFSM_CONFIG, (UVD_PGFSM_CONFIG__UVD_PGFSM_FSM_ADDR_MASK |
UVD_PGFSM_CONFIG__UVD_PGFSM_POWER_UP_MASK |
UVD_PGFSM_CONFIG__UVD_PGFSM_P1_SELECT_MASK));
Expand Down
5 changes: 2 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,10 @@ static int uvd_v5_0_set_powergating_state(void *handle,

if (state == AMD_PG_STATE_GATE) {
uvd_v5_0_stop(adev);
adev->uvd.is_powergated = true;
} else {
ret = uvd_v5_0_start(adev);
if (ret)
goto out;
adev->uvd.is_powergated = false;
}

out:
Expand All @@ -844,7 +842,8 @@ static void uvd_v5_0_get_clockgating_state(void *handle, u32 *flags)

mutex_lock(&adev->pm.mutex);

if (adev->uvd.is_powergated) {
if (RREG32_SMC(ixCURRENT_PG_STATUS) &
CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
DRM_INFO("Cannot get clockgating state when UVD is powergated.\n");
goto out;
}
Expand Down
5 changes: 2 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,12 +1051,10 @@ static int uvd_v6_0_set_powergating_state(void *handle,

if (state == AMD_PG_STATE_GATE) {
uvd_v6_0_stop(adev);
adev->uvd.is_powergated = true;
} else {
ret = uvd_v6_0_start(adev);
if (ret)
goto out;
adev->uvd.is_powergated = false;
}

out:
Expand All @@ -1070,7 +1068,8 @@ static void uvd_v6_0_get_clockgating_state(void *handle, u32 *flags)

mutex_lock(&adev->pm.mutex);

if (adev->uvd.is_powergated) {
if (RREG32_SMC(ixCURRENT_PG_STATUS) &
CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
DRM_INFO("Cannot get clockgating state when UVD is powergated.\n");
goto out;
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx)
WREG32(mmVCE_LMI_SWAP_CNTL, 0);
WREG32(mmVCE_LMI_SWAP_CNTL1, 0);
WREG32(mmVCE_LMI_VM_CTRL, 0);
WREG32_OR(mmVCE_VCPU_CNTL, 0x00100000);

if (adev->asic_type >= CHIP_STONEY) {
WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR0, (adev->vce.gpu_addr >> 8));
WREG32(mmVCE_LMI_VCPU_CACHE_40BIT_BAR1, (adev->vce.gpu_addr >> 8));
Expand Down Expand Up @@ -766,12 +768,10 @@ static int vce_v3_0_set_powergating_state(void *handle,
ret = vce_v3_0_stop(adev);
if (ret)
goto out;
adev->vce.is_powergated = true;
} else {
ret = vce_v3_0_start(adev);
if (ret)
goto out;
adev->vce.is_powergated = false;
}

out:
Expand All @@ -785,7 +785,8 @@ static void vce_v3_0_get_clockgating_state(void *handle, u32 *flags)

mutex_lock(&adev->pm.mutex);

if (adev->vce.is_powergated) {
if (RREG32_SMC(ixCURRENT_PG_STATUS) &
CURRENT_PG_STATUS__VCE_PG_STATUS_MASK) {
DRM_INFO("Cannot get clockgating state when VCE is powergated.\n");
goto out;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_sh_mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5452,5 +5452,7 @@
#define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
#define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
#define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004

#endif /* SMU_7_0_1_SH_MASK_H */
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_1_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -1121,5 +1121,6 @@
#define ixROM_SW_DATA_62 0xc060011c
#define ixROM_SW_DATA_63 0xc0600120
#define ixROM_SW_DATA_64 0xc0600124
#define ixCURRENT_PG_STATUS 0xc020029c

#endif /* SMU_7_1_1_D_H */
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_1_sh_mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -4860,5 +4860,7 @@
#define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
#define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
#define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004

#endif /* SMU_7_1_1_SH_MASK_H */
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -1271,5 +1271,6 @@
#define ixROM_SW_DATA_62 0xc060011c
#define ixROM_SW_DATA_63 0xc0600120
#define ixROM_SW_DATA_64 0xc0600124
#define ixCURRENT_PG_STATUS 0xc020029c

#endif /* SMU_7_1_2_D_H */
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_sh_mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5830,5 +5830,7 @@
#define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
#define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
#define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004

#endif /* SMU_7_1_2_SH_MASK_H */
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -1244,5 +1244,5 @@
#define ixGC_CAC_ACC_CU14 0xc8
#define ixGC_CAC_ACC_CU15 0xc9
#define ixGC_CAC_OVRD_CU 0xe7

#define ixCURRENT_PG_STATUS 0xc020029c
#endif /* SMU_7_1_3_D_H */
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -6076,5 +6076,8 @@
#define GC_CAC_OVRD_CU__OVRRD_SELECT__SHIFT 0x0
#define GC_CAC_OVRD_CU__OVRRD_VALUE_MASK 0xffff0000
#define GC_CAC_OVRD_CU__OVRRD_VALUE__SHIFT 0x10
#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004


#endif /* SMU_7_1_3_SH_MASK_H */
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/include/cgs_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct cgs_firmware_info {
uint32_t ucode_start_address;

void *kptr;
bool is_kicker;
};

struct cgs_mode_info {
Expand Down
Loading

0 comments on commit dec13c8

Please sign in to comment.