Skip to contentSkip to conversation

drm/i915: expose RCS topology to userspace

PATCH Superseded Lionel Landwerlin 3 participants 13 messages Jan 29, 2018 – Jan 30, 2018

Subsystems (3)

v12 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v12 cover drm/i915: expose RCS topology to userspace

Hi,

There is almost no changes from the previous series. I just put the i915_query_ioctl() declaration in its own header file (like Joonas suggested, if I remember correctly).

Adding a couple of patches for discussion on how to have a userspace query all of the information it needs from the device in one ioctl (Chris' suggestion).

Would be great to land !RFC if people are okay with it.

Cheers,

Lionel Landwerlin (8):
drm/i915: store all subslice masks
drm/i915/debugfs: reuse max slice/subslices already stored in sseu drm/i915/debugfs: add rcs topology entry
drm/i915: add rcs topology to error state
drm/i915: add query uAPI
drm/i915: expose rcs topology through query uAPI
RFC: drm/i915: expose chipset/driver properties through query uAPI
RFC: drm/i915: reuse new chipset/driver query in getparam

 drivers/gpu/drm/i915/Makefile            |   1 +
 drivers/gpu/drm/i915/i915_debugfs.c      |  63 ++++---
 drivers/gpu/drm/i915/i915_drv.c          | 216 +++++++++++----------
 drivers/gpu/drm/i915/i915_gpu_error.c    |   1 +
 drivers/gpu/drm/i915/i915_query.c        | 312 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_query.h        |  38 ++++
 drivers/gpu/drm/i915/intel_device_info.c | 226 +++++++++++++++++-----
 drivers/gpu/drm/i915/intel_device_info.h |  49 ++++-
 drivers/gpu/drm/i915/intel_lrc.c         |   2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  |   2 +-
 include/uapi/drm/i915_drm.h              | 188 +++++++++++++++++++
 11 files changed, 926 insertions(+), 172 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_query.c
 create mode 100644 drivers/gpu/drm/i915/i915_query.h

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

#1 lore raw

PATCH v12 1/8 drm/i915: store all subslice masks

Up to now, subslice mask was assumed to be uniform across slices. But starting with Cannonlake, slices can be asymmetric (for example slice0 has different number of subslices as slice1+). This change stores all subslices masks for all slices rather than having a single mask that applies to all slices.

v2: Rework how we store total numbers in sseu_dev_info (Tvrtko)
Fix CHV eu masks, was reading disabled as enabled (Tvrtko) Readability changes (Tvrtko)
Add EU index helper (Tvrtko)

v3: Turn ALIGN(v, 8) / 8 into DIV_ROUND_UP(v, BITS_PER_BYTE) (Tvrtko)
Reuse sseu_eu_idx() for setting eu_mask on CHV (Tvrtko) Reformat debug prints for subslices (Tvrtko)

v4: Change eu_mask helper into sseu_set_eus() (Tvrtko)

---
 drivers/gpu/drm/i915/i915_debugfs.c      |  25 ++--
 drivers/gpu/drm/i915/i915_drv.c          |   2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 201 +++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_device_info.h |  47 +++++++-
 drivers/gpu/drm/i915/intel_lrc.c         |   2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  |   2 +-
 6 files changed, 216 insertions(+), 63 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +15 -10
index 3849ded354e3..8776e028449d 100644
@@ -4277,7 +4277,7 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
 			continue;
 
 		sseu->slice_mask = BIT(0);
-		sseu->subslice_mask |= BIT(ss);
+		sseu->subslice_mask[0] |= BIT(ss);
 		eu_cnt = ((sig1[ss] & CHV_EU08_PG_ENABLE) ? 0 : 2) +
 			 ((sig1[ss] & CHV_EU19_PG_ENABLE) ? 0 : 2) +
 			 ((sig1[ss] & CHV_EU210_PG_ENABLE) ? 0 : 2) +
@@ -4324,7 +4324,7 @@ static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
 			continue;
 
 		sseu->slice_mask |= BIT(s);
-		sseu->subslice_mask = info->sseu.subslice_mask;
+		sseu->subslice_mask[s] = info->sseu.subslice_mask[s];
 
 		for (ss = 0; ss < ss_max; ss++) {
 			unsigned int eu_cnt;
@@ -4379,8 +4379,8 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
 		sseu->slice_mask |= BIT(s);
 
 		if (IS_GEN9_BC(dev_priv))
-			sseu->subslice_mask =
-				INTEL_INFO(dev_priv)->sseu.subslice_mask;
+			sseu->subslice_mask[s] =
+				INTEL_INFO(dev_priv)->sseu.subslice_mask[s];
 
 		for (ss = 0; ss < ss_max; ss++) {
 			unsigned int eu_cnt;
@@ -4390,7 +4390,7 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
 					/* skip disabled subslice */
 					continue;
 
-				sseu->subslice_mask |= BIT(ss);
+				sseu->subslice_mask[s] |= BIT(ss);
 			}
 
 			eu_cnt = 2 * hweight32(eu_reg[2*s + ss/2] &
@@ -4412,9 +4412,12 @@ static void broadwell_sseu_device_status(struct drm_i915_private *dev_priv,
 	sseu->slice_mask = slice_info & GEN8_LSLICESTAT_MASK;
 
 	if (sseu->slice_mask) {
-		sseu->subslice_mask = INTEL_INFO(dev_priv)->sseu.subslice_mask;
 		sseu->eu_per_subslice =
 				INTEL_INFO(dev_priv)->sseu.eu_per_subslice;
+		for (s = 0; s < fls(sseu->slice_mask); s++) {
+			sseu->subslice_mask[s] =
+				INTEL_INFO(dev_priv)->sseu.subslice_mask[s];
+		}
 		sseu->eu_total = sseu->eu_per_subslice *
 				 sseu_subslice_total(sseu);
 
@@ -4433,6 +4436,7 @@ static void i915_print_sseu_info(struct seq_file *m, bool is_available_info,
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 	const char *type = is_available_info ? "Available" : "Enabled";
+	int s;
 
 	seq_printf(m, "  %s Slice Mask: %04x\n", type,
 		   sseu->slice_mask);
@@ -4440,10 +4444,11 @@ static void i915_print_sseu_info(struct seq_file *m, bool is_available_info,
 		   hweight8(sseu->slice_mask));
 	seq_printf(m, "  %s Subslice Total: %u\n", type,
 		   sseu_subslice_total(sseu));
-	seq_printf(m, "  %s Subslice Mask: %04x\n", type,
-		   sseu->subslice_mask);
-	seq_printf(m, "  %s Subslice Per Slice: %u\n", type,
-		   hweight8(sseu->subslice_mask));
+	for (s = 0; s < fls(sseu->slice_mask); s++) {
+		seq_printf(m, "  %s Slice%i %u subslices, mask=%04x\n", type,
+			   s, hweight8(sseu->subslice_mask[s]),
+			   sseu->subslice_mask[s]);
+	}
 	seq_printf(m, "  %s EU Total: %u\n", type,
 		   sseu->eu_total);
 	seq_printf(m, "  %s EU Per Subslice: %u\n", type,
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 1ec12add34b2..902c5304ef12 100644
@@ -418,7 +418,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 			return -ENODEV;
 		break;
 	case I915_PARAM_SUBSLICE_MASK:
-		value = INTEL_INFO(dev_priv)->sseu.subslice_mask;
+		value = INTEL_INFO(dev_priv)->sseu.subslice_mask[0];
 		if (!value)
 			return -ENODEV;
 		break;
drivers/gpu/drm/i915/intel_device_info.c +154 -47

323 lines not on this page · raw message

drivers/gpu/drm/i915/intel_device_info.h +44 -3

67 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 2fa328d512fc..a41bf2815b32 100644
@@ -2061,7 +2061,7 @@ make_rpcs(struct drm_i915_private *dev_priv)
 
 	if (INTEL_INFO(dev_priv)->sseu.has_subslice_pg) {
 		rpcs |= GEN8_RPCS_SS_CNT_ENABLE;
-		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.subslice_mask) <<
+		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.subslice_mask[0]) <<
 			GEN8_RPCS_SS_CNT_SHIFT;
 		rpcs |= GEN8_RPCS_ENABLE;
 	}
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -1
index c5ff203e42d6..23ae9a957fab 100644
@@ -90,7 +90,7 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 
 #define instdone_subslice_mask(dev_priv__) \
 	(INTEL_GEN(dev_priv__) == 7 ? \
-	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask)
+	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
 	for ((slice__) = 0, (subslice__) = 0; \
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v12 2/8 drm/i915/debugfs: reuse max slice/subslices already stored in sseu

In reply to Lionel Landwerlin

Now that we have that information in topology fields, let's just reused it.

v2: Style tweaks (Tvrtko)

---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +11 -16
index 8776e028449d..ca8c90f20bb7 100644
@@ -4292,11 +4292,11 @@ static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
 				     struct sseu_dev_info *sseu)
 {
 	const struct intel_device_info *info = INTEL_INFO(dev_priv);
-	int s_max = 6, ss_max = 4;
 	int s, ss;
-	u32 s_reg[s_max], eu_reg[2 * s_max], eu_mask[2];
+	u32 s_reg[info->sseu.max_slices];
+	u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
 
-	for (s = 0; s < s_max; s++) {
+	for (s = 0; s < info->sseu.max_slices; s++) {
 		/*
 		 * FIXME: Valid SS Mask respects the spec and read
 		 * only valid bits for those registers, excluding reserverd
@@ -4318,7 +4318,7 @@ static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
 		     GEN9_PGCTL_SSB_EU210_ACK |
 		     GEN9_PGCTL_SSB_EU311_ACK;
 
-	for (s = 0; s < s_max; s++) {
+	for (s = 0; s < info->sseu.max_slices; s++) {
 		if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0)
 			/* skip disabled slice */
 			continue;
@@ -4326,7 +4326,7 @@ static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
 		sseu->slice_mask |= BIT(s);
 		sseu->subslice_mask[s] = info->sseu.subslice_mask[s];
 
-		for (ss = 0; ss < ss_max; ss++) {
+		for (ss = 0; ss < info->sseu.max_subslices; ss++) {
 			unsigned int eu_cnt;
 
 			if (!(s_reg[s] & (GEN9_PGCTL_SS_ACK(ss))))
@@ -4346,17 +4346,12 @@ static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
 static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
 				    struct sseu_dev_info *sseu)
 {
-	int s_max = 3, ss_max = 4;
+	const struct intel_device_info *info = INTEL_INFO(dev_priv);
 	int s, ss;
-	u32 s_reg[s_max], eu_reg[2*s_max], eu_mask[2];
-
-	/* BXT has a single slice and at most 3 subslices. */
-	if (IS_GEN9_LP(dev_priv)) {
-		s_max = 1;
-		ss_max = 3;
-	}
+	u32 s_reg[info->sseu.max_slices];
+	u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
 
-	for (s = 0; s < s_max; s++) {
+	for (s = 0; s < info->sseu.max_slices; s++) {
 		s_reg[s] = I915_READ(GEN9_SLICE_PGCTL_ACK(s));
 		eu_reg[2*s] = I915_READ(GEN9_SS01_EU_PGCTL_ACK(s));
 		eu_reg[2*s + 1] = I915_READ(GEN9_SS23_EU_PGCTL_ACK(s));
@@ -4371,7 +4366,7 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
 		     GEN9_PGCTL_SSB_EU210_ACK |
 		     GEN9_PGCTL_SSB_EU311_ACK;
 
-	for (s = 0; s < s_max; s++) {
+	for (s = 0; s < info->sseu.max_slices; s++) {
 		if ((s_reg[s] & GEN9_PGCTL_SLICE_ACK) == 0)
 			/* skip disabled slice */
 			continue;
@@ -4382,7 +4377,7 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
 			sseu->subslice_mask[s] =
 				INTEL_INFO(dev_priv)->sseu.subslice_mask[s];
 
-		for (ss = 0; ss < ss_max; ss++) {
+		for (ss = 0; ss < info->sseu.max_subslices; ss++) {
 			unsigned int eu_cnt;
 
 			if (IS_GEN9_LP(dev_priv)) {
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v12 3/8 drm/i915/debugfs: add rcs topology entry

In reply to Lionel Landwerlin

While the end goal is to make this information available to userspace through a new ioctl, there is no reason we can't display it in a human readable fashion through debugfs.

slice0: 3 subslice(s) (0x7):

	subslice0: 8 EUs (0xff)
	subslice1: 8 EUs (0xff)
	subslice2: 8 EUs (0xff)
	subslice3: 0 EUs (0x0)
slice1: 3 subslice(s) (0x7):
	subslice0: 8 EUs (0xff)
	subslice1: 8 EUs (0xff)
	subslice2: 8 EUs (0xff)
	subslice3: 0 EUs (0x0)
slice2: 3 subslice(s) (0x7):
	subslice0: 8 EUs (0xff)
	subslice1: 8 EUs (0xff)
	subslice2: 8 EUs (0xff)
	subslice3: 0 EUs (0x0)

v2: Reformat debugfs printing (Tvrtko)
Use the new EU mask helper (Tvrtko)

v3: Move printing code to intel_device_info.c to be shared with error
state (Michal)

---
 drivers/gpu/drm/i915/i915_debugfs.c      | 11 +++++++++++
 drivers/gpu/drm/i915/intel_device_info.c | 25 +++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_device_info.h |  2 ++
 3 files changed, 38 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
index ca8c90f20bb7..dd6be4b3c5b8 100644
@@ -3154,6 +3154,16 @@ static int i915_engine_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_rcs_topology(struct seq_file *m, void *unused)
+{
+	struct drm_i915_private *dev_priv = node_to_i915(m->private);
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	intel_device_info_dump_topology(&INTEL_INFO(dev_priv)->sseu, &p);
+
+	return 0;
+}
+
 static int i915_shrinker_info(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *i915 = node_to_i915(m->private);
@@ -4684,6 +4694,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_dmc_info", i915_dmc_info, 0},
 	{"i915_display_info", i915_display_info, 0},
 	{"i915_engine_info", i915_engine_info, 0},
+	{"i915_rcs_topology", i915_rcs_topology, 0},
 	{"i915_shrinker_info", i915_shrinker_info, 0},
 	{"i915_shared_dplls_info", i915_shared_dplls_info, 0},
 	{"i915_dp_mst_info", i915_dp_mst_info, 0},
drivers/gpu/drm/i915/intel_device_info.c +25 -0
index 80cf72069bae..04d00b73523b 100644
@@ -124,6 +124,31 @@ void intel_device_info_dump(const struct intel_device_info *info,
 	intel_device_info_dump_flags(info, p);
 }
 
+void intel_device_info_dump_topology(const struct sseu_dev_info *sseu,
+				     struct drm_printer *p)
+{
+	int s, ss;
+
+	if (sseu->max_slices == 0) {
+		drm_printf(p, "Unavailable\n");
+		return;
+	}
+
+	for (s = 0; s < sseu->max_slices; s++) {
+		drm_printf(p, "slice%d: %u subslice(s) (0x%hhx):\n",
+			   s, hweight8(sseu->subslice_mask[s]),
+			   sseu->subslice_mask[s]);
+
+		for (ss = 0; ss < sseu->max_subslices; ss++) {
+			u8 enabled_eus = sseu_get_eus(sseu, s, ss);
+
+			drm_printf(p, "\tsubslice%d: %u EUs (0x%hhx)\n",
+				   ss, hweight8(enabled_eus), enabled_eus);
+		}
+	}
+}
+
+
 static u16 compute_eu_total(const struct sseu_dev_info *sseu)
 {
 	u16 i, total = 0;
drivers/gpu/drm/i915/intel_device_info.h +2 -0
index 213db0ca6252..5086adf85824 100644
@@ -222,5 +222,7 @@ void intel_device_info_dump_flags(const struct intel_device_info *info,
 				  struct drm_printer *p);
 void intel_device_info_dump_runtime(const struct intel_device_info *info,
 				    struct drm_printer *p);
+void intel_device_info_dump_topology(const struct sseu_dev_info *sseu,
+				     struct drm_printer *p);
 
 #endif
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH v12 4/8 drm/i915: add rcs topology to error state

In reply to Lionel Landwerlin

This might be useful information for developers looking at an error state.

v2: Place topology towards the end of the error state (Chris)

v3: Reuse common printing code (Michal)

v4: Make this a one-liner (Chris)

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gpu_error.c +1 -0
index a81351d9e3a6..499a346923ec 100644
@@ -578,6 +578,7 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,
 	struct drm_printer p = i915_error_printer(m);
 
 	intel_device_info_dump_flags(info, &p);
+	intel_device_info_dump_topology(&info->sseu, &p);
 }
 
 static void err_print_params(struct drm_i915_error_state_buf *m,
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH v12 5/8 drm/i915: add query uAPI

In reply to Lionel Landwerlin

There are a number of information that are readable from hardware registers and that we would like to make accessible to userspace. One particular example is the topology of the execution units (how are execution units grouped in subslices and slices and also which ones have been fused off for die recovery).

At the moment the GET_PARAM ioctl covers some basic needs, but generally is only able to return a single value for each defined parameter. This is a bit problematic with topology descriptions which are array/maps of available units.

This change introduces a new ioctl that can deal with requests to fill structures of potentially variable lengths. The user is expected fill a query with length fields set at 0 on the first call, the kernel then sets the length fields to the their expected values. A second call to the kernel with length fields at their expected values will trigger a copy of the data to the pointed memory locations.

The scope of this uAPI is only to provide information to userspace, not to allow configuration of the device.

v2: Simplify dispatcher code iteration (Tvrtko)
Tweak uapi drm_i915_query_item structure (Tvrtko)

v3: Rename pad fields into flags (Chris)
Return error on flags field != 0 (Chris)
Only copy length back to userspace in drm_i915_query_item (Chris)

v4: Use array of functions instead of switch (Chris)

v5: More comments in uapi (Tvrtko)
Return query item errors in length field (All)

v6: Tweak uapi comments style to match the coding style (Lionel)

v7: Add i915_query.h (Joonas)

---
 drivers/gpu/drm/i915/Makefile     |  1 +
 drivers/gpu/drm/i915/i915_drv.c   |  2 ++
 drivers/gpu/drm/i915/i915_query.c | 67 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_query.h | 33 +++++++++++++++++++
 include/uapi/drm/i915_drm.h       | 41 ++++++++++++++++++++++++
 5 files changed, 144 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/i915_query.c
 create mode 100644 drivers/gpu/drm/i915/i915_query.h
drivers/gpu/drm/i915/Makefile +1 -0
index 3bddd8a06806..b0415a3e2d59 100644
@@ -69,6 +69,7 @@ i915-y += i915_cmd_parser.o \
 	  i915_gem_timeline.o \
 	  i915_gem_userptr.o \
 	  i915_gemfs.o \
+	  i915_query.o \
 	  i915_trace_points.o \
 	  i915_vma.o \
 	  intel_breadcrumbs.o \
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 902c5304ef12..ebb2e4241cf7 100644
@@ -49,6 +49,7 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "i915_pmu.h"
+#include "i915_query.h"
 #include "i915_vgpu.h"
 #include "intel_drv.h"
 #include "intel_uc.h"
@@ -2835,6 +2836,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(I915_QUERY, i915_query_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),
 };
 
 static struct drm_driver driver = {
drivers/gpu/drm/i915/i915_query.c new file +67 -0

67 lines not on this page · raw message

drivers/gpu/drm/i915/i915_query.h new file +33 -0
new file mode 100644
index 000000000000..4550e8f21459
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _I915_QUERY_H_
+#define _I915_QUERY_H_
+
+struct drm_device;
+struct drm_file;
+
+int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
+
+#endif
include/uapi/drm/i915_drm.h +41 -0

59 lines not on this page · raw message

Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v12 6/8 drm/i915: expose rcs topology through query uAPI

In reply to Lionel Landwerlin

With the introduction of asymmetric slices in CNL, we cannot rely on the previous SUBSLICE_MASK getparam to tell userspace what subslices are available. Here we introduce a more detailed way of querying the Gen's GPU topology that doesn't aggregate numbers.

This is essential for monitoring parts of the GPU with the OA unit, because counters need to be normalized to the number of EUs/subslices/slices. The current aggregated numbers like EU_TOTAL do not gives us sufficient information.

As a bonus we can draw representations of the GPU :

https://imgur.com/a/vuqpa

v2: Rename uapi struct s/_mask/_info/ (Tvrtko)
Report max_slice/subslice/eus_per_subslice rather than strides (Tvrtko) Add uapi macros to read data from *_info structs (Tvrtko)

v3: Use !!(v & DRM_I915_BIT()) for uapi macros instead of custom shifts (Tvrtko)

v4: factorize query item writting (Tvrtko)
tweak uapi struct/define names (Tvrtko)

v5: Replace ALIGN() macro (Chris)

v6: Updated uapi comments (Tvrtko)

    Moved flags != 0 checks into vfuncs (Tvrtko)

v7: Use access_ok() before copying anything, to avoid overflows (Chris)
Switch BUG_ON() to GEM_WARN_ON() (Tvrtko)

v8: Tweak uapi comments style to match the coding style (Lionel)

v9: Fix error in comment about computation of enabled subslice (Tvrtko)

---
 drivers/gpu/drm/i915/i915_query.c | 110 ++++++++++++++++++++++++++++++++++++++
 include/uapi/drm/i915_drm.h       |  71 ++++++++++++++++++++++++
 2 files changed, 181 insertions(+)
drivers/gpu/drm/i915/i915_query.c +110 -0
index 5aa886313cf9..ff87ec8a321a 100644
@@ -25,8 +25,118 @@
 #include "i915_drv.h"
 #include <uapi/drm/i915_drm.h>
 
+static int copy_query_data(struct drm_i915_query_item *query_item,
+			   const void *item_ptr, u32 item_length,
+			   const void *data_ptr, u32 data_length)
+{
+	u32 total_length = item_length + data_length;
+
+	if (GEM_WARN_ON(add_overflows(item_length, data_length)))
+		return -EINVAL;
+
+	if (query_item->length == 0)
+		return total_length;
+
+	if (query_item->length < total_length)
+		return -EINVAL;
+
+	if (!access_ok(VERIFY_WRITE, u64_to_user_ptr(query_item->data_ptr),
+		       total_length))
+		return -EFAULT;
+
+	if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr),
+			   item_ptr, item_length))
+		return -EFAULT;
+
+	if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + item_length),
+			   data_ptr, data_length))
+		return -EFAULT;
+
+	return total_length;
+}
+
+static int query_slice_info(struct drm_i915_private *dev_priv,
+			    struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_slice_info slice_info;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	/*
+	 * If we ever change the internal slice mask data type, we'll need to
+	 * update this function.
+	 */
+	BUILD_BUG_ON(sizeof(u8) != sizeof(sseu->slice_mask));
+
+	memset(&slice_info, 0, sizeof(slice_info));
+	slice_info.max_slices = sseu->max_slices;
+
+	return copy_query_data(query_item, &slice_info, sizeof(slice_info),
+			       &sseu->slice_mask, sizeof(sseu->slice_mask));
+}
+
+static int query_subslice_info(struct drm_i915_private *dev_priv,
+			       struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_subslice_info subslice_info;
+	u32 data_length;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	memset(&subslice_info, 0, sizeof(subslice_info));
+	subslice_info.max_slices = sseu->max_slices;
+	subslice_info.max_subslices = sseu->max_subslices;
+
+	data_length = subslice_info.max_slices *
+		DIV_ROUND_UP(subslice_info.max_subslices,
+			     sizeof(sseu->subslice_mask[0]) * BITS_PER_BYTE);
+
+	return copy_query_data(query_item,
+			       &subslice_info, sizeof(subslice_info),
+			       sseu->subslice_mask, data_length);
+}
+
+static int query_eu_info(struct drm_i915_private *dev_priv,
+			 struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_eu_info eu_info;
+	u32 data_length;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	memset(&eu_info, 0, sizeof(eu_info));
+	eu_info.max_slices = sseu->max_slices;
+	eu_info.max_subslices = sseu->max_subslices;
+	eu_info.max_eus_per_subslice = sseu->max_eus_per_subslice;
+
+	data_length = eu_info.max_slices * eu_info.max_subslices *
+		DIV_ROUND_UP(eu_info.max_eus_per_subslice, BITS_PER_BYTE);
+
+	return copy_query_data(query_item,
+			       &eu_info, sizeof(eu_info),
+			       sseu->eu_mask, data_length);
+}
+
 static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
 					struct drm_i915_query_item *query_item) = {
+	query_slice_info,
+	query_subslice_info,
+	query_eu_info,
 };
 
 int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
include/uapi/drm/i915_drm.h +71 -0

83 lines not on this page · raw message

Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH v12 6/8] drm/i915: expose rcs topology through query uAPI

Quoted 185 lines · Lionel Landwerlin

With the introduction of asymmetric slices in CNL, we cannot rely on the previous SUBSLICE_MASK getparam to tell userspace what subslices are available. Here we introduce a more detailed way of querying the Gen's GPU topology that doesn't aggregate numbers.

This is essential for monitoring parts of the GPU with the OA unit, because counters need to be normalized to the number of EUs/subslices/slices. The current aggregated numbers like EU_TOTAL do not gives us sufficient information.

As a bonus we can draw representations of the GPU :

https://imgur.com/a/vuqpa

v2: Rename uapi struct s/_mask/_info/ (Tvrtko)
Report max_slice/subslice/eus_per_subslice rather than strides (Tvrtko) Add uapi macros to read data from *_info structs (Tvrtko)

v3: Use !!(v & DRM_I915_BIT()) for uapi macros instead of custom shifts (Tvrtko)

v4: factorize query item writting (Tvrtko)
tweak uapi struct/define names (Tvrtko)

v5: Replace ALIGN() macro (Chris)

v6: Updated uapi comments (Tvrtko)

     Moved flags != 0 checks into vfuncs (Tvrtko)

v7: Use access_ok() before copying anything, to avoid overflows (Chris)
Switch BUG_ON() to GEM_WARN_ON() (Tvrtko)

v8: Tweak uapi comments style to match the coding style (Lionel)

v9: Fix error in comment about computation of enabled subslice (Tvrtko)

---
  drivers/gpu/drm/i915/i915_query.c | 110 ++++++++++++++++++++++++++++++++++++++
  include/uapi/drm/i915_drm.h       |  71 ++++++++++++++++++++++++
  2 files changed, 181 insertions(+)
drivers/gpu/drm/i915/i915_query.c +110 -0
index 5aa886313cf9..ff87ec8a321a 100644
@@ -25,8 +25,118 @@
  #include "i915_drv.h"
  #include <uapi/drm/i915_drm.h>
 
+static int copy_query_data(struct drm_i915_query_item *query_item,
+			   const void *item_ptr, u32 item_length,
+			   const void *data_ptr, u32 data_length)
+{
+	u32 total_length = item_length + data_length;
+
+	if (GEM_WARN_ON(add_overflows(item_length, data_length)))
+		return -EINVAL;
+
+	if (query_item->length == 0)
+		return total_length;
+
+	if (query_item->length < total_length)
+		return -EINVAL;
+
+	if (!access_ok(VERIFY_WRITE, u64_to_user_ptr(query_item->data_ptr),
+		       total_length))
+		return -EFAULT;
+
+	if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr),
+			   item_ptr, item_length))
+		return -EFAULT;
+
+	if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + item_length),
+			   data_ptr, data_length))
+		return -EFAULT;
+
+	return total_length;
+}
+
+static int query_slice_info(struct drm_i915_private *dev_priv,
+			    struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_slice_info slice_info;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	/*
+	 * If we ever change the internal slice mask data type, we'll need to
+	 * update this function.
+	 */
+	BUILD_BUG_ON(sizeof(u8) != sizeof(sseu->slice_mask));
+
+	memset(&slice_info, 0, sizeof(slice_info));
+	slice_info.max_slices = sseu->max_slices;
+
+	return copy_query_data(query_item, &slice_info, sizeof(slice_info),
+			       &sseu->slice_mask, sizeof(sseu->slice_mask));
+}
+
+static int query_subslice_info(struct drm_i915_private *dev_priv,
+			       struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_subslice_info subslice_info;
+	u32 data_length;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	memset(&subslice_info, 0, sizeof(subslice_info));
+	subslice_info.max_slices = sseu->max_slices;
+	subslice_info.max_subslices = sseu->max_subslices;
+
+	data_length = subslice_info.max_slices *
+		DIV_ROUND_UP(subslice_info.max_subslices,
+			     sizeof(sseu->subslice_mask[0]) * BITS_PER_BYTE);
+
+	return copy_query_data(query_item,
+			       &subslice_info, sizeof(subslice_info),
+			       sseu->subslice_mask, data_length);
+}
+
+static int query_eu_info(struct drm_i915_private *dev_priv,
+			 struct drm_i915_query_item *query_item)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+	struct drm_i915_query_eu_info eu_info;
+	u32 data_length;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (sseu->max_slices == 0)
+		return -ENODEV;
+
+	memset(&eu_info, 0, sizeof(eu_info));
+	eu_info.max_slices = sseu->max_slices;
+	eu_info.max_subslices = sseu->max_subslices;
+	eu_info.max_eus_per_subslice = sseu->max_eus_per_subslice;
+
+	data_length = eu_info.max_slices * eu_info.max_subslices *
+		DIV_ROUND_UP(eu_info.max_eus_per_subslice, BITS_PER_BYTE);
+
+	return copy_query_data(query_item,
+			       &eu_info, sizeof(eu_info),
+			       sseu->eu_mask, data_length);
+}
+
  static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
  					struct drm_i915_query_item *query_item) = {
+	query_slice_info,
+	query_subslice_info,
+	query_eu_info,
  };
 
  int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
include/uapi/drm/i915_drm.h +6 -0
index 03f031652d86..7ae8e9aa0206 100644
@@ -1618,6 +1618,9 @@ struct drm_i915_perf_oa_config {
 
  struct drm_i915_query_item {
  	__u64 query_id;
+#define DRM_I915_QUERY_SLICE_INFO	0x01
+#define DRM_I915_QUERY_SUBSLICE_INFO	0x02
+#define DRM_I915_QUERY_EU_INFO		0x03
 
  	/*
  	 * When set to zero by userspace, this is filled with the size of the
@@ -1654,6 +1657,74 @@ struct drm_i915_query {
  	__u64 items_ptr;
  };
 
+#define DRM_I915_BIT(bit) ((__u32)1 << (bit))
+#define DRM_I915_DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div))
+

include/uapi/drm/i915_drm.h struct drm_i915_query { · line 1672

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_SLICE_INFO :
+ *
+ * data: each bit indicates whether a slice is available (1) or fused off (0).
+ *       Formula to tell if slice X is available :
+ *
+ *            (data[X / 8] >> (X % 8)) & 1
+ *
+ *       Alternatively, use DRM_I915_QUERY_SLICE_AVAILABLE() to query a
+ *       given subslice's availability.

slice's availability

Quoted 6 lines
include/uapi/drm/i915_drm.h +6 -0
+ */
+struct drm_i915_query_slice_info {
+	__u32 max_slices;
+
+#define DRM_I915_QUERY_SLICE_AVAILABLE(info, slice) \
+	!!((info)->data[(slice) / 8] & DRM_I915_BIT((slice) % 8))

include/uapi/drm/i915_drm.h struct drm_i915_query { · line 1688

Quoted 10 lines
include/uapi/drm/i915_drm.h +10 -0
+	__u8 data[];
+};
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_SUBSLICE_INFO :
+ *
+ * data: each bit indicates whether a subslice is available (1) or fused off
+ *       (0). Formula to tell if slice X subslice Y is available :
+ *
+ *            (data[(X * ALIGN(max_subslices, 8) / 8) + Y / 8] >> (Y % 8)) & 1

Can we make this formula use DIV_ROUND_UP for consistency.

Quoted 42 lines
include/uapi/drm/i915_drm.h +39 -0
+ *
+ *       Alternatively, use DRM_I915_QUERY_SUBSLICE_AVAILABLE() to query a
+ *       given subslice's availability.
+ */
+struct drm_i915_query_subslice_info {
+	__u32 max_slices;
+	__u32 max_subslices;
+
+#define DRM_I915_QUERY_SUBSLICE_AVAILABLE(info, slice, subslice) \
+	!!((info)->data[(slice) * DRM_I915_DIV_ROUND_UP((info)->max_subslices, 8) + \
+			(subslice) / 8] & DRM_I915_BIT((subslice) % 8))
+	__u8 data[];
+};
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_EU_INFO :
+ *
+ * data: Each bit indicates whether an EU is available (1) or fused off (0).
+ *       Formula to tell if slice X subslice Y eu Z is available :
+ *
+ *           (data[X * max_subslices * ALIGN(max_eus_per_subslice, 8) / 8 +
+ *                 Y * ALIGN(max_eus_per_subslice, 8) / 8 +
+ *                 Z / 8] >> (Z % 8)) & 1
+ *
+ *       Alternatively, use DRM_I915_QUERY_EU_AVAILABLE() to query a given
+ *       EU's availability.
+ */
+struct drm_i915_query_eu_info {
+	__u32 max_slices;
+	__u32 max_subslices;
+	__u32 max_eus_per_subslice;
+
+#define DRM_I915_QUERY_EU_AVAILABLE(info, slice, subslice, eu) \
+	!!((info)->data[(slice) * DRM_I915_DIV_ROUND_UP((info)->max_eus_per_subslice, 8) * (info)->max_subslices + \
+			(subslice) * DRM_I915_DIV_ROUND_UP((info)->max_eus_per_subslice, 8) + \
+			(eu) / 8] & DRM_I915_BIT((eu) % 8))
+	__u8 data[];
+};
+
  #if defined(__cplusplus)
  }
  #endif
Signature · 7 lines
Thanks,
Sagar

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH v12 6/8] drm/i915: expose rcs topology through query uAPI

Thanks Sagar, fixed locally.

Quoted 190 lines · Sagar Arun Kamble
Quoted 187 lines · Lionel Landwerlin

With the introduction of asymmetric slices in CNL, we cannot rely on the previous SUBSLICE_MASK getparam to tell userspace what subslices are available. Here we introduce a more detailed way of querying the Gen's GPU topology that doesn't aggregate numbers.

This is essential for monitoring parts of the GPU with the OA unit, because counters need to be normalized to the number of EUs/subslices/slices. The current aggregated numbers like EU_TOTAL do not gives us sufficient information.

As a bonus we can draw representations of the GPU :

         https://imgur.com/a/vuqpa

v2: Rename uapi struct s/_mask/_info/ (Tvrtko)
     Report max_slice/subslice/eus_per_subslice rather than strides (Tvrtko) Add uapi macros to read data from *_info structs (Tvrtko)

v3: Use !!(v & DRM_I915_BIT()) for uapi macros instead of custom shifts (Tvrtko)

v4: factorize query item writting (Tvrtko)
     tweak uapi struct/define names (Tvrtko)

v5: Replace ALIGN() macro (Chris)

v6: Updated uapi comments (Tvrtko)
     Moved flags != 0 checks into vfuncs (Tvrtko)

v7: Use access_ok() before copying anything, to avoid overflows (Chris) Switch BUG_ON() to GEM_WARN_ON() (Tvrtko)

v8: Tweak uapi comments style to match the coding style (Lionel)

v9: Fix error in comment about computation of enabled subslice (Tvrtko)

---
  drivers/gpu/drm/i915/i915_query.c | 110
++++++++++++++++++++++++++++++++++++++
  include/uapi/drm/i915_drm.h       |  71 ++++++++++++++++++++++++

  2 files changed, 181 insertions(+)
drivers/gpu/drm/i915/i915_query.c +43 -0
index 5aa886313cf9..ff87ec8a321a 100644
@@ -25,8 +25,118 @@
   #include "i915_drv.h"
   #include <uapi/drm/i915_drm.h>
   +static int copy_query_data(struct drm_i915_query_item *query_item,
+               const void *item_ptr, u32 item_length,
+               const void *data_ptr, u32 data_length)
+{
+    u32 total_length = item_length + data_length;
+
+    if (GEM_WARN_ON(add_overflows(item_length, data_length)))
+        return -EINVAL;
+
+    if (query_item->length == 0)
+        return total_length;
+
+    if (query_item->length < total_length)
+        return -EINVAL;
+
+    if (!access_ok(VERIFY_WRITE, u64_to_user_ptr(query_item->data_ptr),
+               total_length))
+        return -EFAULT;
+
+    if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr),
+               item_ptr, item_length))
+        return -EFAULT;
+
+    if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr + 
 item_length),
+               data_ptr, data_length))
+        return -EFAULT;
+
+    return total_length;
+}
+
+static int query_slice_info(struct drm_i915_private *dev_priv,
+                struct drm_i915_query_item *query_item)
+{
+    const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+    struct drm_i915_query_slice_info slice_info;
+
+    if (query_item->flags != 0)
+        return -EINVAL;
+
+    if (sseu->max_slices == 0)
+        return -ENODEV;
+
+    /*
+     * If we ever change the internal slice mask data type, we'll 

need to
+     * update this function.
+     */
+    BUILD_BUG_ON(sizeof(u8) != sizeof(sseu->slice_mask));

drivers/gpu/drm/i915/i915_query.c +60 -0
+
+    memset(&slice_info, 0, sizeof(slice_info));
+    slice_info.max_slices = sseu->max_slices;
+
+    return copy_query_data(query_item, &slice_info, sizeof(slice_info),
+                   &sseu->slice_mask, sizeof(sseu->slice_mask));
+}
+
+static int query_subslice_info(struct drm_i915_private *dev_priv,
+                   struct drm_i915_query_item *query_item)
+{
+    const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+    struct drm_i915_query_subslice_info subslice_info;
+    u32 data_length;
+
+    if (query_item->flags != 0)
+        return -EINVAL;
+
+    if (sseu->max_slices == 0)
+        return -ENODEV;
+
+    memset(&subslice_info, 0, sizeof(subslice_info));
+    subslice_info.max_slices = sseu->max_slices;
+    subslice_info.max_subslices = sseu->max_subslices;
+
+    data_length = subslice_info.max_slices *
+        DIV_ROUND_UP(subslice_info.max_subslices,
+                 sizeof(sseu->subslice_mask[0]) * BITS_PER_BYTE);
+
+    return copy_query_data(query_item,
+                   &subslice_info, sizeof(subslice_info),
+                   sseu->subslice_mask, data_length);
+}
+
+static int query_eu_info(struct drm_i915_private *dev_priv,
+             struct drm_i915_query_item *query_item)
+{
+    const struct sseu_dev_info *sseu = &INTEL_INFO(dev_priv)->sseu;
+    struct drm_i915_query_eu_info eu_info;
+    u32 data_length;
+
+    if (query_item->flags != 0)
+        return -EINVAL;
+
+    if (sseu->max_slices == 0)
+        return -ENODEV;
+
+    memset(&eu_info, 0, sizeof(eu_info));
+    eu_info.max_slices = sseu->max_slices;
+    eu_info.max_subslices = sseu->max_subslices;
+    eu_info.max_eus_per_subslice = sseu->max_eus_per_subslice;
+
+    data_length = eu_info.max_slices * eu_info.max_subslices *
+        DIV_ROUND_UP(eu_info.max_eus_per_subslice, BITS_PER_BYTE);
+
+    return copy_query_data(query_item,
+                   &eu_info, sizeof(eu_info),
+                   sseu->eu_mask, data_length);
+}
+

  static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv, struct drm_i915_query_item *query_item) = {
+    query_slice_info,
+    query_subslice_info,
+    query_eu_info,
  };
    int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)

