Skip to content

Commit d4ef5d2

Browse files
committed
Merge tag 'amd-drm-fixes-6.11-2024-07-25' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-fixes-6.11-2024-07-25: amdgpu: - SDMA 5.2 workaround - GFX12 fixes - Uninitialized variable fix - VCN/JPEG 4.0.3 fixes - Misc display fixes - RAS fixes - VCN4/5 harvest fix - GPU reset fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 86f259c + 5659b0c commit d4ef5d2

File tree

20 files changed

+261
-17
lines changed

20 files changed

+261
-17
lines changed

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ amdgpu-y += \
106106
df_v1_7.o \
107107
df_v3_6.o \
108108
df_v4_3.o \
109-
df_v4_6_2.o
109+
df_v4_6_2.o \
110+
df_v4_15.o
110111

111112
# add GMC block
112113
amdgpu-y += \

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct amdgpu_df_hash_status {
3333
struct amdgpu_df_funcs {
3434
void (*sw_init)(struct amdgpu_device *adev);
3535
void (*sw_fini)(struct amdgpu_device *adev);
36+
void (*hw_init)(struct amdgpu_device *adev);
3637
void (*enable_broadcast_mode)(struct amdgpu_device *adev,
3738
bool enable);
3839
u32 (*get_fb_channel_number)(struct amdgpu_device *adev);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "df_v3_6.h"
3838
#include "df_v4_3.h"
3939
#include "df_v4_6_2.h"
40+
#include "df_v4_15.h"
4041
#include "nbio_v6_1.h"
4142
#include "nbio_v7_0.h"
4243
#include "nbio_v7_4.h"
@@ -2803,6 +2804,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
28032804
case IP_VERSION(4, 6, 2):
28042805
adev->df.funcs = &df_v4_6_2_funcs;
28052806
break;
2807+
case IP_VERSION(4, 15, 0):
2808+
case IP_VERSION(4, 15, 1):
2809+
adev->df.funcs = &df_v4_15_funcs;
2810+
break;
28062811
default:
28072812
break;
28082813
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,9 +1630,7 @@ static int psp_ras_send_cmd(struct psp_context *psp,
16301630

16311631
switch (cmd) {
16321632
case TA_RAS_COMMAND__TRIGGER_ERROR:
1633-
if (ret || psp->cmd_buf_mem->resp.status)
1634-
ret = -EINVAL;
1635-
else if (out)
1633+
if (!ret && out)
16361634
memcpy(out, &ras_cmd->ras_status, sizeof(ras_cmd->ras_status));
16371635
break;
16381636
case TA_RAS_COMMAND__QUERY_ADDRESS:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,9 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control,
10111011

10121012
uint32_t amdgpu_ras_eeprom_max_record_count(struct amdgpu_ras_eeprom_control *control)
10131013
{
1014+
/* get available eeprom table version first before eeprom table init */
1015+
amdgpu_ras_set_eeprom_table_version(control);
1016+
10141017
if (control->tbl_hdr.version == RAS_TABLE_VER_V2_1)
10151018
return RAS_MAX_RECORD_COUNT_V2_1;
10161019
else

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ uint64_t amdgpu_vm_generation(struct amdgpu_device *adev, struct amdgpu_vm *vm)
434434
if (!vm)
435435
return result;
436436

437-
result += vm->generation;
437+
result += lower_32_bits(vm->generation);
438438
/* Add one if the page tables will be re-generated on next CS */
439439
if (drm_sched_entity_error(&vm->delayed))
440440
++result;
@@ -463,13 +463,14 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm,
463463
int (*validate)(void *p, struct amdgpu_bo *bo),
464464
void *param)
465465
{
466+
uint64_t new_vm_generation = amdgpu_vm_generation(adev, vm);
466467
struct amdgpu_vm_bo_base *bo_base;
467468
struct amdgpu_bo *shadow;
468469
struct amdgpu_bo *bo;
469470
int r;
470471

471-
if (drm_sched_entity_error(&vm->delayed)) {
472-
++vm->generation;
472+
if (vm->generation != new_vm_generation) {
473+
vm->generation = new_vm_generation;
473474
amdgpu_vm_bo_reset_state_machine(vm);
474475
amdgpu_vm_fini_entities(vm);
475476
r = amdgpu_vm_init_entities(adev, vm);
@@ -2439,7 +2440,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
24392440
vm->last_update = dma_fence_get_stub();
24402441
vm->last_unlocked = dma_fence_get_stub();
24412442
vm->last_tlb_flush = dma_fence_get_stub();
2442-
vm->generation = 0;
2443+
vm->generation = amdgpu_vm_generation(adev, NULL);
24432444

24442445
mutex_init(&vm->eviction_lock);
24452446
vm->evicting = false;

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2024 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
#include "amdgpu.h"
24+
#include "df_v4_15.h"
25+
26+
#include "df/df_4_15_offset.h"
27+
#include "df/df_4_15_sh_mask.h"
28+
29+
static void df_v4_15_hw_init(struct amdgpu_device *adev)
30+
{
31+
if (adev->have_atomics_support) {
32+
uint32_t tmp;
33+
uint32_t dis_lcl_proc = (1 << 1 |
34+
1 << 2 |
35+
1 << 13);
36+
37+
tmp = RREG32_SOC15(DF, 0, regNCSConfigurationRegister1);
38+
tmp |= (dis_lcl_proc << NCSConfigurationRegister1__DisIntAtomicsLclProcessing__SHIFT);
39+
WREG32_SOC15(DF, 0, regNCSConfigurationRegister1, tmp);
40+
}
41+
}
42+
43+
const struct amdgpu_df_funcs df_v4_15_funcs = {
44+
.hw_init = df_v4_15_hw_init
45+
};

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2024 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
24+
#ifndef __DF_V4_15_H__
25+
#define __DF_V4_15_H__
26+
27+
extern const struct amdgpu_df_funcs df_v4_15_funcs;
28+
29+
#endif /* __DF_V4_15_H__ */
30+

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#include "vcn/vcn_4_0_3_sh_mask.h"
3333
#include "ivsrcid/vcn/irqsrcs_vcn_4_0.h"
3434

35+
#define NORMALIZE_JPEG_REG_OFFSET(offset) \
36+
(offset & 0x1FFFF)
37+
3538
enum jpeg_engin_status {
3639
UVD_PGFSM_STATUS__UVDJ_PWR_ON = 0,
3740
UVD_PGFSM_STATUS__UVDJ_PWR_OFF = 2,
@@ -621,6 +624,13 @@ static uint64_t jpeg_v4_0_3_dec_ring_get_wptr(struct amdgpu_ring *ring)
621624
ring->pipe ? (0x40 * ring->pipe - 0xc80) : 0);
622625
}
623626

627+
static void jpeg_v4_0_3_ring_emit_hdp_flush(struct amdgpu_ring *ring)
628+
{
629+
/* JPEG engine access for HDP flush doesn't work when RRMT is enabled.
630+
* This is a workaround to avoid any HDP flush through JPEG ring.
631+
*/
632+
}
633+
624634
/**
625635
* jpeg_v4_0_3_dec_ring_set_wptr - set write pointer
626636
*
@@ -817,7 +827,13 @@ void jpeg_v4_0_3_dec_ring_emit_ib(struct amdgpu_ring *ring,
817827
void jpeg_v4_0_3_dec_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
818828
uint32_t val, uint32_t mask)
819829
{
820-
uint32_t reg_offset = (reg << 2);
830+
uint32_t reg_offset;
831+
832+
/* For VF, only local offsets should be used */
833+
if (amdgpu_sriov_vf(ring->adev))
834+
reg = NORMALIZE_JPEG_REG_OFFSET(reg);
835+
836+
reg_offset = (reg << 2);
821837

822838
amdgpu_ring_write(ring, PACKETJ(regUVD_JRBC_RB_COND_RD_TIMER_INTERNAL_OFFSET,
823839
0, 0, PACKETJ_TYPE0));
@@ -858,7 +874,13 @@ void jpeg_v4_0_3_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,
858874

859875
void jpeg_v4_0_3_dec_ring_emit_wreg(struct amdgpu_ring *ring, uint32_t reg, uint32_t val)
860876
{
861-
uint32_t reg_offset = (reg << 2);
877+
uint32_t reg_offset;
878+
879+
/* For VF, only local offsets should be used */
880+
if (amdgpu_sriov_vf(ring->adev))
881+
reg = NORMALIZE_JPEG_REG_OFFSET(reg);
882+
883+
reg_offset = (reg << 2);
862884

863885
amdgpu_ring_write(ring, PACKETJ(regUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET,
864886
0, 0, PACKETJ_TYPE0));
@@ -1072,6 +1094,7 @@ static const struct amdgpu_ring_funcs jpeg_v4_0_3_dec_ring_vm_funcs = {
10721094
.emit_ib = jpeg_v4_0_3_dec_ring_emit_ib,
10731095
.emit_fence = jpeg_v4_0_3_dec_ring_emit_fence,
10741096
.emit_vm_flush = jpeg_v4_0_3_dec_ring_emit_vm_flush,
1097+
.emit_hdp_flush = jpeg_v4_0_3_ring_emit_hdp_flush,
10751098
.test_ring = amdgpu_jpeg_dec_ring_test_ring,
10761099
.test_ib = amdgpu_jpeg_dec_ring_test_ib,
10771100
.insert_nop = jpeg_v4_0_3_dec_ring_nop,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)
176176
DRM_DEBUG("calling WDOORBELL64(0x%08x, 0x%016llx)\n",
177177
ring->doorbell_index, ring->wptr << 2);
178178
WDOORBELL64(ring->doorbell_index, ring->wptr << 2);
179+
/* SDMA seems to miss doorbells sometimes when powergating kicks in.
180+
* Updating the wptr directly will wake it. This is only safe because
181+
* we disallow gfxoff in begin_use() and then allow it again in end_use().
182+
*/
183+
WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
184+
lower_32_bits(ring->wptr << 2));
185+
WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
186+
upper_32_bits(ring->wptr << 2));
179187
} else {
180188
DRM_DEBUG("Not using doorbell -- "
181189
"mmSDMA%i_GFX_RB_WPTR == 0x%08x "
@@ -1647,6 +1655,10 @@ static void sdma_v5_2_ring_begin_use(struct amdgpu_ring *ring)
16471655
* but it shouldn't hurt for other parts since
16481656
* this GFXOFF will be disallowed anyway when SDMA is
16491657
* active, this just makes it explicit.
1658+
* sdma_v5_2_ring_set_wptr() takes advantage of this
1659+
* to update the wptr because sometimes SDMA seems to miss
1660+
* doorbells when entering PG. If you remove this, update
1661+
* sdma_v5_2_ring_set_wptr() as well!
16501662
*/
16511663
amdgpu_gfx_off_ctrl(adev, false);
16521664
}

0 commit comments

Comments
 (0)