Skip to content

Commit 5874d11

Browse files
committed
Merge tag 'amd-drm-fixes-6.5-2023-06-30-1' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-fixes-6.5-2023-06-30-1: amdgpu: - Misc cleanups - GFX 9.4.3 fixes - DEBUGFS build fix - Fix LPDDR5 reporting - ASPM fixes - DCN 3.1.4 fixes - DP MST fixes - DCN 3.2.x fixes - Display PSR TCON fixes - SMU 13.x fixes - RAS fixes - Vega12/20 SMU fixes - PSP flashing cleanup - GFX9 MCBP fixes - SR-IOV fixes - GPUVM clear mappings fix for always valid BOs - Add FAMS quirk for problematic monitor - Fix possible UAF - Better handle monentary temperature fluctuations - SDMA 4.4.2 fixes - Fencing fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 67ebda8 + 2e54154 commit 5874d11

File tree

103 files changed

+1201
-311
lines changed

Some content is hidden

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

103 files changed

+1201
-311
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ extern int amdgpu_user_partt_mode;
286286
#define AMDGPU_SMARTSHIFT_MAX_BIAS (100)
287287
#define AMDGPU_SMARTSHIFT_MIN_BIAS (-100)
288288

289+
/* Extra time delay(in ms) to eliminate the influence of temperature momentary fluctuation */
290+
#define AMDGPU_SWCTF_EXTRA_DELAY 50
291+
289292
struct amdgpu_xcp_mgr;
290293
struct amdgpu_device;
291294
struct amdgpu_irq_src;
@@ -1277,9 +1280,10 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
12771280

12781281
#define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));
12791282

1280-
#define for_each_inst(i, inst_mask) \
1281-
for (i = ffs(inst_mask) - 1; inst_mask; \
1282-
inst_mask &= ~(1U << i), i = ffs(inst_mask) - 1)
1283+
#define BIT_MASK_UPPER(i) ((i) >= BITS_PER_LONG ? 0 : ~0UL << (i))
1284+
#define for_each_inst(i, inst_mask) \
1285+
for (i = ffs(inst_mask); i-- != 0; \
1286+
i = ffs(inst_mask & BIT_MASK_UPPER(i + 1)))
12831287

12841288
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
12851289

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,15 @@ const struct attribute_group amdgpu_vbios_version_attr_group = {
17911791
.attrs = amdgpu_vbios_version_attrs
17921792
};
17931793

