Skip to contentSkip to conversation

intel: query for LLC support

PATCH In review Eugeni Dodonov 3 participants 5 messages Jan 17, 2012 DRM drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel: query for LLC support

This adds support for querying the kernel about the LLC support in the hardware.

In case the ioctl fails, we assume that it is present on GEN6 and GEN7.

---
 include/drm/i915_drm.h   |    1 +
 intel/intel_bufmgr_gem.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
include/drm/i915_drm.h +1 -0
index de72496..af3ce17 100644
@@ -287,6 +287,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
 #define I915_PARAM_HAS_GEN7_SOL_RESET	 16
+#define I915_PARAM_HAS_LLC		 17
 
 typedef struct drm_i915_getparam {
 	int param;
intel/intel_bufmgr_gem.c +12 -0
index 2b4fab1..9bbf10d 100644
@@ -107,6 +107,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int has_bsd : 1;
 	unsigned int has_blt : 1;
 	unsigned int has_relaxed_fencing : 1;
+	unsigned int has_llc : 1;
 	unsigned int bo_reuse : 1;
 	bool fenced_relocs;
 } drm_intel_bufmgr_gem;
@@ -2352,6 +2353,17 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	bufmgr_gem->has_relaxed_fencing = ret == 0;
 
+	gp.param = I915_PARAM_HAS_LLC;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	if (ret == -EINVAL) {
+		/* Kernel does not supports HAS_LLC query, fallback to GPU
+		 * generation detection and assume that we have LLC on GEN6/7
+		 */
+		bufmgr_gem->has_llc = (IS_GEN6(bufmgr_gem->pci_device) |
+				IS_GEN7(bufmgr_gem->pci_device));
+	}
+	bufmgr_gem->has_llc = ret == 0;
+
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
 		gp.value = &bufmgr_gem->available_fences;
Signature · 1 line
1.7.8.3
#1 lore raw

PATCH 1/1 intel: query for LLC support

This adds support for querying the kernel about the LLC support in the hardware.

In case the ioctl fails, we assume that it is present on GEN6 and GEN7.

---
 include/drm/i915_drm.h   |    1 +
 intel/intel_bufmgr_gem.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
include/drm/i915_drm.h +1 -0
index de72496..af3ce17 100644
@@ -287,6 +287,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
 #define I915_PARAM_HAS_GEN7_SOL_RESET	 16
+#define I915_PARAM_HAS_LLC		 17
 
 typedef struct drm_i915_getparam {
 	int param;
intel/intel_bufmgr_gem.c +12 -0
index 2b4fab1..9bbf10d 100644
@@ -107,6 +107,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int has_bsd : 1;
 	unsigned int has_blt : 1;
 	unsigned int has_relaxed_fencing : 1;
+	unsigned int has_llc : 1;
 	unsigned int bo_reuse : 1;
 	bool fenced_relocs;
 } drm_intel_bufmgr_gem;
@@ -2352,6 +2353,17 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	bufmgr_gem->has_relaxed_fencing = ret == 0;
 
+	gp.param = I915_PARAM_HAS_LLC;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	if (ret == -EINVAL) {
+		/* Kernel does not supports HAS_LLC query, fallback to GPU
+		 * generation detection and assume that we have LLC on GEN6/7
+		 */
+		bufmgr_gem->has_llc = (IS_GEN6(bufmgr_gem->pci_device) |
+				IS_GEN7(bufmgr_gem->pci_device));
+	}
+	bufmgr_gem->has_llc = ret == 0;
+
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
 		gp.value = &bufmgr_gem->available_fences;
Signature · 1 line
1.7.8.3
#2 lore raw

PATCH 1/1 intel: query for LLC support

This adds support for querying the kernel about the LLC support in the hardware.

In case the ioctl fails, we assume that it is present on GEN6 and GEN7.

v2: fix the return code checking

---
 include/drm/i915_drm.h   |    1 +
 intel/intel_bufmgr_gem.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
include/drm/i915_drm.h +1 -0
index de72496..af3ce17 100644
@@ -287,6 +287,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_EXEC_CONSTANTS	 14
 #define I915_PARAM_HAS_RELAXED_DELTA	 15
 #define I915_PARAM_HAS_GEN7_SOL_RESET	 16
+#define I915_PARAM_HAS_LLC		 17
 
 typedef struct drm_i915_getparam {
 	int param;
intel/intel_bufmgr_gem.c +12 -0
index 2b4fab1..f5db3d9 100644
@@ -107,6 +107,7 @@ typedef struct _drm_intel_bufmgr_gem {
 	unsigned int has_bsd : 1;
 	unsigned int has_blt : 1;
 	unsigned int has_relaxed_fencing : 1;
+	unsigned int has_llc : 1;
 	unsigned int bo_reuse : 1;
 	bool fenced_relocs;
 } drm_intel_bufmgr_gem;
@@ -2352,6 +2353,17 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
 	bufmgr_gem->has_relaxed_fencing = ret == 0;
 
+	gp.param = I915_PARAM_HAS_LLC;
+	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
+	if (ret == -EINVAL) {
+		/* Kernel does not supports HAS_LLC query, fallback to GPU
+		 * generation detection and assume that we have LLC on GEN6/7
+		 */
+		bufmgr_gem->has_llc = (IS_GEN6(bufmgr_gem->pci_device) |
+				IS_GEN7(bufmgr_gem->pci_device));
+	} else
+		bufmgr_gem->has_llc = ret == 0;
+
 	if (bufmgr_gem->gen < 4) {
 		gp.param = I915_PARAM_NUM_FENCES_AVAIL;
 		gp.value = &bufmgr_gem->available_fences;
Signature · 1 line
1.7.8.3
#4 lore raw
In reply to Eugeni Dodonov
Quoted 7 lines · Eugeni Dodonov

This adds support for querying the kernel about the LLC support in the hardware.

In case the ioctl fails, we assume that it is present on GEN6 and GEN7.

Please ignore this and consider the next one - this was sent with the wrong S-o-b.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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