Skip to contentSkip to conversation

agp/intel: Fix cache control for Sandybridge

RFC PATCH In review Zhenyu Wang 2 participants 2 messages May 27, 2010 – May 28, 2010

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

RFC PATCH 1/1 agp/intel: Fix cache control for Sandybridge

Sandybridge GTT has new cache control bits in PTE, which controls graphics page cache in LLC or LLC/MLC. This one trys to setup a new gtt driver for Gen6, and using new type mask function for that. And this sets cache control to always LLC only by default on Gen6.

As this gtt memory cache control bits are internal to intel hw, so I don't add new flags in agp_backend.h but add them only in intel_gtt.c. So drm/i915 stuff needs to know these new flags too.

---
 drivers/char/agp/intel-agp.c    |    4 +-
 drivers/char/agp/intel-agp.h    |    6 +++
 drivers/char/agp/intel-gtt.c    |   96 +++++++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_drv.h |   10 ++++
 4 files changed, 106 insertions(+), 10 deletions(-)
drivers/char/agp/intel-agp.c +2 -2
index d836a71..5bbc7be 100644
@@ -816,9 +816,9 @@ static const struct intel_driver_description {
 	{ PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG,
 	    "HD Graphics", NULL, &intel_i965_driver },
 	{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG,
-	    "Sandybridge", NULL, &intel_i965_driver },
+	    "Sandybridge", NULL, &intel_gen6_driver },
 	{ PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG,
-	    "Sandybridge", NULL, &intel_i965_driver },
+	    "Sandybridge", NULL, &intel_gen6_driver },
 	{ 0, 0, NULL, NULL, NULL }
 };
 
drivers/char/agp/intel-agp.h +6 -0
index 2547465..c05e3e5 100644
@@ -60,6 +60,12 @@
 #define I810_PTE_LOCAL		0x00000002
 #define I810_PTE_VALID		0x00000001
 #define I830_PTE_SYSTEM_CACHED  0x00000006
+/* GT PTE cache control fields */
+#define GEN6_PTE_UNCACHED	0x00000002
+#define GEN6_PTE_LLC		0x00000004
+#define GEN6_PTE_LLC_MLC	0x00000006
+#define GEN6_PTE_GFDT		0x00000008
+
 #define I810_SMRAM_MISCC	0x70
 #define I810_GFX_MEM_WIN_SIZE	0x00010000
 #define I810_GFX_MEM_WIN_32M	0x00010000
drivers/char/agp/intel-gtt.c +88 -8

129 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drv.h +10 -0
index 7f797ef..9710b4b 100644
@@ -1170,4 +1170,14 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 
 #define PRIMARY_RINGBUFFER_SIZE         (128*1024)
 
+/* Intel specific agp_memory type for Gen6,
+ * must be same as in intel_gtt.c */
+
+/* GEN6: memory only cached in LLC. As default we always make
+ * memory cached in LLC. */
+#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
+#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
+/* GFDT bit flag */
+#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
+
 #endif
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 10 lines · Zhenyu Wang

Sandybridge GTT has new cache control bits in PTE, which controls graphics page cache in LLC or LLC/MLC. This one trys to setup a new gtt driver for Gen6, and using new type mask function for that. And this sets cache control to always LLC only by default on Gen6.

As this gtt memory cache control bits are internal to intel hw, so I don't add new flags in agp_backend.h but add them only in intel_gtt.c. So drm/i915 stuff needs to know these new flags too.

Please put shared definitions in a header file instead of having two .c files define them. intel-agp.h maybe? You might need to move the IS_*, but they should probably be bitfields in device info like they are in i915 now, and then the macros could go away.

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