Commit 6dcb38a1 authored by Jane Jian's avatar Jane Jian Committed by Alex Deucher

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: default avatarJane Jian <Jane.Jian@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ca475186
...@@ -78,9 +78,18 @@ static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev); ...@@ -78,9 +78,18 @@ static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev);
static int vcn_v4_0_early_init(void *handle) static int vcn_v4_0_early_init(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct amdgpu_ring *ring;
if (amdgpu_sriov_vf(adev)) if (amdgpu_sriov_vf(adev)) {
adev->vcn.harvest_config = VCN_HARVEST_MMSCH; adev->vcn.harvest_config = VCN_HARVEST_MMSCH;
for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
ring = &adev->vcn.inst[i].ring_enc[0];
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
adev->vcn.harvest_config |= 1 << i;
dev_info(adev->dev, "VCN%d is disabled by hypervisor\n", i);
}
}
}
/* re-use enc ring as unified ring */ /* re-use enc ring as unified ring */
adev->vcn.num_enc_rings = 1; adev->vcn.num_enc_rings = 1;
...@@ -238,16 +247,11 @@ static int vcn_v4_0_hw_init(void *handle) ...@@ -238,16 +247,11 @@ static int vcn_v4_0_hw_init(void *handle)
continue; continue;
ring = &adev->vcn.inst[i].ring_enc[0]; ring = &adev->vcn.inst[i].ring_enc[0];
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) { ring->wptr = 0;
ring->sched.ready = false; ring->wptr_old = 0;
ring->no_scheduler = true; vcn_v4_0_unified_ring_set_wptr(ring);
dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name); ring->sched.ready = true;
} else {
ring->wptr = 0;
ring->wptr_old = 0;
vcn_v4_0_unified_ring_set_wptr(ring);
ring->sched.ready = true;
}
} }
} else { } else {
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) { for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment