Skip to contentSkip to conversation

drm:amdgpu: enable IH ring1 for IH v7.0

PATCH In review Sunil Khatri 3 participants 4 messages Jul 3, 2024 – Jul 4, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm:amdgpu: enable IH ring1 for IH v7.0

We need IH ring1 for handling the pagefault interrupts which over flow in default ring for specific usecases.

Enable ring1 allows software to redirect high interrupts to ring1 from default IH ring.

---
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +9 -2
index aa6235dd4f2b..548b3c63a765 100644
@@ -546,8 +546,15 @@ static int ih_v7_0_sw_init(void *handle)
 	adev->irq.ih.use_doorbell = true;
 	adev->irq.ih.doorbell_index = adev->doorbell_index.ih << 1;
 
-	adev->irq.ih1.ring_size = 0;
-	adev->irq.ih2.ring_size = 0;
+	if (!(adev->flags & AMD_IS_APU)) {
+		r = amdgpu_ih_ring_init(adev, &adev->irq.ih1, IH_RING_SIZE,
+					use_bus_addr);
+		if (r)
+			return r;
+
+		adev->irq.ih1.use_doorbell = true;
+		adev->irq.ih1.doorbell_index = (adev->doorbell_index.ih + 1) << 1;
+	}
 
 	/* initialize ih control register offset */
 	ih_v7_0_init_register_offset(adev);
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: enable redirection of irq's for IH v7.0

Enable redirection of irq for pagefaults for specific clients to avoid overflow without dropping interrupts.

So here we redirect the interrupts to another IH ring i.e ring1 where only these interrupts are processed.

---
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +15 -0
index 548b3c63a765..6852081fcff2 100644
@@ -346,6 +346,21 @@ static int ih_v7_0_irq_init(struct amdgpu_device *adev)
 			    DELAY, 3);
 	WREG32_SOC15(OSSSYS, 0, regIH_MSI_STORM_CTRL, tmp);
 
+	/* Redirect the interrupts to IH RB1 for dGPU */
+	if (adev->irq.ih1.ring_size) {
+		tmp = RREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_INDEX);
+		tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_INDEX, INDEX, 0);
+		WREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_INDEX, tmp);
+
+		tmp = RREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_DATA);
+		tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA, CLIENT_ID, 0xa);
+		tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA, SOURCE_ID, 0x0);
+		tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA,
+				    SOURCE_ID_MATCH_ENABLE, 0x1);
+
+		WREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_DATA, tmp);
+	}
+
 	pci_set_master(adev->pdev);
 
 	/* enable interrupts */
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH v1 2/2] drm/amdgpu: enable redirection of irq's for IH v7.0

Series is:

Quoted 41 lines · Sunil Khatri

Enable redirection of irq for pagefaults for specific clients to avoid overflow without dropping interrupts.

So here we redirect the interrupts to another IH ring i.e ring1 where only these interrupts are processed.

---
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +15 -1
index 548b3c63a765..6852081fcff2 100644
@@ -346,6 +346,21 @@ static int ih_v7_0_irq_init(struct amdgpu_device *adev)
                            DELAY, 3);
        WREG32_SOC15(OSSSYS, 0, regIH_MSI_STORM_CTRL, tmp);
 
+       /* Redirect the interrupts to IH RB1 for dGPU */
+       if (adev->irq.ih1.ring_size) {
+               tmp = RREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_INDEX);
+               tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_INDEX, INDEX, 0);
+               WREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_INDEX, tmp);
+
+               tmp = RREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_DATA);
+               tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA, CLIENT_ID, 0xa);
+               tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA, SOURCE_ID, 0x0);
+               tmp = REG_SET_FIELD(tmp, IH_RING1_CLIENT_CFG_DATA,
+                                   SOURCE_ID_MATCH_ENABLE, 0x1);
+
+               WREG32_SOC15(OSSSYS, 0, regIH_RING1_CLIENT_CFG_DATA, tmp);
+       }
+
        pci_set_master(adev->pdev);
 
        /* enable interrupts */
--

2.34.1

Reviewed-by on v1 1/2
#3 lore raw
In reply to Sunil Khatri

Am 03.07.24 um 19:49 schrieb Sunil Khatri:

Quoted 9 lines

We need IH ring1 for handling the pagefault interrupts which over flow in default ring for specific usecases.

Enable ring1 allows software to redirect high interrupts to ring1 from default IH ring.

Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/ih_v7_0.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +9 -2
index aa6235dd4f2b..548b3c63a765 100644
@@ -546,8 +546,15 @@ static int ih_v7_0_sw_init(void *handle)
  	adev->irq.ih.use_doorbell = true;
  	adev->irq.ih.doorbell_index = adev->doorbell_index.ih << 1;
 
-	adev->irq.ih1.ring_size = 0;
-	adev->irq.ih2.ring_size = 0;
+	if (!(adev->flags & AMD_IS_APU)) {
+		r = amdgpu_ih_ring_init(adev, &adev->irq.ih1, IH_RING_SIZE,
+					use_bus_addr);
+		if (r)
+			return r;
+
+		adev->irq.ih1.use_doorbell = true;
+		adev->irq.ih1.doorbell_index = (adev->doorbell_index.ih + 1) << 1;
+	}
 
  	/* initialize ih control register offset */
  	ih_v7_0_init_register_offset(adev);