Skip to contentSkip to conversation

drm/i915/hsw: Set correct Haswell PTE encodings.

PATCH In review Ben Widawsky 6 participants 30 messages Jul 4, 2013 – Jul 16, 2013

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

PATCH 1/5 drm/i915/hsw: Set correct Haswell PTE encodings.

From: Ben Widawsky <[email protected]>

The cacheability controls have changed, and the bits have been rearranged in general.

v2: Remove comments for snb/ivb cache leves, that's a separate change.

v3: Resolve conflicts due to patch series reordering.

v4: Rebased on top of Kenneth Graunke's ->pet_encode refactoring.

v5: Removed eLLC bits for separate patch.

In the internal repository this was:

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +11 -2
index 66929ea..42262d0 100644
@@ -33,6 +33,7 @@
 
 /* PPGTT stuff */
 #define GEN6_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0xff0))
+#define HSW_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0x7f0))
 
 #define GEN6_PDE_VALID			(1 << 0)
 /* gen6+ has bit 11-4 for physical addr bit 39-32 */
@@ -44,6 +45,14 @@
 #define GEN6_PTE_CACHE_LLC		(2 << 1)
 #define GEN6_PTE_CACHE_LLC_MLC		(3 << 1)
 #define GEN6_PTE_ADDR_ENCODE(addr)	GEN6_GTT_ADDR_ENCODE(addr)
+#define HSW_PTE_ADDR_ENCODE(addr)	HSW_GTT_ADDR_ENCODE(addr)
+
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
+					 (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)
 
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
 				      enum i915_cache_level level)
@@ -92,10 +101,10 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
 				     enum i915_cache_level level)
 {
 	gen6_gtt_pte_t pte = GEN6_PTE_VALID;
-	pte |= GEN6_PTE_ADDR_ENCODE(addr);
+	pte |= HSW_PTE_ADDR_ENCODE(addr);
 
 	if (level != I915_CACHE_NONE)
-		pte |= GEN6_PTE_CACHE_LLC;
+		pte |= HSW_WB_LLC_AGE0;
 
 	return pte;
 }
Signature · 1 line
1.8.3
#1 lore raw

PATCH 2/5 drm/i915: Define some of the eLLC magic

The EDRAM present register isn't really defined in the docs. It just says check to see if it's set to 1. So I haven't defined the 1 value not knowing what it actually means.

---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
index 4200c32..edea2cb 100644
@@ -4153,8 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
-	if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
-		I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
+	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
 
 	if (HAS_PCH_NOP(dev)) {
 		u32 temp = I915_READ(GEN7_MSG_CTL);
drivers/gpu/drm/i915/i915_reg.h +4 -0
index 9b51be8..a2553ed 100644
@@ -4469,6 +4469,10 @@
 #define  GT_FIFO_FREE_ENTRIES			0x120008
 #define    GT_FIFO_NUM_RESERVED_ENTRIES		20
 
+#define  HSW_IDICR				0x9008
+#define    IDIHASHMSK(x)			(((x) & 0x3f) << 16)
+#define  HSW_EDRAM_PRESENT			0x120010
+
 #define GEN6_UCGCTL1				0x9400
 # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE		(1 << 5)
 # define GEN6_CSUNIT_CLOCK_GATE_DISABLE			(1 << 7)
Signature · 1 line
1.8.3
#2 lore raw

Re: [PATCH 2/5] drm/i915: Define some of the eLLC magic

Quoted 15 lines · Ben Widawsky

The EDRAM present register isn't really defined in the docs. It just says check to see if it's set to 1. So I haven't defined the 1 value not knowing what it actually means.

---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 4200c32..edea2cb 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_init_hw(struct drm_device *dev) · line 4157

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -4153,8 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
        if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
                return -EIO;
 
-       if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
-               I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
+       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+               I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));

even though you said doc doesn't define this register please fwd me the doc... or please explain what is that
sorry about that, but as I said I'm without access :(

Quoted 21 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
        if (HAS_PCH_NOP(dev)) {
                u32 temp = I915_READ(GEN7_MSG_CTL);
drivers/gpu/drm/i915/i915_reg.h +4 -1
index 9b51be8..a2553ed 100644
@@ -4469,6 +4469,10 @@
 #define  GT_FIFO_FREE_ENTRIES                  0x120008
 #define    GT_FIFO_NUM_RESERVED_ENTRIES                20
 
+#define  HSW_IDICR                             0x9008
+#define    IDIHASHMSK(x)                       (((x) & 0x3f) << 16)
+#define  HSW_EDRAM_PRESENT                     0x120010
+
 #define GEN6_UCGCTL1                           0x9400
 # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE               (1 << 5)
 # define GEN6_CSUNIT_CLOCK_GATE_DISABLE                        (1 << 7)
--

1.8.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

#3 lore raw

Re: [PATCH 2/5] drm/i915: Define some of the eLLC magic

Quoted 19 lines · Rodrigo Vivi
Quoted 18 lines · Ben Widawsky

The EDRAM present register isn't really defined in the docs. It just says check to see if it's set to 1. So I haven't defined the 1 value not knowing what it actually means.

---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 4200c32..edea2cb 100644
@@ -4153,8 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
        if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
                return -EIO;
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem.c i915_gem_init_hw(struct drm_device *dev) · line 4157

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +2 -2
-       if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
-               I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
+       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+               I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));

