Skip to contentSkip to conversation

drm/amdgpu: fix prt_warning not balance

PATCH NAK Chunming Zhou 4 participants 11 messages Jan 3, 2019 9 messages not in the archive

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

PATCH 1/2 drm/amdgpu: fix prt_warning not balance

use DRM_WARN instead of dev_warn

Change-Id I8ede212b5f99b1f77d0bd7499da3d85873403c7a
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 +++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 +++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +5 -1
index 9fc3296592fe..dae73f6768c2 100644
@@ -450,9 +450,13 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 	u32 tmp;
 
 	if (enable && !adev->gmc.prt_warning) {
-		dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+		DRM_WARN("Disabling VM faults because of PRT request!\n");
 		adev->gmc.prt_warning = true;
 	}
+	if (!enable && adev->gmc.prt_warning) {
+		DRM_WARN("Re-enabling VM faults!\n");
+		adev->gmc.prt_warning = false;
+	}
 
 	tmp = RREG32(mmVM_PRT_CNTL);
 	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 -1
index 761dcfb2fec0..5bdeb358bfb5 100644
@@ -544,9 +544,13 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
 	uint32_t tmp;
 
 	if (enable && !adev->gmc.prt_warning) {
-		dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+		DRM_WARN("Disabling VM faults because of PRT request!\n");
 		adev->gmc.prt_warning = true;
 	}
+	if (!enable && adev->gmc.prt_warning) {
+		DRM_WARN("Re-enabling VM faults!\n");
+		adev->gmc.prt_warning = false;
+	}
 
 	tmp = RREG32(mmVM_PRT_CNTL);
 	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +5 -1
index 1ad7e6b8ed1d..5150ab614eaa 100644
@@ -770,9 +770,13 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
 	u32 tmp;
 
 	if (enable && !adev->gmc.prt_warning) {
-		dev_warn(adev->dev, "Disabling VM faults because of PRT request!\n");
+		DRM_WARN("Disabling VM faults because of PRT request!\n");
 		adev->gmc.prt_warning = true;
 	}
+	if (!enable && adev->gmc.prt_warning) {
+		DRM_WARN("Re-enabling VM faults!\n");
+		adev->gmc.prt_warning = false;
+	}
 
 	tmp = RREG32(mmVM_PRT_CNTL);
 	tmp = REG_SET_FIELD(tmp, VM_PRT_CNTL,
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/2 drm/amdgpu: disable vm fault irq during prt accessed

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client.
GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
 3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +6 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
 	} else {
 		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
 		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
@@ -495,6 +499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	}
 }
 
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +6 -0
index 5bdeb358bfb5..a4d6d219f4e8 100644
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
 	} else {
 		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
 		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
@@ -591,6 +595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	}
 }
 
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +6 -0
index 5150ab614eaa..eea2eb7fc2f5 100644
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
 	} else {
 		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
 		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
@@ -817,6 +821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
 		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
 		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	}
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 82 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client.
GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
  3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +6 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
  	} else {
  		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
  		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
@@ -495,6 +499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
  	}
  }
 
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +6 -0
index 5bdeb358bfb5..a4d6d219f4e8 100644
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
  	} else {
  		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
  		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);
@@ -591,6 +595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
  	}
  }
 
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
index 5150ab614eaa..eea2eb7fc2f5 100644
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+		/* Note: when vm_debug enabled, vm fault from SDMAx accessing
+		 * PRT range is normal. */
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
  	} else {
  		WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
  		WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable) · line 828

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -0
@@ -817,6 +821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
  		WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
  		WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+		if (!amdgpu_vm_debug)
+			amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
  	}
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a280480a-5240-caf8-b271-b825ec3e9e04-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

need dummy page for that?

-David

Quoted 95 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 85 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client.
GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84

---

  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
  3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -0
@@ -495,6 +499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device 
 *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }

  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -0
@@ -591,6 +595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device 
 *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }

  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -0
@@ -817,6 +821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct amdgpu_device · line 828

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -0
 *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): cb1aaade-32b3-62c0-8e03-a507fecad3fa-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 112 lines

need dummy page for that?

-David

Quoted 95 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 85 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client.
GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84

---

  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
  3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -0
@@ -495,6 +499,8 @@ static void gmc_v6_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }

  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 -0
@@ -591,6 +595,8 @@ static void gmc_v7_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }

  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct 
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);

          WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -0
@@ -817,6 +821,8 @@ static void gmc_v8_0_set_prt(struct 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct · line 828

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -0
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
       }
   }
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): ec38e3ce-f13d-5903-9748-49d3c0a7f088-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#10 lore raw

RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 11 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

-David

Quoted 108 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 47 lines

need dummy page for that?

-David

Quoted 40 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 28 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84

---

  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
  3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

495,6

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

591,6

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 23 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

817,6

Quoted 15 lines
Quoted 10 lines
Quoted 9 lines

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB148061DE6690D83F8B2924CCB48D0-rpdhrqHFk05d5T0P7IZT9AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#12 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Am 03.01.19 um 10:23 schrieb Zhou, David(ChunMing):

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 5 lines
Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

Well we can't, that's why this approach won't work (It was just a theoretically thought).

What we could do on pre-gmc9 is to use the address of the dummy page and set the valid and readonly bit.

This way SDMA reads would return zero (as expected), but writes would still cause a fault.

Not sure if that helps, but it at least mitigates the problem.

Christian.

Quoted 131 lines

-David

Quoted 128 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 47 lines

need dummy page for that?

-David

Quoted 40 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 28 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
   3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c static void gmc_v6_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

495,6

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c static void gmc_v7_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

591,6

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

817,6

Quoted 13 lines
Quoted 9 lines
Quoted 9 lines

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw

RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

In reply to a message not in the archive

Seems we don't need two page table, we just map every prt range to dummy page, any problem?

-David

Quoted 146 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Thursday, January 03, 2019 5:23 PM
To: Koenig, Christian <[email protected]>; amd- [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 9 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

-David

Quoted 52 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 48 lines

need dummy page for that?

-David

Quoted 41 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 29 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84

---

  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
  3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

495,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device

*adev,

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0); +        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

591,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device

*adev,

Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0); +        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {

          WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff); WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

817,6

Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device

*adev,

Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0); +        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); }
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1480CBF51D500CF4138B2C2FB48D0-rpdhrqHFk05d5T0P7IZT9AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#15 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Writes are then not ignored and garbage the dummy page.

Christian.

Am 03.01.19 um 10:46 schrieb Zhou, David(ChunMing):

Quoted 158 lines

Seems we don't need two page table, we just map every prt range to dummy page, any problem?

-David

Quoted 154 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Thursday, January 03, 2019 5:23 PM
To: Koenig, Christian <[email protected]>; amd- [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 9 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

-David

Quoted 51 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 48 lines

need dummy page for that?

-David

Quoted 41 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 29 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
   3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c static void gmc_v6_0_set_prt(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

495,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device

*adev,

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c static void gmc_v7_0_set_prt(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

591,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device

*adev,

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff); @@ -

817,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device

*adev,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 728bcbe4-4ae6-6acd-58fe-41eba8d4ccd4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#17 lore raw

RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Doesn't gpu check PTE prt bit first and then access va range?

Even wrte to dummy page, seem there still is no problem, we don't care that content at all.

-David

Quoted 156 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:54 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Writes are then not ignored and garbage the dummy page.

Christian.

Am 03.01.19 um 10:46 schrieb Zhou, David(ChunMing):

Quoted 1 line

Seems we don't need two page table, we just map every prt range to

dummy page, any problem?

Quoted 80 lines

-David

Quoted 77 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Thursday, January 03, 2019 5:23 PM
To: Koenig, Christian <[email protected]>; amd- [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 9 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

-David

Quoted 50 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 47 lines

need dummy page for that?

-David

Quoted 40 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 28 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
   3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c static void gmc_v6_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 21 lines
Quoted 21 lines
Quoted 2 lines

495,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device

*adev,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c static void gmc_v7_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 22 lines
Quoted 22 lines
Quoted 2 lines

591,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device

*adev,

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
           WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
           WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
+        /* Note: when vm_debug enabled, vm fault from SDMAx
Quoted 27 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -0
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
       } else {
           WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
           WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 19 lines
Quoted 15 lines
Quoted 2 lines

817,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device

*adev,

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1480DD808CF80FFDBE36E73EB48D0-rpdhrqHFk05d5T0P7IZT9AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#19 lore raw

Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

On pre-gmc9 PTE prt bit is completely ignored.

Check the OpenGL spec for PRTs, writes needs to be ignored and reads must return zero.

Not sure about Vulkan and OpenCL.

Christian.

Am 03.01.19 um 10:56 schrieb Zhou, David(ChunMing):

Quoted 188 lines

Doesn't gpu check PTE prt bit first and then access va range?

Even wrte to dummy page, seem there still is no problem, we don't care that content at all.

-David

Quoted 182 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:54 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Writes are then not ignored and garbage the dummy page.

Christian.

Am 03.01.19 um 10:46 schrieb Zhou, David(ChunMing):

Quoted 1 line

Seems we don't need two page table, we just map every prt range to

dummy page, any problem?

Quoted 79 lines

-David

Quoted 77 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Thursday, January 03, 2019 5:23 PM
To: Koenig, Christian <[email protected]>; amd- [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 9 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 03, 2019 5:05 PM
To: Zhou, David(ChunMing) <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: disable vm fault irq during prt accessed

Quoted 4 lines

Yes, exactly.

Problem is that we then probably need two page tables. One for the CB/TC and one for the SDMA.

But when setup page table, how can we know the client is CB/TC or SDMA?

-David

Quoted 50 lines

Christian.

Am 03.01.19 um 10:02 schrieb zhoucm1:

Quoted 47 lines

need dummy page for that?

-David

Quoted 40 lines · Christian König

NAK, the problem is not the interrupt.

E.g. causing faults by accessing unmapped pages with the SDMA can still crash the MC.

The key point is that SDMA can't work with PRT tiles on pre-gmc9 and we need to forbid access on the application side.

Regards,
Christian.

Am 03.01.19 um 09:54 schrieb Chunming Zhou:

Quoted 28 lines

For pre-gmc9, UMD can only access unmapped PRT tile from CB/TC without firing VM fault. Kernel would still receive the VM fault interrupt and output the error message if SDMA is the mc_client. GMC9 don't need the same since it handle the PRT in different way. We cannot just skip message for SDMA, as Christian pointed, VM fault could crash mc block, so we disable vm fault irq during prt range is accesed.
The nagative is normal vm fault could be ignored during that peroid without enabling vm_debug kernel parameter.

Change-Id Ic3c62393768eca90e3e45eaf81e7f26f2e91de84
---
    drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++++++
    drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 6 ++++++
    drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 6 ++++++
    3 files changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -0
index dae73f6768c2..175c4b319559 100644
@@ -486,6 +486,10 @@ static void gmc_v6_0_set_prt(struct
 amdgpu_device *adev, bool enable)
            WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c static void gmc_v6_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
        } else {
            WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
            WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 21 lines
Quoted 21 lines
Quoted 2 lines

495,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+499,8 @@ static void gmc_v6_0_set_prt(struct amdgpu_device

*adev,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 5bdeb358bfb5..a4d6d219f4e8 100644

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -0
@@ -582,6 +582,10 @@ static void gmc_v7_0_set_prt(struct
 amdgpu_device *adev, bool enable)
            WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c static void gmc_v7_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
        } else {
            WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
            WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 21 lines
Quoted 21 lines
Quoted 2 lines

591,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+595,8 @@ static void gmc_v7_0_set_prt(struct amdgpu_device

*adev,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 5150ab614eaa..eea2eb7fc2f5 100644

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +0 -0
@@ -808,6 +808,10 @@ static void gmc_v8_0_set_prt(struct
 amdgpu_device *adev, bool enable)
            WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, high);
            WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, high);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c static void gmc_v8_0_set_prt(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +5 -0
+        /* Note: when vm_debug enabled, vm fault from SDMAx
+accessing
+         * PRT range is normal. */
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
        } else {
            WREG32(mmVM_PRT_APERTURE0_LOW_ADDR, 0xfffffff);
            WREG32(mmVM_PRT_APERTURE1_LOW_ADDR, 0xfffffff);

@@ -

Quoted 19 lines
Quoted 15 lines
Quoted 2 lines

817,6

Quoted 1 line
Quoted 1 line
Quoted 1 line

+821,8 @@ static void gmc_v8_0_set_prt(struct amdgpu_device

*adev,

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines

bool enable)
          WREG32(mmVM_PRT_APERTURE1_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE2_HIGH_ADDR, 0x0); WREG32(mmVM_PRT_APERTURE3_HIGH_ADDR, 0x0);
+        if (!amdgpu_vm_debug)
+            amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
      }
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx