Skip to contentSkip to conversation

Fixed16.16 wrapper cleanup & wm optimization

PATCH In review Mahesh Kumar 3 participants 17 messages Jul 18, 2017 – Aug 10, 2017

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

cover Fixed16.16 wrapper cleanup & wm optimization

This series Include patches for:
clean fixed16.16 wrappers
optimize wm calculation code
enable/Implement trans wm calculation
create a DebugFS entry for IPC status

Mahesh Kumar (8):
drm/i915: Fixed point fixed16 wrapper cleanup drm/i915/skl+: Optimize WM calculation drm/i915/gen10: Calculate and enable transition WM drm/i915/glk: IPC linetime watermark workaround for GLK drm/i915/cnl: Extend WM workaround with IPC for CNL drm/i915/gen9+: Add has_ipc flag in device info structure drm/i915/bxt+: Enable IPC support
drm/i915/skl+: debugfs entry to control IPC

 drivers/gpu/drm/i915/i915_debugfs.c  |  73 +++++++++-
 drivers/gpu/drm/i915/i915_drv.c      |   4 +-
 drivers/gpu/drm/i915/i915_drv.h      |  32 +++--
 drivers/gpu/drm/i915/i915_pci.c      |   4 +
 drivers/gpu/drm/i915/i915_reg.h      |   1 +
 drivers/gpu/drm/i915/intel_display.c |   1 +
 drivers/gpu/drm/i915/intel_drv.h     |   2 +
 drivers/gpu/drm/i915/intel_pm.c      | 262 +++++++++++++++++++++++------------
 8 files changed, 283 insertions(+), 96 deletions(-)
Signature · 6 lines
2.13.0

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

PATCH 1/8 drm/i915: Fixed point fixed16 wrapper cleanup

From: "Kumar, Mahesh" <[email protected]>

As per suggestion from Jani, cleanup the code. Cleanup includes
- Instead of left shifting & check, compare with U32/16_MAX
- Use typecast instead of clamp_t

---
 drivers/gpu/drm/i915/i915_drv.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +7 -7
index 7c6fab08a2e6..96edced67e10 100644
@@ -126,7 +126,7 @@ static inline uint_fixed_16_16_t u32_to_fixed16(uint32_t val)
 {
 	uint_fixed_16_16_t fp;
 
-	WARN_ON(val >> 16);
+	WARN_ON(val > U16_MAX);
 
 	fp.val = val << 16;
 	return fp;
@@ -163,8 +163,8 @@ static inline uint_fixed_16_16_t max_fixed16(uint_fixed_16_16_t max1,
 static inline uint_fixed_16_16_t clamp_u64_to_fixed16(uint64_t val)
 {
 	uint_fixed_16_16_t fp;
-	WARN_ON(val >> 32);
-	fp.val = clamp_t(uint32_t, val, 0, ~0);
+	WARN_ON(val > U32_MAX);
+	fp.val = (uint32_t) val;
 	return fp;
 }
 
@@ -181,8 +181,8 @@ static inline uint32_t mul_round_up_u32_fixed16(uint32_t val,
 
 	intermediate_val = (uint64_t) val * mul.val;
 	intermediate_val = DIV_ROUND_UP_ULL(intermediate_val, 1 << 16);
-	WARN_ON(intermediate_val >> 32);
-	return clamp_t(uint32_t, intermediate_val, 0, ~0);
+	WARN_ON(intermediate_val > U32_MAX);
+	return (uint32_t) intermediate_val;
 }
 
 static inline uint_fixed_16_16_t mul_fixed16(uint_fixed_16_16_t val,
@@ -211,8 +211,8 @@ static inline uint32_t div_round_up_u32_fixed16(uint32_t val,
 
 	interm_val = (uint64_t)val << 16;
 	interm_val = DIV_ROUND_UP_ULL(interm_val, d.val);
-	WARN_ON(interm_val >> 32);
-	return clamp_t(uint32_t, interm_val, 0, ~0);
+	WARN_ON(interm_val > U32_MAX);
+	return (uint32_t) interm_val;
 }
 
 static inline uint_fixed_16_16_t mul_u32_fixed16(uint32_t val,
Signature · 6 lines
2.13.0

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

PATCH 2/8 drm/i915/skl+: Optimize WM calculation

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

Plane configuration parameters doesn't change for each WM-level calculation. Currently we compute same parameters 8 times for each wm-level.
This patch optimizes it by calculating these parameters in beginning & reuse during each level-wm calculation.

---
 drivers/gpu/drm/i915/i915_drv.h |  13 +++
 drivers/gpu/drm/i915/intel_pm.c | 179 ++++++++++++++++++++++------------------
 2 files changed, 111 insertions(+), 81 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +13 -0
index 96edced67e10..62ba18d6717f 100644
@@ -1790,6 +1790,19 @@ struct skl_wm_level {
 	uint8_t plane_res_l;
 };
 
+/* Stores plane specific WM parameters */
+struct skl_wm_params{
+	bool x_tiled, y_tiled;
+	uint32_t width;
+	uint8_t cpp;
+	uint32_t plane_pixel_rate;
+	uint32_t y_min_scanlines;
+	uint32_t plane_bytes_per_line;
+	uint_fixed_16_16_t plane_blocks_per_line;
+	uint_fixed_16_16_t y_tile_minimum;
+	uint32_t linetime_us;
+};
+
 /*
  * This struct helps tracking the state needed for runtime PM, which puts the
  * device in PCI D3 state. Notice that when this happens, nothing on the
drivers/gpu/drm/i915/intel_pm.c +98 -81

261 lines not on this page · raw message

Signature · 6 lines
2.13.0

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

PATCH 3/8 drm/i915/gen10: Calculate and enable transition WM

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

GEN > 9 require transition WM to be programmed if IPC is enabled. This patch calculates & enable transition WM for supported platforms. If transition WM is enabled, Plane read requests are sent at high priority until filling above the transition watermark, then the requests are sent at lower priority until dropping below the level-0 WM. The lower priority requests allow other memory clients to have better memory access.

transition minimum is the minimum amount needed for trans_wm to work to ensure the demote does not happen before enough data has been read to meet the level 0 watermark requirements.

transition amount is configurable value. Higher values will tend to cause longer periods of high priority reads followed by longer periods of lower priority reads. Tuning to lower values will tend to cause shorter periods of high and lower priority reads.

Keeping transition amount to 10 in this patch, as suggested by HW team.

---
 drivers/gpu/drm/i915/intel_pm.c | 51 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +49 -2
index b2bd65847d9b..9a2ed1b734d5 100644
@@ -4579,12 +4579,55 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
 }
 
 static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
+				      struct skl_wm_params *wp,
+				      struct skl_wm_level *wm_l0,
+				      uint16_t ddb_allocation,
 				      struct skl_wm_level *trans_wm /* out */)
 {
+	struct drm_device *dev = cstate->base.crtc->dev;
+	const struct drm_i915_private *dev_priv = to_i915(dev);
+	uint16_t trans_min, trans_y_tile_min;
+	uint16_t trans_amount = 10; /* This is configurable amount */
+	uint16_t trans_offset_b, res_blocks;
+
 	if (!cstate->base.active)
+		goto exit;
+
+	/* Transition WM are not recommended by HW team for GEN9 */
+	if (INTEL_GEN(dev_priv) <= 9)
+		goto exit;
+
+	/* Transition WM don't make any sense if ipc is disabled */
+	if (!dev_priv->ipc_enabled)
+		goto exit;
+
+	if (INTEL_GEN(dev_priv) >= 10)
+		trans_min = 4;
+
+	trans_offset_b = trans_min + trans_amount;
+	trans_y_tile_min = (uint16_t) mul_round_up_u32_fixed16(2,
+							wp->y_tile_minimum);
+
+	if (wp->y_tiled) {
+		res_blocks = max(wm_l0->plane_res_b, trans_y_tile_min) +
+				trans_offset_b;
+	} else {
+		res_blocks = wm_l0->plane_res_b + trans_offset_b;
+	}
+
+	res_blocks += 1;
+
+	/* WA BUG:1938466 add one block for non y-tile planes */
+	if (!wp->y_tiled && IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_A0))
+		res_blocks += 1;
+
+	if (res_blocks < ddb_allocation) {
+		trans_wm->plane_res_b = res_blocks;
+		trans_wm->plane_en = true;
 		return;
+	}
 
-	/* Until we know more, just disable transition WMs */
+exit:
 	trans_wm->plane_en = false;
 }
 
@@ -4611,8 +4654,11 @@ static int skl_build_pipe_wm(struct intel_crtc_state *cstate,
 						to_intel_plane_state(pstate);
 		enum plane_id plane_id = to_intel_plane(plane)->id;
 		struct skl_wm_params wm_params;
+		enum pipe pipe = to_intel_crtc(cstate->base.crtc)->pipe;
+		uint16_t ddb_blocks;
 
 		wm = &pipe_wm->planes[plane_id];
+		ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][plane_id]);
 		memset(&wm_params, 0, sizeof(struct skl_wm_params));
 
 		ret = skl_compute_plane_wm_params(dev_priv, cstate,
@@ -4624,7 +4670,8 @@ static int skl_build_pipe_wm(struct intel_crtc_state *cstate,
 					    intel_pstate, &wm_params, wm);
 		if (ret)
 			return ret;
-		skl_compute_transition_wm(cstate, &wm->trans_wm);
+		skl_compute_transition_wm(cstate, &wm_params, &wm->wm[0],
+					  ddb_blocks, &wm->trans_wm);
 	}
 	pipe_wm->linetime = skl_compute_linetime_wm(cstate);
 
Signature · 6 lines
2.13.0

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

Re: [PATCH 3/8] drm/i915/gen10: Calculate and enable transition WM

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 34 lines

From: "Kumar, Mahesh" <[email protected]>

GEN > 9 require transition WM to be programmed if IPC is enabled. This patch calculates & enable transition WM for supported platforms. If transition WM is enabled, Plane read requests are sent at high priority until filling above the transition watermark, then the requests are sent at lower priority until dropping below the level-0 WM. The lower priority requests allow other memory clients to have better memory access.

transition minimum is the minimum amount needed for trans_wm to work to ensure the demote does not happen before enough data has been read to meet the level 0 watermark requirements.

transition amount is configurable value. Higher values will tend to cause longer periods of high priority reads followed by longer periods of lower priority reads. Tuning to lower values will tend to cause shorter periods of high and lower priority reads.

Keeping transition amount to 10 in this patch, as suggested by HW team.

---
 drivers/gpu/drm/i915/intel_pm.c | 51 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index b2bd65847d9b..9a2ed1b734d5 100644
@@ -4579,12 +4579,55 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
 }
 