even though you said doc doesn't define this register please fwd me the doc... or please explain what is that
sorry about that, but as I said I'm without access :(

It's just in the normal bspec. When I said the doc doesn't define it, what I meant is, the values 0x120010, and 1 have no symbolic names in the docs. It simply says we should read the thing. If you need me to clarify more, maybe we can discuss it on IRC later.

Quoted 32 lines
Quoted 22 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
        if (HAS_PCH_NOP(dev)) {
                u32 temp = I915_READ(GEN7_MSG_CTL);
drivers/gpu/drm/i915/i915_reg.h +4 -1
index 9b51be8..a2553ed 100644
@@ -4469,6 +4469,10 @@
 #define  GT_FIFO_FREE_ENTRIES                  0x120008
 #define    GT_FIFO_NUM_RESERVED_ENTRIES                20
 
+#define  HSW_IDICR                             0x9008
+#define    IDIHASHMSK(x)                       (((x) & 0x3f) << 16)
+#define  HSW_EDRAM_PRESENT                     0x120010
+
 #define GEN6_UCGCTL1                           0x9400
 # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE               (1 << 5)
 # define GEN6_CSUNIT_CLOCK_GATE_DISABLE                        (1 << 7)
--

1.8.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#4 lore raw

PATCH 3/5 drm/i915: store eLLC size

In reply to Ben Widawsky

The eLLC cannot be determined by PCIID because as far as we know, even machines supporting eLLC may not have it enabled, or fused off or whatever. It's possible this isn't actually true, and at that point we can switch to a DEV_INFO flag instead.

I've defined everything where the docs are clear, and left the rest as magic.

---
 drivers/gpu/drm/i915/i915_drv.h | 3 +++
 drivers/gpu/drm/i915/i915_gem.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index fd0f589..c6de881 100644
@@ -1187,6 +1187,9 @@ typedef struct drm_i915_private {
 	/* Old dri1 support infrastructure, beware the dragons ya fools entering
 	 * here! */
 	struct i915_dri1_state dri1;
+
+	/* Cannot be determined by PCIID. You must always read a register. */
+	size_t ellc_size;
 } drm_i915_private_t;
 
 /* Iterate over initialised rings */
drivers/gpu/drm/i915/i915_gem.c +8 -1
index edea2cb..2df993d 100644
@@ -4153,8 +4153,15 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
-	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
 		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
+		/* The docs do not explain exactly how the calculation can be
+		 * made. It is somewhat guessable, but for now, it's always
+		 * 128MB.
+		 */
+		dev_priv->ellc_size = 128;
+		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
+	}
 
 	if (HAS_PCH_NOP(dev)) {
 		u32 temp = I915_READ(GEN7_MSG_CTL);
Signature · 1 line
1.8.3
#5 lore raw

PATCH 1/1 drm/i915: Do eLLC detection earlier

We need it before we set the pte_encode function pointers, which happens really early, in gtt_init.

The problem with just doing the normal sequence earlier is we don't have the ability to use forcewake until after the pte functions have been set up.

Since all solutions are somewhat ugly (barring rewriting all the init ordering), I've opted to do the detection really early, and the enabling later - since the register to detect doesn't require forcewake.

---
 drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++++
 drivers/gpu/drm/i915/i915_gem.c |  9 +--------
 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +10 -0
index 0e22142..7eda8ab 100644
@@ -1524,6 +1524,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	intel_early_sanitize_regs(dev);
 
+	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+		/* The docs do not explain exactly how the calculation can be
+		 * made. It is somewhat guessable, but for now, it's always
+		 * 128MB.
+		 * NB: We can't write IDICR yet because we do not have gt funcs
+		 * set up */
+		dev_priv->ellc_size = 128;
+		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
+	}
+
 	ret = i915_gem_gtt_init(dev);
 	if (ret)
 		goto put_bridge;
drivers/gpu/drm/i915/i915_gem.c +1 -8
index 2df993d..f9834f2 100644
@@ -4153,15 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
-	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+	if (dev_priv->ellc_size)
 		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
-		/* The docs do not explain exactly how the calculation can be
-		 * made. It is somewhat guessable, but for now, it's always
-		 * 128MB.
-		 */
-		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
-	}
 
 	if (HAS_PCH_NOP(dev)) {
 		u32 temp = I915_READ(GEN7_MSG_CTL);
Signature · 1 line
1.8.3
Reviewed-by on v1 1/1
#6 lore raw

Re: [PATCH 3.5/5] drm/i915: Do eLLC detection earlier

to be honest I didn't understood the other idea with forcewake, but this way is fine for me, so:

Quoted 66 lines · Ben Widawsky

We need it before we set the pte_encode function pointers, which happens really early, in gtt_init.

The problem with just doing the normal sequence earlier is we don't have the ability to use forcewake until after the pte functions have been set up.

Since all solutions are somewhat ugly (barring rewriting all the init ordering), I've opted to do the detection really early, and the enabling later - since the register to detect doesn't require forcewake.

---
 drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++++
 drivers/gpu/drm/i915/i915_gem.c |  9 +--------
 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +10 -0
index 0e22142..7eda8ab 100644
@@ -1524,6 +1524,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
        intel_early_sanitize_regs(dev);
 
+       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+               /* The docs do not explain exactly how the calculation can be
+                * made. It is somewhat guessable, but for now, it's always
+                * 128MB.
+                * NB: We can't write IDICR yet because we do not have gt funcs
+                * set up */
+               dev_priv->ellc_size = 128;
+               DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
+       }
+
        ret = i915_gem_gtt_init(dev);
        if (ret)
                goto put_bridge;
