Skip to content

Commit 1193484

Browse files
committed
Merge tag 'amd-drm-next-6.19-2025-10-24' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.19-2025-10-24: amdgpu: - HMM cleanup - Add new RAS framework - DML2.1 updates - YCbCr420 fixes - DC FP fixes - DMUB fixes - LTTPR fixes - DTBCLK fixes - DMU cursor offload handling - Userq validation improvements - Misc code cleanups - Unify shutdown callback handling - Suspend improvements - Power limit code cleanup - Fence cleanup - IP Discovery cleanup - SR-IOV fixes - AUX backlight fixes - DCN 3.5 fixes - HDMI compliance fixes - DCN 4.0.1 cursor updates - DCN interrupt fix - DC KMS full update improvements - Add additional HDCP traces - DCN 3.2 fixes - DP MST fixes - Add support for new SR-IOV mailbox interface Signed-off-by: Simona Vetter <simona.vetter@ffwll.ch> From: Alex Deucher <alexander.deucher@amd.com> Link: https://lore.kernel.org/r/20251024175249.58099-1-alexander.deucher@amd.com
2 parents 098456f + 883687c commit 1193484

215 files changed

Lines changed: 21949 additions & 1627 deletions

File tree

Some content is hidden

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

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
3737
-I$(FULL_AMD_DISPLAY_PATH)/modules/inc \
3838
-I$(FULL_AMD_DISPLAY_PATH)/dc \
3939
-I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \
40-
-I$(FULL_AMD_PATH)/amdkfd
40+
-I$(FULL_AMD_PATH)/amdkfd \
41+
-I$(FULL_AMD_PATH)/ras/ras_mgr
4142

4243
# Locally disable W=1 warnings enabled in drm subsystem Makefile
4344
subdir-ccflags-y += -Wno-override-init
@@ -324,4 +325,9 @@ amdgpu-y += \
324325
isp_v4_1_1.o
325326
endif
326327

328+
AMD_GPU_RAS_PATH := ../ras
329+
AMD_GPU_RAS_FULL_PATH := $(FULL_AMD_PATH)/ras
330+
include $(AMD_GPU_RAS_FULL_PATH)/Makefile
331+
amdgpu-y += $(AMD_GPU_RAS_FILES)
332+
327333
obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ static int aldebaran_mode2_suspend_ip(struct amdgpu_device *adev)
8888
uint32_t ip_block;
8989
int r, i;
9090

91+
/* Skip suspend of SDMA IP versions >= 4.4.2. They are multi-aid */
92+
if (adev->aid_mask)
93+
ip_block_mask &= ~BIT(AMD_IP_BLOCK_TYPE_SDMA);
94+
9195
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
9296
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
9397

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,15 @@ void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev,
372372
u64 *flags);
373373
int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
374374
enum amd_ip_block_type block_type);
375+
bool amdgpu_device_ip_is_hw(struct amdgpu_device *adev,
376+
enum amd_ip_block_type block_type);
375377
bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev,
376378
enum amd_ip_block_type block_type);
377379
int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
378380

379381
int amdgpu_ip_block_resume(struct amdgpu_ip_block *ip_block);
380382

381-
#define AMDGPU_MAX_IP_NUM 16
383+
#define AMDGPU_MAX_IP_NUM AMD_IP_BLOCK_TYPE_NUM
382384

383385
struct amdgpu_ip_block_status {
384386
bool valid;
@@ -839,8 +841,6 @@ struct amd_powerplay {
839841
const struct amd_pm_funcs *pp_funcs;
840842
};
841843

842-
struct ip_discovery_top;
843-
844844
/* polaris10 kickers */
845845
#define ASICID_IS_P20(did, rid) (((did == 0x67DF) && \
846846
((rid == 0xE3) || \
@@ -972,8 +972,7 @@ struct amdgpu_device {
972972
struct notifier_block acpi_nb;
973973
struct notifier_block pm_nb;
974974
struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS];
975-
struct debugfs_blob_wrapper debugfs_vbios_blob;
976-
struct debugfs_blob_wrapper debugfs_discovery_blob;
975+
struct debugfs_blob_wrapper debugfs_vbios_blob;
977976
struct mutex srbm_mutex;
978977
/* GRBM index mutex. Protects concurrent access to GRBM index */
979978
struct mutex grbm_idx_mutex;
@@ -1063,6 +1062,9 @@ struct amdgpu_device {
10631062
u32 log2_max_MBps;
10641063
} mm_stats;
10651064

1065+
/* discovery*/
1066+
struct amdgpu_discovery_info discovery;
1067+
10661068
/* display */
10671069
bool enable_virtual_display;
10681070
struct amdgpu_vkms_output *amdgpu_vkms_output;
@@ -1265,8 +1267,6 @@ struct amdgpu_device {
12651267

12661268
struct list_head ras_list;
12671269

1268-
struct ip_discovery_top *ip_top;
1269-
12701270
struct amdgpu_reset_domain *reset_domain;
12711271

12721272
struct mutex benchmark_mutex;
@@ -1638,7 +1638,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
16381638
struct drm_file *file_priv);
16391639
void amdgpu_driver_release_kms(struct drm_device *dev);
16401640

1641-
int amdgpu_device_ip_suspend(struct amdgpu_device *adev);
16421641
int amdgpu_device_prepare(struct drm_device *dev);
16431642
void amdgpu_device_complete(struct drm_device *dev);
16441643
int amdgpu_device_suspend(struct drm_device *dev, bool fbcon);

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "amdgpu_ras.h"
3737
#include "amdgpu_umc.h"
3838
#include "amdgpu_reset.h"
39+
#include "amdgpu_ras_mgr.h"
3940

4041
/* Total memory size in system memory and all GPU VRAM. Used to
4142
* estimate worst case amount of memory to reserve for page tables
@@ -746,6 +747,20 @@ void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *ad
746747
enum amdgpu_ras_block block, uint16_t pasid,
747748
pasid_notify pasid_fn, void *data, uint32_t reset)
748749
{
750+
751+
if (amdgpu_uniras_enabled(adev)) {
752+
struct ras_ih_info ih_info;
753+
754+
memset(&ih_info, 0, sizeof(ih_info));
755+
ih_info.block = block;
756+
ih_info.pasid = pasid;
757+
ih_info.reset = reset;
758+
ih_info.pasid_fn = pasid_fn;
759+
ih_info.data = data;
760+
amdgpu_ras_mgr_handle_consumer_interrupt(adev, &ih_info);
761+
return;
762+
}
763+
749764
amdgpu_umc_pasid_poison_handler(adev, block, pasid, pasid_fn, data, reset);
750765
}
751766

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct kgd_mem {
7171
struct mutex lock;
7272
struct amdgpu_bo *bo;
7373
struct dma_buf *dmabuf;
74-
struct hmm_range *range;
74+
struct amdgpu_hmm_range *range;
7575
struct list_head attachments;
7676
/* protected by amdkfd_process_info.lock */
7777
struct list_head validate_list;

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
10571057
struct amdkfd_process_info *process_info = mem->process_info;
10581058
struct amdgpu_bo *bo = mem->bo;
10591059
struct ttm_operation_ctx ctx = { true, false };
1060-
struct hmm_range *range;
1060+
struct amdgpu_hmm_range *range;
10611061
int ret = 0;
10621062

10631063
mutex_lock(&process_info->lock);
@@ -1089,8 +1089,15 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
10891089
return 0;
10901090
}
10911091

1092-
ret = amdgpu_ttm_tt_get_user_pages(bo, &range);
1092+
range = amdgpu_hmm_range_alloc(NULL);
1093+
if (unlikely(!range)) {
1094+
ret = -ENOMEM;
1095+
goto unregister_out;
1096+
}
1097+
1098+
ret = amdgpu_ttm_tt_get_user_pages(bo, range);
10931099
if (ret) {
1100+
amdgpu_hmm_range_free(range);
10941101
if (ret == -EAGAIN)
10951102
pr_debug("Failed to get user pages, try again\n");
10961103
else
@@ -1113,7 +1120,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
11131120
amdgpu_bo_unreserve(bo);
11141121

11151122
release_out:
1116-
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, range);
1123+
amdgpu_hmm_range_free(range);
11171124
unregister_out:
11181125
if (ret)
11191126
amdgpu_hmm_unregister(bo);
@@ -1916,7 +1923,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
19161923
if (amdgpu_ttm_tt_get_usermm(mem->bo->tbo.ttm)) {
19171924
amdgpu_hmm_unregister(mem->bo);
19181925
mutex_lock(&process_info->notifier_lock);
1919-
amdgpu_ttm_tt_discard_user_pages(mem->bo->tbo.ttm, mem->range);
1926+
amdgpu_hmm_range_free(mem->range);
19201927
mutex_unlock(&process_info->notifier_lock);
19211928
}
19221929

@@ -1954,9 +1961,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
19541961
*/
19551962
if (size) {
19561963
if (!is_imported &&
1957-
(mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM ||
1958-
(adev->apu_prefer_gtt &&
1959-
mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)))
1964+
mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
19601965
*size = bo_size;
19611966
else
19621967
*size = 0;
@@ -2542,7 +2547,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
25422547

25432548
bo = mem->bo;
25442549

2545-
amdgpu_ttm_tt_discard_user_pages(bo->tbo.ttm, mem->range);
2550+
amdgpu_hmm_range_free(mem->range);
25462551
mem->range = NULL;
25472552

25482553
/* BO reservations and getting user pages (hmm_range_fault)
@@ -2566,9 +2571,14 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
25662571
}
25672572
}
25682573

2574+
mem->range = amdgpu_hmm_range_alloc(NULL);
2575+
if (unlikely(!mem->range))
2576+
return -ENOMEM;
25692577
/* Get updated user pages */
2570-
ret = amdgpu_ttm_tt_get_user_pages(bo, &mem->range);
2578+
ret = amdgpu_ttm_tt_get_user_pages(bo, mem->range);
25712579
if (ret) {
2580+
amdgpu_hmm_range_free(mem->range);
2581+
mem->range = NULL;
25722582
pr_debug("Failed %d to get user pages\n", ret);
25732583

25742584
/* Return -EFAULT bad address error as success. It will
@@ -2741,8 +2751,8 @@ static int confirm_valid_user_pages_locked(struct amdkfd_process_info *process_i
27412751
continue;
27422752

27432753
/* Only check mem with hmm range associated */
2744-
valid = amdgpu_ttm_tt_get_user_pages_done(
2745-
mem->bo->tbo.ttm, mem->range);
2754+
valid = amdgpu_hmm_range_valid(mem->range);
2755+
amdgpu_hmm_range_free(mem->range);
27462756

27472757
mem->range = NULL;
27482758
if (!valid) {

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,22 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
181181
u8 frev, crev;
182182
int usage_bytes = 0;
183183

184-
if (amdgpu_atom_parse_data_header(ctx, index, NULL, &frev, &crev, &data_offset)) {
185-
if (frev == 2 && crev == 1) {
186-
fw_usage_v2_1 =
187-
(struct vram_usagebyfirmware_v2_1 *)(ctx->bios + data_offset);
188-
amdgpu_atomfirmware_allocate_fb_v2_1(adev,
189-
fw_usage_v2_1,
190-
&usage_bytes);
191-
} else if (frev >= 2 && crev >= 2) {
192-
fw_usage_v2_2 =
193-
(struct vram_usagebyfirmware_v2_2 *)(ctx->bios + data_offset);
194-
amdgpu_atomfirmware_allocate_fb_v2_2(adev,
195-
fw_usage_v2_2,
196-
&usage_bytes);
184+
/* Skip atomfirmware allocation for SRIOV VFs when dynamic crit regn is enabled */
185+
if (!(amdgpu_sriov_vf(adev) && adev->virt.is_dynamic_crit_regn_enabled)) {
186+
if (amdgpu_atom_parse_data_header(ctx, index, NULL, &frev, &crev, &data_offset)) {
187+
if (frev == 2 && crev == 1) {
188+
fw_usage_v2_1 =
189+
(struct vram_usagebyfirmware_v2_1 *)(ctx->bios + data_offset);
190+
amdgpu_atomfirmware_allocate_fb_v2_1(adev,
191+
fw_usage_v2_1,
192+
&usage_bytes);
193+
} else if (frev >= 2 && crev >= 2) {
194+
fw_usage_v2_2 =
195+
(struct vram_usagebyfirmware_v2_2 *)(ctx->bios + data_offset);
196+
amdgpu_atomfirmware_allocate_fb_v2_2(adev,
197+
fw_usage_v2_2,
198+
&usage_bytes);
199+
}
197200
}
198201
}
199202

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

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ void amdgpu_bios_release(struct amdgpu_device *adev)
9696
* part of the system bios. On boot, the system bios puts a
9797
* copy of the igp rom at the start of vram if a discrete card is
9898
* present.
99-
* For SR-IOV, the vbios image is also put in VRAM in the VF.
99+
* For SR-IOV, if dynamic critical region is not enabled,
100+
* the vbios image is also put at the start of VRAM in the VF.
100101
*/
101102
static bool amdgpu_read_bios_from_vram(struct amdgpu_device *adev)
102103
{
103-
uint8_t __iomem *bios;
104+
uint8_t __iomem *bios = NULL;
104105
resource_size_t vram_base;
105106
resource_size_t size = 256 * 1024; /* ??? */
106107

@@ -114,18 +115,33 @@ static bool amdgpu_read_bios_from_vram(struct amdgpu_device *adev)
114115

115116
adev->bios = NULL;
116117
vram_base = pci_resource_start(adev->pdev, 0);
117-
bios = ioremap_wc(vram_base, size);
118-
if (!bios)
119-
return false;
120118

121119
adev->bios = kmalloc(size, GFP_KERNEL);
122-
if (!adev->bios) {
123-
iounmap(bios);
120+
if (!adev->bios)
124121
return false;
122+
123+
/* For SRIOV with dynamic critical region is enabled,
124+
* the vbios image is put at a dynamic offset of VRAM in the VF.
125+
* If dynamic critical region is disabled, follow the existing logic as on baremetal.
126+
*/
127+
if (amdgpu_sriov_vf(adev) && adev->virt.is_dynamic_crit_regn_enabled) {
128+
if (amdgpu_virt_get_dynamic_data_info(adev,
129+
AMD_SRIOV_MSG_VBIOS_IMG_TABLE_ID, adev->bios, (uint64_t *)&size)) {
130+
amdgpu_bios_release(adev);
131+
return false;
132+
}
133+
} else {
134+
bios = ioremap_wc(vram_base, size);
135+
if (!bios) {
136+
amdgpu_bios_release(adev);
137+
return false;
138+
}
139+
140+
memcpy_fromio(adev->bios, bios, size);
141+
iounmap(bios);
125142
}
143+
126144
adev->bios_size = size;
127-
memcpy_fromio(adev->bios, bios, size);
128-
iounmap(bios);
129145

130146
if (!check_atom_bios(adev, size)) {
131147
amdgpu_bios_release(adev);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct amdgpu_bo_list_entry {
3838
struct amdgpu_bo *bo;
3939
struct amdgpu_bo_va *bo_va;
4040
uint32_t priority;
41-
struct hmm_range *range;
41+
struct amdgpu_hmm_range *range;
4242
bool user_invalidated;
4343
};
4444

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <linux/pagemap.h>
3030
#include <linux/sync_file.h>
3131
#include <linux/dma-buf.h>
32-
#include <linux/hmm.h>
3332

3433
#include <drm/amdgpu_drm.h>
3534
#include <drm/drm_syncobj.h>
@@ -41,6 +40,7 @@
4140
#include "amdgpu_gmc.h"
4241
#include "amdgpu_gem.h"
4342
#include "amdgpu_ras.h"
43+
#include "amdgpu_hmm.h"
4444

4545
static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p,
4646
struct amdgpu_device *adev,
@@ -891,12 +891,17 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
891891
bool userpage_invalidated = false;
892892
struct amdgpu_bo *bo = e->bo;
893893

894-
r = amdgpu_ttm_tt_get_user_pages(bo, &e->range);
894+
e->range = amdgpu_hmm_range_alloc(NULL);
895+
if (unlikely(!e->range))
896+
return -ENOMEM;
897+
898+
r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
895899
if (r)
896900
goto out_free_user_pages;
897901

898902
for (i = 0; i < bo->tbo.ttm->num_pages; i++) {
899-
if (bo->tbo.ttm->pages[i] != hmm_pfn_to_page(e->range->hmm_pfns[i])) {
903+
if (bo->tbo.ttm->pages[i] !=
904+
hmm_pfn_to_page(e->range->hmm_range.hmm_pfns[i])) {
900905
userpage_invalidated = true;
901906
break;
902907
}
@@ -990,9 +995,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
990995

991996
out_free_user_pages:
992997
amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
993-
struct amdgpu_bo *bo = e->bo;
994-
995-
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, e->range);
998+
amdgpu_hmm_range_free(e->range);
996999
e->range = NULL;
9971000
}
9981001
mutex_unlock(&p->bo_list->bo_list_mutex);
@@ -1323,8 +1326,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
13231326
*/
13241327
r = 0;
13251328
amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
1326-
r |= !amdgpu_ttm_tt_get_user_pages_done(e->bo->tbo.ttm,
1327-
e->range);
1329+
r |= !amdgpu_hmm_range_valid(e->range);
1330+
amdgpu_hmm_range_free(e->range);
13281331
e->range = NULL;
13291332
}
13301333
if (r) {

0 commit comments

Comments
 (0)