Skip to content

Commit 28801cc

Browse files
committed
Merge tag 'amd-drm-fixes-6.5-2023-07-20' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.5-2023-07-20: amdgpu: - More PCIe DPM fixes for Intel platforms - DCN3.0.1 fixes - Virtual display timer fix - Async flip fix - SMU13 clock reporting fixes - Add missing PSP firmware declaration - DP MST fix - DCN3.1.x fixes - Slab out of bounds fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 534a791 + b13d3e9 commit 28801cc

29 files changed

+524
-196
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
17091709
alloc_flags |= (flags & KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC) ?
17101710
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED : 0;
17111711
}
1712-
xcp_id = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id;
1712+
xcp_id = fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ?
1713+
0 : fpriv->xcp_id;
17131714
} else if (flags & KFD_IOC_ALLOC_MEM_FLAGS_GTT) {
17141715
domain = alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
17151716
alloc_flags = 0;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,13 +1229,13 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
12291229
pasid = 0;
12301230
}
12311231

1232-
r = amdgpu_vm_init(adev, &fpriv->vm);
1232+
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
12331233
if (r)
12341234
goto error_pasid;
12351235

1236-
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
1236+
r = amdgpu_vm_init(adev, &fpriv->vm, fpriv->xcp_id);
12371237
if (r)
1238-
goto error_vm;
1238+
goto error_pasid;
12391239

12401240
r = amdgpu_vm_set_pasid(adev, &fpriv->vm, pasid);
12411241
if (r)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
13821382
goto error_pasid;
13831383
}
13841384

1385-
r = amdgpu_vm_init(adev, vm);
1385+
r = amdgpu_vm_init(adev, vm, -1);
13861386
if (r) {
13871387
DRM_ERROR("failed to initialize vm\n");
13881388
goto error_pasid;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer)
5555
DRM_WARN("%s: vblank timer overrun\n", __func__);
5656

5757
ret = drm_crtc_handle_vblank(crtc);
58+
/* Don't queue timer again when vblank is disabled. */
5859
if (!ret)
59-
DRM_ERROR("amdgpu_vkms failure on handling vblank");
60+
return HRTIMER_NORESTART;
6061

6162
return HRTIMER_RESTART;
6263
}
@@ -81,7 +82,7 @@ static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc)
8182
{
8283
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
8384

84-
hrtimer_cancel(&amdgpu_crtc->vblank_timer);
85+
hrtimer_try_to_cancel(&amdgpu_crtc->vblank_timer);
8586
}
8687

8788
static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,13 +2121,14 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout)
21212121
*
21222122
* @adev: amdgpu_device pointer
21232123
* @vm: requested vm
2124+
* @xcp_id: GPU partition selection id
21242125
*
21252126
* Init @vm fields.
21262127
*
21272128
* Returns:
21282129
* 0 for success, error for failure.
21292130
*/
2130-
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
2131+
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id)
21312132
{
21322133
struct amdgpu_bo *root_bo;
21332134
struct amdgpu_bo_vm *root;
@@ -2177,7 +2178,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
21772178
vm->evicting = false;
21782179

21792180
r = amdgpu_vm_pt_create(adev, vm, adev->vm_manager.root_level,
2180-
false, &root);
2181+
false, &root, xcp_id);
21812182
if (r)
21822183
goto error_free_delayed;
21832184
root_bo = &root->bo;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
392392
u32 pasid);
393393

394394
long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
395-
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
395+
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id);
396396
int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
397397
void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
398398
void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
@@ -475,7 +475,8 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm,
475475
int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
476476
struct amdgpu_bo_vm *vmbo, bool immediate);
477477
int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
478-
int level, bool immediate, struct amdgpu_bo_vm **vmbo);
478+
int level, bool immediate, struct amdgpu_bo_vm **vmbo,
479+
int32_t xcp_id);
479480
void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm);
480481
bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
481482
struct amdgpu_vm *vm);

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,12 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
498498
* @level: the page table level
499499
* @immediate: use a immediate update
500500
* @vmbo: pointer to the buffer object pointer
501+
* @xcp_id: GPU partition id
501502
*/
502503
int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
503-
int level, bool immediate, struct amdgpu_bo_vm **vmbo)
504+
int level, bool immediate, struct amdgpu_bo_vm **vmbo,
505+
int32_t xcp_id)
504506
{
505-
struct amdgpu_fpriv *fpriv = container_of(vm, struct amdgpu_fpriv, vm);
506507
struct amdgpu_bo_param bp;
507508
struct amdgpu_bo *bo;
508509
struct dma_resv *resv;
@@ -535,7 +536,7 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
535536

536537
bp.type = ttm_bo_type_kernel;
537538
bp.no_wait_gpu = immediate;
538-
bp.xcp_id_plus1 = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id + 1;
539+
bp.xcp_id_plus1 = xcp_id + 1;
539540

540541
if (vm->root.bo)
541542
bp.resv = vm->root.bo->tbo.base.resv;
@@ -561,7 +562,7 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
561562
bp.type = ttm_bo_type_kernel;
562563
bp.resv = bo->tbo.base.resv;
563564
bp.bo_ptr_size = sizeof(struct amdgpu_bo);
564-
bp.xcp_id_plus1 = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id + 1;
565+
bp.xcp_id_plus1 = xcp_id + 1;
565566

566567
r = amdgpu_bo_create(adev, &bp, &(*vmbo)->shadow);
567568

@@ -606,7 +607,8 @@ static int amdgpu_vm_pt_alloc(struct amdgpu_device *adev,
606607
return 0;
607608

608609
amdgpu_vm_eviction_unlock(vm);
609-
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt);
610+
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt,
611+
vm->root.bo->xcp_id);
610612
amdgpu_vm_eviction_lock(vm);
611613
if (r)
612614
return r;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,
363363
if (!adev->xcp_mgr)
364364
return 0;
365365

366-
fpriv->xcp_id = ~0;
366+
fpriv->xcp_id = AMDGPU_XCP_NO_PARTITION;
367367
for (i = 0; i < MAX_XCP; ++i) {
368368
if (!adev->xcp_mgr->xcp[i].ddev)
369369
break;
@@ -381,7 +381,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,
381381
}
382382
}
383383

384-
fpriv->vm.mem_id = fpriv->xcp_id == ~0 ? -1 :
384+
fpriv->vm.mem_id = fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ? -1 :
385385
adev->xcp_mgr->xcp[fpriv->xcp_id].mem_id;
386386
return 0;
387387
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#define AMDGPU_XCP_FL_NONE 0
3838
#define AMDGPU_XCP_FL_LOCKED (1 << 0)
3939

40+
#define AMDGPU_XCP_NO_PARTITION (~0)
41+
4042
struct amdgpu_fpriv;
4143

4244
enum AMDGPU_XCP_IP_BLOCK {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev,
6868
enum AMDGPU_XCP_IP_BLOCK ip_blk;
6969
uint32_t inst_mask;
7070

71-
ring->xcp_id = ~0;
71+
ring->xcp_id = AMDGPU_XCP_NO_PARTITION;
7272
if (adev->xcp_mgr->mode == AMDGPU_XCP_MODE_NONE)
7373
return;
7474

@@ -177,7 +177,7 @@ static int aqua_vanjaram_select_scheds(
177177
u32 sel_xcp_id;
178178
int i;
179179

180-
if (fpriv->xcp_id == ~0) {
180+
if (fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION) {
181181
u32 least_ref_cnt = ~0;
182182

183183
fpriv->xcp_id = 0;

0 commit comments

Comments
 (0)