Skip to content

Commit 342f141

Browse files
committed
Merge tag 'amd-drm-next-6.18-2025-09-19' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.18-2025-09-19: amdgpu: - Fence drv clean up fix - DPC fixes - Misc display fixes - Support the MMIO remap page as a ttm pool - JPEG parser updates - UserQ updates - VCN ctx handling fixes - Documentation updates - Misc cleanups - SMU 13.0.x updates - SI DPM updates - GC 11.x cleaner shader updates - DMCUB updates - DML fixes - Improve fallback handling for pixel encoding - VCN reset improvements - DCE6 DC updates - DSC fixes - Use devm for i2c buses - GPUVM locking updates - GPUVM documentation improvements - Drop non-DC DCE11 code - S0ix fixes - Backlight fix - SR-IOV fixes amdkfd: - SVM updates Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents 0faeb8c + a490c8d commit 342f141

File tree

205 files changed

+2093
-5194
lines changed

Some content is hidden

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

205 files changed

+2093
-5194
lines changed

Documentation/gpu/amdgpu/apu-asic-info-table.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ Ryzen 7x20 series, Mendocino, 3.1.6, 10.3.7, 3.1.1, 5.2.7, 13.0.8, 13.0.8
1313
Ryzen 7x40 series, Phoenix, 3.1.4, 11.0.1 / 11.0.4, 4.0.2, 6.0.1, 13.0.4 / 13.0.11, 13.0.4 / 13.0.11
1414
Ryzen 8x40 series, Hawk Point, 3.1.4, 11.0.1 / 11.0.4, 4.0.2, 6.0.1, 13.0.4 / 13.0.11, 13.0.4 / 13.0.11
1515
Ryzen AI 300 series, Strix Point, 3.5.0, 11.5.0, 4.0.5, 6.1.0, 14.0.0, 14.0.0
16+
Ryzen AI 330 series, Krackan Point, 3.6.0, 11.5.3, 4.0.5, 6.1.3, 14.0.5, 14.0.5
1617
Ryzen AI 350 series, Krackan Point, 3.5.0, 11.5.2, 4.0.5, 6.1.2, 14.0.4, 14.0.4
1718
Ryzen AI Max 300 series, Strix Halo, 3.5.1, 11.5.1, 4.0.6, 6.1.1, 14.0.1, 14.0.1

Documentation/gpu/amdgpu/driver-core.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,4 @@ IP Blocks
210210
:doc: IP Blocks
211211

212212
.. kernel-doc:: drivers/gpu/drm/amd/include/amd_shared.h
213-
:identifiers: amd_ip_block_type amd_ip_funcs DC_DEBUG_MASK
213+
:identifiers: amd_ip_block_type amd_ip_funcs DC_FEATURE_MASK DC_DEBUG_MASK

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ amdgpu-y += \
138138
# add DCE block
139139
amdgpu-y += \
140140
dce_v10_0.o \
141-
dce_v11_0.o \
142141
amdgpu_vkms.o
143142

144143
# add GFX block

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "kgd_pp_interface.h"
6464

6565
#include "amd_shared.h"
66+
#include "amdgpu_utils.h"
6667
#include "amdgpu_mode.h"
6768
#include "amdgpu_ih.h"
6869
#include "amdgpu_irq.h"
@@ -434,7 +435,6 @@ struct amdgpu_clock {
434435
uint32_t default_mclk;
435436
uint32_t default_sclk;
436437
uint32_t default_dispclk;
437-
uint32_t current_dispclk;
438438
uint32_t dp_extclk;
439439
uint32_t max_pixel_clock;
440440
};
@@ -545,7 +545,7 @@ struct amdgpu_wb {
545545
* this value can be accessed directly by using the offset as an index.
546546
* For the GPU address, it is necessary to use gpu_addr and the offset.
547547
*/
548-
volatile uint32_t *wb;
548+
uint32_t *wb;
549549

550550
/**
551551
* @gpu_addr:
@@ -721,7 +721,7 @@ int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
721721
/* VRAM scratch page for HDP bug, default vram page */
722722
struct amdgpu_mem_scratch {
723723
struct amdgpu_bo *robj;
724-
volatile uint32_t *ptr;
724+
uint32_t *ptr;
725725
u64 gpu_addr;
726726
};
727727

@@ -752,6 +752,7 @@ typedef void (*amdgpu_block_wreg_t)(struct amdgpu_device*, uint32_t, uint32_t, u
752752
struct amdgpu_mmio_remap {
753753
u32 reg_offset;
754754
resource_size_t bus_addr;
755+
struct amdgpu_bo *bo;
755756
};
756757

757758
/* Define the HW IP blocks will be used in driver , add more if necessary */

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,24 @@ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
250250

251251
void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool suspend_proc)
252252
{
253-
if (adev->kfd.dev)
254-
kgd2kfd_suspend(adev->kfd.dev, suspend_proc);
253+
if (adev->kfd.dev) {
254+
if (adev->in_s0ix)
255+
kgd2kfd_stop_sched_all_nodes(adev->kfd.dev);
256+
else
257+
kgd2kfd_suspend(adev->kfd.dev, suspend_proc);
258+
}
255259
}
256260

257261
int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool resume_proc)
258262
{
259263
int r = 0;
260264

261-
if (adev->kfd.dev)
262-
r = kgd2kfd_resume(adev->kfd.dev, resume_proc);
265+
if (adev->kfd.dev) {
266+
if (adev->in_s0ix)
267+
r = kgd2kfd_start_sched_all_nodes(adev->kfd.dev);
268+
else
269+
r = kgd2kfd_resume(adev->kfd.dev, resume_proc);
270+
}
263271

264272
return r;
265273
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask);
428428
int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd);
429429
void kgd2kfd_unlock_kfd(struct kfd_dev *kfd);
430430
int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id);
431+
int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd);
431432
int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id);
433+
int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd);
432434
bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id);
433435
bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
434436
bool retry_fault);
@@ -518,11 +520,21 @@ static inline int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id)
518520
return 0;
519521
}
520522

523+
static inline int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd)
524+
{
525+
return 0;
526+
}
527+
521528
static inline int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id)
522529
{
523530
return 0;
524531
}
525532

533+
static inline int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd)
534+
{
535+
return 0;
536+
}
537+
526538
static inline bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id)
527539
{
528540
return false;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
706706
}
707707
adev->clock.dp_extclk =
708708
le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq);
709-
adev->clock.current_dispclk = adev->clock.default_dispclk;
710709

711710
adev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock);
712711
if (adev->clock.max_pixel_clock == 0)

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

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -184,43 +184,36 @@ void amdgpu_bo_list_put(struct amdgpu_bo_list *list)
184184
int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,
185185
struct drm_amdgpu_bo_list_entry **info_param)
186186
{
187-
const void __user *uptr = u64_to_user_ptr(in->bo_info_ptr);
188187
const uint32_t info_size = sizeof(struct drm_amdgpu_bo_list_entry);
188+
const void __user *uptr = u64_to_user_ptr(in->bo_info_ptr);
189+
const uint32_t bo_info_size = in->bo_info_size;
190+
const uint32_t bo_number = in->bo_number;
189191
struct drm_amdgpu_bo_list_entry *info;
190-
int r;
191-
192-
info = kvmalloc_array(in->bo_number, info_size, GFP_KERNEL);
193-
if (!info)
194-
return -ENOMEM;
195192

196193
/* copy the handle array from userspace to a kernel buffer */
197-
r = -EFAULT;
198-
if (likely(info_size == in->bo_info_size)) {
199-
unsigned long bytes = in->bo_number *
200-
in->bo_info_size;
201-
202-
if (copy_from_user(info, uptr, bytes))
203-
goto error_free;
204-
194+
if (likely(info_size == bo_info_size)) {
195+
info = vmemdup_array_user(uptr, bo_number, info_size);
196+
if (IS_ERR(info))
197+
return PTR_ERR(info);
205198
} else {
206-
unsigned long bytes = min(in->bo_info_size, info_size);
199+
const uint32_t bytes = min(bo_info_size, info_size);
207200
unsigned i;
208201

209-
memset(info, 0, in->bo_number * info_size);
210-
for (i = 0; i < in->bo_number; ++i) {
211-
if (copy_from_user(&info[i], uptr, bytes))
212-
goto error_free;
202+
info = kvmalloc_array(bo_number, info_size, GFP_KERNEL);
203+
if (!info)
204+
return -ENOMEM;
213205

214-
uptr += in->bo_info_size;
206+
memset(info, 0, bo_number * info_size);
207+
for (i = 0; i < bo_number; ++i, uptr += bo_info_size) {
208+
if (copy_from_user(&info[i], uptr, bytes)) {
209+
kvfree(info);
210+
return -EFAULT;
211+
}
215212
}
216213
}
217214

218215
*info_param = info;
219216
return 0;
220-
221-
error_free:
222-
kvfree(info);
223-
return r;
224217
}
225218

226219
int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,

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

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,25 +178,17 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
178178
struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
179179
unsigned int num_ibs[AMDGPU_CS_GANG_SIZE] = { };
180180
struct amdgpu_vm *vm = &fpriv->vm;
181-
uint64_t *chunk_array_user;
182181
uint64_t *chunk_array;
183182
uint32_t uf_offset = 0;
184183
size_t size;
185184
int ret;
186185
int i;
187186

188-
chunk_array = kvmalloc_array(cs->in.num_chunks, sizeof(uint64_t),
189-
GFP_KERNEL);
190-
if (!chunk_array)
191-
return -ENOMEM;
192-
193-
/* get chunks */
194-
chunk_array_user = u64_to_user_ptr(cs->in.chunks);
195-
if (copy_from_user(chunk_array, chunk_array_user,
196-
sizeof(uint64_t)*cs->in.num_chunks)) {
197-
ret = -EFAULT;
198-
goto free_chunk;
199-
}
187+
chunk_array = memdup_array_user(u64_to_user_ptr(cs->in.chunks),
188+
cs->in.num_chunks,
189+
sizeof(uint64_t));
190+
if (IS_ERR(chunk_array))
191+
return PTR_ERR(chunk_array);
200192

201193
p->nchunks = cs->in.num_chunks;
202194
p->chunks = kvmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk),
@@ -209,7 +201,6 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
209201
for (i = 0; i < p->nchunks; i++) {
210202
struct drm_amdgpu_cs_chunk __user *chunk_ptr = NULL;
211203
struct drm_amdgpu_cs_chunk user_chunk;
212-
uint32_t __user *cdata;
213204

214205
chunk_ptr = u64_to_user_ptr(chunk_array[i]);
215206
if (copy_from_user(&user_chunk, chunk_ptr,
@@ -222,20 +213,16 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
222213
p->chunks[i].length_dw = user_chunk.length_dw;
223214

224215
size = p->chunks[i].length_dw;
225-
cdata = u64_to_user_ptr(user_chunk.chunk_data);
226216

227-
p->chunks[i].kdata = kvmalloc_array(size, sizeof(uint32_t),
228-
GFP_KERNEL);
229-
if (p->chunks[i].kdata == NULL) {
230-
ret = -ENOMEM;
217+
p->chunks[i].kdata = vmemdup_array_user(u64_to_user_ptr(user_chunk.chunk_data),
218+
size,
219+
sizeof(uint32_t));
220+
if (IS_ERR(p->chunks[i].kdata)) {
221+
ret = PTR_ERR(p->chunks[i].kdata);
231222
i--;
232223
goto free_partial_kdata;
233224
}
234225
size *= sizeof(uint32_t);
235-
if (copy_from_user(p->chunks[i].kdata, cdata, size)) {
236-
ret = -EFAULT;
237-
goto free_partial_kdata;
238-
}
239226

240227
/* Assume the worst on the following checks */
241228
ret = -EINVAL;
@@ -286,7 +273,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
286273
}
287274
}
288275

289-
if (!p->gang_size) {
276+
if (!p->gang_size || (amdgpu_sriov_vf(p->adev) && p->gang_size > 1)) {
290277
ret = -EINVAL;
291278
goto free_all_kdata;
292279
}
@@ -1767,30 +1754,21 @@ int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
17671754
{
17681755
struct amdgpu_device *adev = drm_to_adev(dev);
17691756
union drm_amdgpu_wait_fences *wait = data;
1770-
uint32_t fence_count = wait->in.fence_count;
1771-
struct drm_amdgpu_fence *fences_user;
17721757
struct drm_amdgpu_fence *fences;
17731758
int r;
17741759

17751760
/* Get the fences from userspace */
1776-
fences = kmalloc_array(fence_count, sizeof(struct drm_amdgpu_fence),
1777-
GFP_KERNEL);
1778-
if (fences == NULL)
1779-
return -ENOMEM;
1780-
1781-
fences_user = u64_to_user_ptr(wait->in.fences);
1782-
if (copy_from_user(fences, fences_user,
1783-
sizeof(struct drm_amdgpu_fence) * fence_count)) {
1784-
r = -EFAULT;
1785-
goto err_free_fences;
1786-
}
1761+
fences = memdup_array_user(u64_to_user_ptr(wait->in.fences),
1762+
wait->in.fence_count,
1763+
sizeof(struct drm_amdgpu_fence));
1764+
if (IS_ERR(fences))
1765+
return PTR_ERR(fences);
17871766

17881767
if (wait->in.wait_all)
17891768
r = amdgpu_cs_wait_all_fences(adev, filp, wait, fences);
17901769
else
17911770
r = amdgpu_cs_wait_any_fence(adev, filp, wait, fences);
17921771

1793-
err_free_fences:
17941772
kfree(fences);
17951773

17961774
return r;

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

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5072,6 +5072,10 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
50725072
if (!adev->in_s4 && (adev->flags & AMD_IS_APU))
50735073
return 0;
50745074

5075+
/* No need to evict when going to S5 through S4 callbacks */
5076+
if (system_state == SYSTEM_POWER_OFF)
5077+
return 0;
5078+
50755079
ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
50765080
if (ret) {
50775081
dev_warn(adev->dev, "evicting device resources failed\n");
@@ -5196,7 +5200,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
51965200
adev->in_suspend = true;
51975201

51985202
if (amdgpu_sriov_vf(adev)) {
5199-
if (!adev->in_s0ix && !adev->in_runpm)
5203+
if (!adev->in_runpm)
52005204
amdgpu_amdkfd_suspend_process(adev);
52015205
amdgpu_virt_fini_data_exchange(adev);
52025206
r = amdgpu_virt_request_full_gpu(adev, false);
@@ -5216,10 +5220,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
52165220

52175221
amdgpu_device_ip_suspend_phase1(adev);
52185222

5219-
if (!adev->in_s0ix) {
5220-
amdgpu_amdkfd_suspend(adev, !amdgpu_sriov_vf(adev) && !adev->in_runpm);
5221-
amdgpu_userq_suspend(adev);
5222-
}
5223+
amdgpu_amdkfd_suspend(adev, !amdgpu_sriov_vf(adev) && !adev->in_runpm);
5224+
amdgpu_userq_suspend(adev);
52235225

52245226
r = amdgpu_device_evict_resources(adev);
52255227
if (r)
@@ -5314,15 +5316,13 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)
53145316
goto exit;
53155317
}
53165318

5317-
if (!adev->in_s0ix) {
5318-
r = amdgpu_amdkfd_resume(adev, !amdgpu_sriov_vf(adev) && !adev->in_runpm);
5319-
if (r)
5320-
goto exit;
5319+
r = amdgpu_amdkfd_resume(adev, !amdgpu_sriov_vf(adev) && !adev->in_runpm);
5320+
if (r)
5321+
goto exit;
53215322

5322-
r = amdgpu_userq_resume(adev);
5323-
if (r)
5324-
goto exit;
5325-
}
5323+
r = amdgpu_userq_resume(adev);
5324+
if (r)
5325+
goto exit;
53265326

53275327
r = amdgpu_device_ip_late_init(adev);
53285328
if (r)
@@ -5335,7 +5335,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)
53355335
amdgpu_virt_init_data_exchange(adev);
53365336
amdgpu_virt_release_full_gpu(adev, true);
53375337

5338-
if (!adev->in_s0ix && !r && !adev->in_runpm)
5338+
if (!r && !adev->in_runpm)
53395339
r = amdgpu_amdkfd_resume_process(adev);
53405340
}
53415341

@@ -6937,7 +6937,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
69376937
{
69386938
struct drm_device *dev = pci_get_drvdata(pdev);
69396939
struct amdgpu_device *adev = drm_to_adev(dev);
6940-
struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev);
6940+
struct amdgpu_hive_info *hive __free(xgmi_put_hive) =
6941+
amdgpu_get_xgmi_hive(adev);
69416942
struct amdgpu_reset_context reset_context;
69426943
struct list_head device_list;
69436944

@@ -6976,10 +6977,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
69766977
amdgpu_device_recovery_get_reset_lock(adev, &device_list);
69776978
amdgpu_device_halt_activities(adev, NULL, &reset_context, &device_list,
69786979
hive, false);
6979-
if (hive) {
6980+
if (hive)
69806981
mutex_unlock(&hive->hive_lock);
6981-
amdgpu_put_xgmi_hive(hive);
6982-
}
69836982
return PCI_ERS_RESULT_NEED_RESET;
69846983
case pci_channel_io_perm_failure:
69856984
/* Permanent error, prepare for device removal */
@@ -7161,7 +7160,7 @@ static void amdgpu_device_cache_switch_state(struct amdgpu_device *adev)
71617160
struct pci_dev *parent = pci_upstream_bridge(adev->pdev);
71627161
int r;
71637162

7164-
if (parent->vendor != PCI_VENDOR_ID_ATI)
7163+
if (!parent || parent->vendor != PCI_VENDOR_ID_ATI)
71657164
return;
71667165

71677166
/* If already saved, return */

0 commit comments

Comments
 (0)