drivers/gpu/drm/i915/i915_gem.c +1 -9
index 2df993d..f9834f2 100644
@@ -4153,15 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
        if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
                return -EIO;
 
-       if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+       if (dev_priv->ellc_size)
                I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
-               /* The docs do not explain exactly how the calculation can be
-                * made. It is somewhat guessable, but for now, it's always
-                * 128MB.
-                */
-               dev_priv->ellc_size = 128;
-               DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
-       }
 
        if (HAS_PCH_NOP(dev)) {
                u32 temp = I915_READ(GEN7_MSG_CTL);
--

1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#7 lore raw

Re: [PATCH 3.5/5] drm/i915: Do eLLC detection earlier

In reply to Ben Widawsky
Quoted 7 lines · Ben Widawsky

We need it before we set the pte_encode function pointers, which happens really early, in gtt_init.

The problem with just doing the normal sequence earlier is we don't have the ability to use forcewake until after the pte functions have been set up.

Quoted 5 lines

Since all solutions are somewhat ugly (barring rewriting all the init ordering), I've opted to do the detection really early, and the enabling later - since the register to detect doesn't require forcewake.

Looking at patch 3.5 here and patch 3 I think those should be squashed together. Ok if I do that when applying?
-Daniel

Quoted 54 lines
---
 drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++++
 drivers/gpu/drm/i915/i915_gem.c |  9 +--------
 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +10 -0
index 0e22142..7eda8ab 100644
@@ -1524,6 +1524,16 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	intel_early_sanitize_regs(dev);
 
+	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+		/* The docs do not explain exactly how the calculation can be
+		 * made. It is somewhat guessable, but for now, it's always
+		 * 128MB.
+		 * NB: We can't write IDICR yet because we do not have gt funcs
+		 * set up */
+		dev_priv->ellc_size = 128;
+		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
+	}
+
 	ret = i915_gem_gtt_init(dev);
 	if (ret)
 		goto put_bridge;
drivers/gpu/drm/i915/i915_gem.c +1 -8
index 2df993d..f9834f2 100644
@@ -4153,15 +4153,8 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
-	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
+	if (dev_priv->ellc_size)
 		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
-		/* The docs do not explain exactly how the calculation can be
-		 * made. It is somewhat guessable, but for now, it's always
-		 * 128MB.
-		 */
-		dev_priv->ellc_size = 128;
-		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
-	}
 
 	if (HAS_PCH_NOP(dev)) {
 		u32 temp = I915_READ(GEN7_MSG_CTL);
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#8 lore raw

Re: [PATCH 3.5/5] drm/i915: Do eLLC detection earlier

Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Ben Widawsky

We need it before we set the pte_encode function pointers, which happens really early, in gtt_init.

The problem with just doing the normal sequence earlier is we don't have the ability to use forcewake until after the pte functions have been set up.

Since all solutions are somewhat ugly (barring rewriting all the init ordering), I've opted to do the detection really early, and the enabling later - since the register to detect doesn't require forcewake.

Quoted 5 lines
Quoted 1 line

Looking at patch 3.5 here and patch 3 I think those should be squashed together. Ok if I do that when applying?
-Daniel

Of course.

[snip]

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#9 lore raw

Re: [PATCH 3/5] drm/i915: store eLLC size

In reply to Ben Widawsky
Quoted 19 lines · Ben Widawsky

The eLLC cannot be determined by PCIID because as far as we know, even machines supporting eLLC may not have it enabled, or fused off or whatever. It's possible this isn't actually true, and at that point we can switch to a DEV_INFO flag instead.

I've defined everything where the docs are clear, and left the rest as magic.

---
 drivers/gpu/drm/i915/i915_drv.h | 3 +++
 drivers/gpu/drm/i915/i915_gem.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index fd0f589..c6de881 100644

drivers/gpu/drm/i915/i915_drv.h typedef struct drm_i915_private { · line 1192

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -1187,6 +1187,9 @@ typedef struct drm_i915_private {
 	/* Old dri1 support infrastructure, beware the dragons ya fools entering
 	 * here! */
 	struct i915_dri1_state dri1;
+
+	/* Cannot be determined by PCIID. You must always read a register. */
+	size_t ellc_size;

Thou shalt not put useful stuff next to the dri/ums dungeons! Really, we've tried a bit to clean up the giant mess that is our driver private structure, I expect people to look for more than 5 secs for a suitable place for this ;-)

Fixed while applying.
-Daniel

Quoted 31 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 } drm_i915_private_t;
 
 /* Iterate over initialised rings */
drivers/gpu/drm/i915/i915_gem.c +8 -1
index edea2cb..2df993d 100644
@@ -4153,8 +4153,15 @@ i915_gem_init_hw(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
 		return -EIO;
 
-	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1))
+	if (IS_HASWELL(dev) && (I915_READ(HSW_EDRAM_PRESENT) == 1)) {
 		I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
+		/* The docs do not explain exactly how the calculation can be
+		 * made. It is somewhat guessable, but for now, it's always
+		 * 128MB.
+		 */
+		dev_priv->ellc_size = 128;
+		DRM_INFO("Found %zuMB of eLLC\n", dev_priv->ellc_size);
+	}
 
 	if (HAS_PCH_NOP(dev)) {
 		u32 temp = I915_READ(GEN7_MSG_CTL);
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#10 lore raw

PATCH 4/5 drm/i915: Use eLLC/LLC by default when available

In reply to Ben Widawsky

DRI clients really should be using MOCS to get fine grained streaming cache controls. With that note, I *hope* that this patch doesn't improve performance overwhelmingly, because if it does - it means there is a problem elsewhere.

In any case, the kernel, and old userspace should get some benefit from this, so let's do it. eLLC is always a good default, and really not using it is the special case for MOCS.

References: http://www.intel.com/newsroom/kits/restricted/ha$well!/pdfs/4th_Gen_Intel_Core_PressBriefing_5-29.pdf (page 57)

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +16 -1
index 42262d0..0ff8073 100644
@@ -53,6 +53,7 @@
 #define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
 					 (((bits) & 0x8) << (11 - 3)))
 #define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)
+#define HSW_WB_ELLC_LLC_AGE0		HSW_CACHEABILITY_CONTROL(0xb)
 
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
 				      enum i915_cache_level level)
