Skip to content

Commit 5d64af4

Browse files
Gavin Wanalexdeucher
authored andcommitted
drm/amd/amdgpu: fix SDMA IRQ client ID <-> req mapping.
sdma has 2 instances in SRIOV cpx mode. Odd numbered VFs have sdma0/sdma1 instances. Even numbered vfs have sdma2/sdma3. For Even numbered vfs, the sdma2 & sdma3 (irq srouce id CLIENTID_SDMA2 and CLIENTID_SDMA3) should map to irq seq 0 & 1. Signed-off-by: Gavin Wan <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 89d568a commit 5d64af4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,23 @@ static unsigned sdma_v4_4_2_seq_to_irq_id(int seq_num)
8383
}
8484
}
8585

86-
static int sdma_v4_4_2_irq_id_to_seq(unsigned client_id)
86+
static int sdma_v4_4_2_irq_id_to_seq(struct amdgpu_device *adev, unsigned client_id)
8787
{
8888
switch (client_id) {
8989
case SOC15_IH_CLIENTID_SDMA0:
9090
return 0;
9191
case SOC15_IH_CLIENTID_SDMA1:
9292
return 1;
9393
case SOC15_IH_CLIENTID_SDMA2:
94-
return 2;
94+
if (amdgpu_sriov_vf(adev) && (adev->gfx.xcc_mask == 0x1))
95+
return 0;
96+
else
97+
return 2;
9598
case SOC15_IH_CLIENTID_SDMA3:
96-
return 3;
99+
if (amdgpu_sriov_vf(adev) && (adev->gfx.xcc_mask == 0x1))
100+
return 1;
101+
else
102+
return 3;
97103
default:
98104
return -EINVAL;
99105
}
@@ -1524,7 +1530,7 @@ static int sdma_v4_4_2_process_trap_irq(struct amdgpu_device *adev,
15241530
uint32_t instance, i;
15251531

15261532
DRM_DEBUG("IH: SDMA trap\n");
1527-
instance = sdma_v4_4_2_irq_id_to_seq(entry->client_id);
1533+
instance = sdma_v4_4_2_irq_id_to_seq(adev, entry->client_id);
15281534

15291535
/* Client id gives the SDMA instance in AID. To know the exact SDMA
15301536
* instance, interrupt entry gives the node id which corresponds to the AID instance.
@@ -1567,7 +1573,7 @@ static int sdma_v4_4_2_process_ras_data_cb(struct amdgpu_device *adev,
15671573
if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA))
15681574
goto out;
15691575

1570-
instance = sdma_v4_4_2_irq_id_to_seq(entry->client_id);
1576+
instance = sdma_v4_4_2_irq_id_to_seq(adev, entry->client_id);
15711577
if (instance < 0)
15721578
goto out;
15731579

@@ -1586,7 +1592,7 @@ static int sdma_v4_4_2_process_illegal_inst_irq(struct amdgpu_device *adev,
15861592

15871593
DRM_ERROR("Illegal instruction in SDMA command stream\n");
15881594

1589-
instance = sdma_v4_4_2_irq_id_to_seq(entry->client_id);
1595+
instance = sdma_v4_4_2_irq_id_to_seq(adev, entry->client_id);
15901596
if (instance < 0)
15911597
return 0;
15921598

@@ -1620,7 +1626,7 @@ static int sdma_v4_4_2_print_iv_entry(struct amdgpu_device *adev,
16201626
struct amdgpu_task_info *task_info;
16211627
u64 addr;
16221628

1623-
instance = sdma_v4_4_2_irq_id_to_seq(entry->client_id);
1629+
instance = sdma_v4_4_2_irq_id_to_seq(adev, entry->client_id);
16241630
if (instance < 0 || instance >= adev->sdma.num_instances) {
16251631
dev_err(adev->dev, "sdma instance invalid %d\n", instance);
16261632
return -EINVAL;

0 commit comments

Comments
 (0)