Skip to content

Commit 6dcb38a

Browse files
Jane Jianalexdeucher
authored andcommitted
drm/amdgpu/vcn: set and use harvest config
in early init to set harvest config if the vcn0/1 is disabled rather than hard-code the ring attributes as before did Signed-off-by: Jane Jian <Jane.Jian@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent ca47518 commit 6dcb38a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,18 @@ static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev);
7878
static int vcn_v4_0_early_init(void *handle)
7979
{
8080
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
81+
struct amdgpu_ring *ring;
8182

82-
if (amdgpu_sriov_vf(adev))
83+
if (amdgpu_sriov_vf(adev)) {
8384
adev->vcn.harvest_config = VCN_HARVEST_MMSCH;
85+
for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
86+
ring = &adev->vcn.inst[i].ring_enc[0];
87+
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
88+
adev->vcn.harvest_config |= 1 << i;
89+
dev_info(adev->dev, "VCN%d is disabled by hypervisor\n", i);
90+
}
91+
}
92+
}
8493

8594
/* re-use enc ring as unified ring */
8695
adev->vcn.num_enc_rings = 1;
@@ -238,16 +247,11 @@ static int vcn_v4_0_hw_init(void *handle)
238247
continue;
239248

240249
ring = &adev->vcn.inst[i].ring_enc[0];
241-
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
242-
ring->sched.ready = false;
243-
ring->no_scheduler = true;
244-
dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name);
245-
} else {
246-
ring->wptr = 0;
247-
ring->wptr_old = 0;
248-
vcn_v4_0_unified_ring_set_wptr(ring);
249-
ring->sched.ready = true;
250-
}
250+
ring->wptr = 0;
251+
ring->wptr_old = 0;
252+
vcn_v4_0_unified_ring_set_wptr(ring);
253+
ring->sched.ready = true;
254+
251255
}
252256
} else {
253257
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {

0 commit comments

Comments
 (0)