Skip to content

Commit 994aeac

Browse files
committed
Merge tag 'drm-next-2024-09-28' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Dave Airlie: "Regular fixes for the week to end the merge window, i915 and xe have a few each, amdgpu makes up most of it with a bunch of SR-IOV related fixes amongst others. i915: - Fix BMG support to UHBR13.5 - Two PSR fixes - Fix colorimetry detection for DP xe: - Fix macro for checking minimum GuC version - Fix CCS offset calculation for some BMG SKUs - Fix locking on memory usage reporting via fdinfo and BO destroy - Fix GPU page fault handler on a closed VM - Fix overflow in oa batch buffer amdgpu: - MES 12 fix - KFD fence sync fix - SR-IOV fixes - VCN 4.0.6 fix - SDMA 7.x fix - Bump driver version to note cleared VRAM support - SWSMU fix - CU occupancy logic fix - SDMA queue fix" * tag 'drm-next-2024-09-28' of https://gitlab.freedesktop.org/drm/kernel: (79 commits) drm/amd/pm: update workload mask after the setting drm/amdgpu: bump driver version for cleared VRAM drm/amdgpu: fix vbios fetching for SR-IOV drm/amdgpu: fix PTE copy corruption for sdma 7 drm/amdkfd: Add SDMA queue quantum support for GFX12 drm/amdgpu/vcn: enable AV1 on both instances drm/amdkfd: Fix CU occupancy for GFX 9.4.3 drm/amdkfd: Update logic for CU occupancy calculations drm/amdgpu: skip coredump after job timeout in SRIOV drm/amdgpu: sync to KFD fences before clearing PTEs drm/amdgpu/mes12: set enable_level_process_quantum_check drm/i915/dp: Fix colorimetry detection drm/amdgpu/mes12: reduce timeout drm/amdgpu/mes11: reduce timeout drm/amdgpu: use GEM references instead of TTMs v2 drm/amd/display: Allow backlight to go below `AMDGPU_DM_DEFAULT_MIN_BACKLIGHT` drm/amd/display: Fix kdoc entry for 'tps' in 'dc_process_dmub_dpia_set_tps_notification' drm/amdgpu: update golden regs for gfx12 drm/amdgpu: clean up vbios fetching code drm/amd/display: handle nulled pipe context in DCE110's set_drr() ...
2 parents 894b3c3 + e7268dd commit 994aeac

File tree

111 files changed

+1097
-862
lines changed

Some content is hidden

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

111 files changed

+1097
-862
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,10 +1083,6 @@ struct amdgpu_device {
10831083

10841084
struct amdgpu_virt virt;
10851085

1086-
/* link all shadow bo */
1087-
struct list_head shadow_list;
1088-
struct mutex shadow_list_lock;
1089-
10901086
/* record hw reset is performed */
10911087
bool has_hw_reset;
10921088
u8 reset_magic[AMDGPU_RESET_MAGIC_NUM];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int __aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *h
511511
return -EINVAL;
512512
}
513513

514-
/* udpate aca bank to aca source error_cache first */
514+
/* update aca bank to aca source error_cache first */
515515
ret = aca_banks_update(adev, smu_type, handler_aca_log_bank_error, qctx, NULL);
516516
if (ret)
517517
return ret;

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

Lines changed: 45 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -950,28 +950,30 @@ static void unlock_spi_csq_mutexes(struct amdgpu_device *adev)
950950
* @inst: xcc's instance number on a multi-XCC setup
951951
*/
952952
static void get_wave_count(struct amdgpu_device *adev, int queue_idx,
953-
int *wave_cnt, int *vmid, uint32_t inst)
953+
struct kfd_cu_occupancy *queue_cnt, uint32_t inst)
954954
{
955955
int pipe_idx;
956956
int queue_slot;
957957
unsigned int reg_val;
958-
958+
unsigned int wave_cnt;
959959
/*
960960
* Program GRBM with appropriate MEID, PIPEID, QUEUEID and VMID
961961
* parameters to read out waves in flight. Get VMID if there are
962962
* non-zero waves in flight.
963963
*/
964-
*vmid = 0xFF;
965-
*wave_cnt = 0;
966964
pipe_idx = queue_idx / adev->gfx.mec.num_queue_per_pipe;
967965
queue_slot = queue_idx % adev->gfx.mec.num_queue_per_pipe;
968-
soc15_grbm_select(adev, 1, pipe_idx, queue_slot, 0, inst);
969-
reg_val = RREG32_SOC15_IP(GC, SOC15_REG_OFFSET(GC, inst, mmSPI_CSQ_WF_ACTIVE_COUNT_0) +
970-
queue_slot);
971-
*wave_cnt = reg_val & SPI_CSQ_WF_ACTIVE_COUNT_0__COUNT_MASK;
972-
if (*wave_cnt != 0)
973-
*vmid = (RREG32_SOC15(GC, inst, mmCP_HQD_VMID) &
974-
CP_HQD_VMID__VMID_MASK) >> CP_HQD_VMID__VMID__SHIFT;
966+
soc15_grbm_select(adev, 1, pipe_idx, queue_slot, 0, GET_INST(GC, inst));
967+
reg_val = RREG32_SOC15_IP(GC, SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
968+
mmSPI_CSQ_WF_ACTIVE_COUNT_0) + queue_slot);
969+
wave_cnt = reg_val & SPI_CSQ_WF_ACTIVE_COUNT_0__COUNT_MASK;
970+
if (wave_cnt != 0) {
971+
queue_cnt->wave_cnt += wave_cnt;
972+
queue_cnt->doorbell_off =
973+
(RREG32_SOC15(GC, GET_INST(GC, inst), mmCP_HQD_PQ_DOORBELL_CONTROL) &
974+
CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET_MASK) >>
975+
CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT;
976+
}
975977
}
976978

