Skip to contentSkip to conversation

drm/i915: Do not cover all future platforms in TLB invalidation

PATCH Superseded Tvrtko Ursulin 3 participants 7 messages Jan 6, 2023 – Jan 10, 2023

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915: Do not cover all future platforms in TLB invalidation

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
* DG2 needs to be covered too. (Matt)

Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>

---
Matt, does DG1 need to be in the MCR branch or plain Gen12?

---
 drivers/gpu/drm/i915/gt/intel_gt.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt.c +13 -1
index 7eeee5a7cb33..b2556a3d8a3f 100644
@@ -1070,7 +1070,19 @@ static void mmio_invalidate_full(struct intel_gt *gt)
 	unsigned int num = 0;
 	unsigned long flags;
 
-	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+	/*
+	 * New platforms should not be added with catch-all-newer (>=)
+	 * condition so that any later platform added triggers the below warning
+	 * and in turn mandates a human cross-check of whether the invalidation
+	 * flows have compatible semantics.
+	 *
+	 * For instance with the 11.00 -> 12.00 transition three out of five
+	 * respective engine registers were moved to masked type. Then after the
+	 * 12.00 -> 12.50 transition multi cast handling is required too.
+	 */
+
+	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&
+	    GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) {
 		regs = NULL;
 		num = ARRAY_SIZE(xehp_regs);
 	} else if (GRAPHICS_VER(i915) == 12) {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
* DG2 needs to be covered too. (Matt)

Quoted 7 lines
Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>

---
Matt, does DG1 need to be in the MCR branch or plain Gen12?

DG1 should use the same "gen12" branch as TGL/RKL/ADL. Bspec page 66696 is the relevant MMIO table for DG1 and the range containing the TLB invalidation registers is not a multicast/replicated range. The types of engines supported, and the register details for each engine are also the same as TGL/RKL/ADL.

Quoted 19 lines
---
 drivers/gpu/drm/i915/gt/intel_gt.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt.c +6 -1
index 7eeee5a7cb33..b2556a3d8a3f 100644
@@ -1070,7 +1070,19 @@ static void mmio_invalidate_full(struct intel_gt *gt)
 	unsigned int num = 0;
 	unsigned long flags;
 
-	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+	/*
+	 * New platforms should not be added with catch-all-newer (>=)
+	 * condition so that any later platform added triggers the below warning
+	 * and in turn mandates a human cross-check of whether the invalidation
+	 * flows have compatible semantics.
+	 *

drivers/gpu/drm/i915/gt/intel_gt.c static void mmio_invalidate_full(struct intel_gt *gt) · line 1088

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt.c +7 -0
+	 * For instance with the 11.00 -> 12.00 transition three out of five
+	 * respective engine registers were moved to masked type. Then after the
+	 * 12.00 -> 12.50 transition multi cast handling is required too.
+	 */
+
+	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&
+	    GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) {
 		regs = NULL;
 		num = ARRAY_SIZE(xehp_regs);
 	} else if (GRAPHICS_VER(i915) == 12) {

Did you want to switch this one to

        GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
        GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)

so that it won't automatically pick up future 12.xx platforms like PVC, MTL, and whatever else might show up in that category in the future?

Matt

Quoted 3 lines
Signature · 1 line
2.34.1
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#2 lore raw

PATCH v3 1/1 drm/i915: Do not cover all future platforms in TLB invalidation

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
* DG2 needs to be covered too. (Matt)

v3:
* Full version check for Gen12 to avoid catching all future platforms. (Matt)

Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_gt.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +15 -2
index 7eeee5a7cb33..5521fa057aab 100644
@@ -1070,10 +1070,23 @@ static void mmio_invalidate_full(struct intel_gt *gt)
 	unsigned int num = 0;
 	unsigned long flags;
 
-	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+	/*
+	 * New platforms should not be added with catch-all-newer (>=)
+	 * condition so that any later platform added triggers the below warning
+	 * and in turn mandates a human cross-check of whether the invalidation
+	 * flows have compatible semantics.
+	 *
+	 * For instance with the 11.00 -> 12.00 transition three out of five
+	 * respective engine registers were moved to masked type. Then after the
+	 * 12.00 -> 12.50 transition multi cast handling is required too.
+	 */
+
+	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&
+	    GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) {
 		regs = NULL;
 		num = ARRAY_SIZE(xehp_regs);
-	} else if (GRAPHICS_VER(i915) == 12) {
+	} else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
+		   GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {
 		regs = gen12_regs;
 		num = ARRAY_SIZE(gen12_regs);
 	} else if (GRAPHICS_VER(i915) >= 8 && GRAPHICS_VER(i915) <= 11) {
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#3 lore raw
Quoted 12 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
* DG2 needs to be covered too. (Matt)

v3:
* Full version check for Gen12 to avoid catching all future platforms. (Matt)

Quoted 5 lines
Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>
Quoted 37 lines
---
 drivers/gpu/drm/i915/gt/intel_gt.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +15 -2
index 7eeee5a7cb33..5521fa057aab 100644
@@ -1070,10 +1070,23 @@ static void mmio_invalidate_full(struct intel_gt *gt)
 	unsigned int num = 0;
 	unsigned long flags;
 
-	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+	/*
+	 * New platforms should not be added with catch-all-newer (>=)
+	 * condition so that any later platform added triggers the below warning
+	 * and in turn mandates a human cross-check of whether the invalidation
+	 * flows have compatible semantics.
+	 *
+	 * For instance with the 11.00 -> 12.00 transition three out of five
+	 * respective engine registers were moved to masked type. Then after the
+	 * 12.00 -> 12.50 transition multi cast handling is required too.
+	 */
+
+	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&
+	    GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) {
 		regs = NULL;
 		num = ARRAY_SIZE(xehp_regs);
-	} else if (GRAPHICS_VER(i915) == 12) {
+	} else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
+		   GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {
 		regs = gen12_regs;
 		num = ARRAY_SIZE(gen12_regs);
 	} else if (GRAPHICS_VER(i915) >= 8 && GRAPHICS_VER(i915) <= 11) {
Signature · 1 line
2.34.1
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#4 lore raw
In reply to Tvrtko Ursulin
Quoted 38 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
* DG2 needs to be covered too. (Matt)

v3:
* Full version check for Gen12 to avoid catching all future platforms.

    (Matt)
Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_gt.c | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +8 -1
index 7eeee5a7cb33..5521fa057aab 100644
@@ -1070,10 +1070,23 @@ static void mmio_invalidate_full(struct intel_gt *gt)
  	unsigned int num = 0;
  	unsigned long flags;
 
-	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+	/*
+	 * New platforms should not be added with catch-all-newer (>=)
+	 * condition so that any later platform added triggers the below warning
+	 * and in turn mandates a human cross-check of whether the invalidation
+	 * flows have compatible semantics.
+	 *
+	 * For instance with the 11.00 -> 12.00 transition three out of five
+	 * respective engine registers were moved to masked type. Then after the

drivers/gpu/drm/i915/gt/intel_gt.c static void mmio_invalidate_full(struct intel_gt *gt) · line 1089

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt.c +7 -1
+	 * 12.00 -> 12.50 transition multi cast handling is required too.
+	 */
+
+	if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&
+	    GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) {
  		regs = NULL;
  		num = ARRAY_SIZE(xehp_regs);
-	} else if (GRAPHICS_VER(i915) == 12) {
+	} else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
+		   GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {

MTL support is lost? IP_VER(12, 70)

And again it looks for me inconsistent, some unknown platforms are covered, for example 12.54, some not, for example 12.11.

Regards
Andrzej

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_gt.c +0 -0
  		regs = gen12_regs;
  		num = ARRAY_SIZE(gen12_regs);
  	} else if (GRAPHICS_VER(i915) >= 8 && GRAPHICS_VER(i915) <= 11) {
#5 lore raw
Quoted 48 lines · Andrzej Hajda
Quoted 45 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
  * DG2 needs to be covered too. (Matt)

v3:
  * Full version check for Gen12 to avoid catching all future platforms. (Matt)

Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>

---
  drivers/gpu/drm/i915/gt/intel_gt.c | 17 +++++++++++++++--

  1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +3 -1
index 7eeee5a7cb33..5521fa057aab 100644
@@ -1070,10 +1070,23 @@ static void mmio_invalidate_full(struct 
 intel_gt *gt)
       unsigned int num = 0;
       unsigned long flags;
-    if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+    /*
+     * New platforms should not be added with catch-all-newer (>=)
+     * condition so that any later platform added triggers the below 

warning
+     * and in turn mandates a human cross-check of whether the invalidation
+     * flows have compatible semantics.
+     *
+     * For instance with the 11.00 -> 12.00 transition three out of five +     * respective engine registers were moved to masked type. Then after the
+     * 12.00 -> 12.50 transition multi cast handling is required too. +     */
+
+    if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&

Quoted 8 lines
Quoted 6 lines

+        GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) { regs = NULL;
          num = ARRAY_SIZE(xehp_regs);
-    } else if (GRAPHICS_VER(i915) == 12) {
+    } else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) || +           GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {

MTL support is lost? IP_VER(12, 70)

AFAIU Matt says MTL is still incomplete anyway, so that would be added in an explicit patch here.

Quoted 1 line

And again it looks for me inconsistent, some unknown platforms are covered, for example 12.54, some not, for example 12.11.

.11 and .54 as hypotheticals? You suggest this instead:

	if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 50) ||
	    GRAPHICS_VER_FULL(i915) == IP_VER(12, 55)) {
		regs = NULL;
		num = ARRAY_SIZE(xehp_regs);
	} else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) ||
		   GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {
		regs = gen12_regs;
		num = ARRAY_SIZE(gen12_regs);

?

It's fine by me if that covers all currently known platforms.

Regards,

Tvrtko

#6 lore raw
Quoted 60 lines · Tvrtko Ursulin
Quoted 49 lines · Andrzej Hajda
Quoted 46 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Revert to the original explicit approach and document the reasoning behind it.

v2:
  * DG2 needs to be covered too. (Matt)

v3:
  * Full version check for Gen12 to avoid catching all future platforms. (Matt)

Cc Matt Roper <[email protected]>
Cc Balasubramani Vivekanandan <[email protected]>
Cc Andrzej Hajda <[email protected]>

---
  drivers/gpu/drm/i915/gt/intel_gt.c | 17 +++++++++++++++--

  1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.c +3 -1
index 7eeee5a7cb33..5521fa057aab 100644
@@ -1070,10 +1070,23 @@ static void mmio_invalidate_full(struct 
 intel_gt *gt)
       unsigned int num = 0;
       unsigned long flags;
-    if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50)) {
+    /*
+     * New platforms should not be added with catch-all-newer (>=)
+     * condition so that any later platform added triggers the 

below warning
+     * and in turn mandates a human cross-check of whether the invalidation
+     * flows have compatible semantics.
+     *
+     * For instance with the 11.00 -> 12.00 transition three out of five
+     * respective engine registers were moved to masked type. Then after the
+     * 12.00 -> 12.50 transition multi cast handling is required too. +     */
+
+    if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 50) &&

Quoted 8 lines
Quoted 6 lines

+        GRAPHICS_VER_FULL(i915) <= IP_VER(12, 55)) { regs = NULL;
          num = ARRAY_SIZE(xehp_regs);
-    } else if (GRAPHICS_VER(i915) == 12) {
+    } else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) || +           GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) {

MTL support is lost? IP_VER(12, 70)

Quoted 1 line

AFAIU Matt says MTL is still incomplete anyway, so that would be added in an explicit patch here.

I've missed this part, sorry for the noise then :) And as I see PVC is similar story.

Quoted 14 lines
Quoted 2 lines

And again it looks for me inconsistent, some unknown platforms are covered, for example 12.54, some not, for example 12.11.

.11 and .54 as hypotheticals? You suggest this instead:

    if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 50) || GRAPHICS_VER_FULL(i915) == IP_VER(12, 55)) { regs = NULL;
        num = ARRAY_SIZE(xehp_regs);
    } else if (GRAPHICS_VER_FULL(i915) == IP_VER(12, 0) || GRAPHICS_VER_FULL(i915) == IP_VER(12, 10)) { regs = gen12_regs;
        num = ARRAY_SIZE(gen12_regs);

Quoted 1 line

?

For me this perfectly follows the 'strict' approach :)

Quoted 2 lines

It's fine by me if that covers all currently known platforms.

My grep in i915_pci.c agrees.

Regards
Andrzej

Quoted 4 lines

Regards,

Tvrtko