@@ -109,6 +110,18 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
 	return pte;
 }
 
+static gen6_gtt_pte_t iris_pte_encode(dma_addr_t addr,
+				      enum i915_cache_level level)
+{
+	gen6_gtt_pte_t pte = GEN6_PTE_VALID;
+	pte |= HSW_PTE_ADDR_ENCODE(addr);
+
+	if (level != I915_CACHE_NONE)
+		pte |= HSW_WB_ELLC_LLC_AGE0;
+
+	return pte;
+}
+
 static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt)
 {
 	struct drm_i915_private *dev_priv = ppgtt->dev->dev_private;
@@ -860,7 +873,9 @@ int i915_gem_gtt_init(struct drm_device *dev)
 	} else {
 		gtt->gtt_probe = gen6_gmch_probe;
 		gtt->gtt_remove = gen6_gmch_remove;
-		if (IS_HASWELL(dev))
+		if (IS_HASWELL(dev) && dev_priv->ellc_size)
+			gtt->pte_encode = iris_pte_encode;
+		else if (IS_HASWELL(dev))
 			gtt->pte_encode = hsw_pte_encode;
 		else if (IS_VALLEYVIEW(dev))
 			gtt->pte_encode = byt_pte_encode;
Signature · 1 line
1.8.3
#11 lore raw

Re: [PATCH 4/5] drm/i915: Use eLLC/LLC by default when available

Quoted 5 lines · Ben Widawsky

DRI clients really should be using MOCS to get fine grained streaming cache controls. With that note, I *hope* that this patch doesn't improve performance overwhelmingly, because if it does - it means there is a problem elsewhere.

Quoted 7 lines

In any case, the kernel, and old userspace should get some benefit from this, so let's do it. eLLC is always a good default, and really not using it is the special case for MOCS.

References: http://www.intel.com/newsroom/kits/restricted/ha$well!/pdfs/4th_Gen_Intel_Core_PressBriefing_5-29.pdf (page 57)

Iris is the marketing name and likely to stick around for a bit (like HD Graphics), I'd vote to use the codename for this thing here, i.e. crw. -Daniel

Quoted 53 lines
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +16 -1
index 42262d0..0ff8073 100644
@@ -53,6 +53,7 @@
 #define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
 					 (((bits) & 0x8) << (11 - 3)))
 #define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)
+#define HSW_WB_ELLC_LLC_AGE0		HSW_CACHEABILITY_CONTROL(0xb)
 
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
 				      enum i915_cache_level level)
@@ -109,6 +110,18 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
 	return pte;
 }
 
