Skip to content

Commit 78e9800

Browse files
committed
Merge tag 'amd-drm-next-6.3-2023-02-03' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.3-2023-02-03: amdgpu: - PCI hotplug fixes - Allow S0ix without BIOS support - GC11 fixes - DCN 3.2.x fixes - Enable freesync over PCon - DSC fix - DCN 3.1.4 fixes - NBIO 4.3 fix - Misc code cleanups and spelling fixes - Temporarily disable S/G on DCN 2.1 and 3.1.2/3 - Fix and re-enable S/G on DCN 3.1.4 - Re-enable the AGP aperture on GMC 11.x Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 1c0db6d + 69ed0c5 commit 78e9800

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+435
-176
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10791079
* S0ix even though the system is suspending to idle, so return false
10801080
* in that case.
10811081
*/
1082-
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1082+
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
10831083
dev_warn_once(adev->dev,
10841084
"Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
10851085
"To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1086-
return false;
1087-
}
10881086

10891087
#if !IS_ENABLED(CONFIG_AMD_PMC)
10901088
dev_warn_once(adev->dev,
10911089
"Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
1092-
return false;
1093-
#else
1094-
return true;
10951090
#endif /* CONFIG_AMD_PMC */
1091+
return true;
10961092
}
10971093

10981094
#endif /* CONFIG_SUSPEND */

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4031,7 +4031,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
40314031

40324032
amdgpu_gart_dummy_page_fini(adev);
40334033

4034-
amdgpu_device_unmap_mmio(adev);
4034+
if (drm_dev_is_unplugged(adev_to_drm(adev)))
4035+
amdgpu_device_unmap_mmio(adev);
40354036

40364037
}
40374038

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,6 +2227,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
22272227
struct drm_device *dev = pci_get_drvdata(pdev);
22282228
struct amdgpu_device *adev = drm_to_adev(dev);
22292229

2230+
drm_dev_unplug(dev);
2231+
22302232
if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
22312233
pm_runtime_get_sync(dev->dev);
22322234
pm_runtime_forbid(dev->dev);
@@ -2266,8 +2268,6 @@ amdgpu_pci_remove(struct pci_dev *pdev)
22662268

22672269
amdgpu_driver_unload_kms(dev);
22682270

2269-
drm_dev_unplug(dev);
2270-
22712271
/*
22722272
* Flush any in flight DMA operations from device.
22732273
* Clear the Bus Master Enable bit and then wait on the PCIe Device

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,21 @@ psp_cmd_submit_buf(struct psp_context *psp,
606606
int timeout = 20000;
607607
bool ras_intr = false;
608608
bool skip_unsupport = false;
609+
bool dev_entered;
609610

610611
if (psp->adev->no_hw_access)
611612
return 0;
612613

613-
if (!drm_dev_enter(adev_to_drm(psp->adev), &idx))
614-
return 0;
614+
dev_entered = drm_dev_enter(adev_to_drm(psp->adev), &idx);
615+
/*
616+
* We allow sending PSP messages LOAD_ASD and UNLOAD_TA without acquiring
617+
* a lock in drm_dev_enter during driver unload because we must call
618+
* drm_dev_unplug as the beginning of unload driver sequence . It is very
619+
* crucial that userspace can't access device instances anymore.
620+
*/
621+
if (!dev_entered)
622+
WARN_ON(psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_LOAD_ASD &&
623+
psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_UNLOAD_TA);
615624

616625
memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
617626

@@ -676,7 +685,8 @@ psp_cmd_submit_buf(struct psp_context *psp,
676685
}
677686

678687
exit:
679-
drm_dev_exit(idx);
688+
if (dev_entered)
689+
drm_dev_exit(idx);
680690
return ret;
681691
}
682692

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,11 +983,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
983983
if (offset == reg_access_ctrl->grbm_cntl) {
984984
/* if the target reg offset is grbm_cntl, write to scratch_reg2 */
985985
writel(v, scratch_reg2);
986-
writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
987986
} else if (offset == reg_access_ctrl->grbm_idx) {
988987
/* if the target reg offset is grbm_idx, write to scratch_reg3 */
989988
writel(v, scratch_reg3);
990-
writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
991989
} else {
992990
/*
993991
* SCRATCH_REG0 = read/write value

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void df_v1_7_update_medium_grain_clock_gating(struct amdgpu_device *adev,
9494
WREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater, tmp);
9595
}
9696

97-
/* Exit boradcast mode */
97+
/* Exit broadcast mode */
9898
adev->df.funcs->enable_broadcast_mode(adev, false);
9999
}
100100

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,8 @@ static void gfx_v11_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd,
754754
* zero here */
755755
WARN_ON(simd != 0);
756756

757-
/* type 2 wave data */
758-
dst[(*no_fields)++] = 2;
757+
/* type 3 wave data */
758+
dst[(*no_fields)++] = 3;
759759
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_STATUS);
760760
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_LO);
761761
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_HI);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,11 @@ static void gfxhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)
151151
{
152152
uint64_t value;
153153

154-
/* Disable AGP. */
154+
/* Program the AGP BAR */
155155
WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BASE, 0);
156-
WREG32_SOC15(GC, 0, regGCMC_VM_AGP_TOP, 0);
157-
WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BOT, 0x00FFFFFF);
156+
WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
157+
WREG32_SOC15(GC, 0, regGCMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
158+
158159

159160
/* Program the system aperture low logical page number. */
160161
WREG32_SOC15(GC, 0, regGCMC_VM_SYSTEM_APERTURE_LOW_ADDR,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ static void gmc_v11_0_vram_gtt_location(struct amdgpu_device *adev,
673673

674674
amdgpu_gmc_vram_location(adev, &adev->gmc, base);
675675
amdgpu_gmc_gart_location(adev, mc);
676+
amdgpu_gmc_agp_location(adev, mc);
676677

677678
/* base offset of vram pages */
678679
if (amdgpu_sriov_vf(adev))

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)
177177
* these regs, and they will be programed at host.
178178
* so skip programing these regs.
179179
*/
180-
/* Disable AGP. */
180+
/* Program the AGP BAR */
181181
WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0);
182-
WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0);
183-
WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF);
182+
WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
183+
WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
184+
184185
/* Program the system aperture low logical page number. */
185186
WREG32_SOC15(MMHUB, 0, regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR,
186187
adev->gmc.vram_start >> 18);

0 commit comments

Comments
 (0)