include/uapi/drm/i915_drm.h +9 -0
index 03f031652d86..7ae8e9aa0206 100644
@@ -1618,6 +1618,9 @@ struct drm_i915_perf_oa_config {
     struct drm_i915_query_item {
       __u64 query_id;
+#define DRM_I915_QUERY_SLICE_INFO    0x01
+#define DRM_I915_QUERY_SUBSLICE_INFO    0x02
+#define DRM_I915_QUERY_EU_INFO        0x03
         /*
        * When set to zero by userspace, this is filled with the size of the
@@ -1654,6 +1657,74 @@ struct drm_i915_query {
       __u64 items_ptr;
   };
   +#define DRM_I915_BIT(bit) ((__u32)1 << (bit))
+#define DRM_I915_DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div))
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_SLICE_INFO :
+ *
+ * data: each bit indicates whether a slice is available (1) or 
Quoted 8 lines
Quoted 7 lines

fused off (0).
+ *       Formula to tell if slice X is available :
+ *
+ *            (data[X / 8] >> (X % 8)) & 1
+ *
+ *       Alternatively, use DRM_I915_QUERY_SLICE_AVAILABLE() to query a
+ *       given subslice's availability.

slice's availability

Thanks, fixed.

Quoted 11 lines
Quoted 11 lines

+ */

include/uapi/drm/i915_drm.h +10 -0
+struct drm_i915_query_slice_info {
+    __u32 max_slices;
+
+#define DRM_I915_QUERY_SLICE_AVAILABLE(info, slice) \
+    !!((info)->data[(slice) / 8] & DRM_I915_BIT((slice) % 8))
+    __u8 data[];
+};
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_SUBSLICE_INFO :
Quoted 8 lines
Quoted 7 lines

+ *
+ * data: each bit indicates whether a subslice is available (1) or fused off
+ *       (0). Formula to tell if slice X subslice Y is available :
+ *
+ *            (data[(X * ALIGN(max_subslices, 8) / 8) + Y / 8] >> (Y % 8)) & 1

Can we make this formula use DIV_ROUND_UP for consistency.

Sure.

Quoted 41 lines
Quoted 41 lines

+ *
+ *       Alternatively, use DRM_I915_QUERY_SUBSLICE_AVAILABLE() to query a
+ *       given subslice's availability.
+ */

include/uapi/drm/i915_drm.h +6 -0
+struct drm_i915_query_subslice_info {
+    __u32 max_slices;
+    __u32 max_subslices;
+
+#define DRM_I915_QUERY_SUBSLICE_AVAILABLE(info, slice, subslice) \
+    !!((info)->data[(slice) * 

DRM_I915_DIV_ROUND_UP((info)->max_subslices, 8) + \
+            (subslice) / 8] & DRM_I915_BIT((subslice) % 8)) +    __u8 data[];

include/uapi/drm/i915_drm.h +6 -0
+};
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_EU_INFO :
+ *
+ * data: Each bit indicates whether an EU is available (1) or fused 

off (0).
+ *       Formula to tell if slice X subslice Y eu Z is available :
+ *
+ *           (data[X * max_subslices * ALIGN(max_eus_per_subslice,
8) / 8 +
+ *                 Y * ALIGN(max_eus_per_subslice, 8) / 8 +
+ *                 Z / 8] >> (Z % 8)) & 1
+ *
+ *       Alternatively, use DRM_I915_QUERY_EU_AVAILABLE() to query a given
+ *       EU's availability.
+ */

include/uapi/drm/i915_drm.h +7 -0
+struct drm_i915_query_eu_info {
+    __u32 max_slices;
+    __u32 max_subslices;
+    __u32 max_eus_per_subslice;
+
+#define DRM_I915_QUERY_EU_AVAILABLE(info, slice, subslice, eu) \
+    !!((info)->data[(slice) * 

DRM_I915_DIV_ROUND_UP((info)->max_eus_per_subslice, 8) * (info)->max_subslices + \
+            (subslice) *

Quoted 9 lines
Quoted 8 lines

DRM_I915_DIV_ROUND_UP((info)->max_eus_per_subslice, 8) + \
+            (eu) / 8] & DRM_I915_BIT((eu) % 8)) +    __u8 data[];

include/uapi/drm/i915_drm.h +2 -0
+};
+

  #if defined(__cplusplus)
  }
  #endif

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

#9 lore raw

PATCH v12 7/8 RFC: drm/i915: expose chipset/driver properties through query uAPI

In reply to Lionel Landwerlin

The purpose of this is to give the ability to userspace to query a bunch of properties in 1 ioctl rather than a series of successive GETPARAM ioctl().

This loosely divides the properties in 2 groups, one being hardware focused and the other being rather driver features.

The structures defined in the uAPI can be extended only by adding new fields. If userspace uses an old version of the structures, the kernel will only copy data up to the size requested by userspace. In the case userspace has an newer version of the struct than what the kernel can provide, any field tag with a more recent version than what returned by the kernel should be ignored.

This change leaves out some of the GETPARAMs :

- EU/slice/subslice: those are already covered by topology structs
- engines queries: those might be addressed in another patch/series
- some deprecated fields which always return ENODEV

---
 drivers/gpu/drm/i915/i915_query.c | 135 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_query.h |   5 ++
 include/uapi/drm/i915_drm.h       |  76 +++++++++++++++++++++
 3 files changed, 216 insertions(+)
drivers/gpu/drm/i915/i915_query.c +135 -0
index ff87ec8a321a..3770a0e49dad 100644
@@ -132,11 +132,146 @@ static int query_eu_info(struct drm_i915_private *dev_priv,
 			       sseu->eu_mask, data_length);
 }
 
+void i915_query_fill_chipset_info(struct drm_i915_private *dev_priv,
+				  struct drm_i915_query_chipset_info *chipset_info)
+{
+	struct pci_dev *pdev = dev_priv->drm.pdev;
+
+	memset(chipset_info, 0, sizeof(*chipset_info));
+	chipset_info->version = 1;
+
+	chipset_info->chipset_id = pdev->device;
+	chipset_info->chipset_revision = pdev->revision;
+	chipset_info->num_fences_available = dev_priv->num_fence_regs;
+	chipset_info->cs_timestamp_frequency =
+		1000ULL * INTEL_INFO(dev_priv)->cs_timestamp_frequency_khz;
+	chipset_info->has_llc = HAS_LLC(dev_priv);
+	chipset_info->has_overlay = dev_priv->overlay ? 1 : 0;
+	chipset_info->has_semaphores = HAS_LEGACY_SEMAPHORES(dev_priv);
+	chipset_info->has_writethrough = HAS_WT(dev_priv);
+}
+
+static int query_chipset_info(struct drm_i915_private *dev_priv,
+			      struct drm_i915_query_item *query_item)
+{
+	struct drm_i915_query_chipset_info chipset_info;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (query_item->length == 0) {
+		query_item->length = sizeof(chipset_info);
+		return 0;
+	}
+
+	i915_query_fill_chipset_info(dev_priv, &chipset_info);
+
+	/*
+	 * Only copy request user size as it depends upon the version of the
+	 * struct used by userspace.
+	 */
+	if (copy_to_user(u64_to_user_ptr(query_item->data_ptr),
+			 &chipset_info, query_item->length))
+		return -EFAULT;
+
+	return 0;
+}
+
+void i915_query_fill_driver_info(struct drm_i915_private *dev_priv,
+				 struct drm_i915_query_driver_info *driver_info)
+{
+	memset(driver_info, 0, sizeof(*driver_info));
+	driver_info->version = 1;
+
+	/* Remember to bump this if the version changes! */
+	driver_info->mmap_version = 1;
+
+	/* For the time being all of these are always true;
+	 * if some supported hardware does not have one of these
+	 * features this value needs to be provided from
+	 * INTEL_INFO(), a feature macro, or similar.
+	 */
+	driver_info->has_coherent_phys_gtt = 1;
+	driver_info->has_coherent_rings = 1;
+	driver_info->has_exec_async = 1;
+	driver_info->has_exec_batch_first = 1;
+	driver_info->has_exec_capture = 1;
+	driver_info->has_exec_fence = 1;
+	driver_info->has_exec_fence_array = 1;
+	driver_info->has_exec_handle_lut = 1;
+	driver_info->has_exec_no_reloc = 1;
+	driver_info->has_exec_softpin = 1;
+	driver_info->has_execbuf2 = 1;
+	driver_info->has_gem = 1;
+	driver_info->has_gen7_sol_reset = 1;
+	driver_info->has_pageflipping = 1;
+	driver_info->has_pinned_batches = 1;
+	driver_info->has_prime_vmap_flush = 1;
+	driver_info->has_relaxed_delta = 1;
+	driver_info->has_relaxed_fencing = 1;
+	driver_info->has_wait_timeout = 1;
+
+	driver_info->has_aliasing_ppgtt = USES_PPGTT(dev_priv);
+
+	driver_info->has_context_isolation =
+		intel_engines_has_context_isolation(dev_priv);
+
+	driver_info->has_gpu_reset = i915_modparams.enable_hangcheck &&
+		intel_has_gpu_reset(dev_priv);
+	if (driver_info->has_gpu_reset && intel_has_reset_engine(dev_priv))
+		driver_info->has_gpu_reset = 2;
+
+	driver_info->has_resource_streamer = HAS_RESOURCE_STREAMER(dev_priv);
+
+	driver_info->has_scheduler = 0;
+	if (dev_priv->engine[RCS] && dev_priv->engine[RCS]->schedule) {
+		driver_info->has_scheduler |= I915_SCHEDULER_CAP_ENABLED;
+		driver_info->has_scheduler |= I915_SCHEDULER_CAP_PRIORITY;
+		if (HAS_LOGICAL_RING_PREEMPTION(dev_priv))
+			driver_info->has_scheduler |= I915_SCHEDULER_CAP_PREEMPTION;
+	}
+
+	driver_info->has_secure_batches = capable(CAP_SYS_ADMIN);
+
+	driver_info->cmd_parser_version = i915_cmd_parser_get_version(dev_priv);
+
+	driver_info->mmap_gtt_version = i915_gem_mmap_gtt_version();
+}
+
+
+static int query_driver_info(struct drm_i915_private *dev_priv,
+			     struct drm_i915_query_item *query_item)
+{
+	struct drm_i915_query_driver_info driver_info;
+
+	if (query_item->flags != 0)
+		return -EINVAL;
+
+	if (query_item->length == 0) {
+		query_item->length = sizeof(driver_info);
+		return 0;
+	}
+
+	i915_query_fill_driver_info(dev_priv, &driver_info);
+
+	/*
+	 * Only copy request user size as it depends upon the version of the
+	 * struct used by userspace.
+	 */
+	if (copy_to_user(u64_to_user_ptr(query_item->data_ptr),
+			 &driver_info, query_item->length))
+		return -EFAULT;
+
+	return 0;
+}
+
 static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
 					struct drm_i915_query_item *query_item) = {
 	query_slice_info,
 	query_subslice_info,
 	query_eu_info,
+	query_chipset_info,
+	query_driver_info,
 };
 
 int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
