Skip to content

Commit 564e3dc

Browse files
Peng Ju Zhoualexdeucher
authored andcommitted
drm/amd/amdgpu: Recovery vcn instance iterate.
The previous logic is recording the amount of valid vcn instances to use them on SRIOV, it is a hard task due to the vcn accessment is based on the index of the vcn instance. Check if the vcn instance enabled before do instance init. Signed-off-by: Peng Ju Zhou <[email protected]> Reviewed-by: Monk Liu <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4b29652 commit 564e3dc

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ static int vcn_v3_0_early_init(void *handle)
9090
int i;
9191

9292
if (amdgpu_sriov_vf(adev)) {
93-
for (i = 0; i < VCN_INSTANCES_SIENNA_CICHLID; i++)
94-
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_DECODE_RING, i))
95-
adev->vcn.num_vcn_inst++;
93+
adev->vcn.num_vcn_inst = VCN_INSTANCES_SIENNA_CICHLID;
9694
adev->vcn.harvest_config = 0;
9795
adev->vcn.num_enc_rings = 1;
9896

@@ -153,8 +151,7 @@ static int vcn_v3_0_sw_init(void *handle)
153151
adev->firmware.fw_size +=
154152
ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
155153

156-
if ((adev->vcn.num_vcn_inst == VCN_INSTANCES_SIENNA_CICHLID) ||
157-
(amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)) {
154+
if (adev->vcn.num_vcn_inst == VCN_INSTANCES_SIENNA_CICHLID) {
158155
adev->firmware.ucode[AMDGPU_UCODE_ID_VCN1].ucode_id = AMDGPU_UCODE_ID_VCN1;
159156
adev->firmware.ucode[AMDGPU_UCODE_ID_VCN1].fw = adev->vcn.fw;
160157
adev->firmware.fw_size +=
@@ -328,18 +325,28 @@ static int vcn_v3_0_hw_init(void *handle)
328325
continue;
329326

330327
ring = &adev->vcn.inst[i].ring_dec;
331-
ring->wptr = 0;
332-
ring->wptr_old = 0;
333-
vcn_v3_0_dec_ring_set_wptr(ring);
334-
ring->sched.ready = true;
335-
336-
for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
337-
ring = &adev->vcn.inst[i].ring_enc[j];
328+
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_DECODE_RING, i)) {
329+
ring->sched.ready = false;
330+
dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name);
331+
} else {
338332
ring->wptr = 0;
339333
ring->wptr_old = 0;
340-
vcn_v3_0_enc_ring_set_wptr(ring);
334+
vcn_v3_0_dec_ring_set_wptr(ring);
341335
ring->sched.ready = true;
342336
}
337+
338+
for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
339+
ring = &adev->vcn.inst[i].ring_enc[j];
340+
if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
341+
ring->sched.ready = false;
342+
dev_info(adev->dev, "ring %s is disabled by hypervisor\n", ring->name);
343+
} else {
344+
ring->wptr = 0;
345+
ring->wptr_old = 0;
346+
vcn_v3_0_enc_ring_set_wptr(ring);
347+
ring->sched.ready = true;
348+
}
349+
}
343350
}
344351
} else {
345352
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {

0 commit comments

Comments
 (0)