drivers/gpu/drm/i915/intel_pm.c skl_compute_linetime_wm(struct intel_crtc_state *cstate) · line 4590

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +7 -0
 static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
+				      struct skl_wm_params *wp,
+				      struct skl_wm_level *wm_l0,
+				      uint16_t ddb_allocation,
 				      struct skl_wm_level *trans_wm /* out */)
 {
+	struct drm_device *dev = cstate->base.crtc->dev;
+	const struct drm_i915_private *dev_priv = to_i915(dev);
+	uint16_t trans_min, trans_y_tile_min;
+	uint16_t trans_amount = 10; /* This is configurable amount */

should probably be a const since it's a tweakable.

Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +12 -0
+	uint16_t trans_offset_b, res_blocks;
+
 	if (!cstate->base.active)
+		goto exit;
+
+	/* Transition WM are not recommended by HW team for GEN9 */
+	if (INTEL_GEN(dev_priv) <= 9)
+		goto exit;
+
+	/* Transition WM don't make any sense if ipc is disabled */
+	if (!dev_priv->ipc_enabled)
+		goto exit;
+

drivers/gpu/drm/i915/intel_pm.c skl_compute_linetime_wm(struct intel_crtc_state *cstate) · line 4613

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+	if (INTEL_GEN(dev_priv) >= 10)
+		trans_min = 4;
+
+	trans_offset_b = trans_min + trans_amount;
+	trans_y_tile_min = (uint16_t) mul_round_up_u32_fixed16(2,
+							wp->y_tile_minimum);
+
+	if (wp->y_tiled) {
+		res_blocks = max(wm_l0->plane_res_b, trans_y_tile_min) +
+				trans_offset_b;

Perhaps only calculate trans_y_tile_min if y-tiled?

drivers/gpu/drm/i915/intel_pm.c skl_compute_linetime_wm(struct intel_crtc_state *cstate) · line 4622

Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9 -0
+	} else {
+		res_blocks = wm_l0->plane_res_b + trans_offset_b;
+	}
+
+	res_blocks += 1;
+
+	/* WA BUG:1938466 add one block for non y-tile planes */
+	if (!wp->y_tiled && IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_A0))
+		res_blocks += 1;

Could be added to the !y_tiled branch?

Patch looks sane though, and seems to match bspec exactly. I couldn't find the value for trans_amount, but I'll take your word it's the right one. :)

With the minor fixes:

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

#5 lore raw

PATCH 4/8 drm/i915/glk: IPC linetime watermark workaround for GLK

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

IF IPC is enabled LINETIME_WM value should be half of calculated value
line time = ROUNDDOWN(1/2 * Calculated Line Time)

Earlier code was rounding-up the value, But updated Bspec says we should take the ROUNDDOWN. This patch corrects that as well.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -3
index 9a2ed1b734d5..dac0fcf8b54e 100644
@@ -4571,9 +4571,10 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
 
 	linetime_wm = fixed16_to_u32_round_up(mul_u32_fixed16(8, linetime_us));
 
-	/* Display WA #1135: bxt. */
-	if (IS_BROXTON(dev_priv) && dev_priv->ipc_enabled)
-		linetime_wm = DIV_ROUND_UP(linetime_wm, 2);
+	/* Display WA #1135: bxt:ALL GLK:ALL */
+	if ((IS_BROXTON(dev_priv) || IS_GEMINILAKE(dev_priv)) &&
+	    dev_priv->ipc_enabled)
+		linetime_wm /= 2;
 
 	return linetime_wm;
 }
Signature · 6 lines
2.13.0

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

PATCH 5/8 drm/i915/cnl: Extend WM workaround with IPC for CNL

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

CNL:A & CNL:B have same workaround as KBL to increase wm level latency by 4us if IPC is enabled.

---
 drivers/gpu/drm/i915/intel_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +2 -1
index dac0fcf8b54e..f2794d29f217 100644
@@ -4447,7 +4447,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 	}
 
 	/* Display WA #1141: kbl,cfl */
-	if ((IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) &&
+	if ((IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
+	    IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0)) &&
 	    dev_priv->ipc_enabled)
 		latency += 4;
 
Signature · 6 lines
2.13.0

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

PATCH 6/8 drm/i915/gen9+: Add has_ipc flag in device info structure

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

New Isochronous Priority Control (IPC) capability is introduced in newer GEN platforms. This patch adds a device info flag to indicate if platform supports IPC. Patch also sets this flag in supported platforms.

---
 drivers/gpu/drm/i915/i915_drv.h | 5 ++++-
 drivers/gpu/drm/i915/i915_pci.c | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +4 -1
index 62ba18d6717f..47745e3de841 100644
@@ -784,7 +784,8 @@ struct intel_csr {
 	func(cursor_needs_physical); \
 	func(hws_needs_physical); \
 	func(overlay_needs_physical); \
-	func(supports_tv);
+	func(supports_tv); \
+	func(has_ipc);
 
 struct sseu_dev_info {
 	u8 slice_mask;
@@ -3011,6 +3012,8 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define HAS_RUNTIME_PM(dev_priv) ((dev_priv)->info.has_runtime_pm)
 #define HAS_64BIT_RELOC(dev_priv) ((dev_priv)->info.has_64bit_reloc)
 
+#define HAS_IPC(dev_priv)		 ((dev_priv)->info.has_ipc)
+
 /*
  * For now, anything with a GuC requires uCode loading, and then supports
  * command submission once loaded. But these are logically independent
drivers/gpu/drm/i915/i915_pci.c +4 -0
index a1e6b696bcfa..0dbdfe0f32a5 100644
@@ -390,6 +390,7 @@ static const struct intel_device_info intel_skylake_gt3_info = {
 	.has_full_ppgtt = 1, \
 	.has_full_48bit_ppgtt = 1, \
 	.has_reset_engine = 1, \
+	.has_ipc = 1, \
 	GEN_DEFAULT_PIPEOFFSETS, \
 	IVB_CURSOR_OFFSETS, \
 	BDW_COLORS
@@ -413,6 +414,7 @@ static const struct intel_device_info intel_geminilake_info = {
 	.platform = INTEL_KABYLAKE, \
 	.has_csr = 1, \
 	.has_guc = 1, \
+	.has_ipc = 1, \
 	.ddb_size = 896
 
 static const struct intel_device_info intel_kabylake_info = {
@@ -431,6 +433,7 @@ static const struct intel_device_info intel_kabylake_gt3_info = {
 	.platform = INTEL_COFFEELAKE, \
 	.has_csr = 1, \
 	.has_guc = 1, \
+	.has_ipc = 1, \
 	.ddb_size = 896
 
 static const struct intel_device_info intel_coffeelake_info = {
@@ -449,6 +452,7 @@ static const struct intel_device_info intel_cannonlake_info = {
 	.gen = 10,
 	.ddb_size = 1024,
 	.has_csr = 1,
+	.has_ipc = 1,
 	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
 };
 
Signature · 6 lines
2.13.0

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

PATCH 7/8 drm/i915/bxt+: Enable IPC support

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

This patch adds IPC support. This patch also enables IPC in all supported platforms based on has_ipc flag.
IPC (Isochronous Priority Control) is the hardware feature, which dynamically controls the memory read priority of Display.

When IPC is enabled, plane read requests are sent at high priority until filling above the transition watermark, then the requests are sent at lower priority until dropping below the level 0 watermark. The lower priority requests allow other memory clients to have better memory access. When IPC is disabled, all plane read requests are sent at high priority.

Changes since V1:
- Remove commandline parameter to disable ipc
- Address Paulo's comments
Changes since V2:
- Address review comments
- Set ipc_enabled flag
Changes since V3:
- move ipc_enabled flag assignment inside intel_ipc_enable function
Changes since V4:
- Re-enable IPC after suspend/resume
Changes since V5:
- Enable IPC for all gen >=9 except SKL
Changes since V6:
- fix commit msg
- after resume program IPC based on SW state.
Changes since V7:
- Modify IPC support check based on HAS_IPC macro (suggested by Chris)

---
 drivers/gpu/drm/i915/i915_drv.c      |  4 +++-
 drivers/gpu/drm/i915/i915_reg.h      |  1 +
 drivers/gpu/drm/i915/intel_display.c |  1 +
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 drivers/gpu/drm/i915/intel_pm.c      | 24 ++++++++++++++++++++++++
 5 files changed, 31 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +3 -1
index d310d8245dca..c69958b55ee2 100644
@@ -1338,7 +1338,7 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	intel_runtime_pm_enable(dev_priv);
 
-	dev_priv->ipc_enabled = false;
+	intel_init_ipc(dev_priv);
 
 	if (IS_ENABLED(CONFIG_DRM_I915_DEBUG))
 		DRM_INFO("DRM_I915_DEBUG enabled\n");
@@ -2602,6 +2602,8 @@ static int intel_runtime_resume(struct device *kdev)
 	if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
 		intel_hpd_init(dev_priv);
 
+	intel_enable_ipc(dev_priv);
+
 	enable_rpm_wakeref_asserts(dev_priv);
 
 	if (ret)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index c712d01f92ab..4ceda0fc1baf 100644
@@ -6728,6 +6728,7 @@ enum {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	_MMIO(0x45004)
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define  DISP_IPC_ENABLE		(1<<3)
 #define DBUF_CTL	_MMIO(0x45008)
 #define  DBUF_POWER_REQUEST		(1<<31)
 #define  DBUF_POWER_STATE		(1<<30)
drivers/gpu/drm/i915/intel_display.c +1 -0
index 0ed454a23e34..0a5d6ba64925 100644
@@ -15733,6 +15733,7 @@ void intel_display_resume(struct drm_device *dev)
 	if (!ret)
 		ret = __intel_display_resume(dev, state, &ctx);
 
+	intel_enable_ipc(dev_priv);
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 0902d7cb48d9..7b0e834a61f9 100644
@@ -1883,6 +1883,8 @@ bool ilk_disable_lp_wm(struct drm_device *dev);
 int sanitize_rc6_option(struct drm_i915_private *dev_priv, int enable_rc6);
 int skl_check_pipe_max_pixel_rate(struct intel_crtc *intel_crtc,
 				  struct intel_crtc_state *cstate);
+void intel_init_ipc(struct drm_i915_private *dev_priv);
+void intel_enable_ipc(struct drm_i915_private *dev_priv);
 static inline int intel_enable_rc6(void)
 {
 	return i915.enable_rc6;
drivers/gpu/drm/i915/intel_pm.c +24 -0
index f2794d29f217..70f59df09e75 100644
@@ -5772,6 +5772,30 @@ void intel_update_watermarks(struct intel_crtc *crtc)
 		dev_priv->display.update_wm(crtc);
 }
 
+void intel_enable_ipc(struct drm_i915_private *dev_priv)
+{
+	u32 val;
+
+	val = I915_READ(DISP_ARB_CTL2);
+
+	if (dev_priv->ipc_enabled)
+		val |= DISP_IPC_ENABLE;
+	else
+		val &= ~DISP_IPC_ENABLE;
+
+	I915_WRITE(DISP_ARB_CTL2, val);
+}
+
+void intel_init_ipc(struct drm_i915_private *dev_priv)
+{
+	dev_priv->ipc_enabled = false;
+	if (!HAS_IPC(dev_priv))
+		return;
+
+	dev_priv->ipc_enabled = true;
+	intel_enable_ipc(dev_priv);
+}
+
 /*
  * Lock protecting IPS related data structures
  */
Signature · 6 lines
2.13.0

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

Re: [PATCH 7/8] drm/i915/bxt+: Enable IPC support

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 23 lines

From: "Kumar, Mahesh" <[email protected]>

This patch adds IPC support. This patch also enables IPC in all supported platforms based on has_ipc flag.
IPC (Isochronous Priority Control) is the hardware feature, which dynamically controls the memory read priority of Display.

When IPC is enabled, plane read requests are sent at high priority until filling above the transition watermark, then the requests are sent at lower priority until dropping below the level 0 watermark. The lower priority requests allow other memory clients to have better memory access. When IPC is disabled, all plane read requests are sent at high priority.

Changes since V1:
- Remove commandline parameter to disable ipc
- Address Paulo's comments
Changes since V2:
- Address review comments
- Set ipc_enabled flag
Changes since V3:
- move ipc_enabled flag assignment inside intel_ipc_enable function
Changes since V4:

Quoted 8 lines

- Re-enable IPC after suspend/resume
Changes since V5:
- Enable IPC for all gen >=9 except SKL
Changes since V6:
- fix commit msg
- after resume program IPC based on SW state.
Changes since V7:
- Modify IPC support check based on HAS_IPC macro (suggested by Chris)

Much better, for all patches without comments..

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

#10 lore raw

PATCH 8/8 drm/i915/skl+: debugfs entry to control IPC

In reply to Mahesh Kumar

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +72 -1
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = m->private;
+
+	seq_printf(m, "Isochronous Priority Control: %s\n",
+			enableddisabled(dev_priv->ipc_enabled));
+	return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *dev_priv = inode->i_private;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct drm_i915_private *dev_priv = m->private;
+	char *newline;
+	char tmp[16];
+	bool enable;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	if (len >= sizeof(tmp))
+		return -EINVAL;
+
+	if (copy_from_user(tmp, ubuf, len))
+		return -EFAULT;
+
+	tmp[len] = '\0';
+
+	/* Strip newline, if any */
+	newline = strchr(tmp, '\n');
+	if (newline)
+		*newline = '\0';
+
+	if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
+	    strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+		enable = false;
+	else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+	    strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+		enable = true;
+	else
+		return -EINVAL;
+
+	intel_runtime_pm_get(dev_priv);
+	dev_priv->ipc_enabled = enable;
+	intel_enable_ipc(dev_priv);
+	intel_runtime_pm_put(dev_priv);
+
+	return len;
+}
+
+static const struct file_operations i915_ipc_status_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_ipc_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = i915_ipc_status_write
+};
+
 static int i915_ddb_info(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -4929,7 +4999,8 @@ static const struct i915_debugfs_files {
 	{"i915_dp_test_type", &i915_displayport_test_type_fops},
 	{"i915_dp_test_active", &i915_displayport_test_active_fops},
 	{"i915_guc_log_control", &i915_guc_log_control_fops},
-	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}
+	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
+	{"i915_ipc_status", &i915_ipc_status_fops}
 };
 
 int i915_debugfs_register(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.13.0

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

Re: [PATCH 8/8] drm/i915/skl+: debugfs entry to control IPC

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 23 lines

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = m->private;
+
+	seq_printf(m, "Isochronous Priority Control: %s\n",

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3609

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+			enableddisabled(dev_priv->ipc_enabled));
+	return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *dev_priv = inode->i_private;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;

I take it you didn't test this version of the patch? :p

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
+
+	return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3624

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct drm_i915_private *dev_priv = m->private;
+	char *newline;
+	char tmp[16];
+	bool enable;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;

Again, though I would remove this check since you already test in open().

Quoted 11 lines
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
+	if (len >= sizeof(tmp))
+		return -EINVAL;
+
+	if (copy_from_user(tmp, ubuf, len))
+		return -EFAULT;
+
+	tmp[len] = '\0';
+
+	/* Strip newline, if any */
+	newline = strchr(tmp, '\n');
+	if (newline)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3646

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+		*newline = '\0';
+
+	if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
+	    strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+		enable = false;
+	else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+	    strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+		enable = true;
+	else
+		return -EINVAL;

Maybe replace with kstrtobool_from_user, and use yesno for ipc_enabled in show()? That way you won't have to do all these special cases here. :)

Quoted 22 lines
drivers/gpu/drm/i915/i915_debugfs.c +18 -0
+
+	intel_runtime_pm_get(dev_priv);
+	dev_priv->ipc_enabled = enable;
+	intel_enable_ipc(dev_priv);
+	intel_runtime_pm_put(dev_priv);
+
+	return len;
+}
+
+static const struct file_operations i915_ipc_status_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_ipc_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = i915_ipc_status_write
+};
+
 static int i915_ddb_info(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);