+static gen6_gtt_pte_t iris_pte_encode(dma_addr_t addr,
+				      enum i915_cache_level level)
+{
+	gen6_gtt_pte_t pte = GEN6_PTE_VALID;
+	pte |= HSW_PTE_ADDR_ENCODE(addr);
+
+	if (level != I915_CACHE_NONE)
+		pte |= HSW_WB_ELLC_LLC_AGE0;
+
+	return pte;
+}
+
 static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt)
 {
 	struct drm_i915_private *dev_priv = ppgtt->dev->dev_private;
@@ -860,7 +873,9 @@ int i915_gem_gtt_init(struct drm_device *dev)
 	} else {
 		gtt->gtt_probe = gen6_gmch_probe;
 		gtt->gtt_remove = gen6_gmch_remove;
-		if (IS_HASWELL(dev))
+		if (IS_HASWELL(dev) && dev_priv->ellc_size)
+			gtt->pte_encode = iris_pte_encode;
+		else if (IS_HASWELL(dev))
 			gtt->pte_encode = hsw_pte_encode;
 		else if (IS_VALLEYVIEW(dev))
 			gtt->pte_encode = byt_pte_encode;
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#12 lore raw

Re: [PATCH 4/5] drm/i915: Use eLLC/LLC by default when available

Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Ben Widawsky

DRI clients really should be using MOCS to get fine grained streaming cache controls. With that note, I *hope* that this patch doesn't improve performance overwhelmingly, because if it does - it means there is a problem elsewhere.

In any case, the kernel, and old userspace should get some benefit from this, so let's do it. eLLC is always a good default, and really not using it is the special case for MOCS.

Quoted 8 lines
Quoted 3 lines

References: http://www.intel.com/newsroom/kits/restricted/ha$well!/pdfs/4th_Gen_Intel_Core_PressBriefing_5-29.pdf (page 57)

Iris is the marketing name and likely to stick around for a bit (like HD Graphics), I'd vote to use the codename for this thing here, i.e. crw. -Daniel

I think we've agreed on IRC to leave this as is?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Reviewed-by
#13 lore raw

Re: [PATCH 4/5] drm/i915: Use eLLC/LLC by default when available

I don't have a strong opinion on iris x crw and you know that I like to split different things in different functions, however in this case I think either iris or crw are still hsw
so if it is possible to get dev_priv->ellc_size inside hsw_pte_encode somehow I in favor of not creating another function for iris... otherwise, fell free to use:

Quoted 26 lines · Ben Widawsky
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Ben Widawsky

DRI clients really should be using MOCS to get fine grained streaming cache controls. With that note, I *hope* that this patch doesn't improve performance overwhelmingly, because if it does - it means there is a problem elsewhere.

In any case, the kernel, and old userspace should get some benefit from this, so let's do it. eLLC is always a good default, and really not using it is the special case for MOCS.

Quoted 8 lines
Quoted 3 lines

References: http://www.intel.com/newsroom/kits/restricted/ha$well!/pdfs/4th_Gen_Intel_Core_PressBriefing_5-29.pdf (page 57)

Iris is the marketing name and likely to stick around for a bit (like HD Graphics), I'd vote to use the codename for this thing here, i.e. crw. -Daniel

I think we've agreed on IRC to leave this as is?
--
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#14 lore raw

PATCH 5/5 drm/i915: debugfs entries for [e]LLC

In reply to Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +14 -0
index 3e36756..b75d0a6 100644
@@ -1941,6 +1941,19 @@ static int i915_dpio_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int i915_llc(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* Size calculation for LLC is a bit of a pain. Ignore for now. */
+	seq_printf(m, "LLC: %s\n", yesno(HAS_LLC(dev)));
+	seq_printf(m, "eLLC: %zuMB\n", dev_priv->ellc_size);
+
+	return 0;
+}
+
 static int
 i915_wedged_get(void *data, u64 *val)
 {
@@ -2370,6 +2383,7 @@ static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_swizzle_info", i915_swizzle_info, 0},
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_dpio", i915_dpio_info, 0},
+	{"i915_llc", i915_llc, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 1 line
1.8.3
#15 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 7 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

Quoted 43 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +14 -0
index 3e36756..b75d0a6 100644
@@ -1941,6 +1941,19 @@ static int i915_dpio_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int i915_llc(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* Size calculation for LLC is a bit of a pain. Ignore for now. */
+	seq_printf(m, "LLC: %s\n", yesno(HAS_LLC(dev)));
+	seq_printf(m, "eLLC: %zuMB\n", dev_priv->ellc_size);
+
+	return 0;
+}
+
 static int
 i915_wedged_get(void *data, u64 *val)
 {
@@ -2370,6 +2383,7 @@ static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_swizzle_info", i915_swizzle_info, 0},
 	{"i915_ppgtt_info", i915_ppgtt_info, 0},
 	{"i915_dpio", i915_dpio_info, 0},
+	{"i915_llc", i915_llc, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#16 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Quoted 9 lines
Quoted 4 lines

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

And I assume drop debugfs?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#17 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 8 lines · Ben Widawsky
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

And I assume drop debugfs?

Yeah, I guess the DRM_INFO message in dmesg should be good enough then. For userspace's convenience we could even look into exposing the LLC size with a getparam.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#18 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 15 lines · Daniel Vetter
Quoted 14 lines · Ben Widawsky
Quoted 13 lines · Daniel Vetter
Quoted 7 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

Quoted 7 lines
Quoted 1 line

And I assume drop debugfs?

Yeah, I guess the DRM_INFO message in dmesg should be good enough then. For userspace's convenience we could even look into exposing the LLC size with a getparam.
-Daniel

I would like to do this since we have easy access to cpuid. I know Chad really wants it. If you'll accept the patch, I'll write it.

Quoted 4 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#19 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 18 lines · Ben Widawsky
Quoted 17 lines · Daniel Vetter
Quoted 15 lines · Ben Widawsky
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Quoted 9 lines
Quoted 4 lines

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

And I assume drop debugfs?

Quoted 8 lines
Quoted 5 lines

Yeah, I guess the DRM_INFO message in dmesg should be good enough then. For userspace's convenience we could even look into exposing the LLC size with a getparam.
-Daniel

I would like to do this since we have easy access to cpuid. I know Chad really wants it. If you'll accept the patch, I'll write it.

I really want to know the cache sizes.

Actually, I didn't expect the kernel to do this for me. So, I've prototyped a patch for Mesa to probe the cache sizes with CPUID. If the kernel does that for Mesa, then I can likely drop my Mesa patch.

#20 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

Quoted 25 lines · Chad Versace
Quoted 24 lines · Ben Widawsky
Quoted 22 lines · Daniel Vetter
Quoted 8 lines · Ben Widawsky
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

I think a getparam for eLLC would be neat, so that usespace can use it to tune working set sizes.
-Daniel

And I assume drop debugfs?

Yeah, I guess the DRM_INFO message in dmesg should be good enough then. For userspace's convenience we could even look into exposing the LLC size with a getparam.
-Daniel

Quoted 9 lines
Quoted 2 lines

I would like to do this since we have easy access to cpuid. I know Chad really wants it. If you'll accept the patch, I'll write it.

I really want to know the cache sizes.

Actually, I didn't expect the kernel to do this for me. So, I've prototyped a patch for Mesa to probe the cache sizes with CPUID. If the kernel does that for Mesa, then I can likely drop my Mesa patch.

I think if we need to do the work, it makes sense to do it in the kernel since the other components can easily take advantage of it. I can even shoehorn it in to the existing LLC param.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#21 lore raw

PATCH 6/6 drm/i915: Add a param for eLLC size

In reply to Ben Widawsky
---
 drivers/gpu/drm/i915/i915_dma.c | 3 +++
 include/uapi/drm/i915_drm.h     | 1 +
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 7eda8ab..435fc4a 100644
@@ -1000,6 +1000,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_HANDLE_LUT:
 		value = 1;
 		break;
+	case I915_PARAM_ELLC_SIZE:
+		value = dev_priv->ellc_size;
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
include/uapi/drm/i915_drm.h +1 -0
index 923ed7f..56bb327 100644
@@ -310,6 +310,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_PINNED_BATCHES	 24
 #define I915_PARAM_HAS_EXEC_NO_RELOC	 25
 #define I915_PARAM_HAS_EXEC_HANDLE_LUT   26
+#define I915_PARAM_ELLC_SIZE		 27
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 1 line
1.8.3
#22 lore raw

Re: [PATCH 6/6] drm/i915: Add a param for eLLC size

Quoted 1 line · Ben Widawsky

Ok, I've slurped the entire series into dinq, with the exception of this patch - I'm waiting for the jury to figure out whether we can do this in userspace with cpuid or not. If not I think the commit message should be amended with that information and then I'll merge it. -Daniel

Quoted 38 lines
---
 drivers/gpu/drm/i915/i915_dma.c | 3 +++
 include/uapi/drm/i915_drm.h     | 1 +
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +3 -0
index 7eda8ab..435fc4a 100644
@@ -1000,6 +1000,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_HANDLE_LUT:
 		value = 1;
 		break;
+	case I915_PARAM_ELLC_SIZE:
+		value = dev_priv->ellc_size;
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
include/uapi/drm/i915_drm.h +1 -0
index 923ed7f..56bb327 100644
@@ -310,6 +310,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_PINNED_BATCHES	 24
 #define I915_PARAM_HAS_EXEC_NO_RELOC	 25
 #define I915_PARAM_HAS_EXEC_HANDLE_LUT   26
+#define I915_PARAM_ELLC_SIZE		 27
 
 typedef struct drm_i915_getparam {
 	int param;
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 5/5
#23 lore raw

Re: [PATCH 5/5] drm/i915: debugfs entries for [e]LLC

In reply to Ben Widawsky

I actually tested it too here on my ult... 0Mb ellc as expected... unfortunately I don't have any cristallwell to test it for real ;)

Quoted 50 lines · Ben Widawsky

To make users life a little easier figuring out what they have on their system.

Ideally, I'd really like to report LLC size, but it turned out to be a bit of a pain. Maybe I'll revisit it in the future.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +14 -1
index 3e36756..b75d0a6 100644
@@ -1941,6 +1941,19 @@ static int i915_dpio_info(struct seq_file *m, void *data)
        return 0;
 }
 
+static int i915_llc(struct seq_file *m, void *data)
+{
+       struct drm_info_node *node = (struct drm_info_node *) m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
+       /* Size calculation for LLC is a bit of a pain. Ignore for now. */
+       seq_printf(m, "LLC: %s\n", yesno(HAS_LLC(dev)));
+       seq_printf(m, "eLLC: %zuMB\n", dev_priv->ellc_size);
+
+       return 0;
+}
+
 static int
 i915_wedged_get(void *data, u64 *val)
 {
@@ -2370,6 +2383,7 @@ static struct drm_info_list i915_debugfs_list[] = {
        {"i915_swizzle_info", i915_swizzle_info, 0},
        {"i915_ppgtt_info", i915_ppgtt_info, 0},
        {"i915_dpio", i915_dpio_info, 0},
+       {"i915_llc", i915_llc, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#24 lore raw
In reply to Ben Widawsky

Hi Ben,

sorry for taking so long to look at your patches.
Well, since I changed my TI password I'm not able to see bspec anymore, so I couldn't verify many things that I'm going to ask many questions.
If the answer is on spec or any other doc please send me in pvt!

Quoted 10 lines · Ben Widawsky

From: Ben Widawsky <[email protected]>

The cacheability controls have changed, and the bits have been rearranged in general.

v2: Remove comments for snb/ivb cache leves, that's a separate change.

v3: Resolve conflicts due to patch series reordering.

v4: Rebased on top of Kenneth Graunke's ->pet_encode refactoring.

pet like in leper?! :P
just kidding never mind.

Quoted 16 lines

v5: Removed eLLC bits for separate patch.

In the internal repository this was:

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 66929ea..42262d0 100644

drivers/gpu/drm/i915/i915_gem_gtt.c line 36

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -0
@@ -33,6 +33,7 @@
 
 /* PPGTT stuff */
 #define GEN6_GTT_ADDR_ENCODE(addr)     ((addr) | (((addr) >> 28) & 0xff0))
+#define HSW_GTT_ADDR_ENCODE(addr)      ((addr) | (((addr) >> 28) & 0x7f0))

why not masking bit 10 anymore?

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
 #define GEN6_PDE_VALID                 (1 << 0)
 /* gen6+ has bit 11-4 for physical addr bit 39-32 */
@@ -44,6 +45,14 @@
 #define GEN6_PTE_CACHE_LLC             (2 << 1)

drivers/gpu/drm/i915/i915_gem_gtt.c line 55

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -0
 #define GEN6_PTE_CACHE_LLC_MLC         (3 << 1)
 #define GEN6_PTE_ADDR_ENCODE(addr)     GEN6_GTT_ADDR_ENCODE(addr)
+#define HSW_PTE_ADDR_ENCODE(addr)      HSW_GTT_ADDR_ENCODE(addr)
+
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits) ((((bits) & 0x7) << 1) | \
+                                        (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0                        HSW_CACHEABILITY_CONTROL(0x3)

where did you get that? and are you really using that in any other patch?

Quoted 19 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -3
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
                                      enum i915_cache_level level)
@@ -92,10 +101,10 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
                                     enum i915_cache_level level)
 {
        gen6_gtt_pte_t pte = GEN6_PTE_VALID;
-       pte |= GEN6_PTE_ADDR_ENCODE(addr);
+       pte |= HSW_PTE_ADDR_ENCODE(addr);
 
        if (level != I915_CACHE_NONE)
-               pte |= GEN6_PTE_CACHE_LLC;
+               pte |= HSW_WB_LLC_AGE0;
 
        return pte;
 }
--

1.8.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

#25 lore raw
Quoted 7 lines · Rodrigo Vivi

Hi Ben,

sorry for taking so long to look at your patches.
Well, since I changed my TI password I'm not able to see bspec anymore, so I couldn't verify many things that I'm going to ask many questions.
If the answer is on spec or any other doc please send me in pvt!

I think since we haven't yet published HSW docs, it's pretty fair of you to ask, and for me to address it publicly.

Quoted 8 lines · Ben Widawsky
Quoted 5 lines

From: Ben Widawsky <[email protected]>

The cacheability controls have changed, and the bits have been rearranged in general.

Quoted 8 lines
Quoted 5 lines

v2: Remove comments for snb/ivb cache leves, that's a separate change.

v3: Resolve conflicts due to patch series reordering.

v4: Rebased on top of Kenneth Graunke's ->pet_encode refactoring.

pet like in leper?! :P
just kidding never mind.

heh, fixedi locally, thanks.

Quoted 18 lines
Quoted 18 lines

v5: Removed eLLC bits for separate patch.

In the internal repository this was:

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 66929ea..42262d0 100644
@@ -33,6 +33,7 @@
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_gem_gtt.c line 36

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -0
 /* PPGTT stuff */
 #define GEN6_GTT_ADDR_ENCODE(addr)     ((addr) | (((addr) >> 28) & 0xff0))
+#define HSW_GTT_ADDR_ENCODE(addr)      ((addr) | (((addr) >> 28) & 0x7f0))

why not masking bit 10 anymore?

You're asking the wrong guy... The HW just supports one less address bit. The bit gets used for some of the cacheability flags later in the series.

Quoted 18 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
 #define GEN6_PDE_VALID                 (1 << 0)
 /* gen6+ has bit 11-4 for physical addr bit 39-32 */
@@ -44,6 +45,14 @@
 #define GEN6_PTE_CACHE_LLC             (2 << 1)

drivers/gpu/drm/i915/i915_gem_gtt.c line 55

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -0
 #define GEN6_PTE_CACHE_LLC_MLC         (3 << 1)
 #define GEN6_PTE_ADDR_ENCODE(addr)     GEN6_GTT_ADDR_ENCODE(addr)
+#define HSW_PTE_ADDR_ENCODE(addr)      HSW_GTT_ADDR_ENCODE(addr)
+
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits) ((((bits) & 0x7) << 1) | \
+                                        (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0                        HSW_CACHEABILITY_CONTROL(0x3)

where did you get that? and are you really using that in any other patch?

It's in a table in the spec. Unfortunately there is no formula defined in the spec, but I came up with this one (actually my original formula had a bug, fixed by Ken).

Not sure what you mean by, "using that in any other patch." I'm not sure why is that relevant, it's used below.

Quoted 30 lines
Quoted 20 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -3
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
                                      enum i915_cache_level level)
@@ -92,10 +101,10 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
                                     enum i915_cache_level level)
 {
        gen6_gtt_pte_t pte = GEN6_PTE_VALID;
-       pte |= GEN6_PTE_ADDR_ENCODE(addr);
+       pte |= HSW_PTE_ADDR_ENCODE(addr);
 
        if (level != I915_CACHE_NONE)
-               pte |= GEN6_PTE_CACHE_LLC;
+               pte |= HSW_WB_LLC_AGE0;
 
        return pte;
 }
--

1.8.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Reviewed-by on v1 1/5
#26 lore raw
In reply to Ben Widawsky
Quoted 11 lines · Ben Widawsky

From: Ben Widawsky <[email protected]>

The cacheability controls have changed, and the bits have been rearranged in general.

v2: Remove comments for snb/ivb cache leves, that's a separate change.

v3: Resolve conflicts due to patch series reordering.

v4: Rebased on top of Kenneth Graunke's ->pet_encode refactoring.

Quoted 7 lines

v5: Removed eLLC bits for separate patch.

In the internal repository this was:

---

Signature · 1 line
Damien
Quoted 50 lines
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +11 -2
index 66929ea..42262d0 100644
@@ -33,6 +33,7 @@
 
 /* PPGTT stuff */
 #define GEN6_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0xff0))
+#define HSW_GTT_ADDR_ENCODE(addr)	((addr) | (((addr) >> 28) & 0x7f0))
 
 #define GEN6_PDE_VALID			(1 << 0)
 /* gen6+ has bit 11-4 for physical addr bit 39-32 */
@@ -44,6 +45,14 @@
 #define GEN6_PTE_CACHE_LLC		(2 << 1)
 #define GEN6_PTE_CACHE_LLC_MLC		(3 << 1)
 #define GEN6_PTE_ADDR_ENCODE(addr)	GEN6_GTT_ADDR_ENCODE(addr)
+#define HSW_PTE_ADDR_ENCODE(addr)	HSW_GTT_ADDR_ENCODE(addr)
+
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
+					 (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)
 
 static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr,
 				      enum i915_cache_level level)
@@ -92,10 +101,10 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
 				     enum i915_cache_level level)
 {
 	gen6_gtt_pte_t pte = GEN6_PTE_VALID;
-	pte |= GEN6_PTE_ADDR_ENCODE(addr);
+	pte |= HSW_PTE_ADDR_ENCODE(addr);
 
 	if (level != I915_CACHE_NONE)
-		pte |= GEN6_PTE_CACHE_LLC;
+		pte |= HSW_WB_LLC_AGE0;
 
 	return pte;
 }
Signature · 6 lines
1.8.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#27 lore raw
In reply to Ben Widawsky

drivers/gpu/drm/i915/i915_gem_gtt.c line 55

Quoted 6 lines · Ben Widawsky
drivers/gpu/drm/i915/i915_gem_gtt.c +6 -0
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
+					 (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)

One small note, an age of '0' means "old" as in it's likely to be evicted before buffers aged 3, 2 or 1. We don't use any other age yet, so it doesn't matter for now, but might in the future.

Signature · 1 line
Damien
#28 lore raw
Quoted 15 lines · Damien Lespiau

drivers/gpu/drm/i915/i915_gem_gtt.c line 55

Quoted 6 lines · Ben Widawsky
drivers/gpu/drm/i915/i915_gem_gtt.c +6 -0
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
+					 (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)

One small note, an age of '0' means "old" as in it's likely to be evicted before buffers aged 3, 2 or 1. We don't use any other age yet, so it doesn't matter for now, but might in the future.

Signature · 1 line
Damien

FWIW, I have no intention of using any ages in the kernel. We can pick 3 equally well. Maybe in a way off future if or when we decide to have the kernel try to track which cacheability to use for objects, we'll care.

Daniel, would you mind adding a comment on merge? Damien is correct 3 is youngest, 0 is oldest.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#29 lore raw
Quoted 16 lines · Ben Widawsky
Quoted 15 lines · Damien Lespiau

drivers/gpu/drm/i915/i915_gem_gtt.c line 55

Quoted 6 lines · Ben Widawsky
drivers/gpu/drm/i915/i915_gem_gtt.c +6 -0
+/* Cacheability Control is a 4-bit value. The low three bits are stored in *
+ * bits 3:1 of the PTE, while the fourth bit is stored in bit 11 of the PTE.
+ */
+#define HSW_CACHEABILITY_CONTROL(bits)	((((bits) & 0x7) << 1) | \
+					 (((bits) & 0x8) << (11 - 3)))
+#define HSW_WB_LLC_AGE0			HSW_CACHEABILITY_CONTROL(0x3)

One small note, an age of '0' means "old" as in it's likely to be evicted before buffers aged 3, 2 or 1. We don't use any other age yet, so it doesn't matter for now, but might in the future.

Signature · 1 line
Damien
Quoted 6 lines

FWIW, I have no intention of using any ages in the kernel. We can pick 3 equally well. Maybe in a way off future if or when we decide to have the kernel try to track which cacheability to use for objects, we'll care.

Daniel, would you mind adding a comment on merge? Damien is correct 3 is youngest, 0 is oldest.

Done and merged, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch