Short summary of fixes pull:

* amdgpu: Fix for drm buddy memory corruption
  * nouveau: PM fixes; DP fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmLY+rcACgkQaA3BHVML
 eiNuGwf/e5tnPLnJMYbkrGy3UxqoAxA/LsJ0ZhUfznsb8yKE8FyIcINJQ3BTtjrG
 9wEiVoUfitKttPtnkFBPrhR+8VDhVOd8qi953PEO+EwLNDmfv+hkKAONyc4oMdLG
 3WucvtvZDYhvWitSH3nJQoPF/W8Ctj6WGsq5JlhQ5AvePt7Fvw7mjYRi+20mLmFS
 cMUEF+R75iW94RfK2aQ8JMz6IKhnh/nGzTdIz1qiO9lK06OAfkhaJbYyJVYt1s7d
 PkL9DcqlMjh1u5uNllTN1RK+UNNgj12DXeFWpUfLfPP1Jd4ywcGgV61tcyHw3D8G
 r34vxdiuaDuFMv8yYJMvlnQSqjp0Hg==
 =vspz
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Dave Airlie 2022-07-22 13:43:46 +10:00
commit cb6b81b21b
5 changed files with 15 additions and 17 deletions

View File

@ -395,11 +395,11 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
unsigned long pages_per_block; unsigned long pages_per_block;
int r; int r;
lpfn = place->lpfn << PAGE_SHIFT; lpfn = (u64)place->lpfn << PAGE_SHIFT;
if (!lpfn) if (!lpfn)
lpfn = man->size; lpfn = man->size;
fpfn = place->fpfn << PAGE_SHIFT; fpfn = (u64)place->fpfn << PAGE_SHIFT;
max_bytes = adev->gmc.mc_vram_size; max_bytes = adev->gmc.mc_vram_size;
if (tbo->type != ttm_bo_type_kernel) if (tbo->type != ttm_bo_type_kernel)
@ -439,12 +439,12 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
/* Allocate blocks in desired range */ /* Allocate blocks in desired range */
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION; vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
remaining_size = vres->base.num_pages << PAGE_SHIFT; remaining_size = (u64)vres->base.num_pages << PAGE_SHIFT;
mutex_lock(&mgr->lock); mutex_lock(&mgr->lock);
while (remaining_size) { while (remaining_size) {
if (tbo->page_alignment) if (tbo->page_alignment)
min_block_size = tbo->page_alignment << PAGE_SHIFT; min_block_size = (u64)tbo->page_alignment << PAGE_SHIFT;
else else
min_block_size = mgr->default_page_size; min_block_size = mgr->default_page_size;
@ -453,12 +453,12 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
/* Limit maximum size to 2GiB due to SG table limitations */ /* Limit maximum size to 2GiB due to SG table limitations */
size = min(remaining_size, 2ULL << 30); size = min(remaining_size, 2ULL << 30);
if (size >= pages_per_block << PAGE_SHIFT) if (size >= (u64)pages_per_block << PAGE_SHIFT)
min_block_size = pages_per_block << PAGE_SHIFT; min_block_size = (u64)pages_per_block << PAGE_SHIFT;
cur_size = size; cur_size = size;
if (fpfn + size != place->lpfn << PAGE_SHIFT) { if (fpfn + size != (u64)place->lpfn << PAGE_SHIFT) {
/* /*
* Except for actual range allocation, modify the size and * Except for actual range allocation, modify the size and
* min_block_size conforming to continuous flag enablement * min_block_size conforming to continuous flag enablement
@ -498,7 +498,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
LIST_HEAD(temp); LIST_HEAD(temp);
trim_list = &vres->blocks; trim_list = &vres->blocks;
original_size = vres->base.num_pages << PAGE_SHIFT; original_size = (u64)vres->base.num_pages << PAGE_SHIFT;
/* /*
* If size value is rounded up to min_block_size, trim the last * If size value is rounded up to min_block_size, trim the last

View File

@ -50,7 +50,7 @@ static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block)
static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block) static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
{ {
return PAGE_SIZE << drm_buddy_block_order(block); return (u64)PAGE_SIZE << drm_buddy_block_order(block);
} }
static inline struct amdgpu_vram_mgr_resource * static inline struct amdgpu_vram_mgr_resource *

View File

@ -1361,13 +1361,11 @@ nouveau_connector_create(struct drm_device *dev,
snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x", snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x",
dcbe->hasht, dcbe->hashm); dcbe->hasht, dcbe->hashm);
nv_connector->aux.name = kstrdup(aux_name, GFP_KERNEL); nv_connector->aux.name = kstrdup(aux_name, GFP_KERNEL);
drm_dp_aux_init(&nv_connector->aux); if (!nv_connector->aux.name) {
if (ret) {
NV_ERROR(drm, "Failed to init AUX adapter for sor-%04x-%04x: %d\n",
dcbe->hasht, dcbe->hashm, ret);
kfree(nv_connector); kfree(nv_connector);
return ERR_PTR(ret); return ERR_PTR(-ENOMEM);
} }
drm_dp_aux_init(&nv_connector->aux);
fallthrough; fallthrough;
default: default:
funcs = &nouveau_connector_funcs; funcs = &nouveau_connector_funcs;

View File

@ -515,7 +515,7 @@ nouveau_display_hpd_work(struct work_struct *work)
pm_runtime_mark_last_busy(drm->dev->dev); pm_runtime_mark_last_busy(drm->dev->dev);
noop: noop:
pm_runtime_put_sync(drm->dev->dev); pm_runtime_put_autosuspend(dev->dev);
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
@ -537,7 +537,7 @@ nouveau_display_acpi_ntfy(struct notifier_block *nb, unsigned long val,
* it's own hotplug events. * it's own hotplug events.
*/ */
pm_runtime_put_autosuspend(drm->dev->dev); pm_runtime_put_autosuspend(drm->dev->dev);
} else if (ret == 0) { } else if (ret == 0 || ret == -EINPROGRESS) {
/* We've started resuming the GPU already, so /* We've started resuming the GPU already, so
* it will handle scheduling a full reprobe * it will handle scheduling a full reprobe
* itself * itself

View File

@ -467,7 +467,7 @@ nouveau_fbcon_set_suspend_work(struct work_struct *work)
if (state == FBINFO_STATE_RUNNING) { if (state == FBINFO_STATE_RUNNING) {
nouveau_fbcon_hotplug_resume(drm->fbcon); nouveau_fbcon_hotplug_resume(drm->fbcon);
pm_runtime_mark_last_busy(drm->dev->dev); pm_runtime_mark_last_busy(drm->dev->dev);
pm_runtime_put_sync(drm->dev->dev); pm_runtime_put_autosuspend(drm->dev->dev);
} }
} }