977979
/**
@@ -981,9 +983,8 @@ static void get_wave_count(struct amdgpu_device *adev, int queue_idx,
981983
* or more queues running and submitting waves to compute units.
982984
*
983985
* @adev: Handle of device from which to get number of waves in flight
984-
* @pasid: Identifies the process for which this query call is invoked
985-
* @pasid_wave_cnt: Output parameter updated with number of waves in flight that
986-
* belong to process with given pasid
986+
* @cu_occupancy: Array that gets filled with wave_cnt and doorbell offset
987+
* for comparison later.
987988
* @max_waves_per_cu: Output parameter updated with maximum number of waves
988989
* possible per Compute Unit
989990
* @inst: xcc's instance number on a multi-XCC setup
@@ -1011,34 +1012,28 @@ static void get_wave_count(struct amdgpu_device *adev, int queue_idx,
10111012
* number of waves that are in flight for the queue at specified index. The
10121013
* index ranges from 0 to 7.
10131014
*
1014-
* If non-zero waves are in flight, read CP_HQD_VMID register to obtain VMID
1015-
* of the wave(s).
1015+
* If non-zero waves are in flight, store the corresponding doorbell offset
1016+
* of the queue, along with the wave count.
10161017
*
1017-
* Determine if VMID from above step maps to pasid provided as parameter. If
1018-
* it matches agrregate the wave count. That the VMID will not match pasid is
1019-
* a normal condition i.e. a device is expected to support multiple queues
1020-
* from multiple proceses.
1018+
* Determine if the queue belongs to the process by comparing the doorbell
1019+
* offset against the process's queues. If it matches, aggregate the wave
1020+
* count for the process.
10211021
*
10221022
* Reading registers referenced above involves programming GRBM appropriately
10231023
*/
1024-
void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid,
1025-
int *pasid_wave_cnt, int *max_waves_per_cu, uint32_t inst)
1024+
void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev,
1025+
struct kfd_cu_occupancy *cu_occupancy,
1026+
int *max_waves_per_cu, uint32_t inst)
10261027
{
10271028
int qidx;
1028-
int vmid;
10291029
int se_idx;
1030-
int sh_idx;
10311030
int se_cnt;
1032-
int sh_cnt;
1033-
int wave_cnt;
10341031
int queue_map;
1035-
int pasid_tmp;
10361032
int max_queue_cnt;
1037-
int vmid_wave_cnt = 0;
10381033
DECLARE_BITMAP(cp_queue_bitmap, AMDGPU_MAX_QUEUES);
10391034

10401035
lock_spi_csq_mutexes(adev);
1041-
soc15_grbm_select(adev, 1, 0, 0, 0, inst);
1036+
soc15_grbm_select(adev, 1, 0, 0, 0, GET_INST(GC, inst));
10421037

10431038
/*
10441039
* Iterate through the shader engines and arrays of the device
@@ -1048,51 +1043,38 @@ void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid,
10481043
AMDGPU_MAX_QUEUES);
10491044
max_queue_cnt = adev->gfx.mec.num_pipe_per_mec *
10501045
adev->gfx.mec.num_queue_per_pipe;
1051-
sh_cnt = adev->gfx.config.max_sh_per_se;
10521046
se_cnt = adev->gfx.config.max_shader_engines;
10531047
for (se_idx = 0; se_idx < se_cnt; se_idx++) {
1054-
for (sh_idx = 0; sh_idx < sh_cnt; sh_idx++) {
1048+
amdgpu_gfx_select_se_sh(adev, se_idx, 0, 0xffffffff, inst);
1049+
queue_map = RREG32_SOC15(GC, GET_INST(GC, inst), mmSPI_CSQ_WF_ACTIVE_STATUS);
1050+
1051+
/*
1052+
* Assumption: queue map encodes following schema: four
1053+
* pipes per each micro-engine, with each pipe mapping
1054+
* eight queues. This schema is true for GFX9 devices
1055+
* and must be verified for newer device families
1056+
*/
1057+
for (qidx = 0; qidx < max_queue_cnt; qidx++) {
1058+
/* Skip qeueus that are not associated with
1059+
* compute functions
1060+
*/
1061+
if (!test_bit(qidx, cp_queue_bitmap))
1062+
continue;
10551063

1056-
amdgpu_gfx_select_se_sh(adev, se_idx, sh_idx, 0xffffffff, inst);
1057-
queue_map = RREG32_SOC15(GC, inst, mmSPI_CSQ_WF_ACTIVE_STATUS);
1064+
if (!(queue_map & (1 << qidx)))
1065+
continue;
10581066

1059-
/*
1060-
* Assumption: queue map encodes following schema: four
1061-
* pipes per each micro-engine, with each pipe mapping
1062-
* eight queues. This schema is true for GFX9 devices
1063-
* and must be verified for newer device families
1064-
*/
1065-
for (qidx = 0; qidx < max_queue_cnt; qidx++) {
1066-
1067-
/* Skip qeueus that are not associated with
1068-
* compute functions
1069-
*/
1070-
if (!test_bit(qidx, cp_queue_bitmap))
1071-
continue;
1072-
1073-
if (!(queue_map & (1 << qidx)))
1074-
continue;
1075-
1076-
/* Get number of waves in flight and aggregate them */
1077-
get_wave_count(adev, qidx, &wave_cnt, &vmid,
1078-
inst);
1079-
if (wave_cnt != 0) {
1080-
pasid_tmp =
1081-
RREG32(SOC15_REG_OFFSET(OSSSYS, inst,
1082-
mmIH_VMID_0_LUT) + vmid);
1083-
if (pasid_tmp == pasid)
1084-
vmid_wave_cnt += wave_cnt;
1085-
}
1086-
}
1067+
/* Get number of waves in flight and aggregate them */
1068+
get_wave_count(adev, qidx, &cu_occupancy[qidx],
1069+
inst);
10871070
}
10881071
}
10891072

10901073
amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, inst);
1091-
soc15_grbm_select(adev, 0, 0, 0, 0, inst);
1074+
soc15_grbm_select(adev, 0, 0, 0, 0, GET_INST(GC, inst));
10921075
unlock_spi_csq_mutexes(adev);
10931076

10941077
/* Update the output parameters and return */
1095-
*pasid_wave_cnt = vmid_wave_cnt;
10961078
*max_waves_per_cu = adev->gfx.cu_info.simd_per_cu *
10971079
adev->gfx.cu_info.max_waves_per_simd;
10981080
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct amdgpu_device *adev,
5252
uint8_t vmid, uint16_t *p_pasid);
5353
void kgd_gfx_v9_set_vm_context_page_table_base(struct amdgpu_device *adev,
5454
uint32_t vmid, uint64_t page_table_base);
55-
void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid,
56-
int *pasid_wave_cnt, int *max_waves_per_cu, uint32_t inst);
55+
void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev,
56+
struct kfd_cu_occupancy *cu_occupancy,
57+
int *max_waves_per_cu, uint32_t inst);
5758
void kgd_gfx_v9_program_trap_handler_settings(struct amdgpu_device *adev,
5859
uint32_t vmid, uint64_t tba_addr, uint64_t tma_addr,
5960
uint32_t inst);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ static int amdgpu_amdkfd_gpuvm_pin_bo(struct amdgpu_bo *bo, u32 domain)
14991499
}
15001500
}
15011501

1502-
ret = amdgpu_bo_pin_restricted(bo, domain, 0, 0);
1502+
ret = amdgpu_bo_pin(bo, domain);
15031503
if (ret)
15041504
pr_err("Error in Pinning BO to domain: %d\n", domain);
15051505

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

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ static bool check_atom_bios(uint8_t *bios, size_t size)
8787
* part of the system bios. On boot, the system bios puts a
8888
* copy of the igp rom at the start of vram if a discrete card is
8989
* present.
90+
* For SR-IOV, the vbios image is also put in VRAM in the VF.
9091
*/
91-
static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
92+
static bool amdgpu_read_bios_from_vram(struct amdgpu_device *adev)
9293
{
9394
uint8_t __iomem *bios;
9495
resource_size_t vram_base;
@@ -284,10 +285,6 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
284285
acpi_status status;
285286
bool found = false;
286287

287-
/* ATRM is for the discrete card only */
288-
if (adev->flags & AMD_IS_APU)
289-
return false;
290-
291288
/* ATRM is for on-platform devices only */
292289
if (dev_is_removable(&adev->pdev->dev))
293290
return false;
@@ -343,11 +340,8 @@ static inline bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
343340

344341
static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
345342
{
346-
if (adev->flags & AMD_IS_APU)
347-
return igp_read_bios_from_vram(adev);
348-
else
349-
return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ?
350-
false : amdgpu_asic_read_disabled_bios(adev);
343+
return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ?
344+
false : amdgpu_asic_read_disabled_bios(adev);
351345
}
352346

353347
#ifdef CONFIG_ACPI
@@ -414,7 +408,36 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
414408
}
415409
#endif
416410

417-
bool amdgpu_get_bios(struct amdgpu_device *adev)
411+
static bool amdgpu_get_bios_apu(struct amdgpu_device *adev)
412+
{
413+
if (amdgpu_acpi_vfct_bios(adev)) {
414+
dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
415+
goto success;
416+
}
417+
418+
if (amdgpu_read_bios_from_vram(adev)) {
419+
dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n");
420+
goto success;
421+
}
422+
423+
if (amdgpu_read_bios(adev)) {
424+
dev_info(adev->dev, "Fetched VBIOS from ROM BAR\n");
425+
goto success;
426+
}
427+
428+
if (amdgpu_read_platform_bios(adev)) {
429+
dev_info(adev->dev, "Fetched VBIOS from platform\n");
430+
goto success;
431+
}
432+
433+
dev_err(adev->dev, "Unable to locate a BIOS ROM\n");
434+
return false;
435+
436+
success:
437+
return true;
438+
}
439+
440+
static bool amdgpu_get_bios_dgpu(struct amdgpu_device *adev)
418441
{
419442
if (amdgpu_atrm_get_bios(adev)) {
420443
dev_info(adev->dev, "Fetched VBIOS from ATRM\n");
@@ -426,7 +449,8 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
426449
goto success;
427450
}
428451

429-
if (igp_read_bios_from_vram(adev)) {
452+
/* this is required for SR-IOV */
453+
if (amdgpu_read_bios_from_vram(adev)) {
430454
dev_info(adev->dev, "Fetched VBIOS from VRAM BAR\n");
431455
goto success;
432456
}
@@ -455,10 +479,24 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
455479
return false;
456480

457481
success:
458-
adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
459482
return true;
460483
}
461484

485+
bool amdgpu_get_bios(struct amdgpu_device *adev)
486+
{
487+
bool found;
488+
489+
if (adev->flags & AMD_IS_APU)
490+
found = amdgpu_get_bios_apu(adev);
491+
else
492+
found = amdgpu_get_bios_dgpu(adev);
493+
494+
if (found)
495+
adev->is_atom_fw = adev->asic_type >= CHIP_VEGA10;
496+
497+
return found;
498+
}
499+
462500
/* helper function for soc15 and onwards to read bios from rom */
463501
bool amdgpu_soc15_read_bios_from_rom(struct amdgpu_device *adev,
464502
u8 *bios, u32 length_bytes)

0 commit comments

Comments
 (0)