Skip to content

Commit cb6b81b

Browse files
committed
Merge tag 'drm-misc-next-fixes-2022-07-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
Short summary of fixes pull: * amdgpu: Fix for drm buddy memory corruption * nouveau: PM fixes; DP fixes Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/Ytj65+PdAJs4jIEO@linux-uq9g
2 parents 3cfb5bc + 6f2c8d5 commit cb6b81b

5 files changed

Lines changed: 15 additions & 17 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,11 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
395395
unsigned long pages_per_block;
396396
int r;
397397

398-
lpfn = place->lpfn << PAGE_SHIFT;
398+
lpfn = (u64)place->lpfn << PAGE_SHIFT;
399399
if (!lpfn)
400400
lpfn = man->size;
401401

402-
fpfn = place->fpfn << PAGE_SHIFT;
402+
fpfn = (u64)place->fpfn << PAGE_SHIFT;
403403

404404
max_bytes = adev->gmc.mc_vram_size;
405405
if (tbo->type != ttm_bo_type_kernel)
@@ -439,12 +439,12 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
439439
/* Allocate blocks in desired range */
440440
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
441441

442-
remaining_size = vres->base.num_pages << PAGE_SHIFT;
442+
remaining_size = (u64)vres->base.num_pages << PAGE_SHIFT;
443443

444444
mutex_lock(&mgr->lock);
445445
while (remaining_size) {
446446
if (tbo->page_alignment)
447-
min_block_size = tbo->page_alignment << PAGE_SHIFT;
447+
min_block_size = (u64)tbo->page_alignment << PAGE_SHIFT;
448448
else
449449
min_block_size = mgr->default_page_size;
450450

@@ -453,12 +453,12 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
453453
/* Limit maximum size to 2GiB due to SG table limitations */
454454
size = min(remaining_size, 2ULL << 30);
455455

456-
if (size >= pages_per_block << PAGE_SHIFT)
457-
min_block_size = pages_per_block << PAGE_SHIFT;
456+
if (size >= (u64)pages_per_block << PAGE_SHIFT)
457+
min_block_size = (u64)pages_per_block << PAGE_SHIFT;
458458

459459
cur_size = size;
460460

461-
if (fpfn + size != place->lpfn << PAGE_SHIFT) {
461+
if (fpfn + size != (u64)place->lpfn << PAGE_SHIFT) {
462462
/*
463463
* Except for actual range allocation, modify the size and
464464
* min_block_size conforming to continuous flag enablement
@@ -498,7 +498,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
498498
LIST_HEAD(temp);
499499

500500
trim_list = &vres->blocks;
501-
original_size = vres->base.num_pages << PAGE_SHIFT;
501+
original_size = (u64)vres->base.num_pages << PAGE_SHIFT;
502502

503503
/*
504504
* If size value is rounded up to min_block_size, trim the last

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block)
5050

5151
static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
5252
{
53-
return PAGE_SIZE << drm_buddy_block_order(block);
53+
return (u64)PAGE_SIZE << drm_buddy_block_order(block);
5454
}
5555

5656
static inline struct amdgpu_vram_mgr_resource *

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,13 +1361,11 @@ nouveau_connector_create(struct drm_device *dev,
13611361
snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x",
13621362
dcbe->hasht, dcbe->hashm);
13631363
nv_connector->aux.name = kstrdup(aux_name, GFP_KERNEL);
1364-
drm_dp_aux_init(&nv_connector->aux);
1365-
if (ret) {
1366-
NV_ERROR(drm, "Failed to init AUX adapter for sor-%04x-%04x: %d\n",
1367-
dcbe->hasht, dcbe->hashm, ret);
1364+
if (!nv_connector->aux.name) {
13681365
kfree(nv_connector);
1369-
return ERR_PTR(ret);
1366+
return ERR_PTR(-ENOMEM);
13701367
}
1368+
drm_dp_aux_init(&nv_connector->aux);
13711369
fallthrough;
13721370
default:
13731371
funcs = &nouveau_connector_funcs;

drivers/gpu/drm/nouveau/nouveau_display.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ nouveau_display_hpd_work(struct work_struct *work)
515515

516516
pm_runtime_mark_last_busy(drm->dev->dev);
517517
noop:
518-
pm_runtime_put_sync(drm->dev->dev);
518+
pm_runtime_put_autosuspend(dev->dev);
519519
}
520520

521521
#ifdef CONFIG_ACPI
@@ -537,7 +537,7 @@ nouveau_display_acpi_ntfy(struct notifier_block *nb, unsigned long val,
537537
* it's own hotplug events.
538538
*/
539539
pm_runtime_put_autosuspend(drm->dev->dev);
540-
} else if (ret == 0) {
540+
} else if (ret == 0 || ret == -EINPROGRESS) {
541541
/* We've started resuming the GPU already, so
542542
* it will handle scheduling a full reprobe
543543
* itself

drivers/gpu/drm/nouveau/nouveau_fbcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ nouveau_fbcon_set_suspend_work(struct work_struct *work)
467467
if (state == FBINFO_STATE_RUNNING) {
468468
nouveau_fbcon_hotplug_resume(drm->fbcon);
469469
pm_runtime_mark_last_busy(drm->dev->dev);
470-
pm_runtime_put_sync(drm->dev->dev);
470+
pm_runtime_put_autosuspend(drm->dev->dev);
471471
}
472472
}
473473

0 commit comments

Comments
 (0)