1794+
int amdgpu_atombios_sysfs_init(struct amdgpu_device *adev)
1795+
{
1796+
if (adev->mode_info.atom_context)
1797+
return devm_device_add_group(adev->dev,
1798+
&amdgpu_vbios_version_attr_group);
1799+
1800+
return 0;
1801+
}
1802+
17941803
/**
17951804
* amdgpu_atombios_fini - free the driver info and callbacks for atombios
17961805
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,6 @@ int amdgpu_atombios_get_data_table(struct amdgpu_device *adev,
217217

218218
void amdgpu_atombios_fini(struct amdgpu_device *adev);
219219
int amdgpu_atombios_init(struct amdgpu_device *adev);
220+
int amdgpu_atombios_sysfs_init(struct amdgpu_device *adev);
220221

221222
#endif

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,13 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
327327
mem_channel_number = igp_info->v11.umachannelnumber;
328328
if (!mem_channel_number)
329329
mem_channel_number = 1;
330-
/* channel width is 64 */
331-
if (vram_width)
332-
*vram_width = mem_channel_number * 64;
333330
mem_type = igp_info->v11.memorytype;
331+
if (mem_type == LpDdr5MemType)
332+
mem_channel_width = 32;
333+
else
334+
mem_channel_width = 64;
335+
if (vram_width)
336+
*vram_width = mem_channel_number * mem_channel_width;
334337
if (vram_type)
335338
*vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
336339
break;
@@ -345,10 +348,13 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
345348
mem_channel_number = igp_info->v21.umachannelnumber;
346349
if (!mem_channel_number)
347350
mem_channel_number = 1;
348-
/* channel width is 64 */
349-
if (vram_width)
350-
*vram_width = mem_channel_number * 64;
351351
mem_type = igp_info->v21.memorytype;
352+
if (mem_type == LpDdr5MemType)
353+
mem_channel_width = 32;
354+
else
355+
mem_channel_width = 64;
356+
if (vram_width)
357+
*vram_width = mem_channel_number * mem_channel_width;
352358
if (vram_type)
353359
*vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
354360
break;

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ static int amdgpu_cs_p1_user_fence(struct amdgpu_cs_parser *p,
136136
bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
137137
p->uf_entry.priority = 0;
138138
p->uf_entry.tv.bo = &bo->tbo;
139-
/* One for TTM and two for the CS job */
140-
p->uf_entry.tv.num_shared = 3;
141-
142139
drm_gem_object_put(gobj);
143140

144141
size = amdgpu_bo_size(bo);
@@ -912,15 +909,19 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
912909

913910
mutex_lock(&p->bo_list->bo_list_mutex);
914911

915-
/* One for TTM and one for the CS job */
912+
/* One for TTM and one for each CS job */
916913
amdgpu_bo_list_for_each_entry(e, p->bo_list)
917-
e->tv.num_shared = 2;
914+
e->tv.num_shared = 1 + p->gang_size;
915+
p->uf_entry.tv.num_shared = 1 + p->gang_size;
918916

919917
amdgpu_bo_list_get_list(p->bo_list, &p->validated);
920918

921919
INIT_LIST_HEAD(&duplicates);
922920
amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
923921

922+
/* Two for VM updates, one for TTM and one for each CS job */
923+
p->vm_pd.tv.num_shared = 3 + p->gang_size;
924+
924925
if (p->uf_entry.tv.bo && !ttm_to_amdgpu_bo(p->uf_entry.tv.bo)->parent)
925926
list_add(&p->uf_entry.tv.head, &p->validated);
926927

@@ -1653,15 +1654,15 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
16531654
continue;
16541655

16551656
r = dma_fence_wait_timeout(fence, true, timeout);
1657+
if (r > 0 && fence->error)
1658+
r = fence->error;
1659+
16561660
dma_fence_put(fence);
16571661
if (r < 0)
16581662
return r;
16591663

16601664
if (r == 0)
16611665
break;
1662-
1663-
if (fence->error)
1664-
return fence->error;
16651666
}
16661667

16671668
memset(wait, 0, sizeof(*wait));

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

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
25522552
adev->ip_blocks[i].status.hw = true;
25532553

25542554
/* right after GMC hw init, we create CSA */
2555-
if (amdgpu_mcbp) {
2555+
if (adev->gfx.mcbp) {
25562556
r = amdgpu_allocate_static_csa(adev, &adev->virt.csa_obj,
25572557
AMDGPU_GEM_DOMAIN_VRAM |
25582558
AMDGPU_GEM_DOMAIN_GTT,
@@ -3673,6 +3673,23 @@ static const struct attribute *amdgpu_dev_attributes[] = {
36733673
NULL
36743674
};
36753675

3676+
static void amdgpu_device_set_mcbp(struct amdgpu_device *adev)
3677+
{
3678+
if (amdgpu_mcbp == 1)
3679+
adev->gfx.mcbp = true;
3680+
3681+
if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 0, 0)) &&
3682+
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 0, 0)) &&
3683+
adev->gfx.num_gfx_rings)
3684+
adev->gfx.mcbp = true;
3685+
3686+
if (amdgpu_sriov_vf(adev))
3687+
adev->gfx.mcbp = true;
3688+
3689+
if (adev->gfx.mcbp)
3690+
DRM_INFO("MCBP is enabled\n");
3691+
}
3692+
36763693
/**
36773694
* amdgpu_device_init - initialize the driver
36783695
*
@@ -3824,9 +3841,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
38243841
DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base);
38253842
DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size);
38263843

3827-
if (amdgpu_mcbp)
3828-
DRM_INFO("MCBP is enabled\n");
3829-
38303844
/*
38313845
* Reset domain needs to be present early, before XGMI hive discovered
38323846
* (if any) and intitialized to use reset sem and in_gpu reset flag
@@ -3852,6 +3866,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
38523866
if (r)
38533867
return r;
38543868

3869+
amdgpu_device_set_mcbp(adev);
3870+
38553871
/* Get rid of things like offb */
38563872
r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
38573873
if (r)
@@ -4018,6 +4034,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
40184034
/* Get a log2 for easy divisions. */
40194035
adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps));
40204036

4037+
r = amdgpu_atombios_sysfs_init(adev);
4038+
if (r)
4039+
drm_err(&adev->ddev,
4040+
"registering atombios sysfs failed (%d).\n", r);
4041+
40214042
r = amdgpu_pm_sysfs_init(adev);
40224043
if (r)
40234044
DRM_ERROR("registering pm sysfs failed (%d).\n", r);

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ uint amdgpu_dc_feature_mask = 2;
180180
uint amdgpu_dc_debug_mask;
181181
uint amdgpu_dc_visual_confirm;
182182
int amdgpu_async_gfx_ring = 1;
183-
int amdgpu_mcbp;
183+
int amdgpu_mcbp = -1;
184184
int amdgpu_discovery = -1;
185185
int amdgpu_mes;
186186
int amdgpu_mes_kiq;
@@ -634,10 +634,10 @@ module_param_named(async_gfx_ring, amdgpu_async_gfx_ring, int, 0444);
634634

635635
/**
636636
* DOC: mcbp (int)
637-
* It is used to enable mid command buffer preemption. (0 = disabled (default), 1 = enabled)
637+
* It is used to enable mid command buffer preemption. (0 = disabled, 1 = enabled, -1 auto (default))
638638
*/
639639
MODULE_PARM_DESC(mcbp,
640-
"Enable Mid-command buffer preemption (0 = disabled (default), 1 = enabled)");
640+
"Enable Mid-command buffer preemption (0 = disabled, 1 = enabled), -1 = auto (default)");
641641
module_param_named(mcbp, amdgpu_mcbp, int, 0444);
642642

643643
/**
@@ -2899,12 +2899,10 @@ static struct pci_error_handlers amdgpu_pci_err_handler = {
28992899

29002900
extern const struct attribute_group amdgpu_vram_mgr_attr_group;
29012901
extern const struct attribute_group amdgpu_gtt_mgr_attr_group;
2902-
extern const struct attribute_group amdgpu_vbios_version_attr_group;
29032902

29042903
static const struct attribute_group *amdgpu_sysfs_groups[] = {
29052904
&amdgpu_vram_mgr_attr_group,
29062905
&amdgpu_gtt_mgr_attr_group,
2907-
&amdgpu_vbios_version_attr_group,
29082906
NULL,
29092907
};
29102908

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ struct amdgpu_gfx {
434434
uint16_t xcc_mask;
435435
uint32_t num_xcc_per_xcp;
436436
struct mutex partition_mutex;
437+
bool mcbp; /* mid command buffer preemption */
437438
};
438439

439440
struct amdgpu_gfx_ras_reg_entry {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ int amdgpu_jpeg_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *
255255

256256
if (amdgpu_ras_is_supported(adev, ras_block->block)) {
257257
for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
258-
if (adev->jpeg.harvest_config & (1 << i))
258+
if (adev->jpeg.harvest_config & (1 << i) ||
259+
!adev->jpeg.inst[i].ras_poison_irq.funcs)
259260
continue;
260261

261262
r = amdgpu_irq_get(adev, &adev->jpeg.inst[i].ras_poison_irq, 0);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
805805
dev_info->ids_flags = 0;
806806
if (adev->flags & AMD_IS_APU)
807807
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
808-
if (amdgpu_mcbp)
808+
if (adev->gfx.mcbp)
809809
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
810810
if (amdgpu_is_tmz(adev))
811811
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
@@ -1247,7 +1247,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
12471247
goto error_vm;
12481248
}
12491249

1250-
if (amdgpu_mcbp) {
1250+
if (adev->gfx.mcbp) {
12511251
uint64_t csa_addr = amdgpu_csa_vaddr(adev) & AMDGPU_GMC_HOLE_MASK;
12521252

12531253
r = amdgpu_map_static_csa(adev, &fpriv->vm, adev->virt.csa_obj,

0 commit comments

Comments
 (0)