drivers/gpu/drm/i915/i915_query.h +5 -0
index 4550e8f21459..30cb8c892aab 100644
@@ -30,4 +30,9 @@ struct drm_file;
 
 int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
 
+void i915_query_fill_chipset_info(struct drm_i915_private *dev_priv,
+				  struct drm_i915_query_chipset_info *chipset_info);
+void i915_query_fill_driver_info(struct drm_i915_private *dev_priv,
+				 struct drm_i915_query_driver_info *driver_info);
+
 #endif
include/uapi/drm/i915_drm.h +76 -0

88 lines not on this page · raw message

Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH v12 8/8 RFC: drm/i915: reuse new chipset/driver query in getparam

In reply to Lionel Landwerlin
---
 drivers/gpu/drm/i915/i915_drv.c | 212 ++++++++++++++++++++++------------------
 1 file changed, 119 insertions(+), 93 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +119 -93
index ebb2e4241cf7..cc0342e8a400 100644
@@ -278,11 +278,123 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv)
 	pci_dev_put(pch);
 }
 
+static int read_unsigned_struct_field(void *data, uint32_t offset, uint32_t size)
+{
+	switch (size) {
+	case 1:
+		return *(uint8_t *)(data + offset);
+	case 2:
+		return *(uint16_t *)(data + offset);
+	case 4:
+		return *(uint32_t *)(data + offset);
+	case 8:
+		return *(uint64_t *)(data + offset);
+	}
+
+	GEM_BUG_ON(true);
+	return 0;
+}
+
+static const struct {
+	uint32_t param;
+	uint32_t offset;
+	uint8_t size;
+} i915_param_chipset_mapping[] = {
+#define MEMBER_OFFSET_SIZE(param, member) \
+	{ param, \
+	  offsetof(struct drm_i915_query_chipset_info, member),	\
+	  sizeof(((struct drm_i915_query_chipset_info *)0)->member), }
+	MEMBER_OFFSET_SIZE(I915_PARAM_CHIPSET_ID,		chipset_id),
+	MEMBER_OFFSET_SIZE(I915_PARAM_REVISION,			chipset_revision),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_LLC,			has_llc),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_WT,			has_writethrough),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_SEMAPHORES,		has_semaphores),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_OVERLAY,		has_overlay),
+	MEMBER_OFFSET_SIZE(I915_PARAM_NUM_FENCES_AVAIL,		num_fences_available),
+	MEMBER_OFFSET_SIZE(I915_PARAM_CS_TIMESTAMP_FREQUENCY,	cs_timestamp_frequency),
+#undef MEMBER_OFFSET_SIZE
+};
+static bool i915_getparam_chipset(struct drm_i915_private *dev_priv,
+				  s32 param, int *value)
+{
+	struct drm_i915_query_chipset_info chipset_info;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(i915_param_chipset_mapping); i++) {
+		if (i915_param_chipset_mapping[i].param == param) {
+			i915_query_fill_chipset_info(dev_priv, &chipset_info);
+			*value = read_unsigned_struct_field(&chipset_info,
+							    i915_param_chipset_mapping[i].offset,
+							    i915_param_chipset_mapping[i].size);
+			return true;
+		}
+	}
+
+	return false;
+}
+
+static const struct {
+	uint32_t param;
+	uint32_t offset;
+	uint8_t size;
+} i915_param_driver_mapping[] = {
+#define MEMBER_OFFSET_SIZE(param, member) \
+	{ param, \
+	  offsetof(struct drm_i915_query_driver_info, member), \
+	  sizeof(((struct drm_i915_query_driver_info *)0)->member), }
+	MEMBER_OFFSET_SIZE(I915_PARAM_CMD_PARSER_VERSION,	cmd_parser_version),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_ALIASING_PPGTT,	has_aliasing_ppgtt),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_CONTEXT_ISOLATION,	has_context_isolation),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_COHERENT_PHYS_GTT,	has_coherent_phys_gtt),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_COHERENT_RINGS,	has_coherent_rings),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_GEM,			has_gem),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_GEN7_SOL_RESET,	has_gen7_sol_reset),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_GPU_RESET,		has_gpu_reset),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_PAGEFLIPPING,		has_pageflipping),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_ASYNC,		has_exec_async),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_BATCH_FIRST,	has_exec_batch_first),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_CAPTURE,		has_exec_capture),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_NO_RELOC,	has_exec_no_reloc),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_FENCE,		has_exec_fence),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_FENCE_ARRAY,	has_exec_fence_array),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_HANDLE_LUT,	has_exec_handle_lut),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_EXEC_SOFTPIN,		has_exec_softpin),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_PINNED_BATCHES,	has_pinned_batches),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_PRIME_VMAP_FLUSH,	has_prime_vmap_flush),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_RELAXED_DELTA,	has_relaxed_delta),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_RELAXED_FENCING,	has_relaxed_fencing),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_RESOURCE_STREAMER,	has_resource_streamer),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_SCHEDULER,		has_scheduler),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_SECURE_BATCHES,	has_secure_batches),
+	MEMBER_OFFSET_SIZE(I915_PARAM_HAS_WAIT_TIMEOUT,		has_wait_timeout),
+	MEMBER_OFFSET_SIZE(I915_PARAM_MMAP_GTT_VERSION,		mmap_gtt_version),
+	MEMBER_OFFSET_SIZE(I915_PARAM_MMAP_VERSION,		mmap_version),
+#undef MEMBER_OFFSET_SIZE
+};
+
+static bool i915_getparam_driver(struct drm_i915_private *dev_priv,
+				  s32 param, int *value)
+{
+	struct drm_i915_query_driver_info driver_info;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(i915_param_driver_mapping); i++) {
+		if (i915_param_driver_mapping[i].param == param) {
+			i915_query_fill_driver_info(dev_priv, &driver_info);
+			*value = read_unsigned_struct_field(&driver_info,
+							    i915_param_driver_mapping[i].offset,
+							    i915_param_driver_mapping[i].size);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 static int i915_getparam(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct pci_dev *pdev = dev_priv->drm.pdev;
 	drm_i915_getparam_t *param = data;
 	int value;
 
@@ -293,18 +405,6 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_CONSTANTS:
 		/* Reject all old ums/dri params. */
 		return -ENODEV;
-	case I915_PARAM_CHIPSET_ID:
-		value = pdev->device;
-		break;
-	case I915_PARAM_REVISION:
-		value = pdev->revision;
-		break;
-	case I915_PARAM_NUM_FENCES_AVAIL:
-		value = dev_priv->num_fence_regs;
-		break;
-	case I915_PARAM_HAS_OVERLAY:
-		value = dev_priv->overlay ? 1 : 0;
-		break;
 	case I915_PARAM_HAS_BSD:
 		value = !!dev_priv->engine[VCS];
 		break;
@@ -317,24 +417,6 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_BSD2:
 		value = !!dev_priv->engine[VCS2];
 		break;
-	case I915_PARAM_HAS_LLC:
-		value = HAS_LLC(dev_priv);
-		break;
-	case I915_PARAM_HAS_WT:
-		value = HAS_WT(dev_priv);
-		break;
-	case I915_PARAM_HAS_ALIASING_PPGTT:
-		value = USES_PPGTT(dev_priv);
-		break;
-	case I915_PARAM_HAS_SEMAPHORES:
-		value = HAS_LEGACY_SEMAPHORES(dev_priv);
-		break;
-	case I915_PARAM_HAS_SECURE_BATCHES:
-		value = capable(CAP_SYS_ADMIN);
-		break;
-	case I915_PARAM_CMD_PARSER_VERSION:
-		value = i915_cmd_parser_get_version(dev_priv);
-		break;
 	case I915_PARAM_SUBSLICE_TOTAL:
 		value = sseu_subslice_total(&INTEL_INFO(dev_priv)->sseu);
 		if (!value)
@@ -345,15 +427,6 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		if (!value)
 			return -ENODEV;
 		break;
-	case I915_PARAM_HAS_GPU_RESET:
-		value = i915_modparams.enable_hangcheck &&
-			intel_has_gpu_reset(dev_priv);
-		if (value && intel_has_reset_engine(dev_priv))
-			value = 2;
-		break;
-	case I915_PARAM_HAS_RESOURCE_STREAMER:
-		value = HAS_RESOURCE_STREAMER(dev_priv);
-		break;
 	case I915_PARAM_HAS_POOLED_EU:
 		value = HAS_POOLED_EU(dev_priv);
 		break;
@@ -365,54 +438,6 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		value = I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED;
 		intel_runtime_pm_put(dev_priv);
 		break;
-	case I915_PARAM_MMAP_GTT_VERSION:
-		/* Though we've started our numbering from 1, and so class all
-		 * earlier versions as 0, in effect their value is undefined as
-		 * the ioctl will report EINVAL for the unknown param!
-		 */
-		value = i915_gem_mmap_gtt_version();
-		break;
-	case I915_PARAM_HAS_SCHEDULER:
-		value = 0;
-		if (dev_priv->engine[RCS] && dev_priv->engine[RCS]->schedule) {
-			value |= I915_SCHEDULER_CAP_ENABLED;
-			value |= I915_SCHEDULER_CAP_PRIORITY;
-			if (HAS_LOGICAL_RING_PREEMPTION(dev_priv))
-				value |= I915_SCHEDULER_CAP_PREEMPTION;
-		}
-		break;
-
-	case I915_PARAM_MMAP_VERSION:
-		/* Remember to bump this if the version changes! */
-	case I915_PARAM_HAS_GEM:
-	case I915_PARAM_HAS_PAGEFLIPPING:
-	case I915_PARAM_HAS_EXECBUF2: /* depends on GEM */
-	case I915_PARAM_HAS_RELAXED_FENCING:
-	case I915_PARAM_HAS_COHERENT_RINGS:
-	case I915_PARAM_HAS_RELAXED_DELTA:
-	case I915_PARAM_HAS_GEN7_SOL_RESET:
-	case I915_PARAM_HAS_WAIT_TIMEOUT:
-	case I915_PARAM_HAS_PRIME_VMAP_FLUSH:
-	case I915_PARAM_HAS_PINNED_BATCHES:
-	case I915_PARAM_HAS_EXEC_NO_RELOC:
-	case I915_PARAM_HAS_EXEC_HANDLE_LUT:
-	case I915_PARAM_HAS_COHERENT_PHYS_GTT:
-	case I915_PARAM_HAS_EXEC_SOFTPIN:
-	case I915_PARAM_HAS_EXEC_ASYNC:
-	case I915_PARAM_HAS_EXEC_FENCE:
-	case I915_PARAM_HAS_EXEC_CAPTURE:
-	case I915_PARAM_HAS_EXEC_BATCH_FIRST:
-	case I915_PARAM_HAS_EXEC_FENCE_ARRAY:
-		/* For the time being all of these are always true;
-		 * if some supported hardware does not have one of these
-		 * features this value needs to be provided from
-		 * INTEL_INFO(), a feature macro, or similar.
-		 */
-		value = 1;
-		break;
-	case I915_PARAM_HAS_CONTEXT_ISOLATION:
-		value = intel_engines_has_context_isolation(dev_priv);
-		break;
 	case I915_PARAM_SLICE_MASK:
 		value = INTEL_INFO(dev_priv)->sseu.slice_mask;
 		if (!value)
@@ -423,12 +448,13 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		if (!value)
 			return -ENODEV;
 		break;
-	case I915_PARAM_CS_TIMESTAMP_FREQUENCY:
-		value = 1000 * INTEL_INFO(dev_priv)->cs_timestamp_frequency_khz;
-		break;
 	default:
-		DRM_DEBUG("Unknown parameter %d\n", param->param);
-		return -EINVAL;
+		if (!i915_getparam_chipset(dev_priv, param->param, &value) &&
+		    !i915_getparam_driver(dev_priv, param->param, &value)) {
+			DRM_DEBUG("Unknown parameter %d\n", param->param);
+			return -EINVAL;
+		}
+		break;
 	}
 
 	if (put_user(value, param->value))
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

✓ Fi.CI.BAT: success for drm/i915: expose RCS topology to userspace

In reply to Lionel Landwerlin
== Series Details ==

== Series Details ==

Series: drm/i915: expose RCS topology to userspace
URL : https://patchwork.freedesktop.org/series/37290/
State : success

== Summary ==

Series 37290v1 drm/i915: expose RCS topology to userspace
https://patchwork.freedesktop.org/api/1.0/series/37290/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:426s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:426s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:373s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:491s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:483s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:482s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:466s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:569s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:279s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:510s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:392s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:401s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:415s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:445s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:413s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:455s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:500s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:459s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:504s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:585s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:510s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:484s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:485s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:414s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:430s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:515s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:396s
Blacklisted hosts:
fi-cnl-y2        total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:533s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:469s

fi-skl-6700hq failed to collect. IGT log at Patchwork_7810/fi-skl-6700hq/igt.log

5f9f3637ad4677971149ec7cde9ed2081a90839b drm-tip: 2018y-01m-29d-13h-02m-54s UTC integration manifest d02134e51838 RFC: drm/i915: reuse new chipset/driver query in getparam
c47cff0245e4 RFC: drm/i915: expose chipset/driver properties through query uAPI a1892c017b5d drm/i915: expose rcs topology through query uAPI
9c5a93f46d27 drm/i915: add query uAPI
f42c533d3656 drm/i915: add rcs topology to error state
e050f06ebba9 drm/i915/debugfs: add rcs topology entry
c32afc436cbe drm/i915/debugfs: reuse max slice/subslices already stored in sseu e0415f64bdd2 drm/i915: store all subslice masks

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7810/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

✗ Fi.CI.IGT: failure for drm/i915: expose RCS topology to userspace

In reply to Lionel Landwerlin
== Series Details ==

== Series Details ==

Series: drm/i915: expose RCS topology to userspace
URL : https://patchwork.freedesktop.org/series/37290/
State : failure

== Summary ==

Test gem_gpgpu_fill:

                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)
Test kms_flip:
        Subgroup modeset-vs-vblank-race-interruptible:
                fail       -> PASS       (shard-hsw) fdo#103060
Test pm_sseu:
        Subgroup full-enable:
                pass       -> FAIL       (shard-apl) fdo#104651
Test perf_pmu:
        Subgroup frequency:
                fail       -> PASS       (shard-apl) fdo#104829
Test perf:
        Subgroup oa-exponents:
                fail       -> PASS       (shard-apl) fdo#102254
Test kms_frontbuffer_tracking:
        Subgroup fbc-suspend:
                skip       -> PASS       (shard-snb) fdo#101623 +1
        Subgroup fbc-1p-shrfb-fliptrack:
                fail       -> PASS       (shard-apl) fdo#103167
Test gem_media_fill:
                pass       -> FAIL       (shard-hsw)
                pass       -> FAIL       (shard-apl)

fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#104651 https://bugs.freedesktop.org/show_bug.cgi?id=104651
fdo#104829 https://bugs.freedesktop.org/show_bug.cgi?id=104829
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167

shard-apl        total:2838 pass:1749 dwarn:1   dfail:0   fail:24  skip:1064 time:12653s
shard-hsw        total:2838 pass:1734 dwarn:1   dfail:0   fail:12  skip:1090 time:11983s
shard-snb        total:2838 pass:1330 dwarn:1   dfail:0   fail:10  skip:1497 time:6663s

Blacklisted hosts:
shard-kbl total:2838 pass:1866 dwarn:5 dfail:0 fail:26 skip:941 time:9623s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7810/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx