Commit ab5999de authored by Jane Jian's avatar Jane Jian Committed by Alex Deucher

drm/amdgpu: enable VCN0 and VCN1 sriov instances support for Arcturus

v1: compared to bare-metal: sriov support psp loading VCN firmware; only one
encoding ring would be used in each instance.
v2: keep unchange for bare-metal VCN2.5 hw_init, just add a flag with sriov
and also remove multiple lines.
v3: squash in warning fix
Signed-off-by: default avatarJane Jian <Jane.Jian@amd.com>
Reviewed-by: default avatarLeo Liu <leo.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b40953c2
...@@ -830,8 +830,13 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) ...@@ -830,8 +830,13 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
if (!amdgpu_sriov_vf(adev)) if (!amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
if (unlikely(adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT)) if (amdgpu_sriov_vf(adev)) {
amdgpu_device_ip_block_add(adev, &vcn_v2_5_ip_block); if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP))
amdgpu_device_ip_block_add(adev, &vcn_v2_5_ip_block);
} else {
if (unlikely(adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT))
amdgpu_device_ip_block_add(adev, &vcn_v2_5_ip_block);
}
if (!amdgpu_sriov_vf(adev)) if (!amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, &jpeg_v2_5_ip_block); amdgpu_device_ip_block_add(adev, &jpeg_v2_5_ip_block);
break; break;
......
...@@ -90,7 +90,13 @@ static int vcn_v2_5_early_init(void *handle) ...@@ -90,7 +90,13 @@ static int vcn_v2_5_early_init(void *handle)
} else } else
adev->vcn.num_vcn_inst = 1; adev->vcn.num_vcn_inst = 1;
adev->vcn.num_enc_rings = 2; if (amdgpu_sriov_vf(adev)) {
adev->vcn.num_vcn_inst = 2;
adev->vcn.harvest_config = 0;
adev->vcn.num_enc_rings = 1;
} else {
adev->vcn.num_enc_rings = 2;
}
vcn_v2_5_set_dec_ring_funcs(adev); vcn_v2_5_set_dec_ring_funcs(adev);
vcn_v2_5_set_enc_ring_funcs(adev); vcn_v2_5_set_enc_ring_funcs(adev);
...@@ -178,7 +184,9 @@ static int vcn_v2_5_sw_init(void *handle) ...@@ -178,7 +184,9 @@ static int vcn_v2_5_sw_init(void *handle)
ring = &adev->vcn.inst[j].ring_dec; ring = &adev->vcn.inst[j].ring_dec;
ring->use_doorbell = true; ring->use_doorbell = true;
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 8*j;
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) +
(amdgpu_sriov_vf(adev) ? 2*j : 8*j);
sprintf(ring->name, "vcn_dec_%d", j); sprintf(ring->name, "vcn_dec_%d", j);
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[j].irq, 0); r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[j].irq, 0);
if (r) if (r)
...@@ -187,7 +195,10 @@ static int vcn_v2_5_sw_init(void *handle) ...@@ -187,7 +195,10 @@ static int vcn_v2_5_sw_init(void *handle)
for (i = 0; i < adev->vcn.num_enc_rings; ++i) { for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
ring = &adev->vcn.inst[j].ring_enc[i]; ring = &adev->vcn.inst[j].ring_enc[i];
ring->use_doorbell = true; ring->use_doorbell = true;
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 2 + i + 8*j;
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) +
(amdgpu_sriov_vf(adev) ? (1 + i + 2*j) : (2 + i + 8*j));
sprintf(ring->name, "vcn_enc_%d.%d", j, i); sprintf(ring->name, "vcn_enc_%d.%d", j, i);
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[j].irq, 0); r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[j].irq, 0);
if (r) if (r)
...@@ -195,6 +206,12 @@ static int vcn_v2_5_sw_init(void *handle) ...@@ -195,6 +206,12 @@ static int vcn_v2_5_sw_init(void *handle)
} }
} }
if (amdgpu_sriov_vf(adev)) {
r = amdgpu_virt_alloc_mm_table(adev);
if (r)
return r;
}
return 0; return 0;
} }
...@@ -210,6 +227,9 @@ static int vcn_v2_5_sw_fini(void *handle) ...@@ -210,6 +227,9 @@ static int vcn_v2_5_sw_fini(void *handle)
int r; int r;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (amdgpu_sriov_vf(adev))
amdgpu_virt_free_mm_table(adev);
r = amdgpu_vcn_suspend(adev); r = amdgpu_vcn_suspend(adev);
if (r) if (r)
return r; return r;
...@@ -230,25 +250,37 @@ static int vcn_v2_5_hw_init(void *handle) ...@@ -230,25 +250,37 @@ static int vcn_v2_5_hw_init(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct amdgpu_ring *ring; struct amdgpu_ring *ring;
int i, j, r; int i, j, r = 0;
if (amdgpu_sriov_vf(adev))
r = vcn_v2_5_sriov_start(adev);
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) { for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j)) if (adev->vcn.harvest_config & (1 << j))
continue; continue;
ring = &adev->vcn.inst[j].ring_dec;
adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell, if (amdgpu_sriov_vf(adev)) {
ring->doorbell_index, j); adev->vcn.inst[j].ring_enc[0].sched.ready = true;
adev->vcn.inst[j].ring_enc[1].sched.ready = false;
adev->vcn.inst[j].ring_enc[2].sched.ready = false;
adev->vcn.inst[j].ring_dec.sched.ready = true;
} else {
r = amdgpu_ring_test_helper(ring); ring = &adev->vcn.inst[j].ring_dec;
if (r)
goto done; adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
ring->doorbell_index, j);
for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
ring = &adev->vcn.inst[j].ring_enc[i];
r = amdgpu_ring_test_helper(ring); r = amdgpu_ring_test_helper(ring);
if (r) if (r)
goto done; goto done;
for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
ring = &adev->vcn.inst[j].ring_enc[i];
r = amdgpu_ring_test_helper(ring);
if (r)
goto done;
}
} }
} }
......
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