drivers/gpu/drm/i915/i915_debugfs.c static const struct i915_debugfs_files { · line 5006

Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -4929,7 +4999,8 @@ static const struct i915_debugfs_files {
 	{"i915_dp_test_type", &i915_displayport_test_type_fops},
 	{"i915_dp_test_active", &i915_displayport_test_active_fops},
 	{"i915_guc_log_control", &i915_guc_log_control_fops},
-	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}
+	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
+	{"i915_ipc_status", &i915_ipc_status_fops}
 };
 
 int i915_debugfs_register(struct drm_i915_private *dev_priv)

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

#12 lore raw

Re: [PATCH 8/8] drm/i915/skl+: debugfs entry to control IPC

Hi,

Thanks for review.

Quoted 19 lines · Maarten Lankhorst

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 18 lines

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
  drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
  1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
  	return 0;
  }
 
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
+static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = m->private;
+
+	seq_printf(m, "Isochronous Priority Control: %s\n",

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3609

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+			enableddisabled(dev_priv->ipc_enabled));
+	return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *dev_priv = inode->i_private;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;

I take it you didn't test this version of the patch? :p

hmm, I switched HAS_IPC macro in this version of patch only. will fix this. thanks for catching it.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -0
+
+	return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3624

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+	struct drm_i915_private *dev_priv = m->private;
+	char *newline;
+	char tmp[16];
+	bool enable;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;

Again, though I would remove this check since you already test in open().

ok, will remove this check.

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_debugfs.c +14 -0
+	if (len >= sizeof(tmp))
+		return -EINVAL;
+
+	if (copy_from_user(tmp, ubuf, len))
+		return -EFAULT;
+
+	tmp[len] = '\0';
+
+	/* Strip newline, if any */
+	newline = strchr(tmp, '\n');
+	if (newline)
+		*newline = '\0';
+
+	if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3646

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+	    strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+		enable = false;
+	else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+	    strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+		enable = true;
+	else
+		return -EINVAL;

Maybe replace with kstrtobool_from_user, and use yesno for ipc_enabled in show()? That way you won't have to do all these special cases here. :)

kstrtobool_from_user sounds good, will use this macro :)

-Mahesh

Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/i915_debugfs.c +20 -1
+
+	intel_runtime_pm_get(dev_priv);
+	dev_priv->ipc_enabled = enable;
+	intel_enable_ipc(dev_priv);
+	intel_runtime_pm_put(dev_priv);
+
+	return len;
+}
+
+static const struct file_operations i915_ipc_status_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_ipc_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = i915_ipc_status_write
+};
+
  static int i915_ddb_info(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -4929,7 +4999,8 @@ static const struct i915_debugfs_files {
  	{"i915_dp_test_type", &i915_displayport_test_type_fops},
  	{"i915_dp_test_active", &i915_displayport_test_active_fops},
  	{"i915_guc_log_control", &i915_guc_log_control_fops},
-	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}
+	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
+	{"i915_ipc_status", &i915_ipc_status_fops}
  };
 
Quoted 2 lines

drivers/gpu/drm/i915/i915_debugfs.c static const struct i915_debugfs_files { · line 5006

Quoted 1 line
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
  int i915_debugfs_register(struct drm_i915_private *dev_priv)

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

#13 lore raw

Re: [PATCH 8/8] drm/i915/skl+: debugfs entry to control IPC

In reply to Mahesh Kumar

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 65 lines

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +47 -0
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = m->private;
+
+	seq_printf(m, "Isochronous Priority Control: %s\n",
+			enableddisabled(dev_priv->ipc_enabled));
+	return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *dev_priv = inode->i_private;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct drm_i915_private *dev_priv = m->private;
+	char *newline;
+	char tmp[16];
+	bool enable;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	if (len >= sizeof(tmp))
+		return -EINVAL;
+
+	if (copy_from_user(tmp, ubuf, len))
+		return -EFAULT;
+
+	tmp[len] = '\0';
+
+	/* Strip newline, if any */
+	newline = strchr(tmp, '\n');
+	if (newline)
+		*newline = '\0';
+
+	if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
+	    strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+		enable = false;

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3651

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+	else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+	    strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+		enable = true;
+	else
+		return -EINVAL;
+
+	intel_runtime_pm_get(dev_priv);
+	dev_priv->ipc_enabled = enable;
+	intel_enable_ipc(dev_priv);
+	intel_runtime_pm_put(dev_priv);

Hm, intel_enable_ipc should take a bool on whether to enable ipc.

Forcefully enabling IPC here might give weird effects until the next plane update. The transition watermarks are not updated yet until the next commit. This could probably be handled here, but that would be overkill..

Perhaps add a drm_info or something about it when setting enable = true, when it was previously false?

Quoted 17 lines
drivers/gpu/drm/i915/i915_debugfs.c +13 -0
+
+	return len;
+}
+
+static const struct file_operations i915_ipc_status_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_ipc_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = i915_ipc_status_write
+};
+
 static int i915_ddb_info(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);

drivers/gpu/drm/i915/i915_debugfs.c static const struct i915_debugfs_files { · line 5006

Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -4929,7 +4999,8 @@ static const struct i915_debugfs_files {
 	{"i915_dp_test_type", &i915_displayport_test_type_fops},
 	{"i915_dp_test_active", &i915_displayport_test_active_fops},
 	{"i915_guc_log_control", &i915_guc_log_control_fops},
-	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}
+	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
+	{"i915_ipc_status", &i915_ipc_status_fops}
 };
 
 int i915_debugfs_register(struct drm_i915_private *dev_priv)

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

#14 lore raw

Re: [PATCH 8/8] drm/i915/skl+: debugfs entry to control IPC

Hi,

Quoted 69 lines · Maarten Lankhorst

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 68 lines

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
  drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
  1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +50 -0
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
  	return 0;
  }
 
+static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = m->private;
+
+	seq_printf(m, "Isochronous Priority Control: %s\n",
+			enableddisabled(dev_priv->ipc_enabled));
+	return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *dev_priv = inode->i_private;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
+				     size_t len, loff_t *offp)
+{
+	struct seq_file *m = file->private_data;
+	struct drm_i915_private *dev_priv = m->private;
+	char *newline;
+	char tmp[16];
+	bool enable;
+
+	if (HAS_IPC(dev_priv))
+		return -ENODEV;
+
+	if (len >= sizeof(tmp))
+		return -EINVAL;
+
+	if (copy_from_user(tmp, ubuf, len))
+		return -EFAULT;
+
+	tmp[len] = '\0';
+
+	/* Strip newline, if any */
+	newline = strchr(tmp, '\n');
+	if (newline)
+		*newline = '\0';
+
+	if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
+	    strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+		enable = false;
+	else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+	    strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+		enable = true;
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3651

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+	else
+		return -EINVAL;
+
+	intel_runtime_pm_get(dev_priv);
+	dev_priv->ipc_enabled = enable;
+	intel_enable_ipc(dev_priv);
+	intel_runtime_pm_put(dev_priv);

Hm, intel_enable_ipc should take a bool on whether to enable ipc.

intel_enable_ipc takes decision to enable/disable ipc based on dev_priv->ipc_enabled value. which is anyway input to function.

Quoted 2 lines

Forcefully enabling IPC here might give weird effects until the next plane update. The transition watermarks are not updated yet until the next commit. This could probably be handled here, but that would be overkill..

yes, agree, but I don't wanted to call a commit internally. Will add a drm_info when changing IPC disable => enable as suggested. -Mahesh

Quoted 27 lines

Perhaps add a drm_info or something about it when setting enable = true, when it was previously false?

Quoted 25 lines
drivers/gpu/drm/i915/i915_debugfs.c +15 -1
+
+	return len;
+}
+
+static const struct file_operations i915_ipc_status_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_ipc_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+	.write = i915_ipc_status_write
+};
+
  static int i915_ddb_info(struct seq_file *m, void *unused)
  {
  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -4929,7 +4999,8 @@ static const struct i915_debugfs_files {
  	{"i915_dp_test_type", &i915_displayport_test_type_fops},
  	{"i915_dp_test_active", &i915_displayport_test_active_fops},
  	{"i915_guc_log_control", &i915_guc_log_control_fops},
-	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops}
+	{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
+	{"i915_ipc_status", &i915_ipc_status_fops}
  };
 
Quoted 2 lines

drivers/gpu/drm/i915/i915_debugfs.c static const struct i915_debugfs_files { · line 5006

Quoted 1 line
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
  int i915_debugfs_register(struct drm_i915_private *dev_priv)

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

#15 lore raw

Re: [PATCH 8/8] drm/i915/skl+: debugfs entry to control IPC

Op 10-08-17 om 10:56 schreef Mahesh Kumar:

Quoted 80 lines

Hi,

Quoted 68 lines · Maarten Lankhorst

Op 18-07-17 om 14:49 schreef Mahesh Kumar:

Quoted 67 lines

From: "Kumar, Mahesh" <[email protected]>

This patch creates an entry in debugfs to check the status of IPC. This can also be used to enable/disable IPC in supported platforms.

---
  drivers/gpu/drm/i915/i915_debugfs.c | 73 ++++++++++++++++++++++++++++++++++++-
  1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +49 -0
index 2ef75c1a6119..368f64de0fdc 100644
@@ -3592,6 +3592,76 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
      return 0;
  }
  +static int i915_ipc_status_show(struct seq_file *m, void *data)
+{
+    struct drm_i915_private *dev_priv = m->private;
+
+    seq_printf(m, "Isochronous Priority Control: %s\n",
+            enableddisabled(dev_priv->ipc_enabled));
+    return 0;
+}
+
+static int i915_ipc_status_open(struct inode *inode, struct file *file)
+{
+    struct drm_i915_private *dev_priv = inode->i_private;
+
+    if (HAS_IPC(dev_priv))
+        return -ENODEV;
+
+    return single_open(file, i915_ipc_status_show, dev_priv);
+}
+
+static ssize_t i915_ipc_status_write(struct file *file, const char __user *ubuf,
+                     size_t len, loff_t *offp)
+{
+    struct seq_file *m = file->private_data;
+    struct drm_i915_private *dev_priv = m->private;
+    char *newline;
+    char tmp[16];
+    bool enable;
+
+    if (HAS_IPC(dev_priv))
+        return -ENODEV;
+
+    if (len >= sizeof(tmp))
+        return -EINVAL;
+
+    if (copy_from_user(tmp, ubuf, len))
+        return -EFAULT;
+
+    tmp[len] = '\0';
+
+    /* Strip newline, if any */
+    newline = strchr(tmp, '\n');
+    if (newline)
+        *newline = '\0';
+
+    if (strcmp(tmp, "0") == 0 || strcmp(tmp, "disable") == 0 ||
+        strcmp(tmp, "off") == 0 || strcmp(tmp, "dis") == 0)
+        enable = false;
+    else if (strcmp(tmp, "1") == 0 || strcmp(tmp, "enable") == 0 ||
+        strcmp(tmp, "on") == 0 || strcmp(tmp, "en") == 0)
+        enable = true;
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3651

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+    else
+        return -EINVAL;
+
+    intel_runtime_pm_get(dev_priv);
+    dev_priv->ipc_enabled = enable;
+    intel_enable_ipc(dev_priv);
+    intel_runtime_pm_put(dev_priv);

Hm, intel_enable_ipc should take a bool on whether to enable ipc.

Quoted 4 lines

intel_enable_ipc takes decision to enable/disable ipc based on dev_priv->ipc_enabled value. which is anyway input to function.

Quoted 2 lines

Forcefully enabling IPC here might give weird effects until the next plane update. The transition watermarks are not updated yet until the next commit. This could probably be handled here, but that would be overkill..

yes, agree, but I don't wanted to call a commit internally. Will add a drm_info when changing IPC disable => enable as suggested.

True, perhaps we could set dev_priv->wm.distrust_bios_wm to force recalculation next time?

~Maarten

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

#16 lore raw

✓ Fi.CI.BAT: success for Fixed16.16 wrapper cleanup & wm optimization (rev6)

In reply to Mahesh Kumar
== Series Details ==

== Series Details ==

Series: Fixed16.16 wrapper cleanup & wm optimization (rev6)
URL : https://patchwork.freedesktop.org/series/25692/
State : success

== Summary ==

Series 25692v6 Fixed16.16 wrapper cleanup & wm optimization
https://patchwork.freedesktop.org/api/1.0/series/25692/revisions/6/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) k.org#196399
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-j1900) fdo#101705 +1

k.org#196399 https://bugzilla.kernel.org/show_bug.cgi?id=196399
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:439s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:429s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:358s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:535s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:504s
fi-byt-j1900     total:279  pass:255  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:490s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:598s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:443s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:417s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:414s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:499s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:466s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:463s
fi-kbl-7560u     total:279  pass:268  dwarn:1   dfail:0   fail:0   skip:10  time:571s
fi-kbl-r         total:279  pass:260  dwarn:1   dfail:0   fail:0   skip:18  time:578s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:563s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:453s
fi-skl-6700hq    total:279  pass:262  dwarn:0   dfail:0   fail:0   skip:17  time:586s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:467s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:475s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:441s
fi-skl-x1585l    total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:463s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:548s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:399s

10de1e17faaab452782e5a1baffd1b30a639a261 drm-tip: 2017y-07m-18d-10h-08m-42s UTC integration manifest e6dea33 drm/i915/skl+: debugfs entry to control IPC
38552712 drm/i915/bxt+: Enable IPC support
1564688 drm/i915/gen9+: Add has_ipc flag in device info structure
fac25d3 drm/i915/cnl: Extend WM workaround with IPC for CNL
c99e00c drm/i915/glk: IPC linetime watermark workaround for GLK
c549418 drm/i915/gen10: Calculate and enable transition WM
a180ccf drm/i915/skl+: Optimize WM calculation
10e25f6 drm/i915: Fixed point fixed16 wrapper cleanup

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5218/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx