Skip to contentSkip to conversation

Basic Broxton enabling

PATCH In review Imre Deak 14 participants 191 messages Mar 17, 2015 – Apr 24, 2015 Page 1 of 2

Subsystems (5)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

cover Basic Broxton enabling

Hi,

This patchset adds basic graphics driver support for Broxton (BXT).

Broxton is the latest Intel® Atom(tm) Processor from Intel® with HD Graphics.

The major GPU hardware features include:
- Gen9 Intel® HD Graphics
- The addition of a 3rd display plane
- Three HDMI/DP/eDP display ports
- Two MIPI/DSI display ports

The GPU side is very similar to the one in Skylake. This is also true for the display side, with the exception of the added DSI ports and a different DP/HDMI PHY hardware implementation, the latter one being a Valleyview/Cherryview derivative. Based on this most of the patches in this series are related to the display side. Features yet to be implemented include DSI support and runtime power management, patches for these will follow after this series.

Thanks for all who contributed to this effort, especially:
Damien Lespiau
Satheesh Krishna
Vandana Kannan
Ben Widawsky
Jesse Barnes

--Imre

A.Sunil Kamath (4):
drm/i915/bxt: Add change to support gmbus pin pair for BXT drm/i915/bxt: WARN in case BXT unused gmbus ports are accessed drm/i915/bxt: Avoid registering unused gmbus ports as i2c adapter drm/i915/bxt: Implement enable/disable for Display C9 state

Ben Widawsky (3):
drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround drm/i915/bxt: add WaDisableMaskBasedCammingInRCC workaround drm/i915/skl: add WaDisableMaskBasedCammingInRCC workaround

Daisy Sun (1):
drm/i915/bxt: BXT FBC enablement

Damien Lespiau (8):
drm/i915/bxt: Add BXT PCI ids
drm/i915/bxt: Broxton uses the same GMS values as Skylake drm/i915/bxt: Broxton has 3 sprite planes on pipe A/B, 2 on pipe C drm/i915/bxt: Add the plane4 related interrupt definitions drm/i915/bxt: Broxton DDB is 512 blocks
drm/i915/bxt: Broxton raises the maximum number of planes to 4 drm/i915: Iterate through the initialized DDIs to prepare their
buffers
drm/i915: Don't write the HDMI buffer translation entry when not
needed

Imre Deak (10):
drm/i915/bxt: map GTT as uncached
drm/i915/gen9: fix PIPE_CONTROL flush for VS_INVALIDATE drm/i915/bxt: add bxt_init_clock_gating
drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround drm/i915/bxt: add description about the BXT PHYs drm/i915: factor out vlv_PLL_is_optimal
drm/i915: check for div-by-zero in vlv_PLL_is_optimal drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll drm/i915/bxt: add bxt_find_best_dpll
drm/i915: suppress false PLL state warnings on non-GMCH platforms

Jesse Barnes (1):
drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Nick Hoath (1):
drm/i915/bxt: HardWare WorkAround ring initialisation for Broxton

Robert Beckett (1):
drm/i915/bxt: add workaround to avoid PTE corruption

Satheeshakrishna M (8):
drm/i915/bxt: Add IS_BROXTON macro
drm/i915/bxt: Define BXT power domains
drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9 drm/i915/bxt: Define bxt DDI PLLs and implement enable/disable
sequence
drm/i915/bxt: BXT clock divider calculation drm/i915/bxt: Assign PLL for pipe
drm/i915/bxt: Determine PLL attached to pipe drm/i915/bxt: Determine programmed frequency

Shashank Sharma (4):
drm/i915/bxt: DDI Hotplug interrupt setup drm/i915/bxt: Add DDI hpd handler drm/i915/bxt: Add BXT support in gen8_irq functions drm/i915/bxt: Enable GMBUS IRQ

Suketu Shah (1):
drm/i915/bxt: Add DC9 Trigger sequence

Sumit Singh (1):
drm/i915/bxt: Enable PTE encoding

Vandana Kannan (6):
drm/i915/bxt: don't use unsupported port detection drm/i915/bxt: Increase DDI buf idle timeout drm/i915: Rename vlv_cdclk_freq to cdclk_freq drm/i915/bxt: add display initialize/uninitialize sequence drm/i915/bxt: VSwing programming sequence drm/i915/bxt: Update max level of vswing

 Documentation/DocBook/drm.tmpl          |   4 +-
 arch/x86/kernel/early-quirks.c          |   1 +
 drivers/gpu/drm/i915/i915_dma.c         |   6 +-
 drivers/gpu/drm/i915/i915_drv.c         |  45 +-
 drivers/gpu/drm/i915/i915_drv.h         |  20 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c     |   9 +-
 drivers/gpu/drm/i915/i915_irq.c         | 122 ++++-
 drivers/gpu/drm/i915/i915_reg.h         | 316 ++++++++++++-
 drivers/gpu/drm/i915/intel_bios.c       |   3 +-
 drivers/gpu/drm/i915/intel_ddi.c        | 787 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_display.c    | 290 ++++++++++--
 drivers/gpu/drm/i915/intel_dp.c         |  70 ++-
 drivers/gpu/drm/i915/intel_dp_mst.c     |   6 +-
 drivers/gpu/drm/i915/intel_drv.h        |  11 +
 drivers/gpu/drm/i915/intel_dvo.c        |   2 +-
 drivers/gpu/drm/i915/intel_i2c.c        |  79 +++-
 drivers/gpu/drm/i915/intel_lrc.c        |  19 +-
 drivers/gpu/drm/i915/intel_lvds.c       |   2 +-
 drivers/gpu/drm/i915/intel_pm.c         |  33 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |  21 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c | 121 +++++
 drivers/gpu/drm/i915/intel_sdvo.c       |   4 +-
 include/drm/i915_pciids.h               |   6 +
 23 files changed, 1857 insertions(+), 120 deletions(-)
Signature · 6 lines
2.1.0

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

PATCH 1/49 drm/i915/bxt: Add BXT PCI ids

From: Damien Lespiau <[email protected]>

v2: Switch to info->ring_mask and add VEBOX support.
v3: Fold in update from Damien.
v4: Add GEN_DEFAULT_PIPEOFFSETS and IVB_CURSOR_OFFSETS
v5: set no-LLC (imre)

---
 drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++++-
 include/drm/i915_pciids.h       |  6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +13 -1
index 82f8be4..4d50785 100644
@@ -381,6 +381,17 @@ static const struct intel_device_info intel_skylake_gt3_info = {
 	IVB_CURSOR_OFFSETS,
 };
 
+static const struct intel_device_info intel_broxton_info = {
+	.is_preliminary = 1,
+	.gen = 9,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
+	.num_pipes = 3,
+	.has_ddi = 1,
+	GEN_DEFAULT_PIPEOFFSETS,
+	IVB_CURSOR_OFFSETS,
+};
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
@@ -420,7 +431,8 @@ static const struct intel_device_info intel_skylake_gt3_info = {
 	INTEL_CHV_IDS(&intel_cherryview_info),	\
 	INTEL_SKL_GT1_IDS(&intel_skylake_info),	\
 	INTEL_SKL_GT2_IDS(&intel_skylake_info),	\
-	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info)	\
+	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),	\
+	INTEL_BXT_IDS(&intel_broxton_info)
 
 static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_PCI_IDS,
include/drm/i915_pciids.h +6 -0
index 6133723..bd0d644 100644
@@ -287,4 +287,10 @@
 	INTEL_SKL_GT3_IDS(info)
 
 
+#define INTEL_BXT_IDS(info) \
+	INTEL_VGA_DEVICE(0x0A84, info), \
+	INTEL_VGA_DEVICE(0x0A85, info), \
+	INTEL_VGA_DEVICE(0x0A86, info), \
+	INTEL_VGA_DEVICE(0x0A87, info)
+
 #endif /* _I915_PCIIDS_H */
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/49
#2 lore raw

Re: [PATCH 01/49] drm/i915/bxt: Add BXT PCI ids

Quoted 53 lines · Imre Deak

From: Damien Lespiau <[email protected]>

v2: Switch to info->ring_mask and add VEBOX support.
v3: Fold in update from Damien.
v4: Add GEN_DEFAULT_PIPEOFFSETS and IVB_CURSOR_OFFSETS
v5: set no-LLC (imre)

---
 drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++++-
 include/drm/i915_pciids.h       |  6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +13 -1
index 82f8be4..4d50785 100644
@@ -381,6 +381,17 @@ static const struct intel_device_info intel_skylake_gt3_info = {
 	IVB_CURSOR_OFFSETS,
 };
 
+static const struct intel_device_info intel_broxton_info = {
+	.is_preliminary = 1,
+	.gen = 9,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
+	.num_pipes = 3,
+	.has_ddi = 1,
+	GEN_DEFAULT_PIPEOFFSETS,
+	IVB_CURSOR_OFFSETS,
+};
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
@@ -420,7 +431,8 @@ static const struct intel_device_info intel_skylake_gt3_info = {
 	INTEL_CHV_IDS(&intel_cherryview_info),	\
 	INTEL_SKL_GT1_IDS(&intel_skylake_info),	\
 	INTEL_SKL_GT2_IDS(&intel_skylake_info),	\
-	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info)	\
+	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),	\
+	INTEL_BXT_IDS(&intel_broxton_info)
 
 static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_PCI_IDS,
include/drm/i915_pciids.h +0 -0
index 6133723..bd0d644 100644

include/drm/i915_pciids.h line 296

Quoted 10 lines
include/drm/i915_pciids.h +6 -0
@@ -287,4 +287,10 @@
 	INTEL_SKL_GT3_IDS(info)
 
 
+#define INTEL_BXT_IDS(info) \
+	INTEL_VGA_DEVICE(0x0A84, info), \
+	INTEL_VGA_DEVICE(0x0A85, info), \
+	INTEL_VGA_DEVICE(0x0A86, info), \
+	INTEL_VGA_DEVICE(0x0A87, info)
+
 #endif /* _I915_PCIIDS_H */

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

author
#3 lore raw

PATCH 2/49 drm/i915/bxt: BXT FBC enablement

In reply to Imre Deak

From: Daisy Sun <[email protected]>

Enable FBC feature on Broxton

Issue: VIZ-3784

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 4d50785..48434cb6 100644
@@ -388,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = {
 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
 	.num_pipes = 3,
 	.has_ddi = 1,
+	.has_fbc = 1,
 	GEN_DEFAULT_PIPEOFFSETS,
 	IVB_CURSOR_OFFSETS,
 };
Signature · 6 lines
2.1.0

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

Re: [PATCH 02/49] drm/i915/bxt: BXT FBC enablement

Does BXT really has fbc? And same implementation and registers as HSW?

Quoted 30 lines · Imre Deak

From: Daisy Sun <[email protected]>

Enable FBC feature on Broxton

Issue: VIZ-3784

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 4d50785..48434cb6 100644
@@ -388,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = {
        .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
        .num_pipes = 3,
        .has_ddi = 1,
+       .has_fbc = 1,
        GEN_DEFAULT_PIPEOFFSETS,
        IVB_CURSOR_OFFSETS,
 };
--

2.1.0

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

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#5 lore raw

Re: [PATCH 02/49] drm/i915/bxt: BXT FBC enablement

Quoted 1 line · Rodrigo Vivi

Does BXT really has fbc?

Yes.

Quoted 1 line

And same implementation and registers as HSW?

Yes, but actually the selection for BXT would be incorrect in i915_setup_compression(), I can follow up with a fix for that in this patchset. In addition we also need to add BXT specific workarounds, but I would suggest doing that as a follow-up to this enabling patchset.

--Imre

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

author
#6 lore raw

PATCH 1/1 drm/i915: use proper FBC base register on all new platforms

In reply to Imre Deak

Starting from GEN5 the FBC base register is the same on all platforms. GEN>=5 is the same condition as HAS_PCH_SPLIT except on BXT, so make things work on BXT as well.

Motivated by Rodrigo's request to check FBC support on BXT.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index f8da716..348ed5a 100644
@@ -209,7 +209,7 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp)
 
 	dev_priv->fbc.threshold = ret;
 
-	if (HAS_PCH_SPLIT(dev))
+	if (INTEL_INFO(dev_priv)->gen >= 5)
 		I915_WRITE(ILK_DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start);
 	else if (IS_GM45(dev)) {
 		I915_WRITE(DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start);
Signature · 6 lines
2.1.0

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

Re: [PATCH 02.1/49] drm/i915: use proper FBC base register on all new platforms

Quoted 17 lines · Imre Deak

Starting from GEN5 the FBC base register is the same on all platforms. GEN>=5 is the same condition as HAS_PCH_SPLIT except on BXT, so make things work on BXT as well.

Motivated by Rodrigo's request to check FBC support on BXT.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +0 -0
index f8da716..348ed5a 100644

drivers/gpu/drm/i915/i915_gem_stolen.c static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp) · line 215

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
@@ -209,7 +209,7 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp)
 
 	dev_priv->fbc.threshold = ret;
 
-	if (HAS_PCH_SPLIT(dev))
+	if (INTEL_INFO(dev_priv)->gen >= 5)
 		I915_WRITE(ILK_DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start);
 	else if (IS_GM45(dev)) {
 		I915_WRITE(DPFC_CB_BASE, dev_priv->fbc.compressed_fb.start);

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

Reviewed-by on v1 2/49
#8 lore raw

Re: [PATCH 02/49] drm/i915/bxt: BXT FBC enablement

In reply to Imre Deak
Quoted 17 lines · Imre Deak

From: Daisy Sun <[email protected]>

Enable FBC feature on Broxton

Issue: VIZ-3784

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 4d50785..48434cb6 100644

drivers/gpu/drm/i915/i915_drv.c static const struct intel_device_info intel_broxton_info = { · line 394

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -388,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = {
 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
 	.num_pipes = 3,
 	.has_ddi = 1,
+	.has_fbc = 1,
 	GEN_DEFAULT_PIPEOFFSETS,
 	IVB_CURSOR_OFFSETS,
 };

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

Reviewed-by on v1 2/49
#9 lore raw

Re: [PATCH 02/49] drm/i915/bxt: BXT FBC enablement

In reply to Imre Deak
Quoted 17 lines · Imre Deak

From: Daisy Sun <[email protected]>

Enable FBC feature on Broxton

Issue: VIZ-3784

---
 drivers/gpu/drm/i915/i915_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 4d50785..48434cb6 100644

drivers/gpu/drm/i915/i915_drv.c static const struct intel_device_info intel_broxton_info = { · line 394

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -388,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = {
 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
 	.num_pipes = 3,
 	.has_ddi = 1,
+	.has_fbc = 1,
 	GEN_DEFAULT_PIPEOFFSETS,
 	IVB_CURSOR_OFFSETS,
 };

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

author
#10 lore raw

PATCH 3/49 drm/i915/bxt: Add IS_BROXTON macro

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Adding IS_BROXTON macro for broxton specific implementation.

---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 81f60b4..eba53c3 100644
@@ -2305,6 +2305,7 @@ struct drm_i915_cmd_table {
 #define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
 #define IS_BROADWELL(dev)	(!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
 #define IS_SKYLAKE(dev)	(INTEL_INFO(dev)->is_skylake)
+#define IS_BROXTON(dev)	(!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev))
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
 #define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
 				 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
Signature · 6 lines
2.1.0

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

Re: [PATCH 03/49] drm/i915/bxt: Add IS_BROXTON macro

Quoted 15 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Adding IS_BROXTON macro for broxton specific implementation.

---
  drivers/gpu/drm/i915/i915_drv.h | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 81f60b4..eba53c3 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_cmd_table { · line 2311

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2305,6 +2305,7 @@ struct drm_i915_cmd_table {
  #define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
  #define IS_BROADWELL(dev)	(!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
  #define IS_SKYLAKE(dev)	(INTEL_INFO(dev)->is_skylake)
+#define IS_BROXTON(dev)	(!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev))
  #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
  #define IS_HSW_EARLY_SDV(dev)	(IS_HASWELL(dev) && \
  				 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)

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

author
#12 lore raw

PATCH 4/49 drm/i915/bxt: Broxton uses the same GMS values as Skylake

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

v2: Rebase on top of the early-quirks rework from Ville.

---
 arch/x86/kernel/early-quirks.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/early-quirks.c +1 -0
index fe9f0b7..ab470e4 100644
@@ -546,6 +546,7 @@ static const struct pci_device_id intel_stolen_ids[] __initconst = {
 	INTEL_BDW_D_IDS(&gen8_stolen_funcs),
 	INTEL_CHV_IDS(&chv_stolen_funcs),
 	INTEL_SKL_IDS(&gen9_stolen_funcs),
+	INTEL_BXT_IDS(&gen9_stolen_funcs),
 };
 
 static void __init intel_graphics_stolen(int num, int slot, int func)
Signature · 6 lines
2.1.0

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

Re: [PATCH 04/49] drm/i915/bxt: Broxton uses the same GMS values as Skylake

Quoted 16 lines · Imre Deak

From: Damien Lespiau <[email protected]>

v2: Rebase on top of the early-quirks rework from Ville.

---
 arch/x86/kernel/early-quirks.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/early-quirks.c +0 -0
index fe9f0b7..ab470e4 100644

arch/x86/kernel/early-quirks.c static const struct pci_device_id intel_stolen_ids[] __initconst = { · line 552

Quoted 7 lines
arch/x86/kernel/early-quirks.c +1 -0
@@ -546,6 +546,7 @@ static const struct pci_device_id intel_stolen_ids[] __initconst = {
 	INTEL_BDW_D_IDS(&gen8_stolen_funcs),
 	INTEL_CHV_IDS(&chv_stolen_funcs),
 	INTEL_SKL_IDS(&gen9_stolen_funcs),
+	INTEL_BXT_IDS(&gen9_stolen_funcs),
 };
 
 static void __init intel_graphics_stolen(int num, int slot, int func)

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

author
#14 lore raw

PATCH 5/49 drm/i915/bxt: Enable PTE encoding

In reply to Imre Deak

From: Sumit Singh <[email protected]>

The caching options for page table entries have remained the same as Cherryview. This patch fixes it so the right code path is taken on BXT.

v2: Fix up commit message (Mike)

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
index f1b9ea6..4311292 100644
@@ -1506,7 +1506,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 
 
 	if (INTEL_INFO(dev)->gen >= 8) {
-		if (IS_CHERRYVIEW(dev))
+		if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev))
 			chv_setup_private_ppat(dev_priv);
 		else
 			bdw_setup_private_ppat(dev_priv);
@@ -2187,7 +2187,7 @@ static int gen8_gmch_probe(struct drm_device *dev,
 
 	*gtt_total = (gtt_size / sizeof(gen8_gtt_pte_t)) << PAGE_SHIFT;
 
-	if (IS_CHERRYVIEW(dev))
+	if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev))
 		chv_setup_private_ppat(dev_priv);
 	else
 		bdw_setup_private_ppat(dev_priv);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 5/49
#15 lore raw

Re: [PATCH 05/49] drm/i915/bxt: Enable PTE encoding

Quoted 28 lines · Imre Deak

From: Sumit Singh <[email protected]>

The caching options for page table entries have remained the same as Cherryview. This patch fixes it so the right code path is taken on BXT.

v2: Fix up commit message (Mike)

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
index f1b9ea6..4311292 100644
@@ -1506,7 +1506,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 
 
 	if (INTEL_INFO(dev)->gen >= 8) {
-		if (IS_CHERRYVIEW(dev))
+		if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev))
 			chv_setup_private_ppat(dev_priv);
 		else
 			bdw_setup_private_ppat(dev_priv);

drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_gmch_probe(struct drm_device *dev, · line 2193

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
@@ -2187,7 +2187,7 @@ static int gen8_gmch_probe(struct drm_device *dev,
 
 	*gtt_total = (gtt_size / sizeof(gen8_gtt_pte_t)) << PAGE_SHIFT;
 
-	if (IS_CHERRYVIEW(dev))
+	if (IS_CHERRYVIEW(dev) || IS_BROXTON(dev))
 		chv_setup_private_ppat(dev_priv);
 	else
 		bdw_setup_private_ppat(dev_priv);

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

author
#16 lore raw

PATCH 6/49 drm/i915/bxt: Broxton has 3 sprite planes on pipe A/B, 2 on pipe C

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

v2: Rebase on top of the for_each_pipe() change adding dev_priv as first
argument.

---
 drivers/gpu/drm/i915/i915_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +5 -1
index d49ed68..a94a970 100644
@@ -585,7 +585,11 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 
 	info = (struct intel_device_info *)&dev_priv->info;
 
-	if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
+	if (IS_BROXTON(dev)) {
+		info->num_sprites[PIPE_A] = 3;
+		info->num_sprites[PIPE_B] = 3;
+		info->num_sprites[PIPE_C] = 2;
+	} else if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
 		for_each_pipe(dev_priv, pipe)
 			info->num_sprites[pipe] = 2;
 	else
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 6/49
#17 lore raw

Re: [PATCH 06/49] drm/i915/bxt: Broxton has 3 sprite planes on pipe A/B, 2 on pipe C

Quoted 18 lines · Imre Deak

From: Damien Lespiau <[email protected]>

v2: Rebase on top of the for_each_pipe() change adding dev_priv as first
argument.

---
 drivers/gpu/drm/i915/i915_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index d49ed68..a94a970 100644
@@ -585,7 +585,11 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 
 	info = (struct intel_device_info *)&dev_priv->info;

drivers/gpu/drm/i915/i915_dma.c static void intel_device_info_runtime_init(struct drm_device *dev) · line 595

Quoted 10 lines
drivers/gpu/drm/i915/i915_dma.c +5 -1
 
-	if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
+	if (IS_BROXTON(dev)) {
+		info->num_sprites[PIPE_A] = 3;
+		info->num_sprites[PIPE_B] = 3;
+		info->num_sprites[PIPE_C] = 2;
+	} else if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
 		for_each_pipe(dev_priv, pipe)
 			info->num_sprites[pipe] = 2;
 	else

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

#18 lore raw

Re: [PATCH 06/49] drm/i915/bxt: Broxton has 3 sprite planes on pipe A/B, 2 on pipe C

In reply to Imre Deak
Quoted 15 lines · Imre Deak

From: Damien Lespiau <[email protected]>

v2: Rebase on top of the for_each_pipe() change adding dev_priv as first
argument.

---
 drivers/gpu/drm/i915/i915_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +0 -0
index d49ed68..a94a970 100644

drivers/gpu/drm/i915/i915_dma.c static void intel_device_info_runtime_init(struct drm_device *dev) · line 591

Quoted 8 lines
drivers/gpu/drm/i915/i915_dma.c +4 -1
@@ -585,7 +585,11 @@ static void intel_device_info_runtime_init(struct drm_device *dev)
 
 	info = (struct intel_device_info *)&dev_priv->info;
 
-	if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
+	if (IS_BROXTON(dev)) {
+		info->num_sprites[PIPE_A] = 3;
+		info->num_sprites[PIPE_B] = 3;
+		info->num_sprites[PIPE_C] = 2;

Same todo as with skl: The last sprite plane is actually also the cursor, and we really shouldn't expose both. Damien is signed up to fix that since I don't want to drop the prelim_hw_support label for skl before we fix this abi issue.
-Daniel

Quoted 11 lines
drivers/gpu/drm/i915/i915_dma.c +1 -0
+	} else if (IS_VALLEYVIEW(dev) || INTEL_INFO(dev)->gen == 9)
 		for_each_pipe(dev_priv, pipe)
 			info->num_sprites[pipe] = 2;
 	else
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#19 lore raw

PATCH 7/49 drm/i915/bxt: Add the plane4 related interrupt definitions

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index cc8ebab..3369a11 100644
@@ -5216,9 +5216,11 @@ enum skl_disp_power_wells {
 #define  GEN8_PIPE_VSYNC		(1 << 1)
 #define  GEN8_PIPE_VBLANK		(1 << 0)
 #define  GEN9_PIPE_CURSOR_FAULT		(1 << 11)
+#define  GEN9_PIPE_PLANE4_FAULT		(1 << 10)
 #define  GEN9_PIPE_PLANE3_FAULT		(1 << 9)
 #define  GEN9_PIPE_PLANE2_FAULT		(1 << 8)
 #define  GEN9_PIPE_PLANE1_FAULT		(1 << 7)
+#define  GEN9_PIPE_PLANE4_FLIP_DONE	(1 << 6)
 #define  GEN9_PIPE_PLANE3_FLIP_DONE	(1 << 5)
 #define  GEN9_PIPE_PLANE2_FLIP_DONE	(1 << 4)
 #define  GEN9_PIPE_PLANE1_FLIP_DONE	(1 << 3)
@@ -5229,6 +5231,7 @@ enum skl_disp_power_wells {
 	 GEN8_PIPE_PRIMARY_FAULT)
 #define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \
 	(GEN9_PIPE_CURSOR_FAULT | \
+	 GEN9_PIPE_PLANE4_FAULT | \
 	 GEN9_PIPE_PLANE3_FAULT | \
 	 GEN9_PIPE_PLANE2_FAULT | \
 	 GEN9_PIPE_PLANE1_FAULT)
Signature · 6 lines
2.1.0

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

Re: [PATCH 07/49] drm/i915/bxt: Add the plane4 related interrupt definitions

Quoted 25 lines · Imre Deak

From: Damien Lespiau <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index cc8ebab..3369a11 100644
@@ -5216,9 +5216,11 @@ enum skl_disp_power_wells {
 #define  GEN8_PIPE_VSYNC		(1 << 1)
 #define  GEN8_PIPE_VBLANK		(1 << 0)
 #define  GEN9_PIPE_CURSOR_FAULT		(1 << 11)
+#define  GEN9_PIPE_PLANE4_FAULT		(1 << 10)
 #define  GEN9_PIPE_PLANE3_FAULT		(1 << 9)
 #define  GEN9_PIPE_PLANE2_FAULT		(1 << 8)
 #define  GEN9_PIPE_PLANE1_FAULT		(1 << 7)
+#define  GEN9_PIPE_PLANE4_FLIP_DONE	(1 << 6)
 #define  GEN9_PIPE_PLANE3_FLIP_DONE	(1 << 5)
 #define  GEN9_PIPE_PLANE2_FLIP_DONE	(1 << 4)
 #define  GEN9_PIPE_PLANE1_FLIP_DONE	(1 << 3)

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 5237

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -5229,6 +5231,7 @@ enum skl_disp_power_wells {
 	 GEN8_PIPE_PRIMARY_FAULT)
 #define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \
 	(GEN9_PIPE_CURSOR_FAULT | \
+	 GEN9_PIPE_PLANE4_FAULT | \
 	 GEN9_PIPE_PLANE3_FAULT | \
 	 GEN9_PIPE_PLANE2_FAULT | \
 	 GEN9_PIPE_PLANE1_FAULT)

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

author
#21 lore raw

PATCH 8/49 drm/i915/bxt: Broxton DDB is 512 blocks

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

---
 drivers/gpu/drm/i915/intel_pm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +5 -1
index 288c9d2..b89ab4d 100644
@@ -2538,6 +2538,7 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)
  */
 
 #define SKL_DDB_SIZE		896	/* in blocks */
+#define BXT_DDB_SIZE		512
 
 static void
 skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
@@ -2556,7 +2557,10 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
 		return;
 	}
 
-	ddb_size = SKL_DDB_SIZE;
+	if (IS_BROXTON(dev))
+		ddb_size = BXT_DDB_SIZE;
+	else
+		ddb_size = SKL_DDB_SIZE;
 
 	ddb_size -= 4; /* 4 blocks for bypass path allocation */
 
Signature · 6 lines
2.1.0

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

Re: [PATCH 08/49] drm/i915/bxt: Broxton DDB is 512 blocks

Quoted 22 lines · Imre Deak

From: Damien Lespiau <[email protected]>

---
 drivers/gpu/drm/i915/intel_pm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -0
index 288c9d2..b89ab4d 100644
@@ -2538,6 +2538,7 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)
  */
 
 #define SKL_DDB_SIZE		896	/* in blocks */
+#define BXT_DDB_SIZE		512
 
 static void
 skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
@@ -2556,7 +2557,10 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
 		return;

drivers/gpu/drm/i915/intel_pm.c skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, · line 2566

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +4 -1
 	}
 
-	ddb_size = SKL_DDB_SIZE;
+	if (IS_BROXTON(dev))
+		ddb_size = BXT_DDB_SIZE;
+	else
+		ddb_size = SKL_DDB_SIZE;
 
 	ddb_size -= 4; /* 4 blocks for bypass path allocation */
 

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

author
#23 lore raw

PATCH 9/49 drm/i915/bxt: Broxton raises the maximum number of planes to 4

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

Pipe A and b have 4 planes.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index eba53c3..8fb7cc0 100644
@@ -130,7 +130,7 @@ enum transcoder {
  *
  * This value doesn't count the cursor plane.
  */
-#define I915_MAX_PLANES	3
+#define I915_MAX_PLANES	4
 
 enum plane {
 	PLANE_A = 0,
Signature · 6 lines
2.1.0

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

Re: [PATCH 09/49] drm/i915/bxt: Broxton raises the maximum number of planes to 4

Quoted 15 lines · Imre Deak

From: Damien Lespiau <[email protected]>

Pipe A and b have 4 planes.

---
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index eba53c3..8fb7cc0 100644

drivers/gpu/drm/i915/i915_drv.h enum transcoder { · line 136

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -130,7 +130,7 @@ enum transcoder {
  *
  * This value doesn't count the cursor plane.
  */
-#define I915_MAX_PLANES	3
+#define I915_MAX_PLANES	4
 
 enum plane {
 	PLANE_A = 0,

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

author
#25 lore raw

PATCH 10/49 drm/i915/bxt: map GTT as uncached

In reply to Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
index 4311292..8edf3cf 100644
@@ -2065,7 +2065,10 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);
+	else
+		dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
 	if (!dev_priv->gtt.gsm) {
 		DRM_ERROR("Failed to map the gtt page table\n");
 		return -ENOMEM;
Signature · 6 lines
2.1.0

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

Re: [PATCH 10/49] drm/i915/bxt: map GTT as uncached

Quoted 14 lines · Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 4311292..8edf3cf 100644

drivers/gpu/drm/i915/i915_gem_gtt.c static int ggtt_probe_common(struct drm_device *dev, · line 2069

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
@@ -2065,7 +2065,10 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);

This one sucks badly. Do we have a w/a name assigned to this, hsd filed and some commit that this will be fixed in later revisions? -Daniel

Quoted 12 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
+	else
+		dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
 	if (!dev_priv->gtt.gsm) {
 		DRM_ERROR("Failed to map the gtt page table\n");
 		return -ENOMEM;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#27 lore raw

Re: [PATCH 10/49] drm/i915/bxt: map GTT as uncached

Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 4311292..8edf3cf 100644
@@ -2065,7 +2065,10 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_gtt.c static int ggtt_probe_common(struct drm_device *dev, · line 2069

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);

This one sucks badly. Do we have a w/a name assigned to this, hsd filed and some commit that this will be fixed in later revisions?

We filed an HSD for this, it's closed now with the explanation from HW people that WC mapping for the GTT is invalid: "Writes larger than QW to GTTMMADR space will get dropped on BXT."
"Writes" here refers to the 64 byte burst write from the WC buffer.

Based on the above this isn't a w/a, so no name for it. I think Jesse is about to file a feature request to support WC mappings in the future.

--Imre

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

#28 lore raw

Re: [PATCH 10/49] drm/i915/bxt: map GTT as uncached

Quoted 26 lines · Imre Deak
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
index 4311292..8edf3cf 100644
@@ -2065,7 +2065,10 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_gtt.c static int ggtt_probe_common(struct drm_device *dev, · line 2069

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -1
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);

This one sucks badly. Do we have a w/a name assigned to this, hsd filed and some commit that this will be fixed in later revisions?

Quoted 7 lines

We filed an HSD for this, it's closed now with the explanation from HW people that WC mapping for the GTT is invalid: "Writes larger than QW to GTTMMADR space will get dropped on BXT."
"Writes" here refers to the 64 byte burst write from the WC buffer.

Based on the above this isn't a w/a, so no name for it. I think Jesse is about to file a feature request to support WC mappings in the future.

I guess then we need a big comment for this :(
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#29 lore raw

PATCH v2 1/1 drm/i915/bxt: map GTT as uncached

In reply to Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

v2:
- add comment explaining how the problem with WC mapping manifests (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +11 -1
index e33b121..4d15237 100644
@@ -2256,7 +2256,17 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	/*
+	 * On BXT writes larger than 64 bit to the GTT pagetable range will be
+	 * dropped. For WC mappings in general we have 64 byte burst writes
+	 * when the WC buffer is flushed, so we can't use it, but have to
+	 * resort to an uncached mapping. The WC issue is easily caught by the
+	 * readback check when writing GTT PTE entries.
+	 */
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);
+	else
+		dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
 	if (!dev_priv->gtt.gsm) {
 		DRM_ERROR("Failed to map the gtt page table\n");
 		return -ENOMEM;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#30 lore raw

Re: [PATCH v2] drm/i915/bxt: map GTT as uncached

Quoted 27 lines · Imre Deak

On Broxton per specification the GTT has to be mapped as uncached. This was caught by the PTE write readback warning, which showed a corrupted PTE value with using the current write-combine mapping.

v2:
- add comment explaining how the problem with WC mapping manifests (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -1
index e33b121..4d15237 100644
@@ -2256,7 +2256,17 @@ static int ggtt_probe_common(struct drm_device *dev,
 	gtt_phys_addr = pci_resource_start(dev->pdev, 0) +
 		(pci_resource_len(dev->pdev, 0) / 2);
 
-	dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
+	/*
+	 * On BXT writes larger than 64 bit to the GTT pagetable range will be
+	 * dropped. For WC mappings in general we have 64 byte burst writes
+	 * when the WC buffer is flushed, so we can't use it, but have to

drivers/gpu/drm/i915/i915_gem_gtt.c static int ggtt_probe_common(struct drm_device *dev, · line 2272

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +7 -0
+	 * resort to an uncached mapping. The WC issue is easily caught by the
+	 * readback check when writing GTT PTE entries.
+	 */
+	if (IS_BROXTON(dev))
+		dev_priv->gtt.gsm = ioremap_nocache(gtt_phys_addr, gtt_size);
+	else
+		dev_priv->gtt.gsm = ioremap_wc(gtt_phys_addr, gtt_size);
 	if (!dev_priv->gtt.gsm) {
 		DRM_ERROR("Failed to map the gtt page table\n");
 		return -ENOMEM;

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

author
#31 lore raw

PATCH 11/49 drm/i915/gen9: fix PIPE_CONTROL flush for VS_INVALIDATE

In reply to Imre Deak

On GEN9+ per specification a NULL PIPE_CONTROL needs to be emitted before any PIPE_CONTROL command with the VS_INVALIDATE flag set.

---
 drivers/gpu/drm/i915/intel_lrc.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +18 -1
index fcb074b..71aeeb3 100644
@@ -1262,6 +1262,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 {
 	struct intel_engine_cs *ring = ringbuf->ring;
 	u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
+	bool vf_flush_wa;
 	u32 flags = 0;
 	int ret;
 
@@ -1283,10 +1284,26 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 		flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
 	}
 
-	ret = intel_logical_ring_begin(ringbuf, ctx, 6);
+	/*
+	 * On GEN9+ Before VF_CACHE_INVALIDATE we need to emit a NULL pipe
+	 * control.
+	 */
+	vf_flush_wa = INTEL_INFO(ring->dev)->gen >= 9 &&
+		      flags & PIPE_CONTROL_VF_CACHE_INVALIDATE;
+
+	ret = intel_logical_ring_begin(ringbuf, ctx, vf_flush_wa ? 12 : 6);
 	if (ret)
 		return ret;
 
+	if (vf_flush_wa) {
+		intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+	}
+
 	intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
 	intel_logical_ring_emit(ringbuf, flags);
 	intel_logical_ring_emit(ringbuf, scratch_addr);
Signature · 6 lines
2.1.0

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

Re: [PATCH 11/49] drm/i915/gen9: fix PIPE_CONTROL flush for VS_INVALIDATE

Quoted 4 lines · Imre Deak

On GEN9+ per specification a NULL PIPE_CONTROL needs to be emitted before any PIPE_CONTROL command with the VS_INVALIDATE flag set.

Can you please take out the gen9/skl patches from your bxt enabling into a separate series so that we can fastrack it?

Thanks, Daniel

Quoted 51 lines
---
 drivers/gpu/drm/i915/intel_lrc.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +18 -1
index fcb074b..71aeeb3 100644
@@ -1262,6 +1262,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 {
 	struct intel_engine_cs *ring = ringbuf->ring;
 	u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
+	bool vf_flush_wa;
 	u32 flags = 0;
 	int ret;
 
@@ -1283,10 +1284,26 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
 		flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
 	}
 
-	ret = intel_logical_ring_begin(ringbuf, ctx, 6);
+	/*
+	 * On GEN9+ Before VF_CACHE_INVALIDATE we need to emit a NULL pipe
+	 * control.
+	 */
+	vf_flush_wa = INTEL_INFO(ring->dev)->gen >= 9 &&
+		      flags & PIPE_CONTROL_VF_CACHE_INVALIDATE;
+
+	ret = intel_logical_ring_begin(ringbuf, ctx, vf_flush_wa ? 12 : 6);
 	if (ret)
 		return ret;
 
+	if (vf_flush_wa) {
+		intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+	}
+
 	intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
 	intel_logical_ring_emit(ringbuf, flags);
 	intel_logical_ring_emit(ringbuf, scratch_addr);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 11/49
#33 lore raw

Re: [PATCH 11/49] drm/i915/gen9: fix PIPE_CONTROL flush for VS_INVALIDATE

In reply to Imre Deak
Quoted 4 lines · Imre Deak

On GEN9+ per specification a NULL PIPE_CONTROL needs to be emitted before any PIPE_CONTROL command with the VS_INVALIDATE flag set.

Quoted 35 lines
---
  drivers/gpu/drm/i915/intel_lrc.c | 19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +11 -1
index fcb074b..71aeeb3 100644
@@ -1262,6 +1262,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
  {
  	struct intel_engine_cs *ring = ringbuf->ring;
  	u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
+	bool vf_flush_wa;
  	u32 flags = 0;
  	int ret;
 
@@ -1283,10 +1284,26 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
  		flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
  	}
 
-	ret = intel_logical_ring_begin(ringbuf, ctx, 6);
+	/*
+	 * On GEN9+ Before VF_CACHE_INVALIDATE we need to emit a NULL pipe
+	 * control.
+	 */
+	vf_flush_wa = INTEL_INFO(ring->dev)->gen >= 9 &&
+		      flags & PIPE_CONTROL_VF_CACHE_INVALIDATE;
+
+	ret = intel_logical_ring_begin(ringbuf, ctx, vf_flush_wa ? 12 : 6);
  	if (ret)
  		return ret;
 
+	if (vf_flush_wa) {
+		intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));

drivers/gpu/drm/i915/intel_lrc.c static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf, · line 1309

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +7 -0
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+		intel_logical_ring_emit(ringbuf, 0);
+	}
+
  	intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6));
  	intel_logical_ring_emit(ringbuf, flags);
  	intel_logical_ring_emit(ringbuf, scratch_addr);

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

author
#34 lore raw

PATCH 12/49 drm/i915/bxt: HardWare WorkAround ring initialisation for Broxton

In reply to Imre Deak

From: Nick Hoath <[email protected]>

Adds framework for Broxton HW WAs

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +10 -2
index 441e250..abe062a 100644
@@ -1027,6 +1027,13 @@ static int skl_init_workarounds(struct intel_engine_cs *ring)
 	return skl_tune_iz_hashing(ring);
 }
 
+static int bxt_init_workarounds(struct intel_engine_cs *ring)
+{
+	gen9_init_workarounds(ring);
+
+	return 0;
+}
+
 int init_workarounds_ring(struct intel_engine_cs *ring)
 {
 	struct drm_device *dev = ring->dev;
@@ -1044,8 +1051,9 @@ int init_workarounds_ring(struct intel_engine_cs *ring)
 
 	if (IS_SKYLAKE(dev))
 		return skl_init_workarounds(ring);
-	else if (IS_GEN9(dev))
-		return gen9_init_workarounds(ring);
+
+	if (IS_BROXTON(dev))
+		return bxt_init_workarounds(ring);
 
 	return 0;
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 12/49
#35 lore raw

Re: [PATCH 12/49] drm/i915/bxt: HardWare WorkAround ring initialisation for Broxton

Quoted 6 lines · Imre Deak

From: Nick Hoath <[email protected]>

Adds framework for Broxton HW WAs

Quoted 25 lines
---
  drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +7 -0
index 441e250..abe062a 100644
@@ -1027,6 +1027,13 @@ static int skl_init_workarounds(struct intel_engine_cs *ring)
  	return skl_tune_iz_hashing(ring);
  }
 
+static int bxt_init_workarounds(struct intel_engine_cs *ring)
+{
+	gen9_init_workarounds(ring);
+
+	return 0;
+}
+
  int init_workarounds_ring(struct intel_engine_cs *ring)
  {
  	struct drm_device *dev = ring->dev;
@@ -1044,8 +1051,9 @@ int init_workarounds_ring(struct intel_engine_cs *ring)
 

drivers/gpu/drm/i915/intel_ringbuffer.c int init_workarounds_ring(struct intel_engine_cs *ring) · line 1059

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +3 -2
  	if (IS_SKYLAKE(dev))
  		return skl_init_workarounds(ring);
-	else if (IS_GEN9(dev))
-		return gen9_init_workarounds(ring);
+
+	if (IS_BROXTON(dev))
+		return bxt_init_workarounds(ring);
 
  	return 0;
  }

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

author
#36 lore raw

PATCH 13/49 drm/i915/bxt: add bxt_init_clock_gating

In reply to Imre Deak
---
 drivers/gpu/drm/i915/intel_pm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +11 -1
index b89ab4d..3d4a7c3 100644
@@ -94,6 +94,11 @@ static void skl_init_clock_gating(struct drm_device *dev)
 			   GEN8_LQSC_RO_PERF_DIS);
 }
 
+static void bxt_init_clock_gating(struct drm_device *dev)
+{
+	gen9_init_clock_gating(dev);
+}
+
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6503,7 +6508,12 @@ void intel_init_pm(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_setup_wm_latency(dev);
 
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
+		if (IS_BROXTON(dev))
+			dev_priv->display.init_clock_gating =
+				bxt_init_clock_gating;
+		else
+			dev_priv->display.init_clock_gating =
+				skl_init_clock_gating;
 		dev_priv->display.update_wm = skl_update_wm;
 		dev_priv->display.update_sprite_wm = skl_update_sprite_wm;
 	} else if (HAS_PCH_SPLIT(dev)) {
Signature · 6 lines
2.1.0

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

Re: [PATCH 13/49] drm/i915/bxt: add bxt_init_clock_gating

Quoted 22 lines · Imre Deak
---
  drivers/gpu/drm/i915/intel_pm.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +5 -0
index b89ab4d..3d4a7c3 100644
@@ -94,6 +94,11 @@ static void skl_init_clock_gating(struct drm_device *dev)
  			   GEN8_LQSC_RO_PERF_DIS);
  }
 
+static void bxt_init_clock_gating(struct drm_device *dev)
+{
+	gen9_init_clock_gating(dev);
+}
+
  static void i915_pineview_get_mem_freq(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6516

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -1
@@ -6503,7 +6508,12 @@ void intel_init_pm(struct drm_device *dev)
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_setup_wm_latency(dev);
 
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
+		if (IS_BROXTON(dev))
+			dev_priv->display.init_clock_gating =
+				bxt_init_clock_gating;
+		else
+			dev_priv->display.init_clock_gating =
+				skl_init_clock_gating;

This doesn't match the style in: "HardWare WorkAround ring initialisation for Broxton", where we explicitly check the IS_BROXTON and IS_SKYLAKE state.

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6519

Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
  		dev_priv->display.update_wm = skl_update_wm;
  		dev_priv->display.update_sprite_wm = skl_update_sprite_wm;
  	} else if (HAS_PCH_SPLIT(dev)) {

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

author
#38 lore raw

Re: [PATCH 13/49] drm/i915/bxt: add bxt_init_clock_gating

Quoted 26 lines · Nick Hoath
Quoted 25 lines · Imre Deak
---
  drivers/gpu/drm/i915/intel_pm.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +5 -0
index b89ab4d..3d4a7c3 100644
@@ -94,6 +94,11 @@ static void skl_init_clock_gating(struct drm_device *dev)
  			   GEN8_LQSC_RO_PERF_DIS);
  }
 
+static void bxt_init_clock_gating(struct drm_device *dev)
+{
+	gen9_init_clock_gating(dev);
+}
+
  static void i915_pineview_get_mem_freq(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6503,7 +6508,12 @@ void intel_init_pm(struct drm_device *dev)
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_setup_wm_latency(dev);
 
Quoted 11 lines

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6516

Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +6 -1
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
+		if (IS_BROXTON(dev))
+			dev_priv->display.init_clock_gating =
+				bxt_init_clock_gating;
+		else
+			dev_priv->display.init_clock_gating =
+				skl_init_clock_gating;

This doesn't match the style in: "HardWare WorkAround ring initialisation for Broxton", where we explicitly check the IS_BROXTON and IS_SKYLAKE state.

Ok, will fix this to set skl_init_clock_gating only for IS_SKYLAKE.

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

author
#39 lore raw

PATCH v2 13/49 drm/i915/bxt: add bxt_init_clock_gating

In reply to Imre Deak

v2:
- Make the condition to select between SKL and BXT consistent with the corresponding condition in init_workarounds_ring (Nick)

---
 drivers/gpu/drm/i915/intel_pm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +11 -1
index c52f8b7..8a8d52a 100644
@@ -94,6 +94,11 @@ static void skl_init_clock_gating(struct drm_device *dev)
 			   GEN8_LQSC_RO_PERF_DIS);
 }
 
+static void bxt_init_clock_gating(struct drm_device *dev)
+{
+	gen9_init_clock_gating(dev);
+}
+
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6548,7 +6553,12 @@ void intel_init_pm(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_setup_wm_latency(dev);
 
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
+		if (IS_BROXTON(dev))
+			dev_priv->display.init_clock_gating =
+				bxt_init_clock_gating;
+		else if (IS_SKYLAKE(dev))
+			dev_priv->display.init_clock_gating =
+				skl_init_clock_gating;
 		dev_priv->display.update_wm = skl_update_wm;
 		dev_priv->display.update_sprite_wm = skl_update_sprite_wm;
 	} else if (HAS_PCH_SPLIT(dev)) {
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 13/49
#40 lore raw

Re: [PATCH v2 13/49] drm/i915/bxt: add bxt_init_clock_gating

Quoted 4 lines · Imre

v2:
- Make the condition to select between SKL and BXT consistent with the corresponding condition in init_workarounds_ring (Nick)

Quoted 26 lines
---
  drivers/gpu/drm/i915/intel_pm.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +5 -0
index c52f8b7..8a8d52a 100644
@@ -94,6 +94,11 @@ static void skl_init_clock_gating(struct drm_device *dev)
  			   GEN8_LQSC_RO_PERF_DIS);
  }
 
+static void bxt_init_clock_gating(struct drm_device *dev)
+{
+	gen9_init_clock_gating(dev);
+}
+
  static void i915_pineview_get_mem_freq(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6548,7 +6553,12 @@ void intel_init_pm(struct drm_device *dev)
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_setup_wm_latency(dev);
 

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6564

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -1
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
+		if (IS_BROXTON(dev))
+			dev_priv->display.init_clock_gating =
+				bxt_init_clock_gating;
+		else if (IS_SKYLAKE(dev))
+			dev_priv->display.init_clock_gating =
+				skl_init_clock_gating;
  		dev_priv->display.update_wm = skl_update_wm;
  		dev_priv->display.update_sprite_wm = skl_update_sprite_wm;
  	} else if (HAS_PCH_SPLIT(dev)) {

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

author
#41 lore raw

PATCH 14/49 drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

In reply to Imre Deak
---
 drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +11 -0
index 3d4a7c3..d5dd0b3 100644
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
 static void bxt_init_clock_gating(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 */
+	 /* WaDisableSDEUnitClockGating:bxt */
+	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
+		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
 }
 
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
Signature · 6 lines
2.1.0

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

Re: [PATCH 14/49] drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

Quoted 10 lines · Imre Deak
---
 drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 3d4a7c3..d5dd0b3 100644

drivers/gpu/drm/i915/intel_pm.c static void skl_init_clock_gating(struct drm_device *dev) · line 105

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
 static void bxt_init_clock_gating(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.

We have pci revid macros now. Do you have plans to roll similar ones out for bxt?
-Daniel

Quoted 15 lines
drivers/gpu/drm/i915/intel_pm.c +5 -0
+	 */
+	 /* WaDisableSDEUnitClockGating:bxt */
+	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
+		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
 }
 
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#43 lore raw

Re: [PATCH 14/49] drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Imre Deak
---
 drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 3d4a7c3..d5dd0b3 100644
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_pm.c static void skl_init_clock_gating(struct drm_device *dev) · line 105

Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
 static void bxt_init_clock_gating(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.

We have pci revid macros now. Do you have plans to roll similar ones out for bxt?

Yes. It may be that for BXT we also need to look at the PCI_REVISION_ID field besides PCI_CLASS_REVISION, I still have to figure out the exact mapping. (And also understand the meaning/difference between SOC vs. GT revision IDs).

--Imre

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

#44 lore raw

Re: [PATCH 14/49] drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

Quoted 26 lines · Imre Deak
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Imre Deak
---
  drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 3d4a7c3..d5dd0b3 100644
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_pm.c static void skl_init_clock_gating(struct drm_device *dev) · line 105

Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
  static void bxt_init_clock_gating(struct drm_device *dev)
  {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
  	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.

We have pci revid macros now. Do you have plans to roll similar ones out for bxt?

Quoted 4 lines

Yes. It may be that for BXT we also need to look at the PCI_REVISION_ID field besides PCI_CLASS_REVISION, I still have to figure out the exact mapping. (And also understand the meaning/difference between SOC vs. GT revision IDs).

I've posted a patch with the Broxton revision ID's from the specs.

Quoted 8 lines

--Imre

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

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

author
#45 lore raw

Re: [PATCH 14/49] drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

Quoted 27 lines · Nick Hoath
Quoted 26 lines · Imre Deak
Quoted 24 lines · Daniel Vetter
Quoted 10 lines · Imre Deak
---
  drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 3d4a7c3..d5dd0b3 100644

drivers/gpu/drm/i915/intel_pm.c static void skl_init_clock_gating(struct drm_device *dev) · line 105

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
  static void bxt_init_clock_gating(struct drm_device *dev)
  {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
  	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.

We have pci revid macros now. Do you have plans to roll similar ones out for bxt?

Quoted 4 lines
Quoted 4 lines

Yes. It may be that for BXT we also need to look at the PCI_REVISION_ID field besides PCI_CLASS_REVISION, I still have to figure out the exact mapping. (And also understand the meaning/difference between SOC vs. GT revision IDs).

Ok, the above is red herring. PCI_REVISION_ID is just the 8 low bits of PCI_CLASS_REVISION, so we can reuse INTEL_REVID as-is.

Quoted 1 line

I've posted a patch with the Broxton revision ID's from the specs.

It looks ok, but I prefer adding them as a follow-up to this patchset.

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

Reviewed-by
#46 lore raw

Re: [PATCH 14/49] drm/i915/bxt: add GEN8_SDEUNIT_CLOCK_GATE_DISABLE workaround

Quoted 33 lines · Imre
Quoted 27 lines · Nick Hoath
Quoted 26 lines · Imre Deak
Quoted 24 lines · Daniel Vetter
Quoted 10 lines · Imre Deak
---
   drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
   1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 3d4a7c3..d5dd0b3 100644

drivers/gpu/drm/i915/intel_pm.c static void skl_init_clock_gating(struct drm_device *dev) · line 105

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -96,7 +96,18 @@ static void skl_init_clock_gating(struct drm_device *dev)
 
   static void bxt_init_clock_gating(struct drm_device *dev)
   {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
   	gen9_init_clock_gating(dev);
+
+	/*
+	 * FIXME:
+	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.

We have pci revid macros now. Do you have plans to roll similar ones out for bxt?

Quoted 4 lines
Quoted 4 lines

Yes. It may be that for BXT we also need to look at the PCI_REVISION_ID field besides PCI_CLASS_REVISION, I still have to figure out the exact mapping. (And also understand the meaning/difference between SOC vs. GT revision IDs).

Quoted 8 lines

Ok, the above is red herring. PCI_REVISION_ID is just the 8 low bits of PCI_CLASS_REVISION, so we can reuse INTEL_REVID as-is.

Quoted 1 line

I've posted a patch with the Broxton revision ID's from the specs.

It looks ok, but I prefer adding them as a follow-up to this patchset.

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

author
#47 lore raw

PATCH 15/49 drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

In reply to Imre Deak

From: Ben Widawsky <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
 #define GEN8_UCGCTL6				0x9430
 #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE	(1<<24)
 #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
 #define GEN6_GFXPAUSE				0xA000
 #define GEN6_RPNSWREQ				0xA008
drivers/gpu/drm/i915/intel_pm.c +3 -1
index d5dd0b3..52d3c02 100644
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct drm_device *dev)
 	/*
 	 * FIXME:
 	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
 	 */
 	 /* WaDisableSDEUnitClockGating:bxt */
 	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE |
+		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
 
 }
 
Signature · 6 lines
2.1.0

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

Re: [PATCH 15/49] drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

Quoted 26 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/i915_reg.h | 1 +
  drivers/gpu/drm/i915/intel_pm.c | 4 +++-
  2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
  #define GEN8_UCGCTL6				0x9430
  #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE	(1<<24)
  #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
  #define GEN6_GFXPAUSE				0xA000
  #define GEN6_RPNSWREQ				0xA008
drivers/gpu/drm/i915/intel_pm.c +0 -0
index d5dd0b3..52d3c02 100644

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 108

Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +1 -0
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct drm_device *dev)
  	/*
  	 * FIXME:
  	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
  	 */
  	 /* WaDisableSDEUnitClockGating:bxt */

I can't find where WaDisableSDEUnitClockGating is listed as required for BXT?

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 114

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
  	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE |
+		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
 
  }
 

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

author
#49 lore raw

Re: [PATCH 15/49] drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

Quoted 20 lines · Nick Hoath
Quoted 19 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/i915_reg.h | 1 +
  drivers/gpu/drm/i915/intel_pm.c | 4 +++-
  2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
  #define GEN8_UCGCTL6				0x9430
  #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE	(1<<24)
  #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
Quoted 16 lines

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 108

Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
  #define GEN6_GFXPAUSE				0xA000
  #define GEN6_RPNSWREQ				0xA008
drivers/gpu/drm/i915/intel_pm.c +1 -0
index d5dd0b3..52d3c02 100644
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct drm_device *dev)
  	/*
  	 * FIXME:
  	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
  	 */
  	 /* WaDisableSDEUnitClockGating:bxt */

I can't find where WaDisableSDEUnitClockGating is listed as required for BXT?

It's specified in BSpec GEN8_UCGCTL6 (0x9430) as required for BXT A0.

--Imre

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

#50 lore raw

Re: [PATCH 15/49] drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

Quoted 21 lines · Imre
Quoted 20 lines · Nick Hoath
Quoted 19 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
   drivers/gpu/drm/i915/i915_reg.h | 1 +
   drivers/gpu/drm/i915/intel_pm.c | 4 +++-
   2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
   #define GEN8_UCGCTL6				0x9430
   #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE	(1<<24)
   #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 106

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
   #define GEN6_GFXPAUSE				0xA000
   #define GEN6_RPNSWREQ				0xA008
drivers/gpu/drm/i915/intel_pm.c +1 -0
index d5dd0b3..52d3c02 100644
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct drm_device *dev)
   	/*
   	 * FIXME:
   	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.

Shouldn't this WA therefore have a check for 3x6 around it?

Quoted 10 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 108

Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
   	 */
   	 /* WaDisableSDEUnitClockGating:bxt */

I can't find where WaDisableSDEUnitClockGating is listed as required for BXT?

It's specified in BSpec GEN8_UCGCTL6 (0x9430) as required for BXT A0.

--Imre

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

author
#51 lore raw

Re: [PATCH 15/49] drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

Quoted 22 lines · Nick Hoath
Quoted 21 lines · Imre
Quoted 20 lines · Nick Hoath
Quoted 19 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
   drivers/gpu/drm/i915/i915_reg.h | 1 +
   drivers/gpu/drm/i915/intel_pm.c | 4 +++-
   2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
   #define GEN8_UCGCTL6				0x9430
   #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE	(1<<24)
   #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
Quoted 13 lines
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 106

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
   #define GEN6_GFXPAUSE				0xA000
   #define GEN6_RPNSWREQ				0xA008
drivers/gpu/drm/i915/intel_pm.c +1 -0
index d5dd0b3..52d3c02 100644
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct drm_device *dev)
   	/*
   	 * FIXME:
   	 * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.

Shouldn't this WA therefore have a check for 3x6 around it?

Yes, and that's the reason for the above FIXME:. Once we know which steppings are not-3x6, or have a way to retrieve this information we can revisit this (see Jeff's EU slice info patchset). Atm Bspec lists all BXT devices having a 3x6 config.

--Imre

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

Reviewed-by
#52 lore raw

Re: [PATCH 15/49] drm/i915/bxt: add GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ workaround

In reply to Nick Hoath
Quoted 7 lines · Nick Hoath
Quoted 6 lines · Imre
Quoted 5 lines · Nick Hoath
Quoted 4 lines · Imre Deak

From: Ben Widawsky <[email protected]>

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
---
   drivers/gpu/drm/i915/i915_reg.h | 1 +
   drivers/gpu/drm/i915/intel_pm.c | 4 +++-
   2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 3369a11..b7ba061 100644
@@ -6104,6 +6104,7 @@ enum skl_disp_power_wells {
   #define GEN8_UCGCTL6                0x9430
   #define   GEN8_GAPSUNIT_CLOCK_GATE_DISABLE    (1<<24)
   #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE    (1<<14)
+#define   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
 
Quoted 28 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
   #define GEN6_GFXPAUSE                0xA000
   #define GEN6_RPNSWREQ                0xA008
drivers/gpu/drm/i915/intel_pm.c +0 -1
index d5dd0b3..52d3c02 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+++ b/drivers/gpu/drm/i915/intel_pm.c

drivers/gpu/drm/i915/intel_pm.c +1 -0
@@ -103,10 +103,12 @@ static void bxt_init_clock_gating(struct
 drm_device *dev)
       /*
        * FIXME:
        * GEN8_SDEUNIT_CLOCK_GATE_DISABLE applies on A0 only.
+     * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT

SKUs only.

Shouldn't this WA therefore have a check for 3x6 around it?

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
        */
        /* WaDisableSDEUnitClockGating:bxt */

I can't find where WaDisableSDEUnitClockGating is listed as required for BXT?

It's specified in BSpec GEN8_UCGCTL6 (0x9430) as required for BXT A0.

--Imre

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

author
#53 lore raw

PATCH 16/49 drm/i915/bxt: add WaDisableMaskBasedCammingInRCC workaround

In reply to Imre Deak

From: Ben Widawsky <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h         | 4 ++++
 drivers/gpu/drm/i915/intel_ringbuffer.c | 9 +++++++++
 2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index b7ba061..1d074e8 100644
@@ -5346,6 +5346,10 @@ enum skl_disp_power_wells {
 #define  HDC_FORCE_NON_COHERENT			(1<<4)
 #define  HDC_BARRIER_PERFORMANCE_DISABLE	(1<<10)
 
+/* GEN9 chicken */
+#define SLICE_ECO_CHICKEN0			0x7308
+#define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
+
 /* WaCatErrorRejectionIssue */
 #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		0x9030
 #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
drivers/gpu/drm/i915/intel_ringbuffer.c +9 -0
index abe062a..e23cbdc 100644
@@ -966,6 +966,15 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
 	WA_CLR_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN5,
 			  GEN9_CCS_TLB_PREFETCH_ENABLE);
 
+	/*
+	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
+	 * the flag reads back as 0.
+	 */
+	/* WaDisableMaskBasedCammingInRCC:bxtA */
+	if (IS_BROXTON(dev))
+		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
+				  PIXEL_MASK_CAMMING_DISABLE);
+
 	return 0;
 }
 
Signature · 6 lines
2.1.0

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

Re: [PATCH 16/49] drm/i915/bxt: add WaDisableMaskBasedCammingInRCC workaround

Quoted 29 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/i915_reg.h         | 4 ++++
  drivers/gpu/drm/i915/intel_ringbuffer.c | 9 +++++++++
  2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index b7ba061..1d074e8 100644
@@ -5346,6 +5346,10 @@ enum skl_disp_power_wells {
  #define  HDC_FORCE_NON_COHERENT			(1<<4)
  #define  HDC_BARRIER_PERFORMANCE_DISABLE	(1<<10)
 
+/* GEN9 chicken */
+#define SLICE_ECO_CHICKEN0			0x7308
+#define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
+
  /* WaCatErrorRejectionIssue */
  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		0x9030
  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index abe062a..e23cbdc 100644

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 972

Quoted 7 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -0
@@ -966,6 +966,15 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
  	WA_CLR_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN5,
  			  GEN9_CCS_TLB_PREFETCH_ENABLE);
 
+	/*
+	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
+	 * the flag reads back as 0.
+	 */

I've just posted a patch with the stepping macros. You can use these in the same way as for Skylake.

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 980

Quoted 9 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +5 -0
+	/* WaDisableMaskBasedCammingInRCC:bxtA */
+	if (IS_BROXTON(dev))
+		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
+				  PIXEL_MASK_CAMMING_DISABLE);
+
  	return 0;
  }
 

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

author
#55 lore raw

Re: [PATCH 16/49] drm/i915/bxt: add WaDisableMaskBasedCammingInRCC workaround

Quoted 33 lines · Nick Hoath
Quoted 32 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/i915_reg.h         | 4 ++++
  drivers/gpu/drm/i915/intel_ringbuffer.c | 9 +++++++++
  2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index b7ba061..1d074e8 100644
@@ -5346,6 +5346,10 @@ enum skl_disp_power_wells {
  #define  HDC_FORCE_NON_COHERENT			(1<<4)
  #define  HDC_BARRIER_PERFORMANCE_DISABLE	(1<<10)
 
+/* GEN9 chicken */
+#define SLICE_ECO_CHICKEN0			0x7308
+#define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
+
  /* WaCatErrorRejectionIssue */
  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		0x9030
  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index abe062a..e23cbdc 100644
@@ -966,6 +966,15 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
  	WA_CLR_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN5,
  			  GEN9_CCS_TLB_PREFETCH_ENABLE);
 
Quoted 7 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 972

Quoted 4 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -0
+	/*
+	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
+	 * the flag reads back as 0.
+	 */

I've just posted a patch with the stepping macros. You can use these in the same way as for Skylake.

I'm not so happy to make these changes at this point. Without them we still have a correct - even if conservative - behavior on other steppings. There are quite a few places marked with FIXME that need improvement in a similar way and I'd leave them as-is for now to keep as close as possible to the good known working state (as of the power-on) and to make merging of this initial patchset fast.

Quoted 11 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 980

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +5 -0
+	/* WaDisableMaskBasedCammingInRCC:bxtA */
+	if (IS_BROXTON(dev))
+		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
+				  PIXEL_MASK_CAMMING_DISABLE);
+
  	return 0;
  }
 

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

Reviewed-by
#56 lore raw

Re: [PATCH 16/49] drm/i915/bxt: add WaDisableMaskBasedCammingInRCC workaround

Quoted 42 lines · Imre
Quoted 33 lines · Nick Hoath
Quoted 32 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
   drivers/gpu/drm/i915/i915_reg.h         | 4 ++++
   drivers/gpu/drm/i915/intel_ringbuffer.c | 9 +++++++++
   2 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index b7ba061..1d074e8 100644
@@ -5346,6 +5346,10 @@ enum skl_disp_power_wells {
   #define  HDC_FORCE_NON_COHERENT			(1<<4)
   #define  HDC_BARRIER_PERFORMANCE_DISABLE	(1<<10)
 
+/* GEN9 chicken */
+#define SLICE_ECO_CHICKEN0			0x7308
+#define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
+
   /* WaCatErrorRejectionIssue */
   #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		0x9030
   #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index abe062a..e23cbdc 100644
@@ -966,6 +966,15 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
   	WA_CLR_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN5,
   			  GEN9_CCS_TLB_PREFETCH_ENABLE);
 
Quoted 7 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 972

Quoted 4 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -0
+	/*
+	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
+	 * the flag reads back as 0.
+	 */

I've just posted a patch with the stepping macros. You can use these in the same way as for Skylake.

Quoted 7 lines

I'm not so happy to make these changes at this point. Without them we still have a correct - even if conservative - behavior on other steppings. There are quite a few places marked with FIXME that need improvement in a similar way and I'd leave them as-is for now to keep as close as possible to the good known working state (as of the power-on) and to make merging of this initial patchset fast.

In that case:

Quoted 13 lines
Quoted 11 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 980

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +5 -0
+	/* WaDisableMaskBasedCammingInRCC:bxtA */
+	if (IS_BROXTON(dev))
+		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
+				  PIXEL_MASK_CAMMING_DISABLE);
+
   	return 0;
   }
 

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

author
#57 lore raw

PATCH 17/49 drm/i915/skl: add WaDisableMaskBasedCammingInRCC workaround

In reply to Imre Deak

From: Ben Widawsky <[email protected]>

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
index e23cbdc..000f608 100644
@@ -970,8 +970,8 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
 	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
 	 * the flag reads back as 0.
 	 */
-	/* WaDisableMaskBasedCammingInRCC:bxtA */
-	if (IS_BROXTON(dev))
+	/* WaDisableMaskBasedCammingInRCC:sklC,bxtA */
+	if (INTEL_REVID(dev) == SKL_REVID_C0 || IS_BROXTON(dev))
 		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
 				  PIXEL_MASK_CAMMING_DISABLE);
 
Signature · 6 lines
2.1.0

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

Re: [PATCH 17/49] drm/i915/skl: add WaDisableMaskBasedCammingInRCC workaround

Quoted 13 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index e23cbdc..000f608 100644

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 974

Quoted 7 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
@@ -970,8 +970,8 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
  	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
  	 * the flag reads back as 0.
  	 */
-	/* WaDisableMaskBasedCammingInRCC:bxtA */
-	if (IS_BROXTON(dev))
+	/* WaDisableMaskBasedCammingInRCC:sklC,bxtA */
+	if (INTEL_REVID(dev) == SKL_REVID_C0 || IS_BROXTON(dev))

This looks wrong. (IS_BROXTON && BXT_REVID_C0) || (IS_SKYLAKE && SKL_REVID_C0) please.

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 977

Quoted 4 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
  		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
  				  PIXEL_MASK_CAMMING_DISABLE);
 

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

author
#59 lore raw

Re: [PATCH 17/49] drm/i915/skl: add WaDisableMaskBasedCammingInRCC workaround

Quoted 9 lines · Nick Hoath
Quoted 8 lines · Imre Deak

From: Ben Widawsky <[email protected]>

---
  drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 974

Quoted 12 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
index e23cbdc..000f608 100644
@@ -970,8 +970,8 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
  	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
  	 * the flag reads back as 0.
  	 */
-	/* WaDisableMaskBasedCammingInRCC:bxtA */
-	if (IS_BROXTON(dev))
+	/* WaDisableMaskBasedCammingInRCC:sklC,bxtA */
+	if (INTEL_REVID(dev) == SKL_REVID_C0 || IS_BROXTON(dev))

This looks wrong. (IS_BROXTON && BXT_REVID_C0) || (IS_SKYLAKE && SKL_REVID_C0) please.

It's correct though. gen9_init_workarounds() is called for Skylake or Broxton, so the condition is true either on Broxton regardless of the stepping, or on Skylake if the revid matches.

Also on Broxton we have to _exclude_ the workaround on C0, so if we add the revid check for Broxton too, then we have to rewrite the condition to:

(IS_BROXTON && INTEL_REVID != BXT_REVID_C0) || (IS_SKYLAKE && INTEL_REVID == SKL_REVID_C0)

Quoted 5 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 977

Quoted 4 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
  		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
  				  PIXEL_MASK_CAMMING_DISABLE);
 

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

Reviewed-by
#60 lore raw

Re: [PATCH 17/49] drm/i915/skl: add WaDisableMaskBasedCammingInRCC workaround

Quoted 6 lines · Imre
Quoted 5 lines · Nick Hoath
Quoted 4 lines · Imre Deak

From: Ben Widawsky <[email protected]>

Bearing in mind having to revisit all these with the stepping checks:

Quoted 23 lines
Quoted 4 lines
Quoted 4 lines
---
   drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines

drivers/gpu/drm/i915/intel_ringbuffer.c static int gen9_init_workarounds(struct intel_engine_cs *ring) · line 974

Quoted 12 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
index e23cbdc..000f608 100644
@@ -970,8 +970,8 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)
   	 * FIXME: don't apply the following on BXT for stepping C. On BXT A0
   	 * the flag reads back as 0.
   	 */
-	/* WaDisableMaskBasedCammingInRCC:bxtA */
-	if (IS_BROXTON(dev))
+	/* WaDisableMaskBasedCammingInRCC:sklC,bxtA */
+	if (INTEL_REVID(dev) == SKL_REVID_C0 || IS_BROXTON(dev))

This looks wrong. (IS_BROXTON && BXT_REVID_C0) || (IS_SKYLAKE && SKL_REVID_C0) please.

It's correct though. gen9_init_workarounds() is called for Skylake or Broxton, so the condition is true either on Broxton regardless of the stepping, or on Skylake if the revid matches.

Quoted 14 lines

Also on Broxton we have to _exclude_ the workaround on C0, so if we add the revid check for Broxton too, then we have to rewrite the condition to:

(IS_BROXTON && INTEL_REVID != BXT_REVID_C0) || (IS_SKYLAKE && INTEL_REVID == SKL_REVID_C0)

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
   		WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
   				  PIXEL_MASK_CAMMING_DISABLE);
 

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

author
#61 lore raw

PATCH 18/49 drm/i915/bxt: add workaround to avoid PTE corruption

In reply to Imre Deak

From: Robert Beckett <[email protected]>

Set TLBPF in TILECTL. This fixes an issue with BXT HW seeing corrupted pte entries.

v2:
- move the workaround to bxt_init_clock_gating (imre)

---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 1d074e8..d69d7b9 100644
@@ -1151,6 +1151,7 @@ enum skl_disp_power_wells {
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
 #define   TILECTL_SWZCTL			(1 << 0)
+#define   TILECTL_TLBPF			(1 << 1)
 #define   TILECTL_TLB_PREFETCH_DIS	(1 << 2)
 #define   TILECTL_BACKSNOOP_DIS		(1 << 3)
 
drivers/gpu/drm/i915/intel_pm.c +2 -0
index 52d3c02..d3f2557 100644
@@ -110,6 +110,8 @@ static void bxt_init_clock_gating(struct drm_device *dev)
 		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE |
 		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
 
+	/* FIXME: apply on A0 only */
+	I915_WRITE(TILECTL, I915_READ(TILECTL) | TILECTL_TLBPF);
 }
 
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
Signature · 6 lines
2.1.0

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

Re: [PATCH 18/49] drm/i915/bxt: add workaround to avoid PTE corruption

Quoted 4 lines · Imre Deak

From: Robert Beckett <[email protected]>

Set TLBPF in TILECTL. This fixes an issue with BXT HW seeing corrupted pte entries.

Is this for the ggtt or ppgtt ptes?
-Daniel

Quoted 43 lines

v2:
- move the workaround to bxt_init_clock_gating (imre)

---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 1d074e8..d69d7b9 100644
@@ -1151,6 +1151,7 @@ enum skl_disp_power_wells {
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
 #define   TILECTL_SWZCTL			(1 << 0)
+#define   TILECTL_TLBPF			(1 << 1)
 #define   TILECTL_TLB_PREFETCH_DIS	(1 << 2)
 #define   TILECTL_BACKSNOOP_DIS		(1 << 3)
 
drivers/gpu/drm/i915/intel_pm.c +2 -0
index 52d3c02..d3f2557 100644
@@ -110,6 +110,8 @@ static void bxt_init_clock_gating(struct drm_device *dev)
 		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE |
 		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
 
+	/* FIXME: apply on A0 only */
+	I915_WRITE(TILECTL, I915_READ(TILECTL) | TILECTL_TLBPF);
 }
 
 static void i915_pineview_get_mem_freq(struct drm_device *dev)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#63 lore raw

Re: [PATCH 18/49] drm/i915/bxt: add workaround to avoid PTE corruption

Quoted 7 lines · Daniel Vetter
Quoted 4 lines · Imre Deak

From: Robert Beckett <[email protected]>

Set TLBPF in TILECTL. This fixes an issue with BXT HW seeing corrupted pte entries.

Is this for the ggtt or ppgtt ptes?

Robert, did you see how this problem manifests? I just copied the w/a from your branch and checked it against BSpec, but haven't seen the actual problem.

Thanks,
Imre

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

Reviewed-by on v1 18/49
#64 lore raw

Re: [PATCH 18/49] drm/i915/bxt: add workaround to avoid PTE corruption

In reply to Imre Deak
Quoted 10 lines · Imre Deak

From: Robert Beckett <[email protected]>

Set TLBPF in TILECTL. This fixes an issue with BXT HW seeing corrupted pte entries.

v2:
- move the workaround to bxt_init_clock_gating (imre)

Quoted 23 lines
---
  drivers/gpu/drm/i915/i915_reg.h | 1 +
  drivers/gpu/drm/i915/intel_pm.c | 2 ++
  2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 1d074e8..d69d7b9 100644
@@ -1151,6 +1151,7 @@ enum skl_disp_power_wells {
  /* control register for cpu gtt access */
  #define TILECTL				0x101000
  #define   TILECTL_SWZCTL			(1 << 0)
+#define   TILECTL_TLBPF			(1 << 1)
  #define   TILECTL_TLB_PREFETCH_DIS	(1 << 2)
  #define   TILECTL_BACKSNOOP_DIS		(1 << 3)
 
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 52d3c02..d3f2557 100644

drivers/gpu/drm/i915/intel_pm.c static void bxt_init_clock_gating(struct drm_device *dev) · line 117

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +2 -0
@@ -110,6 +110,8 @@ static void bxt_init_clock_gating(struct drm_device *dev)
  		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE |
  		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
 
+	/* FIXME: apply on A0 only */
+	I915_WRITE(TILECTL, I915_READ(TILECTL) | TILECTL_TLBPF);
  }
 
  static void i915_pineview_get_mem_freq(struct drm_device *dev)

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

author
#65 lore raw

PATCH 19/49 drm/i915/bxt: don't use unsupported port detection

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

The port detection register flags in SFUSE_STRAP and DDI_BUF_CTL_A are not defined for BXT, so don't use them.

Suggested by Satheesh.

v2:
- DDI_BUF_CTL_A bit 0 is not useful on BXT. Making changes to use this bit when simulator or BXT is not applicable. Code re-arranged as per Damien's suggestion.

v3:
- clarify commit message, add code comment (imre)

Cc M, Satheeshakrishna <[email protected]>
Cc Lespiau, Damien <[email protected]>
Cc Shankar, Uma <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +10 -1
index 90b460c..e54e948 100644
@@ -12615,7 +12615,16 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (intel_crt_present(dev))
 		intel_crt_init(dev);
 
-	if (HAS_DDI(dev)) {
+	if (IS_BROXTON(dev)) {
+		/*
+		 * FIXME: Broxton doesn't support port detection via the
+		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
+		 * detect the ports.
+		 */
+		intel_ddi_init(dev, PORT_A);
+		intel_ddi_init(dev, PORT_B);
+		intel_ddi_init(dev, PORT_C);
+	} else if (HAS_DDI(dev)) {
 		int found;
 
 		/*
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 19/49
#66 lore raw

Re: [PATCH 19/49] drm/i915/bxt: don't use unsupported port detection

Quoted 12 lines · Imre Deak

From: Vandana Kannan <[email protected]>

The port detection register flags in SFUSE_STRAP and DDI_BUF_CTL_A are not defined for BXT, so don't use them.

Suggested by Satheesh.

v2:
- DDI_BUF_CTL_A bit 0 is not useful on BXT. Making changes to use this bit when simulator or BXT is not applicable. Code re-arranged as per Damien's suggestion.

Quoted 8 lines

v3:
- clarify commit message, add code comment (imre)

Cc M, Satheeshakrishna <[email protected]>
Cc Lespiau, Damien <[email protected]>
Cc Shankar, Uma <[email protected]>
Quoted 33 lines
---
 drivers/gpu/drm/i915/intel_display.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +10 -1
index 90b460c..e54e948 100644
@@ -12615,7 +12615,16 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (intel_crt_present(dev))
 		intel_crt_init(dev);
 
-	if (HAS_DDI(dev)) {
+	if (IS_BROXTON(dev)) {
+		/*
+		 * FIXME: Broxton doesn't support port detection via the
+		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
+		 * detect the ports.
+		 */
+		intel_ddi_init(dev, PORT_A);
+		intel_ddi_init(dev, PORT_B);
+		intel_ddi_init(dev, PORT_C);
+	} else if (HAS_DDI(dev)) {
 		int found;
 
 		/*
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#67 lore raw

PATCH 20/49 drm/i915/bxt: Add change to support gmbus pin pair for BXT

In reply to Imre Deak

From: "A.Sunil Kamath" <[email protected]>

For BXT gmbus is pulled from GPU to CPU. From implementation point of view only pin pair configuration will change. The existing implementation supports all platforms previous to GEN8 and also SKL. But for BXT pin pair configuration
is completely different than SKL or other previous GEN's. This patch introduces the new pin pair configuration structure specific to BXT and also ensures every real gmbus port has a gpio pin.

Tested on BDW hardware to confirm it doesnt break anything in existing platform.

For BDW pin pair config will remain as:
gmbus[0]: Name = i915 gmbus ssc, gpio_reg = c5014, reg0 = 1 gmbus[1]: Name = i915 gmbus vga, gpio_reg = c5010, reg0 = 2 gmbus[2]: Name = i915 gmbus panel, gpio_reg = c5018, reg0 = 3 gmbus[3]: Name = i915 gmbus dpc, gpio_reg = c501c, reg0 = 4 gmbus[4]: Name = i915 gmbus dpb, gpio_reg = c5020, reg0 = 5 gmbus[5]: Name = i915 gmbus dpd, gpio_reg = c5024, reg0 = 6

BXT will have:
gmbus[0]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[1]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[2]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[3]: name = i915 gmbus dpc, gpio_reg = c5018, reg0 = 2 gmbus[4]: name = i915 gmbus dpb, gpio_reg = c5014, reg0 = 1 gmbus[5]: name = i915 gmbus misc, gpio_reg = c501c, reg0 = 3

Values of GMBUS_PORT_DPB, GMBUS_PORT_DPC, GMBUS_PORT_DPD is retained as it is like other platforms. Only logic in gmbus structure creation is changed to minimize changes in multiple files.

v1: Initial release
Structure gmbus_ports_bxt created for 3 ports only. Here for BXT, gmbus[0], gmbus[1], gmbus[2] is untouched. Logic used to calculate pin from respective register address as:
pin = reg & 0x000f >> 2

v2: Incorporated review comments from Jani Nikula. Added a full bxt specific gmbus_ports_bxt and used it for bxt regardless of pin >= 4.
Added const char *name and initialized it conditionally to IS_BROXTON() so and avoided duplication of snprintf. Added port_to_pin_bxt(port) function which returns right pin value for a port for bxt platform.

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/intel_i2c.c | 55 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 49 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +49 -6
index b31088a..3aa31e1 100644
@@ -48,6 +48,16 @@ static const struct gmbus_port gmbus_ports[] = {
 	{ "dpd", GPIOF },
 };
 
+/* gmbus pin pair configuration for bxt */
+static const struct gmbus_port gmbus_ports_bxt[] = {
+	{ "None", 0 },
+	{ "None", 0 },
+	{ "None", 0 },
+	{ "dpc", PCH_GPIOC },
+	{ "dpb", PCH_GPIOB },
+	{ "misc", PCH_GPIOD },
+};
+
 /* Intel GPIO access functions */
 
 #define I2C_RISEFALL_TIME 10
@@ -185,12 +195,17 @@ static void
 intel_gpio_setup(struct intel_gmbus *bus, u32 pin)
 {
 	struct drm_i915_private *dev_priv = bus->dev_priv;
+	struct drm_device *dev = dev_priv->dev;
 	struct i2c_algo_bit_data *algo;
 
 	algo = &bus->bit_algo;
 
 	/* -1 to map pin pair to gmbus index */
-	bus->gpio_reg = dev_priv->gpio_mmio_base + gmbus_ports[pin - 1].reg;
+	if (IS_BROXTON(dev))
+		bus->gpio_reg = gmbus_ports_bxt[pin - 1].reg;
+	else
+		bus->gpio_reg = dev_priv->gpio_mmio_base
+				+ gmbus_ports[pin - 1].reg;
 
 	bus->adapter.algo_data = algo;
 	algo->setsda = set_data;
@@ -510,6 +525,27 @@ static const struct i2c_algorithm gmbus_algorithm = {
 	.functionality	= gmbus_func
 };
 
+/* returns mapped pin for a port in BXT */
+static u32 port_to_pin_bxt(u32 port)
+{
+	u32 pin;
+
+	switch (port) {
+	case GMBUS_PORT_DPB:
+		pin = 1;
+		break;
+	case GMBUS_PORT_DPC:
+		pin = 2;
+		break;
+	case GMBUS_PORT_DPD:
+		pin = 3;
+		break;
+	default:
+		pin = 0;
+	}
+	return pin;
+}
+
 /**
  * intel_gmbus_setup - instantiate all Intel i2c GMBuses
  * @dev: DRM device
@@ -534,13 +570,17 @@ int intel_setup_gmbus(struct drm_device *dev)
 	for (i = 0; i < GMBUS_NUM_PORTS; i++) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
 		u32 port = i + 1; /* +1 to map gmbus index to pin pair */
+		const char *name;
 
 		bus->adapter.owner = THIS_MODULE;
 		bus->adapter.class = I2C_CLASS_DDC;
-		snprintf(bus->adapter.name,
-			 sizeof(bus->adapter.name),
-			 "i915 gmbus %s",
-			 gmbus_ports[i].name);
+		if (IS_BROXTON(dev))
+			name = gmbus_ports_bxt[i].name;
+		else
+			name = gmbus_ports[i].name;
+
+		snprintf(bus->adapter.name, sizeof(bus->adapter.name),
+			 "i915 gmbus %s", name);
 
 		bus->adapter.dev.parent = &dev->pdev->dev;
 		bus->dev_priv = dev_priv;
@@ -548,7 +588,10 @@ int intel_setup_gmbus(struct drm_device *dev)
 		bus->adapter.algo = &gmbus_algorithm;
 
 		/* By default use a conservative clock rate */
-		bus->reg0 = port | GMBUS_RATE_100KHZ;
+		if (IS_BROXTON(dev))
+			bus->reg0 = port_to_pin_bxt(port) | GMBUS_RATE_100KHZ;
+		else
+			bus->reg0 = port | GMBUS_RATE_100KHZ;
 
 		/* gmbus seems to be broken on i830 */
 		if (IS_I830(dev))
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 20/49
#68 lore raw

Re: [PATCH 20/49] drm/i915/bxt: Add change to support gmbus pin pair for BXT

Quoted 78 lines · Imre Deak

From: "A.Sunil Kamath" <[email protected]>

For BXT gmbus is pulled from GPU to CPU. From implementation point of view only pin pair configuration will change. The existing implementation supports all platforms previous to GEN8 and also SKL. But for BXT pin pair configuration
is completely different than SKL or other previous GEN's. This patch introduces the new pin pair configuration structure specific to BXT and also ensures every real gmbus port has a gpio pin.

Tested on BDW hardware to confirm it doesnt break anything in existing platform.

For BDW pin pair config will remain as:
gmbus[0]: Name = i915 gmbus ssc, gpio_reg = c5014, reg0 = 1 gmbus[1]: Name = i915 gmbus vga, gpio_reg = c5010, reg0 = 2 gmbus[2]: Name = i915 gmbus panel, gpio_reg = c5018, reg0 = 3 gmbus[3]: Name = i915 gmbus dpc, gpio_reg = c501c, reg0 = 4 gmbus[4]: Name = i915 gmbus dpb, gpio_reg = c5020, reg0 = 5 gmbus[5]: Name = i915 gmbus dpd, gpio_reg = c5024, reg0 = 6

BXT will have:
gmbus[0]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[1]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[2]: name = i915 gmbus None, gpio_reg = 0, reg0 = 0 gmbus[3]: name = i915 gmbus dpc, gpio_reg = c5018, reg0 = 2 gmbus[4]: name = i915 gmbus dpb, gpio_reg = c5014, reg0 = 1 gmbus[5]: name = i915 gmbus misc, gpio_reg = c501c, reg0 = 3

Values of GMBUS_PORT_DPB, GMBUS_PORT_DPC, GMBUS_PORT_DPD is retained as it is like other platforms. Only logic in gmbus structure creation is changed to minimize changes in multiple files.

v1: Initial release
Structure gmbus_ports_bxt created for 3 ports only. Here for BXT, gmbus[0], gmbus[1], gmbus[2] is untouched. Logic used to calculate pin from respective register address as:
pin = reg & 0x000f >> 2

v2: Incorporated review comments from Jani Nikula. Added a full bxt specific gmbus_ports_bxt and used it for bxt regardless of pin >= 4.
Added const char *name and initialized it conditionally to IS_BROXTON() so and avoided duplication of snprintf. Added port_to_pin_bxt(port) function which returns right pin value for a port for bxt platform.

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/intel_i2c.c | 55 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 49 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +10 -0
index b31088a..3aa31e1 100644
@@ -48,6 +48,16 @@ static const struct gmbus_port gmbus_ports[] = {
 	{ "dpd", GPIOF },
 };
 
+/* gmbus pin pair configuration for bxt */
+static const struct gmbus_port gmbus_ports_bxt[] = {
+	{ "None", 0 },
+	{ "None", 0 },
+	{ "None", 0 },
+	{ "dpc", PCH_GPIOC },
+	{ "dpb", PCH_GPIOB },
+	{ "misc", PCH_GPIOD },
+};
+
 /* Intel GPIO access functions */
 
 #define I2C_RISEFALL_TIME 10

drivers/gpu/drm/i915/intel_i2c.c static void · line 198

Quoted 4 lines
drivers/gpu/drm/i915/intel_i2c.c +1 -0
@@ -185,12 +195,17 @@ static void
 intel_gpio_setup(struct intel_gmbus *bus, u32 pin)
 {
 	struct drm_i915_private *dev_priv = bus->dev_priv;
+	struct drm_device *dev = dev_priv->dev;

IS_BROXTON() eats dev_priv too so this is not needed.

Quoted 83 lines
drivers/gpu/drm/i915/intel_i2c.c +38 -6
 	struct i2c_algo_bit_data *algo;
 
 	algo = &bus->bit_algo;
 
 	/* -1 to map pin pair to gmbus index */
-	bus->gpio_reg = dev_priv->gpio_mmio_base + gmbus_ports[pin - 1].reg;
+	if (IS_BROXTON(dev))
+		bus->gpio_reg = gmbus_ports_bxt[pin - 1].reg;
+	else
+		bus->gpio_reg = dev_priv->gpio_mmio_base
+				+ gmbus_ports[pin - 1].reg;
 
 	bus->adapter.algo_data = algo;
 	algo->setsda = set_data;
@@ -510,6 +525,27 @@ static const struct i2c_algorithm gmbus_algorithm = {
 	.functionality	= gmbus_func
 };
 
+/* returns mapped pin for a port in BXT */
+static u32 port_to_pin_bxt(u32 port)
+{
+	u32 pin;
+
+	switch (port) {
+	case GMBUS_PORT_DPB:
+		pin = 1;
+		break;
+	case GMBUS_PORT_DPC:
+		pin = 2;
+		break;
+	case GMBUS_PORT_DPD:
+		pin = 3;
+		break;
+	default:
+		pin = 0;
+	}
+	return pin;
+}
+
 /**
  * intel_gmbus_setup - instantiate all Intel i2c GMBuses
  * @dev: DRM device
@@ -534,13 +570,17 @@ int intel_setup_gmbus(struct drm_device *dev)
 	for (i = 0; i < GMBUS_NUM_PORTS; i++) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
 		u32 port = i + 1; /* +1 to map gmbus index to pin pair */
+		const char *name;
 
 		bus->adapter.owner = THIS_MODULE;
 		bus->adapter.class = I2C_CLASS_DDC;
-		snprintf(bus->adapter.name,
-			 sizeof(bus->adapter.name),
-			 "i915 gmbus %s",
-			 gmbus_ports[i].name);
+		if (IS_BROXTON(dev))
+			name = gmbus_ports_bxt[i].name;
+		else
+			name = gmbus_ports[i].name;
+
+		snprintf(bus->adapter.name, sizeof(bus->adapter.name),
+			 "i915 gmbus %s", name);
 
 		bus->adapter.dev.parent = &dev->pdev->dev;
 		bus->dev_priv = dev_priv;
@@ -548,7 +588,10 @@ int intel_setup_gmbus(struct drm_device *dev)
 		bus->adapter.algo = &gmbus_algorithm;
 
 		/* By default use a conservative clock rate */
-		bus->reg0 = port | GMBUS_RATE_100KHZ;
+		if (IS_BROXTON(dev))
+			bus->reg0 = port_to_pin_bxt(port) | GMBUS_RATE_100KHZ;
+		else
+			bus->reg0 = port | GMBUS_RATE_100KHZ;
 
 		/* gmbus seems to be broken on i830 */
 		if (IS_I830(dev))
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#69 lore raw

PATCH 21/49 drm/i915/bxt: WARN in case BXT unused gmbus ports are accessed

In reply to Imre Deak

From: "A.Sunil Kamath" <[email protected]>

This patch will WARN if unused gmbus ports gets accessed for BXT using gmbus_get_adapter also ensure that only valid ports of BXT gets used. For BXT its more important to do this as it has only 3 valid ports and structure has empty content otherwise.

Because of additonal IS_BROXTON check an additional "dev" argument is added to intel_gmbus_is_port_valid. Also added related changes in other places from where this function is accessed.

v1: This WARN patch is added as per review comments from Daniel Vetter on gmbus BXT patch

v2: Changed get_adapter to have only one is_port_valid call according to review comments from M Satheeshakrishna.

v3: Early bail out on errors according to review comments from Daniel Vetter.

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/i915_drv.h   | 8 ++++++--
 drivers/gpu/drm/i915/intel_bios.c | 3 ++-
 drivers/gpu/drm/i915/intel_dvo.c  | 2 +-
 drivers/gpu/drm/i915/intel_i2c.c  | 9 ++++++---
 drivers/gpu/drm/i915/intel_lvds.c | 2 +-
 drivers/gpu/drm/i915/intel_sdvo.c | 4 +++-
 6 files changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -2
index 8fb7cc0..52e5f18 100644
@@ -3037,9 +3037,13 @@ void i915_teardown_sysfs(struct drm_device *dev_priv);
 /* intel_i2c.c */
 extern int intel_setup_gmbus(struct drm_device *dev);
 extern void intel_teardown_gmbus(struct drm_device *dev);
-static inline bool intel_gmbus_is_port_valid(unsigned port)
+static inline bool
+intel_gmbus_is_port_valid(struct drm_device *dev, unsigned port)
 {
-	return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD);
+	if (IS_BROXTON(dev))
+		return port >= GMBUS_PORT_DPC && port <= GMBUS_PORT_DPD;
+	else
+		return port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD;
 }
 
 extern struct i2c_adapter *intel_gmbus_get_adapter(
drivers/gpu/drm/i915/intel_bios.c +2 -1
index c684085..e423cc8 100644
@@ -431,6 +431,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
 			  struct bdb_header *bdb)
 {
 	struct bdb_general_definitions *general;
+	struct drm_device *dev = dev_priv->dev;
 
 	general = find_section(bdb, BDB_GENERAL_DEFINITIONS);
 	if (general) {
@@ -438,7 +439,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
 		if (block_size >= sizeof(*general)) {
 			int bus_pin = general->crt_ddc_gmbus_pin;
 			DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
-			if (intel_gmbus_is_port_valid(bus_pin))
+			if (intel_gmbus_is_port_valid(dev, bus_pin))
 				dev_priv->vbt.crt_ddc_pin = bus_pin;
 		} else {
 			DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n",
drivers/gpu/drm/i915/intel_dvo.c +1 -1
index d857951..27d5b9a 100644
@@ -499,7 +499,7 @@ void intel_dvo_init(struct drm_device *dev)
 		 * special cases, but otherwise default to what's defined
 		 * in the spec.
 		 */
-		if (intel_gmbus_is_port_valid(dvo->gpio))
+		if (intel_gmbus_is_port_valid(dev, dvo->gpio))
 			gpio = dvo->gpio;
 		else if (dvo->type == INTEL_DVO_CHIP_LVDS)
 			gpio = GMBUS_PORT_SSC;
drivers/gpu/drm/i915/intel_i2c.c +6 -3
index 3aa31e1..06892b5 100644
@@ -619,10 +619,13 @@ err:
 struct i2c_adapter *intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,
 					    unsigned port)
 {
-	WARN_ON(!intel_gmbus_is_port_valid(port));
+	struct drm_device *dev = dev_priv->dev;
+
+	if (WARN_ON(!intel_gmbus_is_port_valid(dev, port)))
+		return NULL;
+
 	/* -1 to map pin pair to gmbus index */
-	return (intel_gmbus_is_port_valid(port)) ?
-		&dev_priv->gmbus[port - 1].adapter : NULL;
+	return &dev_priv->gmbus[port - 1].adapter;
 }
 
 void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed)
drivers/gpu/drm/i915/intel_lvds.c +1 -1
index 24e8730..094b88e 100644
@@ -780,7 +780,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
 		    child->device_type != DEVICE_TYPE_LFP)
 			continue;
 
-		if (intel_gmbus_is_port_valid(child->i2c_pin))
+		if (intel_gmbus_is_port_valid(dev, child->i2c_pin))
 			*i2c_pin = child->i2c_pin;
 
 		/* However, we cannot trust the BIOS writers to populate
drivers/gpu/drm/i915/intel_sdvo.c +3 -1
index 9e554c2..d68936e 100644
@@ -2283,6 +2283,7 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
 			  struct intel_sdvo *sdvo, u32 reg)
 {
 	struct sdvo_device_mapping *mapping;
+	struct drm_device *dev = dev_priv->dev;
 	u8 pin;
 
 	if (sdvo->is_sdvob)
@@ -2290,7 +2291,8 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
 	else
 		mapping = &dev_priv->sdvo_mappings[1];
 
-	if (mapping->initialized && intel_gmbus_is_port_valid(mapping->i2c_pin))
+	if (mapping->initialized &&
+		intel_gmbus_is_port_valid(dev, mapping->i2c_pin))
 		pin = mapping->i2c_pin;
 	else
 		pin = GMBUS_PORT_DPB;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 21/49
#70 lore raw

Re: [PATCH 21/49] drm/i915/bxt: WARN in case BXT unused gmbus ports are accessed

Quoted 37 lines · Imre Deak

From: "A.Sunil Kamath" <[email protected]>

This patch will WARN if unused gmbus ports gets accessed for BXT using gmbus_get_adapter also ensure that only valid ports of BXT gets used. For BXT its more important to do this as it has only 3 valid ports and structure has empty content otherwise.

Because of additonal IS_BROXTON check an additional "dev" argument is added to intel_gmbus_is_port_valid. Also added related changes in other places from where this function is accessed.

v1: This WARN patch is added as per review comments from Daniel Vetter on gmbus BXT patch

v2: Changed get_adapter to have only one is_port_valid call according to review comments from M Satheeshakrishna.

v3: Early bail out on errors according to review comments from Daniel Vetter.

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/i915_drv.h   | 8 ++++++--
 drivers/gpu/drm/i915/intel_bios.c | 3 ++-
 drivers/gpu/drm/i915/intel_dvo.c  | 2 +-
 drivers/gpu/drm/i915/intel_i2c.c  | 9 ++++++---
 drivers/gpu/drm/i915/intel_lvds.c | 2 +-
 drivers/gpu/drm/i915/intel_sdvo.c | 4 +++-
 6 files changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 8fb7cc0..52e5f18 100644

drivers/gpu/drm/i915/i915_drv.h void i915_teardown_sysfs(struct drm_device *dev_priv); · line 3041

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +2 -1
@@ -3037,9 +3037,13 @@ void i915_teardown_sysfs(struct drm_device *dev_priv);
 /* intel_i2c.c */
 extern int intel_setup_gmbus(struct drm_device *dev);
 extern void intel_teardown_gmbus(struct drm_device *dev);
-static inline bool intel_gmbus_is_port_valid(unsigned port)
+static inline bool
+intel_gmbus_is_port_valid(struct drm_device *dev, unsigned port)

It's probably better to pass dev_priv here, and fix all the call sites. Removes a bunch of extra local vars down there.

With this fixed,

drivers/gpu/drm/i915/i915_drv.h void i915_teardown_sysfs(struct drm_device *dev_priv); · line 3044

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +2 -1
 {
-	return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD);
+	if (IS_BROXTON(dev))
+		return port >= GMBUS_PORT_DPC && port <= GMBUS_PORT_DPD;

It's seriously confusing that _DPB is within that range... but not a problem in this patch per se.

Quoted 102 lines
drivers/gpu/drm/i915/i915_drv.h +2 -0
+	else
+		return port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD;
 }
 
 extern struct i2c_adapter *intel_gmbus_get_adapter(
drivers/gpu/drm/i915/intel_bios.c +2 -1
index c684085..e423cc8 100644
@@ -431,6 +431,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
 			  struct bdb_header *bdb)
 {
 	struct bdb_general_definitions *general;
+	struct drm_device *dev = dev_priv->dev;
 
 	general = find_section(bdb, BDB_GENERAL_DEFINITIONS);
 	if (general) {
@@ -438,7 +439,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
 		if (block_size >= sizeof(*general)) {
 			int bus_pin = general->crt_ddc_gmbus_pin;
 			DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
-			if (intel_gmbus_is_port_valid(bus_pin))
+			if (intel_gmbus_is_port_valid(dev, bus_pin))
 				dev_priv->vbt.crt_ddc_pin = bus_pin;
 		} else {
 			DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n",
drivers/gpu/drm/i915/intel_dvo.c +1 -1
index d857951..27d5b9a 100644
@@ -499,7 +499,7 @@ void intel_dvo_init(struct drm_device *dev)
 		 * special cases, but otherwise default to what's defined
 		 * in the spec.
 		 */
-		if (intel_gmbus_is_port_valid(dvo->gpio))
+		if (intel_gmbus_is_port_valid(dev, dvo->gpio))
 			gpio = dvo->gpio;
 		else if (dvo->type == INTEL_DVO_CHIP_LVDS)
 			gpio = GMBUS_PORT_SSC;
drivers/gpu/drm/i915/intel_i2c.c +6 -3
index 3aa31e1..06892b5 100644
@@ -619,10 +619,13 @@ err:
 struct i2c_adapter *intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,
 					    unsigned port)
 {
-	WARN_ON(!intel_gmbus_is_port_valid(port));
+	struct drm_device *dev = dev_priv->dev;
+
+	if (WARN_ON(!intel_gmbus_is_port_valid(dev, port)))
+		return NULL;
+
 	/* -1 to map pin pair to gmbus index */
-	return (intel_gmbus_is_port_valid(port)) ?
-		&dev_priv->gmbus[port - 1].adapter : NULL;
+	return &dev_priv->gmbus[port - 1].adapter;
 }
 
 void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed)
drivers/gpu/drm/i915/intel_lvds.c +1 -1
index 24e8730..094b88e 100644
@@ -780,7 +780,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
 		    child->device_type != DEVICE_TYPE_LFP)
 			continue;
 
-		if (intel_gmbus_is_port_valid(child->i2c_pin))
+		if (intel_gmbus_is_port_valid(dev, child->i2c_pin))
 			*i2c_pin = child->i2c_pin;
 
 		/* However, we cannot trust the BIOS writers to populate
drivers/gpu/drm/i915/intel_sdvo.c +3 -1
index 9e554c2..d68936e 100644
@@ -2283,6 +2283,7 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
 			  struct intel_sdvo *sdvo, u32 reg)
 {
 	struct sdvo_device_mapping *mapping;
+	struct drm_device *dev = dev_priv->dev;
 	u8 pin;
 
 	if (sdvo->is_sdvob)
@@ -2290,7 +2291,8 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
 	else
 		mapping = &dev_priv->sdvo_mappings[1];
 
-	if (mapping->initialized && intel_gmbus_is_port_valid(mapping->i2c_pin))
+	if (mapping->initialized &&
+		intel_gmbus_is_port_valid(dev, mapping->i2c_pin))
 		pin = mapping->i2c_pin;
 	else
 		pin = GMBUS_PORT_DPB;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#71 lore raw

PATCH 22/49 drm/i915/bxt: Avoid registering unused gmbus ports as i2c adapter

In reply to Imre Deak

From: "A.Sunil Kamath" <[email protected]>

Though we populate all gmbus ports during setup_gmbus, only valid ones should be registered to i2c adapters. This is important as userspace can directly interact with the i2c bus.

While populating gmbus register we ensure that unused ports will have gpio_reg value set as 0. This patch ensures that only those with non zero gpio reg will get registered as i2c adapter and this is applicable for all platforms.

del_adapter will check if the adaptor was really added before, still its better to avoid unnecessary calls to the same. This patch also adds a check to deregister only added i2c adapters.

Tested using i2c-tools to confirm that only valid gmbus ports are registered as i2c adapter.

BXT will have only valid i2c adapters as below:

i2c-x      i2c     i915 gmbus dpc      I2C adapter
i2c-x+1    i2c     i915 gmbus dpb      I2C adapter
i2c-x+2    i2c     i915 gmbus misc     I2C adapter

v1: This patch is added as per review comments from Daniel Vetter on gmbus BXT patch

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/intel_i2c.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +10 -5
index 06892b5..d5ca310 100644
@@ -599,9 +599,12 @@ int intel_setup_gmbus(struct drm_device *dev)
 
 		intel_gpio_setup(bus, port);
 
-		ret = i2c_add_adapter(&bus->adapter);
-		if (ret)
-			goto err;
+		/* Do not register unused gmbus ports as i2c adapter */
+		if (bus->gpio_reg) {
+			ret = i2c_add_adapter(&bus->adapter);
+			if (ret)
+				goto err;
+		}
 	}
 
 	intel_i2c_reset(dev_priv->dev);
@@ -611,7 +614,8 @@ int intel_setup_gmbus(struct drm_device *dev)
 err:
 	while (--i) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 	return ret;
 }
@@ -652,6 +656,7 @@ void intel_teardown_gmbus(struct drm_device *dev)
 
 	for (i = 0; i < GMBUS_NUM_PORTS; i++) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 }
Signature · 6 lines
2.1.0

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

Re: [PATCH 22/49] drm/i915/bxt: Avoid registering unused gmbus ports as i2c adapter

Quoted 38 lines · Imre Deak

From: "A.Sunil Kamath" <[email protected]>

Though we populate all gmbus ports during setup_gmbus, only valid ones should be registered to i2c adapters. This is important as userspace can directly interact with the i2c bus.

While populating gmbus register we ensure that unused ports will have gpio_reg value set as 0. This patch ensures that only those with non zero gpio reg will get registered as i2c adapter and this is applicable for all platforms.

del_adapter will check if the adaptor was really added before, still its better to avoid unnecessary calls to the same. This patch also adds a check to deregister only added i2c adapters.

Tested using i2c-tools to confirm that only valid gmbus ports are registered as i2c adapter.

BXT will have only valid i2c adapters as below:

i2c-x      i2c     i915 gmbus dpc      I2C adapter
i2c-x+1    i2c     i915 gmbus dpb      I2C adapter
i2c-x+2    i2c     i915 gmbus misc     I2C adapter

v1: This patch is added as per review comments from Daniel Vetter on gmbus BXT patch

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/intel_i2c.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +0 -0
index 06892b5..d5ca310 100644

drivers/gpu/drm/i915/intel_i2c.c int intel_setup_gmbus(struct drm_device *dev) · line 603

Quoted 8 lines
drivers/gpu/drm/i915/intel_i2c.c +2 -3
@@ -599,9 +599,12 @@ int intel_setup_gmbus(struct drm_device *dev)
 
 		intel_gpio_setup(bus, port);
 
-		ret = i2c_add_adapter(&bus->adapter);
-		if (ret)
-			goto err;
+		/* Do not register unused gmbus ports as i2c adapter */
+		if (bus->gpio_reg) {

This works by accident, as bus->gpio_reg will contain dev_priv->gpio_mmio_base even if the reg is 0. Luckily for BXT this is the case.

I think the question is, why do we initialize anything for dev_priv->gmbus[i] where i is an unused pin pair? I think we should have the validity check at the top, and if (invalid) continue;.

I care because we appear to be registering unused adapters also on other recent platforms, and we should fix that too. That doesn't have to be part of bxt enabling, but I don't like adding broken stuff that makes future work harder.

BR,
Jani.

Quoted 29 lines
drivers/gpu/drm/i915/intel_i2c.c +5 -2
+ ret = i2c_add_adapter(&bus->adapter); + if (ret) + goto err; + } }
 
 	intel_i2c_reset(dev_priv->dev);
@@ -611,7 +614,8 @@ int intel_setup_gmbus(struct drm_device *dev)
 err:
 	while (--i) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 	return ret;
 }
@@ -652,6 +656,7 @@ void intel_teardown_gmbus(struct drm_device *dev)
 
 	for (i = 0; i < GMBUS_NUM_PORTS; i++) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#73 lore raw

Re: [PATCH 22/49] drm/i915/bxt: Avoid registering unused gmbus ports as i2c adapter

Quoted 52 lines · Jani Nikula
Quoted 38 lines · Imre Deak

From: "A.Sunil Kamath" <[email protected]>

Though we populate all gmbus ports during setup_gmbus, only valid ones should be registered to i2c adapters. This is important as userspace can directly interact with the i2c bus.

While populating gmbus register we ensure that unused ports will have gpio_reg value set as 0. This patch ensures that only those with non zero gpio reg will get registered as i2c adapter and this is applicable for all platforms.

del_adapter will check if the adaptor was really added before, still its better to avoid unnecessary calls to the same. This patch also adds a check to deregister only added i2c adapters.

Tested using i2c-tools to confirm that only valid gmbus ports are registered as i2c adapter.

BXT will have only valid i2c adapters as below:

i2c-x      i2c     i915 gmbus dpc      I2C adapter
i2c-x+1    i2c     i915 gmbus dpb      I2C adapter
i2c-x+2    i2c     i915 gmbus misc     I2C adapter

v1: This patch is added as per review comments from Daniel Vetter on gmbus BXT patch

Issue: VIZ-3574

---
 drivers/gpu/drm/i915/intel_i2c.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +0 -0
index 06892b5..d5ca310 100644

drivers/gpu/drm/i915/intel_i2c.c int intel_setup_gmbus(struct drm_device *dev) · line 603

Quoted 8 lines
drivers/gpu/drm/i915/intel_i2c.c +2 -3
@@ -599,9 +599,12 @@ int intel_setup_gmbus(struct drm_device *dev)
 
 		intel_gpio_setup(bus, port);
 
-		ret = i2c_add_adapter(&bus->adapter);
-		if (ret)
-			goto err;
+		/* Do not register unused gmbus ports as i2c adapter */
+		if (bus->gpio_reg) {

This works by accident, as bus->gpio_reg will contain dev_priv->gpio_mmio_base even if the reg is 0. Luckily for BXT this is the case.

Quoted 8 lines

I think the question is, why do we initialize anything for dev_priv->gmbus[i] where i is an unused pin pair? I think we should have the validity check at the top, and if (invalid) continue;.

I care because we appear to be registering unused adapters also on other recent platforms, and we should fix that too. That doesn't have to be part of bxt enabling, but I don't like adding broken stuff that makes future work harder.

Okay, so I ended up fixing this myself [1], replacing patches 20, 21, and 22 of this series.

BR,
Jani.

[1] http://mid.gmane.org/[email protected]

Quoted 38 lines

BR,
Jani.

Quoted 29 lines
drivers/gpu/drm/i915/intel_i2c.c +5 -2
+ ret = i2c_add_adapter(&bus->adapter); + if (ret) + goto err; + } }
 
 	intel_i2c_reset(dev_priv->dev);
@@ -611,7 +614,8 @@ int intel_setup_gmbus(struct drm_device *dev)
 err:
 	while (--i) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 	return ret;
 }
@@ -652,6 +656,7 @@ void intel_teardown_gmbus(struct drm_device *dev)
 
 	for (i = 0; i < GMBUS_NUM_PORTS; i++) {
 		struct intel_gmbus *bus = &dev_priv->gmbus[i];
-		i2c_del_adapter(&bus->adapter);
+		if (bus->gpio_reg)
+			i2c_del_adapter(&bus->adapter);
 	}
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#74 lore raw

PATCH 23/49 drm/i915/bxt: Increase DDI buf idle timeout

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

For BXT, DDI buf idle timeout delay needs to be increased to 16us.

Since this is a timeout value and we return as soon as the condition is realized, no penalty incurred for other platforms.

---
 drivers/gpu/drm/i915/i915_reg.h  | 1 +
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index d69d7b9..60ff760 100644
@@ -6576,6 +6576,7 @@ enum skl_disp_power_wells {
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
 #define  DDI_BUF_PORT_REVERSAL			(1<<16)
 #define  DDI_BUF_IS_IDLE			(1<<7)
+#define  DDI_BUF_IDLE_TIMEOUT			16	  /* 16us */
 #define  DDI_A_4_LANES				(1<<4)
 #define  DDI_PORT_WIDTH(width)			(((width) - 1) << 1)
 #define  DDI_INIT_DISPLAY_DETECTED		(1<<0)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index 8aee7d7..a203d9d 100644
@@ -322,7 +322,7 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 	uint32_t reg = DDI_BUF_CTL(port);
 	int i;
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < DDI_BUF_IDLE_TIMEOUT; i++) {
 		udelay(1);
 		if (I915_READ(reg) & DDI_BUF_IS_IDLE)
 			return;
Signature · 6 lines
2.1.0

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

Re: [PATCH 23/49] drm/i915/bxt: Increase DDI buf idle timeout

Quoted 22 lines · Imre Deak

From: Vandana Kannan <[email protected]>

For BXT, DDI buf idle timeout delay needs to be increased to 16us.

Since this is a timeout value and we return as soon as the condition is realized, no penalty incurred for other platforms.

---
 drivers/gpu/drm/i915/i915_reg.h  | 1 +
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index d69d7b9..60ff760 100644

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6579

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -6576,6 +6576,7 @@ enum skl_disp_power_wells {
 #define  DDI_BUF_EMP_MASK			(0xf<<24)
 #define  DDI_BUF_PORT_REVERSAL			(1<<16)
 #define  DDI_BUF_IS_IDLE			(1<<7)
+#define  DDI_BUF_IDLE_TIMEOUT			16	  /* 16us */

Putting this sw value in the middle of all the hw register definitions is really confusing. Imo just drop it, just adds indirection.

drivers/gpu/drm/i915/intel_ddi.c static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv, · line 324

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
 #define  DDI_A_4_LANES				(1<<4)
 #define  DDI_PORT_WIDTH(width)			(((width) - 1) << 1)
 #define  DDI_INIT_DISPLAY_DETECTED		(1<<0)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 8aee7d7..a203d9d 100644
@@ -322,7 +322,7 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 	uint32_t reg = DDI_BUF_CTL(port);
 	int i;
 

Instead please add a wa notice or comment here that bxt needs more timeout delay. Otherwise someone might frob this again by accident. -Daniel

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -1
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < DDI_BUF_IDLE_TIMEOUT; i++) {
 		udelay(1);
 		if (I915_READ(reg) & DDI_BUF_IS_IDLE)
 			return;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#76 lore raw

PATCH v2 23/49 drm/i915/bxt: Increase DDI buf idle timeout

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

For BXT, DDI buf idle timeout delay needs to be increased to 16us.

Since this is a timeout value and we return as soon as the condition is realized, no penalty incurred for other platforms.

v2:
- remove TIMEOUT macro used only at a single place (Daniel)

---
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index 8aee7d7..e24cd6f 100644
@@ -322,7 +322,7 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 	uint32_t reg = DDI_BUF_CTL(port);
 	int i;
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < 16; i++) {
 		udelay(1);
 		if (I915_READ(reg) & DDI_BUF_IS_IDLE)
 			return;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 23/49
#77 lore raw

Re: [PATCH v2 23/49] drm/i915/bxt: Increase DDI buf idle timeout

Quoted 7 lines · Imre Deak

From: Vandana Kannan <[email protected]>

For BXT, DDI buf idle timeout delay needs to be increased to 16us.

Since this is a timeout value and we return as soon as the condition is realized, no penalty incurred for other platforms.

Quoted 8 lines

v2:
- remove TIMEOUT macro used only at a single place (Daniel)

Might have a comment about bxt vs. others in there, but either way,

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index 8aee7d7..e24cd6f 100644
@@ -322,7 +322,7 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 	uint32_t reg = DDI_BUF_CTL(port);
 	int i;
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < 16; i++) {
 		udelay(1);
 		if (I915_READ(reg) & DDI_BUF_IS_IDLE)
 			return;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#78 lore raw

Re: [PATCH v2 23/49] drm/i915/bxt: Increase DDI buf idle timeout

Quoted 8 lines · Jani Nikula
Quoted 7 lines · Imre Deak

From: Vandana Kannan <[email protected]>

For BXT, DDI buf idle timeout delay needs to be increased to 16us.

Since this is a timeout value and we return as soon as the condition is realized, no penalty incurred for other platforms.

Quoted 8 lines
Quoted 8 lines

v2:
- remove TIMEOUT macro used only at a single place (Daniel)

Just because this one is lacking sobe lines ... when you send out patches, you should add your own sob. Anyway, applied without that. -Daniel

Quoted 33 lines

Might have a comment about bxt vs. others in there, but either way,

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_ddi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
index 8aee7d7..e24cd6f 100644
@@ -322,7 +322,7 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 	uint32_t reg = DDI_BUF_CTL(port);
 	int i;
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < 16; i++) {
 		udelay(1);
 		if (I915_READ(reg) & DDI_BUF_IS_IDLE)
 			return;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#79 lore raw

PATCH 24/49 drm/i915/bxt: DDI Hotplug interrupt setup

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)

---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 25 +++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +48 -1
index 49ad5fb..a51c00e 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3235,6 +3241,44 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	list_for_each_entry(intel_encoder, &mode_config->encoder_list,
+		base.head) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4355,7 +4399,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +25 -0
index 60ff760..1efee7d 100644
@@ -5247,6 +5247,14 @@ enum skl_disp_power_wells {
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
+/* Gen 9 BXT DDI Hotplug */
+#define BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					BXT_DE_PORT_HP_DDIB | \
+					BXT_DE_PORT_HP_DDIC)
+
 #define GEN8_DE_MISC_ISR 0x44460
 #define GEN8_DE_MISC_IMR 0x44464
 #define GEN8_DE_MISC_IIR 0x44468
@@ -5258,6 +5266,23 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL		0xC4030
+#define BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					BXT_DDIB_HPD_ENABLE | \
+					BXT_DDIC_HPD_ENABLE)
+
+/* Hot plug status */
+#define BXT_DDIA_HPD_STATUS		(3 << 24)
+#define BXT_DDIB_HPD_STATUS		(3 << 0)
+#define BXT_DDIC_HPD_STATUS		(3 << 8)
+#define BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					BXT_DDIB_HPD_STATUS | \
+					BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 6 lines
2.1.0

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

Re: [PATCH 24/49] drm/i915/bxt: DDI Hotplug interrupt setup

Quoted 70 lines · Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)

---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 25 +++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +32 -0
index 49ad5fb..a51c00e 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3235,6 +3241,44 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	list_for_each_entry(intel_encoder, &mode_config->encoder_list,
+		base.head) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;

drivers/gpu/drm/i915/i915_irq.c static void ibx_hpd_irq_setup(struct drm_device *dev) · line 3279

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);

Out of paranoi I checked the locking here, but we seem to be save already with dev_priv->irq_lock.

Quoted 22 lines
drivers/gpu/drm/i915/i915_irq.c +6 -1
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4355,7 +4399,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 60ff760..1efee7d 100644

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 5256

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
@@ -5247,6 +5247,14 @@ enum skl_disp_power_wells {
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
+/* Gen 9 BXT DDI Hotplug */
+#define BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					BXT_DE_PORT_HP_DDIB | \
+					BXT_DE_PORT_HP_DDIC)

Generally we interleave definitions for different platforms if it's the same register.

Quoted 35 lines
drivers/gpu/drm/i915/i915_reg.h +18 -0
+
 #define GEN8_DE_MISC_ISR 0x44460
 #define GEN8_DE_MISC_IMR 0x44464
 #define GEN8_DE_MISC_IIR 0x44468
@@ -5258,6 +5266,23 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL		0xC4030
+#define BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					BXT_DDIB_HPD_ENABLE | \
+					BXT_DDIC_HPD_ENABLE)
+
+/* Hot plug status */
+#define BXT_DDIA_HPD_STATUS		(3 << 24)
+#define BXT_DDIB_HPD_STATUS		(3 << 0)
+#define BXT_DDIC_HPD_STATUS		(3 << 8)
+#define BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					BXT_DDIB_HPD_STATUS | \
+					BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#81 lore raw

Re: [PATCH 24/49] drm/i915/bxt: DDI Hotplug interrupt setup

Quoted 110 lines · Daniel Vetter
Quoted 70 lines · Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)

---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 25 +++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +32 -0
index 49ad5fb..a51c00e 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3235,6 +3241,44 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	list_for_each_entry(intel_encoder, &mode_config->encoder_list,
+		base.head) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;

drivers/gpu/drm/i915/i915_irq.c static void ibx_hpd_irq_setup(struct drm_device *dev) · line 3279

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);

Out of paranoi I checked the locking here, but we seem to be save already with dev_priv->irq_lock.

Quoted 25 lines
drivers/gpu/drm/i915/i915_irq.c +6 -1
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4355,7 +4399,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 60ff760..1efee7d 100644
@@ -5247,6 +5247,14 @@ enum skl_disp_power_wells {
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
Quoted 10 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 5256

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+/* Gen 9 BXT DDI Hotplug */
+#define BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					BXT_DE_PORT_HP_DDIB | \
+					BXT_DE_PORT_HP_DDIC)

Generally we interleave definitions for different platforms if it's the same register.

The list was already a bit mis-ordered, but agreed, will clean this up.

Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/i915/i915_reg.h +18 -0
+
 #define GEN8_DE_MISC_ISR 0x44460
 #define GEN8_DE_MISC_IMR 0x44464
 #define GEN8_DE_MISC_IIR 0x44468
@@ -5258,6 +5266,23 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL		0xC4030
+#define BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					BXT_DDIB_HPD_ENABLE | \
+					BXT_DDIC_HPD_ENABLE)
+
+/* Hot plug status */
+#define BXT_DDIA_HPD_STATUS		(3 << 24)
+#define BXT_DDIB_HPD_STATUS		(3 << 0)
+#define BXT_DDIC_HPD_STATUS		(3 << 8)
+#define BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					BXT_DDIB_HPD_STATUS | \
+					BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 1 line
2.1.0
Quoted 5 lines
Quoted 4 lines

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

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

author
#82 lore raw

PATCH v6 24/49 drm/i915/bxt: DDI Hotplug interrupt setup

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)
v6: fix order of definitions for register bitfields (Daniel)

---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 25 ++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +48 -1
index 14ecb4d..d09b389 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3178,6 +3184,44 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	list_for_each_entry(intel_encoder, &mode_config->encoder_list,
+		base.head) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4298,7 +4342,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +24 -1
index 6a5ade6..a082d7d 100644
@@ -5240,10 +5240,16 @@ enum skl_disp_power_wells {
 #define GEN8_DE_PORT_IMR 0x44444
 #define GEN8_DE_PORT_IIR 0x44448
 #define GEN8_DE_PORT_IER 0x4444c
-#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN9_AUX_CHANNEL_D		(1 << 27)
 #define  GEN9_AUX_CHANNEL_C		(1 << 26)
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
+#define  BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define  BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define  BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define  BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					 BXT_DE_PORT_HP_DDIB | \
+					 BXT_DE_PORT_HP_DDIC)
+#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
@@ -5257,6 +5263,23 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL			0xC4030
+#define BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					 BXT_DDIB_HPD_ENABLE | \
+					 BXT_DDIC_HPD_ENABLE)
+
+/* Hot plug status */
+#define BXT_DDIA_HPD_STATUS		(3 << 24)
+#define BXT_DDIC_HPD_STATUS		(3 << 8)
+#define BXT_DDIB_HPD_STATUS		(3 << 0)
+#define BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					 BXT_DDIB_HPD_STATUS | \
+					 BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 6 lines
2.1.0

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

Re: [PATCH v6 24/49] drm/i915/bxt: DDI Hotplug interrupt setup

Quoted 29 lines · Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)
v6: fix order of definitions for register bitfields (Daniel)

---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 25 ++++++++++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 14ecb4d..d09b389 100644

drivers/gpu/drm/i915/i915_irq.c static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th · line 92

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +2 -0
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[] = {

You need to specify the size hpd_bxt[HPD_NUM_PINS] here to be defensive about not going out of bounds.

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +5 -0
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3178,6 +3184,44 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)

drivers/gpu/drm/i915/i915_irq.c static void ibx_hpd_irq_setup(struct drm_device *dev) · line 3197

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	list_for_each_entry(intel_encoder, &mode_config->encoder_list,
+		base.head) {

for_each_intel_encoder

Quoted 74 lines
drivers/gpu/drm/i915/i915_irq.c +31 -1
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4298,7 +4342,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +13 -1
index 6a5ade6..a082d7d 100644
@@ -5240,10 +5240,16 @@ enum skl_disp_power_wells {
 #define GEN8_DE_PORT_IMR 0x44444
 #define GEN8_DE_PORT_IIR 0x44448
 #define GEN8_DE_PORT_IER 0x4444c
-#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN9_AUX_CHANNEL_D		(1 << 27)
 #define  GEN9_AUX_CHANNEL_C		(1 << 26)
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
+#define  BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define  BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define  BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define  BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					 BXT_DE_PORT_HP_DDIB | \
+					 BXT_DE_PORT_HP_DDIC)
+#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
@@ -5257,6 +5263,23 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL			0xC4030
+#define BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 5281

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+					 BXT_DDIB_HPD_ENABLE | \
+					 BXT_DDIC_HPD_ENABLE)
+
+/* Hot plug status */
+#define BXT_DDIA_HPD_STATUS		(3 << 24)
+#define BXT_DDIC_HPD_STATUS		(3 << 8)
+#define BXT_DDIB_HPD_STATUS		(3 << 0)
+#define BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					 BXT_DDIB_HPD_STATUS | \
+					 BXT_DDIC_HPD_STATUS)

I'd appreciate keeping the convention of having two spaces between #define and the name for register contents (bits, masks, etc.).

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#84 lore raw

PATCH v7 24/49 drm/i915/bxt: DDI Hotplug interrupt setup

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)
v6: fix order of definitions for register bitfields (Daniel)
v7: (jani)
- define the size of the hpd_bxt array explicitly for bound checking
- use for_each_intel_encoder instead of open coding it
- fix format/order of definitions for BXT_HOTPLUG_CTL reg bitfields

---
 drivers/gpu/drm/i915/i915_irq.c | 47 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 23 +++++++++++++++++++-
 2 files changed, 68 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +46 -1
index 46bcbff..631484d 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[HPD_NUM_PINS] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3159,6 +3165,42 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	for_each_intel_encoder(dev, intel_encoder) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4279,7 +4321,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +22 -1
index 7d51aec..670a9d4 100644
@@ -5256,10 +5256,16 @@ enum skl_disp_power_wells {
 #define GEN8_DE_PORT_IMR 0x44444
 #define GEN8_DE_PORT_IIR 0x44448
 #define GEN8_DE_PORT_IER 0x4444c
-#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN9_AUX_CHANNEL_D		(1 << 27)
 #define  GEN9_AUX_CHANNEL_C		(1 << 26)
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
+#define  BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define  BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define  BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define  BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					 BXT_DE_PORT_HP_DDIB | \
+					 BXT_DE_PORT_HP_DDIC)
+#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
@@ -5273,6 +5279,21 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL			0xC4030
+#define   BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define   BXT_DDIA_HPD_STATUS		(3 << 24)
+#define   BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define   BXT_DDIC_HPD_STATUS		(3 << 8)
+#define   BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define   BXT_DDIB_HPD_STATUS		(3 << 0)
+#define   BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					 BXT_DDIB_HPD_ENABLE | \
+					 BXT_DDIC_HPD_ENABLE)
+#define   BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					 BXT_DDIB_HPD_STATUS | \
+					 BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 6 lines
1.9.1

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

PATCH v2 25/49 drm/i915/bxt: Add DDI hpd handler

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

v2: (jani)
- drop redundant unlikely()
- s/Todo/FIXME:/ in code comment
- declare 'found' var in the scope where it's used
- check for IS_BROXTON before handling BXT_DE_PORT_HOTPLUG_MASK

---
 drivers/gpu/drm/i915/i915_irq.c | 46 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +44 -2
index 631484d..b06364f 100644
@@ -2152,6 +2152,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (!(hp_control & BXT_HOTPLUG_CTL_MASK)) {
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
+
+	/*
+	 * FIXME: Save the hot plug status for bottom half before
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */
+
+	/* Clear sticky bits in hpd status */
+	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+}
+
 static irqreturn_t gen8_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -2197,12 +2229,22 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 	if (master_ctl & GEN8_DE_PORT_IRQ) {
 		tmp = I915_READ(GEN8_DE_PORT_IIR);
 		if (tmp) {
+			bool found = false;
+
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
 			ret = IRQ_HANDLED;
 
-			if (tmp & aux_mask)
+			if (tmp & aux_mask) {
 				dp_aux_irq_handler(dev);
-			else
+				found = true;
+			}
+
+			if (IS_BROXTON(dev) && tmp & BXT_DE_PORT_HOTPLUG_MASK) {
+				bxt_hpd_handler(dev, tmp);
+				found = true;
+			}
+
+			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
 		else
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 25/49
#86 lore raw

Re: [PATCH v2 25/49] drm/i915/bxt: Add DDI hpd handler

Quoted 15 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

v2: (jani)
- drop redundant unlikely()
- s/Todo/FIXME:/ in code comment
- declare 'found' var in the scope where it's used
- check for IS_BROXTON before handling BXT_DE_PORT_HOTPLUG_MASK

Quoted 4 lines
Quoted 75 lines
---
 drivers/gpu/drm/i915/i915_irq.c | 46 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +44 -2
index 631484d..b06364f 100644
@@ -2152,6 +2152,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (!(hp_control & BXT_HOTPLUG_CTL_MASK)) {
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
+
+	/*
+	 * FIXME: Save the hot plug status for bottom half before
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */
+
+	/* Clear sticky bits in hpd status */
+	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+}
+
 static irqreturn_t gen8_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -2197,12 +2229,22 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 	if (master_ctl & GEN8_DE_PORT_IRQ) {
 		tmp = I915_READ(GEN8_DE_PORT_IIR);
 		if (tmp) {
+			bool found = false;
+
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
 			ret = IRQ_HANDLED;
 
-			if (tmp & aux_mask)
+			if (tmp & aux_mask) {
 				dp_aux_irq_handler(dev);
-			else
+				found = true;
+			}
+
+			if (IS_BROXTON(dev) && tmp & BXT_DE_PORT_HOTPLUG_MASK) {
+				bxt_hpd_handler(dev, tmp);
+				found = true;
+			}
+
+			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
 		else
Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#87 lore raw

PATCH v2 26/49 drm/i915/bxt: Add BXT support in gen8_irq functions

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

v2: (jani)
- drop redundant TODO comment about PCH IRQ flags on BXT
- check HAS_PCH_SPLIT instead of IS_BROXTON when handling PCH specific IRQ events in gen8_irq_handler()
- check HAS_PCH_SPLIT before calling the function instead of a corresponding early return within the called function for ibx_irq_reset(), ibx_irq_pre_postinstall(), ibx_irq_postinstall()

---
 drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +14 -7
index b06364f..a185f44 100644
@@ -2297,7 +2297,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	if (HAS_PCH_SPLIT(dev) && !HAS_PCH_NOP(dev) &&
+	    master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3073,7 +3074,8 @@ static void ironlake_irq_reset(struct drm_device *dev)
 
 	gen5_gt_irq_reset(dev);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 static void vlv_display_irq_reset(struct drm_i915_private *dev_priv)
@@ -3133,7 +3135,8 @@ static void gen8_irq_reset(struct drm_device *dev)
 	GEN5_IRQ_RESET(GEN8_DE_MISC_);
 	GEN5_IRQ_RESET(GEN8_PCU_);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3323,13 +3326,15 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 	I915_WRITE(HWSTAM, 0xeffe);
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	GEN5_IRQ_INIT(DE, dev_priv->irq_mask, display_mask | extra_mask);
 
 	gen5_gt_irq_postinstall(dev);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
 	if (IS_IRONLAKE_M(dev)) {
 		/* Enable PCU event interrupts
@@ -3545,12 +3550,14 @@ static int gen8_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	gen8_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
 	I915_WRITE(GEN8_MASTER_IRQ, DE_MASTER_IRQ_CONTROL);
 	POSTING_READ(GEN8_MASTER_IRQ);
Signature · 6 lines
1.9.1

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

Re: [PATCH v2 26/49] drm/i915/bxt: Add BXT support in gen8_irq functions

Quoted 62 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

v2: (jani)
- drop redundant TODO comment about PCH IRQ flags on BXT
- check HAS_PCH_SPLIT instead of IS_BROXTON when handling PCH specific IRQ events in gen8_irq_handler()
- check HAS_PCH_SPLIT before calling the function instead of a corresponding early return within the called function for ibx_irq_reset(), ibx_irq_pre_postinstall(), ibx_irq_postinstall()

---
 drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -4
index b06364f..a185f44 100644
@@ -2297,7 +2297,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	if (HAS_PCH_SPLIT(dev) && !HAS_PCH_NOP(dev) &&
+	    master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3073,7 +3074,8 @@ static void ironlake_irq_reset(struct drm_device *dev)
 
 	gen5_gt_irq_reset(dev);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 static void vlv_display_irq_reset(struct drm_i915_private *dev_priv)
@@ -3133,7 +3135,8 @@ static void gen8_irq_reset(struct drm_device *dev)
 	GEN5_IRQ_RESET(GEN8_DE_MISC_);
 	GEN5_IRQ_RESET(GEN8_PCU_);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3323,13 +3326,15 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 	I915_WRITE(HWSTAM, 0xeffe);
 
-	ibx_irq_pre_postinstall(dev);

drivers/gpu/drm/i915/i915_irq.c static int ironlake_irq_postinstall(struct drm_device *dev) · line 3337

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +4 -1
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	GEN5_IRQ_INIT(DE, dev_priv->irq_mask, display_mask | extra_mask);
 
 	gen5_gt_irq_postinstall(dev);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);

/me scratches head, we shouldn't ever call ironlake_irq_postinstall on bxt, should we? Did I miss something?

With this hunk dropped, I think the patch looks good.

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/i915_irq.c +4 -2
 	if (IS_IRONLAKE_M(dev)) {
 		/* Enable PCU event interrupts
@@ -3545,12 +3550,14 @@ static int gen8_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	gen8_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
 	I915_WRITE(GEN8_MASTER_IRQ, DE_MASTER_IRQ_CONTROL);
 	POSTING_READ(GEN8_MASTER_IRQ);
Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#89 lore raw

Re: [PATCH v2 26/49] drm/i915/bxt: Add BXT support in gen8_irq functions

Quoted 68 lines · Jani Nikula
Quoted 67 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

v2: (jani)
- drop redundant TODO comment about PCH IRQ flags on BXT
- check HAS_PCH_SPLIT instead of IS_BROXTON when handling PCH specific IRQ events in gen8_irq_handler()
- check HAS_PCH_SPLIT before calling the function instead of a corresponding early return within the called function for ibx_irq_reset(), ibx_irq_pre_postinstall(), ibx_irq_postinstall()

---
 drivers/gpu/drm/i915/i915_irq.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +8 -4
index b06364f..a185f44 100644
@@ -2297,7 +2297,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	if (HAS_PCH_SPLIT(dev) && !HAS_PCH_NOP(dev) &&
+	    master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3073,7 +3074,8 @@ static void ironlake_irq_reset(struct drm_device *dev)
 
 	gen5_gt_irq_reset(dev);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 static void vlv_display_irq_reset(struct drm_i915_private *dev_priv)
@@ -3133,7 +3135,8 @@ static void gen8_irq_reset(struct drm_device *dev)
 	GEN5_IRQ_RESET(GEN8_DE_MISC_);
 	GEN5_IRQ_RESET(GEN8_PCU_);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3323,13 +3326,15 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 	I915_WRITE(HWSTAM, 0xeffe);
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	GEN5_IRQ_INIT(DE, dev_priv->irq_mask, display_mask | extra_mask);
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_irq.c static int ironlake_irq_postinstall(struct drm_device *dev) · line 3337

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
 	gen5_gt_irq_postinstall(dev);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);

/me scratches head, we shouldn't ever call ironlake_irq_postinstall on bxt, should we? Did I miss something?

Nope, I just added the check blindly to all call sites. But here HAS_PCH_SPLIT happens to be true of course, so yea it's not needed.

Quoted 24 lines

With this hunk dropped, I think the patch looks good.

BR,
Jani.

Quoted 18 lines
drivers/gpu/drm/i915/i915_irq.c +4 -2
 	if (IS_IRONLAKE_M(dev)) {
 		/* Enable PCU event interrupts
@@ -3545,12 +3550,14 @@ static int gen8_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	gen8_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	I915_WRITE(GEN8_MASTER_IRQ, DE_MASTER_IRQ_CONTROL);
 	POSTING_READ(GEN8_MASTER_IRQ);
Signature · 1 line
1.9.1

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

author
#90 lore raw

PATCH v3 26/49 drm/i915/bxt: Add BXT support in gen8_irq functions

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

v2: (jani)
- drop redundant TODO comment about PCH IRQ flags on BXT
- check HAS_PCH_SPLIT instead of IS_BROXTON when handling PCH specific IRQ events in gen8_irq_handler()
- check HAS_PCH_SPLIT before calling the function instead of a corresponding early return within the called function for ibx_irq_reset(), ibx_irq_pre_postinstall(), ibx_irq_postinstall()
v3: (jani)
- in ironlake_irq_postinstall() and ironlake_irq_reset() HAS_PCH_SPLIT is always true, so drop the check for it

---
 drivers/gpu/drm/i915/i915_irq.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +8 -4
index b06364f..b0cd7a9 100644
@@ -2297,7 +2297,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	if (HAS_PCH_SPLIT(dev) && !HAS_PCH_NOP(dev) &&
+	    master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3133,7 +3134,8 @@ static void gen8_irq_reset(struct drm_device *dev)
 	GEN5_IRQ_RESET(GEN8_DE_MISC_);
 	GEN5_IRQ_RESET(GEN8_PCU_);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3545,12 +3547,14 @@ static int gen8_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	gen8_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
 	I915_WRITE(GEN8_MASTER_IRQ, DE_MASTER_IRQ_CONTROL);
 	POSTING_READ(GEN8_MASTER_IRQ);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v3 26/49
#91 lore raw

Re: [PATCH v3 26/49] drm/i915/bxt: Add BXT support in gen8_irq functions

Quoted 18 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

v2: (jani)
- drop redundant TODO comment about PCH IRQ flags on BXT
- check HAS_PCH_SPLIT instead of IS_BROXTON when handling PCH specific IRQ events in gen8_irq_handler()
- check HAS_PCH_SPLIT before calling the function instead of a corresponding early return within the called function for ibx_irq_reset(), ibx_irq_pre_postinstall(), ibx_irq_postinstall()
v3: (jani)
- in ironlake_irq_postinstall() and ironlake_irq_reset() HAS_PCH_SPLIT is always true, so drop the check for it

Quoted 4 lines
Quoted 48 lines
---
 drivers/gpu/drm/i915/i915_irq.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +8 -4
index b06364f..b0cd7a9 100644
@@ -2297,7 +2297,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	if (HAS_PCH_SPLIT(dev) && !HAS_PCH_NOP(dev) &&
+	    master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3133,7 +3134,8 @@ static void gen8_irq_reset(struct drm_device *dev)
 	GEN5_IRQ_RESET(GEN8_DE_MISC_);
 	GEN5_IRQ_RESET(GEN8_PCU_);
 
-	ibx_irq_reset(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_reset(dev);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3545,12 +3547,14 @@ static int gen8_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	ibx_irq_pre_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_pre_postinstall(dev);
 
 	gen8_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
-	ibx_irq_postinstall(dev);
+	if (HAS_PCH_SPLIT(dev))
+		ibx_irq_postinstall(dev);
 
 	I915_WRITE(GEN8_MASTER_IRQ, DE_MASTER_IRQ_CONTROL);
 	POSTING_READ(GEN8_MASTER_IRQ);
Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#92 lore raw

PATCH v4 27/49 drm/i915/bxt: Enable GMBUS IRQ

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

GMBUS interrupt has been moved to CPU side in BXT. What this patch does is:
1. Enable GMBUS IRQ in de_post_install function
2. Handle this interrupt as a port interrupt in display irq handler

v2: Rebase on top of the for_each_pipe() change adding dev_priv as
first argument (Damien).
v3: read BXT_DE_PORT_GMBUS IIR flag only on BXT on other platforms
it's reserved (imre)
v4: (jani)
- remove redundant 'BXT GMBUS' comment
- fix formatting of BXT_DE_PORT_GMBUS definition

---
 drivers/gpu/drm/i915/i915_irq.c | 14 +++++++++++---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -3
index a185f44..5417d5a 100644
@@ -2244,6 +2244,11 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 				found = true;
 			}
 
+			if (IS_BROXTON(dev) && (tmp & BXT_DE_PORT_GMBUS)) {
+				gmbus_irq_handler(dev);
+				found = true;
+			}
+
 			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
@@ -3518,13 +3523,16 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
 	uint32_t de_pipe_enables;
 	int pipe;
-	u32 aux_en = GEN8_AUX_CHANNEL_A;
+	u32 de_port_en = GEN8_AUX_CHANNEL_A;
 
 	if (IS_GEN9(dev_priv)) {
 		de_pipe_masked |= GEN9_PIPE_PLANE1_FLIP_DONE |
 				  GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
-		aux_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
+		de_port_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
 			GEN9_AUX_CHANNEL_D;
+
+		if (IS_BROXTON(dev_priv))
+			de_port_en |= BXT_DE_PORT_GMBUS;
 	} else
 		de_pipe_masked |= GEN8_PIPE_PRIMARY_FLIP_DONE |
 				  GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
@@ -3543,7 +3551,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 					  dev_priv->de_irq_mask[pipe],
 					  de_pipe_enables);
 
-	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~aux_en, aux_en);
+	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~de_port_en, de_port_en);
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 670a9d4..4950aa4 100644
@@ -5266,6 +5266,7 @@ enum skl_disp_power_wells {
 					 BXT_DE_PORT_HP_DDIB | \
 					 BXT_DE_PORT_HP_DDIC)
 #define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
+#define  BXT_DE_PORT_GMBUS		(1 << 1)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
Signature · 6 lines
1.9.1

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

Re: [PATCH v4 27/49] drm/i915/bxt: Enable GMBUS IRQ

Quoted 16 lines · Imre Deak

From: Shashank Sharma <[email protected]>

GMBUS interrupt has been moved to CPU side in BXT. What this patch does is:
1. Enable GMBUS IRQ in de_post_install function
2. Handle this interrupt as a port interrupt in display irq handler

v2: Rebase on top of the for_each_pipe() change adding dev_priv as
first argument (Damien).
v3: read BXT_DE_PORT_GMBUS IIR flag only on BXT on other platforms
it's reserved (imre)
v4: (jani)
- remove redundant 'BXT GMBUS' comment
- fix formatting of BXT_DE_PORT_GMBUS definition

Quoted 5 lines

Yup. ^

Quoted 64 lines
---
 drivers/gpu/drm/i915/i915_irq.c | 14 +++++++++++---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -3
index a185f44..5417d5a 100644
@@ -2244,6 +2244,11 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 				found = true;
 			}
 
+			if (IS_BROXTON(dev) && (tmp & BXT_DE_PORT_GMBUS)) {
+				gmbus_irq_handler(dev);
+				found = true;
+			}
+
 			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
@@ -3518,13 +3523,16 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
 	uint32_t de_pipe_enables;
 	int pipe;
-	u32 aux_en = GEN8_AUX_CHANNEL_A;
+	u32 de_port_en = GEN8_AUX_CHANNEL_A;
 
 	if (IS_GEN9(dev_priv)) {
 		de_pipe_masked |= GEN9_PIPE_PLANE1_FLIP_DONE |
 				  GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
-		aux_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
+		de_port_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
 			GEN9_AUX_CHANNEL_D;
+
+		if (IS_BROXTON(dev_priv))
+			de_port_en |= BXT_DE_PORT_GMBUS;
 	} else
 		de_pipe_masked |= GEN8_PIPE_PRIMARY_FLIP_DONE |
 				  GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
@@ -3543,7 +3551,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 					  dev_priv->de_irq_mask[pipe],
 					  de_pipe_enables);
 
-	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~aux_en, aux_en);
+	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~de_port_en, de_port_en);
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 670a9d4..4950aa4 100644
@@ -5266,6 +5266,7 @@ enum skl_disp_power_wells {
 					 BXT_DE_PORT_HP_DDIB | \
 					 BXT_DE_PORT_HP_DDIC)
 #define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
+#define  BXT_DE_PORT_GMBUS		(1 << 1)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v7 24/49
#94 lore raw

Re: [PATCH v7 24/49] drm/i915/bxt: DDI Hotplug interrupt setup

In reply to Imre Deak
Quoted 19 lines · Imre Deak

From: Shashank Sharma <[email protected]>

In BXT, DDI hotplug control has been moved to CPU from PCH. This patch adds a new IRQ setup function for BXT which:
1. Checks which HPD ports are requested to be enabled by encoders.
2. Enables those ports in the hot plug control register.
3. Un-masks these port interrupts in the IMR register.
4. Enables these port interrupts in the IER register.

V3: Kept the default HPD filter count to default (500 us) as per
satheesh's comment
v4: Remove unused HPD filter defines (Damien)
v5: warn if trying to setup HPD on port A (imre)
v6: fix order of definitions for register bitfields (Daniel)
v7: (jani)
- define the size of the hpd_bxt array explicitly for bound checking
- use for_each_intel_encoder instead of open coding it
- fix format/order of definitions for BXT_HOTPLUG_CTL reg bitfields

Quoted 4 lines
Quoted 124 lines
---
 drivers/gpu/drm/i915/i915_irq.c | 47 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h | 23 +++++++++++++++++++-
 2 files changed, 68 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +46 -1
index 46bcbff..631484d 100644
@@ -88,6 +88,12 @@ static const u32 hpd_status_i915[HPD_NUM_PINS] = { /* i915 and valleyview are th
 	[HPD_PORT_D] = PORTD_HOTPLUG_INT_STATUS
 };
 
+/* BXT hpd list */
+static const u32 hpd_bxt[HPD_NUM_PINS] = {
+	[HPD_PORT_B] = BXT_DE_PORT_HP_DDIB,
+	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -3159,6 +3165,42 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void bxt_hpd_irq_setup(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_encoder *intel_encoder;
+	u32 hotplug_port = 0;
+	u32 hotplug_ctrl;
+
+	/* Now, enable HPD */
+	for_each_intel_encoder(dev, intel_encoder) {
+		if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark
+				== HPD_ENABLED)
+			hotplug_port |= hpd_bxt[intel_encoder->hpd_pin];
+	}
+
+	/* Mask all HPD control bits */
+	hotplug_ctrl = I915_READ(BXT_HOTPLUG_CTL) & ~BXT_HOTPLUG_CTL_MASK;
+
+	/* Enable requested port in hotplug control */
+	/* TODO: implement (short) HPD support on port A */
+	WARN_ON_ONCE(hotplug_port & BXT_DE_PORT_HP_DDIA);
+	if (hotplug_port & BXT_DE_PORT_HP_DDIB)
+		hotplug_ctrl |= BXT_DDIB_HPD_ENABLE;
+	if (hotplug_port & BXT_DE_PORT_HP_DDIC)
+		hotplug_ctrl |= BXT_DDIC_HPD_ENABLE;
+	I915_WRITE(BXT_HOTPLUG_CTL, hotplug_ctrl);
+
+	/* Unmask DDI hotplug in IMR */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IMR) & ~hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IMR, hotplug_ctrl);
+
+	/* Enable DDI hotplug in IER */
+	hotplug_ctrl = I915_READ(GEN8_DE_PORT_IER) | hotplug_port;
+	I915_WRITE(GEN8_DE_PORT_IER, hotplug_ctrl);
+	POSTING_READ(GEN8_DE_PORT_IER);
+}
+
 static void ibx_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4279,7 +4321,10 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen8_irq_uninstall;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		if (HAS_PCH_SPLIT(dev))
+			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
+		else
+			dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
 	} else if (HAS_PCH_SPLIT(dev)) {
 		dev->driver->irq_handler = ironlake_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +22 -1
index 7d51aec..670a9d4 100644
@@ -5256,10 +5256,16 @@ enum skl_disp_power_wells {
 #define GEN8_DE_PORT_IMR 0x44444
 #define GEN8_DE_PORT_IIR 0x44448
 #define GEN8_DE_PORT_IER 0x4444c
-#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN9_AUX_CHANNEL_D		(1 << 27)
 #define  GEN9_AUX_CHANNEL_C		(1 << 26)
 #define  GEN9_AUX_CHANNEL_B		(1 << 25)
+#define  BXT_DE_PORT_HP_DDIC		(1 << 5)
+#define  BXT_DE_PORT_HP_DDIB		(1 << 4)
+#define  BXT_DE_PORT_HP_DDIA		(1 << 3)
+#define  BXT_DE_PORT_HOTPLUG_MASK	(BXT_DE_PORT_HP_DDIA | \
+					 BXT_DE_PORT_HP_DDIB | \
+					 BXT_DE_PORT_HP_DDIC)
+#define  GEN8_PORT_DP_A_HOTPLUG		(1 << 3)
 #define  GEN8_AUX_CHANNEL_A		(1 << 0)
 
 #define GEN8_DE_MISC_ISR 0x44460
@@ -5273,6 +5279,21 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
+/* BXT hotplug control */
+#define BXT_HOTPLUG_CTL			0xC4030
+#define   BXT_DDIA_HPD_ENABLE		(1 << 28)
+#define   BXT_DDIA_HPD_STATUS		(3 << 24)
+#define   BXT_DDIC_HPD_ENABLE		(1 << 12)
+#define   BXT_DDIC_HPD_STATUS		(3 << 8)
+#define   BXT_DDIB_HPD_ENABLE		(1 << 4)
+#define   BXT_DDIB_HPD_STATUS		(3 << 0)
+#define   BXT_HOTPLUG_CTL_MASK		(BXT_DDIA_HPD_ENABLE | \
+					 BXT_DDIB_HPD_ENABLE | \
+					 BXT_DDIC_HPD_ENABLE)
+#define   BXT_HPD_STATUS_MASK		(BXT_DDIA_HPD_STATUS | \
+					 BXT_DDIB_HPD_STATUS | \
+					 BXT_DDIC_HPD_STATUS)
+
 #define ILK_DISPLAY_CHICKEN2	0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT	(1 << 25)
Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#95 lore raw

PATCH 25/49 drm/i915/bxt: Add DDI hpd handler

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

---
 drivers/gpu/drm/i915/i915_irq.c | 45 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +43 -2
index a51c00e..4a2f85b 100644
@@ -2227,6 +2227,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (unlikely(!(hp_control & BXT_HOTPLUG_CTL_MASK))) {
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
+
+	/*
+	 * Todo: Save the hot plug status for bottom half before
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */
+
+	/* Clear sticky bits in hpd status */
+	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+}
+
 static irqreturn_t gen8_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -2236,6 +2268,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 	uint32_t tmp = 0;
 	enum pipe pipe;
 	u32 aux_mask = GEN8_AUX_CHANNEL_A;
+	bool found = false;
 
 	if (!intel_irqs_enabled(dev_priv))
 		return IRQ_NONE;
@@ -2276,9 +2309,17 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
 			ret = IRQ_HANDLED;
 
-			if (tmp & aux_mask)
+			if (tmp & aux_mask) {
 				dp_aux_irq_handler(dev);
-			else
+				found = true;
+			}
+
+			if (tmp & BXT_DE_PORT_HOTPLUG_MASK) {
+				bxt_hpd_handler(dev, tmp);
+				found = true;
+			}
+
+			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
 		else
Signature · 6 lines
2.1.0

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

Re: [PATCH 25/49] drm/i915/bxt: Add DDI hpd handler

Quoted 41 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

---
 drivers/gpu/drm/i915/i915_irq.c | 45 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +17 -0
index a51c00e..4a2f85b 100644
@@ -2227,6 +2227,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (unlikely(!(hp_control & BXT_HOTPLUG_CTL_MASK))) {
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t ironlake_irq_handler(int irq, void *arg) · line 2256

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
+
+	/*
+	 * Todo: Save the hot plug status for bottom half before
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */

This seems to be ok, but code to handle long/short pulse in intel_hpd_irq_handler seems to be missing. And we absolutely need that for mst ports (I guess bxt has those?).
-Daniel

Quoted 43 lines
drivers/gpu/drm/i915/i915_irq.c +16 -2
+
+	/* Clear sticky bits in hpd status */
+	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+}
+
 static irqreturn_t gen8_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -2236,6 +2268,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 	uint32_t tmp = 0;
 	enum pipe pipe;
 	u32 aux_mask = GEN8_AUX_CHANNEL_A;
+	bool found = false;
 
 	if (!intel_irqs_enabled(dev_priv))
 		return IRQ_NONE;
@@ -2276,9 +2309,17 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
 			ret = IRQ_HANDLED;
 
-			if (tmp & aux_mask)
+			if (tmp & aux_mask) {
 				dp_aux_irq_handler(dev);
-			else
+				found = true;
+			}
+
+			if (tmp & BXT_DE_PORT_HOTPLUG_MASK) {
+				bxt_hpd_handler(dev, tmp);
+				found = true;
+			}
+
+			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
 		else
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#97 lore raw

Re: [PATCH 25/49] drm/i915/bxt: Add DDI hpd handler

Quoted 47 lines · Daniel Vetter
Quoted 46 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

---
 drivers/gpu/drm/i915/i915_irq.c | 45 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +22 -0
index a51c00e..4a2f85b 100644
@@ -2227,6 +2227,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (unlikely(!(hp_control & BXT_HOTPLUG_CTL_MASK))) {
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
+
Quoted 8 lines

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t ironlake_irq_handler(int irq, void *arg) · line 2256

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +5 -0
+	/*
+	 * Todo: Save the hot plug status for bottom half before
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */

This seems to be ok, but code to handle long/short pulse in intel_hpd_irq_handler seems to be missing.

Oops. Yea, that's completely missing, we need at least a new bxt_port_to_hotplug_shift(). Will follow up with this. Why always shuffling around the bits??:)

Quoted 2 lines

And we absolutely need that for
mst ports (I guess bxt has those?).

Yea, port B and C.

--Imre

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

author
#98 lore raw

PATCH 1/1 drm/i915/bxt: support for HPD long/short status decoding

In reply to Imre Deak

All non-GMCH platforms have the same register layout for HPD long/short status, so let's use this condition instead of HAS_PCH_SPLIT, as the latter doesn't apply for BXT.

Noticed by Daniel.

---
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
index 4833e2b..17eed72 100644
@@ -1446,7 +1446,7 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
 		if (port && dev_priv->hpd_irq_port[port]) {
 			bool long_hpd;
 
-			if (HAS_PCH_SPLIT(dev)) {
+			if (!HAS_GMCH_DISPLAY(dev_priv)) {
 				dig_shift = pch_port_to_hotplug_shift(port);
 				long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
 			} else {
Signature · 6 lines
2.1.0

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

Re: [PATCH 25.1/49] drm/i915/bxt: support for HPD long/short status decoding

Quoted 16 lines · Imre Deak

All non-GMCH platforms have the same register layout for HPD long/short status, so let's use this condition instead of HAS_PCH_SPLIT, as the latter doesn't apply for BXT.

Noticed by Daniel.

---
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 4833e2b..17eed72 100644

drivers/gpu/drm/i915/i915_irq.c static inline void intel_hpd_irq_handler(struct drm_device *dev, · line 1450

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -1446,7 +1446,7 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
 		if (port && dev_priv->hpd_irq_port[port]) {
 			bool long_hpd;
 
-			if (HAS_PCH_SPLIT(dev)) {
+			if (!HAS_GMCH_DISPLAY(dev_priv)) {
 				dig_shift = pch_port_to_hotplug_shift(port);

This is (will be) broken for port A.

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 				long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
 			} else {
Signature · 1 line
2.1.0
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#100 lore raw

Re: [PATCH 25.1/49] drm/i915/bxt: support for HPD long/short status decoding

Quoted 20 lines · Jani Nikula
Quoted 19 lines · Imre Deak

All non-GMCH platforms have the same register layout for HPD long/short status, so let's use this condition instead of HAS_PCH_SPLIT, as the latter doesn't apply for BXT.

Noticed by Daniel.

---
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 4833e2b..17eed72 100644
@@ -1446,7 +1446,7 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
 		if (port && dev_priv->hpd_irq_port[port]) {
 			bool long_hpd;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_irq.c static inline void intel_hpd_irq_handler(struct drm_device *dev, · line 1450

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
-			if (HAS_PCH_SPLIT(dev)) {
+			if (!HAS_GMCH_DISPLAY(dev_priv)) {
 				dig_shift = pch_port_to_hotplug_shift(port);

This is (will be) broken for port A.

HPD on port A is not supported atm on any platforms. On BXT we also WARN if someone tried to enable it in bxt_hpd_irq_setup(). I think adding support for this is a separate (follow-up) issue.

Quoted 7 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 				long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
 			} else {
Signature · 1 line
2.1.0

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

Reviewed-by
#101 lore raw

Re: [PATCH 25.1/49] drm/i915/bxt: support for HPD long/short status decoding

Quoted 27 lines · Imre Deak
Quoted 20 lines · Jani Nikula
Quoted 19 lines · Imre Deak

All non-GMCH platforms have the same register layout for HPD long/short status, so let's use this condition instead of HAS_PCH_SPLIT, as the latter doesn't apply for BXT.

Noticed by Daniel.

---
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 4833e2b..17eed72 100644
@@ -1446,7 +1446,7 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
 		if (port && dev_priv->hpd_irq_port[port]) {
 			bool long_hpd;
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_irq.c static inline void intel_hpd_irq_handler(struct drm_device *dev, · line 1450

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
-			if (HAS_PCH_SPLIT(dev)) {
+			if (!HAS_GMCH_DISPLAY(dev_priv)) {
 				dig_shift = pch_port_to_hotplug_shift(port);

This is (will be) broken for port A.

Quoted 3 lines

HPD on port A is not supported atm on any platforms. On BXT we also WARN if someone tried to enable it in bxt_hpd_irq_setup(). I think adding support for this is a separate (follow-up) issue.

Fair enough.

Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 				long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
 			} else {
Signature · 1 line
2.1.0
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#102 lore raw

Re: [PATCH 25/49] drm/i915/bxt: Add DDI hpd handler

In reply to Imre Deak
Quoted 26 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds a hot plug interrupt handler function for BXT. What this function typically does is:
1. Check if hot plug is enabled from hot plug control register.
2. Call hpd_irq_handler with appropriate trigger to detect a plug storm and schedule a bottom half.
3. Clear sticky status bits in hot plug control register..

---
 drivers/gpu/drm/i915/i915_irq.c | 45 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +2 -0
index a51c00e..4a2f85b 100644
@@ -2227,6 +2227,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
 	return ret;
 }
 
+static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
+{

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t ironlake_irq_handler(int irq, void *arg) · line 2241

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t hp_control;
+	uint32_t hp_trigger;
+
+	/* Get the status */
+	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
+	hp_control = I915_READ(BXT_HOTPLUG_CTL);
+
+	/* Hotplug not enabled ? */
+	if (unlikely(!(hp_control & BXT_HOTPLUG_CTL_MASK))) {

Drop the unlikely. Or turn this into WARN_ON_ONCE, or something.

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t ironlake_irq_handler(int irq, void *arg) · line 2250

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +9 -0
+		DRM_ERROR("Interrupt when HPD disabled\n");
+		return;
+	}
+
+	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
+		hp_control & BXT_HOTPLUG_CTL_MASK);
+
+	/* Check for HPD storm and schedule bottom half */
+	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);

That one needs to be updated for bxt hp_control.

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t ironlake_irq_handler(int irq, void *arg) · line 2253

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	/*
+	 * Todo: Save the hot plug status for bottom half before

Make it TODO, XXX, or FIXME, but not Todo.

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +8 -0
+	 * clearing the sticky status bits, else the status will be
+	 * lost.
+	 */
+
+	/* Clear sticky bits in hpd status */
+	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+}
+
 static irqreturn_t gen8_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg) · line 2271

Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -2236,6 +2268,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 	uint32_t tmp = 0;
 	enum pipe pipe;
 	u32 aux_mask = GEN8_AUX_CHANNEL_A;
+	bool found = false;

Move this down within the block where it's needed.

Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	if (!intel_irqs_enabled(dev_priv))
 		return IRQ_NONE;
@@ -2276,9 +2309,17 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg) · line 2317

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +5 -2
 			ret = IRQ_HANDLED;
 
-			if (tmp & aux_mask)
+			if (tmp & aux_mask) {
 				dp_aux_irq_handler(dev);
-			else
+				found = true;
+			}
+
+			if (tmp & BXT_DE_PORT_HOTPLUG_MASK) {

This needs IS_BROXTON check.

Quoted 15 lines
drivers/gpu/drm/i915/i915_irq.c +5 -0
+				bxt_hpd_handler(dev, tmp);
+				found = true;
+			}
+
+			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
 		else
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#103 lore raw

PATCH 26/49 drm/i915/bxt: Add BXT support in gen8_irq functions

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

---
 drivers/gpu/drm/i915/i915_irq.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +10 -4
index 4a2f85b..3b82eb2 100644
@@ -2372,7 +2372,13 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	/*
+	 * Todo: BXT doesnt have a PCH, so GEN8_DE_PCH_IRQ shouldn't
+	 * be set. But until this part is confirmed, going paranoid, and adding
+	 * a IS_BROXTON check here.
+	 */
+	if (!IS_BROXTON(dev) && !HAS_PCH_NOP(dev) &&
+			master_ctl & GEN8_DE_PCH_IRQ) {
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3096,7 +3102,7 @@ static void ibx_irq_reset(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;
 
 	GEN5_IRQ_RESET(SDE);
@@ -3117,7 +3123,7 @@ static void ibx_irq_pre_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;
 
 	WARN_ON(I915_READ(SDEIER) != 0);
@@ -3325,7 +3331,7 @@ static void ibx_irq_postinstall(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 mask;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;
 
 	if (HAS_PCH_IBX(dev))
Signature · 6 lines
2.1.0

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

Re: [PATCH 26/49] drm/i915/bxt: Add BXT support in gen8_irq functions

Quoted 20 lines · Imre Deak

From: Shashank Sharma <[email protected]>

This patch adds conditional checks in gen8_irq functions to support BXT. Most of the checks just look for PCH split availability, and block the call to PCH interrupt functions if not available.

---
 drivers/gpu/drm/i915/i915_irq.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 4a2f85b..3b82eb2 100644
@@ -2372,7 +2372,13 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 			DRM_ERROR("The master control interrupt lied (DE PIPE)!\n");

drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg) · line 2381

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +7 -1
 	}
 
-	if (!HAS_PCH_NOP(dev) && master_ctl & GEN8_DE_PCH_IRQ) {
+	/*
+	 * Todo: BXT doesnt have a PCH, so GEN8_DE_PCH_IRQ shouldn't
+	 * be set. But until this part is confirmed, going paranoid, and adding
+	 * a IS_BROXTON check here.
+	 */
+	if (!IS_BROXTON(dev) && !HAS_PCH_NOP(dev) &&
+			master_ctl & GEN8_DE_PCH_IRQ) {

Drop the todo comment, and add HAS_PCH_SPLIT() instead of !IS_BROXTON() here, and it's fine. We never want to call pch functions on non-pch platforms, so this is IMO the obvious thing to do.

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_reset(struct drm_device *dev) · line 3106

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
 		/*
 		 * FIXME(BDW): Assume for now that the new interrupt handling
 		 * scheme also closed the SDE interrupt handling race we've seen
@@ -3096,7 +3102,7 @@ static void ibx_irq_reset(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;

No, I think it's much better to simply not call pch functions on non-pch platforms. Instead, please add

	if (HAS_PCH_SPLIT(dev))
        	ibx_irq_reset(dev);

in gen8_irq_reset().

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_pre_postinstall(struct drm_device *dev) · line 3127

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
 	GEN5_IRQ_RESET(SDE);
@@ -3117,7 +3123,7 @@ static void ibx_irq_pre_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;

Same here, but for gen8_irq_postinstall().

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_postinstall(struct drm_device *dev) · line 3335

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +1 -1
 	WARN_ON(I915_READ(SDEIER) != 0);
@@ -3325,7 +3331,7 @@ static void ibx_irq_postinstall(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 mask;
 
-	if (HAS_PCH_NOP(dev))
+	if (HAS_PCH_NOP(dev) || !HAS_PCH_SPLIT(dev))
 		return;

Ditto.

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	if (HAS_PCH_IBX(dev))
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#105 lore raw

PATCH 27/49 drm/i915/bxt: Enable GMBUS IRQ

In reply to Imre Deak

From: Shashank Sharma <[email protected]>

GMBUS interrupt has been moved to CPU side in BXT. What this patch does is:
1. Enable GMBUS IRQ in de_post_install function
2. Handle this interrupt as a port interrupt in display irq handler

v2: Rebase on top of the for_each_pipe() change adding dev_priv as
first argument (Damien).
v3: read BXT_DE_PORT_GMBUS IIR flag only on BXT on other platforms
it's reserved (imre)

---
 drivers/gpu/drm/i915/i915_irq.c | 14 +++++++++++---
 drivers/gpu/drm/i915/i915_reg.h |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -3
index 3b82eb2..2be167c 100644
@@ -2319,6 +2319,11 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 				found = true;
 			}
 
+			if (IS_BROXTON(dev) && (tmp & BXT_DE_PORT_GMBUS)) {
+				gmbus_irq_handler(dev);
+				found = true;
+			}
+
 			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
@@ -3596,13 +3601,16 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
 	uint32_t de_pipe_enables;
 	int pipe;
-	u32 aux_en = GEN8_AUX_CHANNEL_A;
+	u32 de_port_en = GEN8_AUX_CHANNEL_A;
 
 	if (IS_GEN9(dev_priv)) {
 		de_pipe_masked |= GEN9_PIPE_PLANE1_FLIP_DONE |
 				  GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
-		aux_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
+		de_port_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
 			GEN9_AUX_CHANNEL_D;
+
+		if (IS_BROXTON(dev_priv))
+			de_port_en |= BXT_DE_PORT_GMBUS;
 	} else
 		de_pipe_masked |= GEN8_PIPE_PRIMARY_FLIP_DONE |
 				  GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
@@ -3621,7 +3629,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 					  dev_priv->de_irq_mask[pipe],
 					  de_pipe_enables);
 
-	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~aux_en, aux_en);
+	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~de_port_en, de_port_en);
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 1efee7d..b4474d3 100644
@@ -5255,6 +5255,9 @@ enum skl_disp_power_wells {
 					BXT_DE_PORT_HP_DDIB | \
 					BXT_DE_PORT_HP_DDIC)
 
+/* BXT GMBUS */
+#define BXT_DE_PORT_GMBUS	(1 << 1)
+
 #define GEN8_DE_MISC_ISR 0x44460
 #define GEN8_DE_MISC_IMR 0x44464
 #define GEN8_DE_MISC_IIR 0x44468
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 27/49
#106 lore raw

Re: [PATCH 27/49] drm/i915/bxt: Enable GMBUS IRQ

Quoted 71 lines · Imre Deak

From: Shashank Sharma <[email protected]>

GMBUS interrupt has been moved to CPU side in BXT. What this patch does is:
1. Enable GMBUS IRQ in de_post_install function
2. Handle this interrupt as a port interrupt in display irq handler

v2: Rebase on top of the for_each_pipe() change adding dev_priv as
first argument (Damien).
v3: read BXT_DE_PORT_GMBUS IIR flag only on BXT on other platforms
it's reserved (imre)

---
 drivers/gpu/drm/i915/i915_irq.c | 14 +++++++++++---
 drivers/gpu/drm/i915/i915_reg.h |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -3
index 3b82eb2..2be167c 100644
@@ -2319,6 +2319,11 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 				found = true;
 			}
 
+			if (IS_BROXTON(dev) && (tmp & BXT_DE_PORT_GMBUS)) {
+				gmbus_irq_handler(dev);
+				found = true;
+			}
+
 			if (!found)
 				DRM_ERROR("Unexpected DE Port interrupt\n");
 		}
@@ -3596,13 +3601,16 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
 	uint32_t de_pipe_enables;
 	int pipe;
-	u32 aux_en = GEN8_AUX_CHANNEL_A;
+	u32 de_port_en = GEN8_AUX_CHANNEL_A;
 
 	if (IS_GEN9(dev_priv)) {
 		de_pipe_masked |= GEN9_PIPE_PLANE1_FLIP_DONE |
 				  GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
-		aux_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
+		de_port_en |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
 			GEN9_AUX_CHANNEL_D;
+
+		if (IS_BROXTON(dev_priv))
+			de_port_en |= BXT_DE_PORT_GMBUS;
 	} else
 		de_pipe_masked |= GEN8_PIPE_PRIMARY_FLIP_DONE |
 				  GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
@@ -3621,7 +3629,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 					  dev_priv->de_irq_mask[pipe],
 					  de_pipe_enables);
 
-	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~aux_en, aux_en);
+	GEN5_IRQ_INIT(GEN8_DE_PORT_, ~de_port_en, de_port_en);
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 1efee7d..b4474d3 100644

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 5258

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -5255,6 +5255,9 @@ enum skl_disp_power_wells {
 					BXT_DE_PORT_HP_DDIB | \
 					BXT_DE_PORT_HP_DDIC)
 
+/* BXT GMBUS */

That's obvious from the define, no need for the comment, just move this right next to the other bit definitions above and put two spaces after #define.

With that done,

Quoted 12 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+#define BXT_DE_PORT_GMBUS	(1 << 1)
+
 #define GEN8_DE_MISC_ISR 0x44460
 #define GEN8_DE_MISC_IMR 0x44464
 #define GEN8_DE_MISC_IIR 0x44468
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#107 lore raw

PATCH 28/49 drm/i915/bxt: Define BXT power domains

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Add BXT power domains

v2: Use DOMAIN_PLLS instead of a new CDCLK one, whitespace fixes
(Damien)
v3: add VGA, TRANSCODER_A power domains (imre)

---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 55 +++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
drivers/gpu/drm/i915/intel_runtime_pm.c +55 -0
index ce00e69..ff5cce3 100644
@@ -319,6 +319,38 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv,
 	SKL_DISPLAY_MISC_IO_POWER_DOMAINS)) |		\
 	BIT(POWER_DOMAIN_INIT))
 
+#define BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS (		\
+	BIT(POWER_DOMAIN_TRANSCODER_A) |		\
+	BIT(POWER_DOMAIN_PIPE_B) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_B) |		\
+	BIT(POWER_DOMAIN_PIPE_C) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_C) |		\
+	BIT(POWER_DOMAIN_PIPE_B_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PIPE_C_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) |		\
+	BIT(POWER_DOMAIN_AUX_B) |			\
+	BIT(POWER_DOMAIN_AUX_C) |			\
+	BIT(POWER_DOMAIN_AUDIO) |			\
+	BIT(POWER_DOMAIN_VGA) |				\
+	BIT(POWER_DOMAIN_INIT))
+#define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS (		\
+	BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS |		\
+	BIT(POWER_DOMAIN_PIPE_A) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_EDP) |		\
+	BIT(POWER_DOMAIN_PIPE_A_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) |		\
+	BIT(POWER_DOMAIN_AUX_A) |			\
+	BIT(POWER_DOMAIN_PLLS) |			\
+	BIT(POWER_DOMAIN_INIT))
+#define BXT_DISPLAY_ALWAYS_ON_POWER_DOMAINS (		\
+	(POWER_DOMAIN_MASK & ~(BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS |	\
+	BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS)) |	\
+	BIT(POWER_DOMAIN_INIT))
+
 static void skl_set_power_well(struct drm_i915_private *dev_priv,
 			struct i915_power_well *power_well, bool enable)
 {
@@ -1313,6 +1345,27 @@ static struct i915_power_well skl_power_wells[] = {
 	},
 };
 
+static struct i915_power_well bxt_power_wells[] = {
+	{
+		.name = "always-on",
+		.always_on = 1,
+		.domains = BXT_DISPLAY_ALWAYS_ON_POWER_DOMAINS,
+		.ops = &i9xx_always_on_power_well_ops,
+	},
+	{
+		.name = "power well 1",
+		.domains = BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS,
+		.ops = &skl_power_well_ops,
+		.data = SKL_DISP_PW_1,
+	},
+	{
+		.name = "power well 2",
+		.domains = BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS,
+		.ops = &skl_power_well_ops,
+		.data = SKL_DISP_PW_2,
+	}
+};
+
 #define set_power_wells(power_domains, __power_wells) ({		\
 	(power_domains)->power_wells = (__power_wells);			\
 	(power_domains)->power_well_count = ARRAY_SIZE(__power_wells);	\
@@ -1341,6 +1394,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
 		set_power_wells(power_domains, bdw_power_wells);
 	} else if (IS_SKYLAKE(dev_priv->dev)) {
 		set_power_wells(power_domains, skl_power_wells);
+	} else if (IS_BROXTON(dev_priv->dev)) {
+		set_power_wells(power_domains, bxt_power_wells);
 	} else if (IS_CHERRYVIEW(dev_priv->dev)) {
 		set_power_wells(power_domains, chv_power_wells);
 	} else if (IS_VALLEYVIEW(dev_priv->dev)) {
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 28/49
#108 lore raw

Re: [PATCH 28/49] drm/i915/bxt: Define BXT power domains

Quoted 11 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Add BXT power domains

v2: Use DOMAIN_PLLS instead of a new CDCLK one, whitespace fixes
(Damien)
v3: add VGA, TRANSCODER_A power domains (imre)

Quoted 91 lines
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 55 +++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
drivers/gpu/drm/i915/intel_runtime_pm.c +55 -0
index ce00e69..ff5cce3 100644
@@ -319,6 +319,38 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv,
 	SKL_DISPLAY_MISC_IO_POWER_DOMAINS)) |		\
 	BIT(POWER_DOMAIN_INIT))
 
+#define BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS (		\
+	BIT(POWER_DOMAIN_TRANSCODER_A) |		\
+	BIT(POWER_DOMAIN_PIPE_B) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_B) |		\
+	BIT(POWER_DOMAIN_PIPE_C) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_C) |		\
+	BIT(POWER_DOMAIN_PIPE_B_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PIPE_C_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) |		\
+	BIT(POWER_DOMAIN_AUX_B) |			\
+	BIT(POWER_DOMAIN_AUX_C) |			\
+	BIT(POWER_DOMAIN_AUDIO) |			\
+	BIT(POWER_DOMAIN_VGA) |				\
+	BIT(POWER_DOMAIN_INIT))
+#define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS (		\
+	BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS |		\
+	BIT(POWER_DOMAIN_PIPE_A) |			\
+	BIT(POWER_DOMAIN_TRANSCODER_EDP) |		\
+	BIT(POWER_DOMAIN_PIPE_A_PANEL_FITTER) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) |		\
+	BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) |		\
+	BIT(POWER_DOMAIN_AUX_A) |			\
+	BIT(POWER_DOMAIN_PLLS) |			\
+	BIT(POWER_DOMAIN_INIT))
+#define BXT_DISPLAY_ALWAYS_ON_POWER_DOMAINS (		\
+	(POWER_DOMAIN_MASK & ~(BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS |	\
+	BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS)) |	\
+	BIT(POWER_DOMAIN_INIT))
+
 static void skl_set_power_well(struct drm_i915_private *dev_priv,
 			struct i915_power_well *power_well, bool enable)
 {
@@ -1313,6 +1345,27 @@ static struct i915_power_well skl_power_wells[] = {
 	},
 };
 
+static struct i915_power_well bxt_power_wells[] = {
+	{
+		.name = "always-on",
+		.always_on = 1,
+		.domains = BXT_DISPLAY_ALWAYS_ON_POWER_DOMAINS,
+		.ops = &i9xx_always_on_power_well_ops,
+	},
+	{
+		.name = "power well 1",
+		.domains = BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS,
+		.ops = &skl_power_well_ops,
+		.data = SKL_DISP_PW_1,
+	},
+	{
+		.name = "power well 2",
+		.domains = BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS,
+		.ops = &skl_power_well_ops,
+		.data = SKL_DISP_PW_2,
+	}
+};
+
 #define set_power_wells(power_domains, __power_wells) ({		\
 	(power_domains)->power_wells = (__power_wells);			\
 	(power_domains)->power_well_count = ARRAY_SIZE(__power_wells);	\
@@ -1341,6 +1394,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
 		set_power_wells(power_domains, bdw_power_wells);
 	} else if (IS_SKYLAKE(dev_priv->dev)) {
 		set_power_wells(power_domains, skl_power_wells);
+	} else if (IS_BROXTON(dev_priv->dev)) {
+		set_power_wells(power_domains, bxt_power_wells);
 	} else if (IS_CHERRYVIEW(dev_priv->dev)) {
 		set_power_wells(power_domains, chv_power_wells);
 	} else if (IS_VALLEYVIEW(dev_priv->dev)) {
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#109 lore raw

PATCH 29/49 drm/i915: Rename vlv_cdclk_freq to cdclk_freq

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

Rename vlv_cdclk_freq to cdclk_freq so that it can be used for all platforms as required. Needed by the next patch.

---
 drivers/gpu/drm/i915/i915_drv.h      |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 52e5f18..1b2a294 100644
@@ -1659,7 +1659,7 @@ struct drm_i915_private {
 	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
 
 	unsigned int fsb_freq, mem_freq, is_ddr3;
-	unsigned int vlv_cdclk_freq;
+	unsigned int cdclk_freq;
 	unsigned int hpll_freq;
 
 	/**
drivers/gpu/drm/i915/intel_display.c +10 -8
index e54e948..b91862e 100644
@@ -4879,16 +4879,16 @@ static void vlv_update_cdclk(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	dev_priv->vlv_cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
+	dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
 	DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz\n",
-			 dev_priv->vlv_cdclk_freq);
+			 dev_priv->cdclk_freq);
 
 	/*
 	 * Program the gmbus_freq based on the cdclk frequency.
 	 * BSpec erroneously claims we should aim for 4MHz, but
 	 * in fact 1MHz is the correct frequency.
 	 */
-	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000));
+	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
 }
 
 /* Adjust CDclk dividers to allow high res or save power if possible */
@@ -4897,7 +4897,8 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+					!= dev_priv->cdclk_freq);
 
 	if (cdclk >= 320000) /* jump to highest voltage for 400MHz too */
 		cmd = 2;
@@ -4961,7 +4962,8 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+						!= dev_priv->cdclk_freq);
 
 	switch (cdclk) {
 	case 333333:
@@ -5050,7 +5052,7 @@ static void valleyview_modeset_global_pipes(struct drm_device *dev,
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 
 	if (valleyview_calc_cdclk(dev_priv, max_pixclk) ==
-	    dev_priv->vlv_cdclk_freq)
+	    dev_priv->cdclk_freq)
 		return;
 
 	/* disable/enable all currently active pipes while we change cdclk */
@@ -5068,7 +5070,7 @@ static void vlv_program_pfi_credits(struct drm_i915_private *dev_priv)
 	else
 		default_credits = PFI_CREDIT(8);
 
-	if (DIV_ROUND_CLOSEST(dev_priv->vlv_cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
+	if (DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
 		/* CHV suggested value is 31 or 63 */
 		if (IS_CHERRYVIEW(dev_priv))
 			credits = PFI_CREDIT_31;
@@ -5101,7 +5103,7 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 	int req_cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
 
-	if (req_cdclk != dev_priv->vlv_cdclk_freq) {
+	if (req_cdclk != dev_priv->cdclk_freq) {
 		/*
 		 * FIXME: We can end up here with all power domains off, yet
 		 * with a CDCLK frequency other than the minimum. To account
Signature · 6 lines
2.1.0

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

Re: [PATCH 29/49] drm/i915: Rename vlv_cdclk_freq to cdclk_freq

Quoted 4 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Rename vlv_cdclk_freq to cdclk_freq so that it can be used for all platforms as required. Needed by the next patch.

Nah, we name functions by the first platform that introduces them, not just drop the prefix when it's used for a bit longer. cdclock goes back as a concept since forever, so this is definitely way too generic a name. -Daniel

Quoted 100 lines
---
 drivers/gpu/drm/i915/i915_drv.h      |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 52e5f18..1b2a294 100644
@@ -1659,7 +1659,7 @@ struct drm_i915_private {
 	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
 
 	unsigned int fsb_freq, mem_freq, is_ddr3;
-	unsigned int vlv_cdclk_freq;
+	unsigned int cdclk_freq;
 	unsigned int hpll_freq;
 
 	/**
drivers/gpu/drm/i915/intel_display.c +10 -8
index e54e948..b91862e 100644
@@ -4879,16 +4879,16 @@ static void vlv_update_cdclk(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	dev_priv->vlv_cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
+	dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
 	DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz\n",
-			 dev_priv->vlv_cdclk_freq);
+			 dev_priv->cdclk_freq);
 
 	/*
 	 * Program the gmbus_freq based on the cdclk frequency.
 	 * BSpec erroneously claims we should aim for 4MHz, but
 	 * in fact 1MHz is the correct frequency.
 	 */
-	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000));
+	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
 }
 
 /* Adjust CDclk dividers to allow high res or save power if possible */
@@ -4897,7 +4897,8 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+					!= dev_priv->cdclk_freq);
 
 	if (cdclk >= 320000) /* jump to highest voltage for 400MHz too */
 		cmd = 2;
@@ -4961,7 +4962,8 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+						!= dev_priv->cdclk_freq);
 
 	switch (cdclk) {
 	case 333333:
@@ -5050,7 +5052,7 @@ static void valleyview_modeset_global_pipes(struct drm_device *dev,
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 
 	if (valleyview_calc_cdclk(dev_priv, max_pixclk) ==
-	    dev_priv->vlv_cdclk_freq)
+	    dev_priv->cdclk_freq)
 		return;
 
 	/* disable/enable all currently active pipes while we change cdclk */
@@ -5068,7 +5070,7 @@ static void vlv_program_pfi_credits(struct drm_i915_private *dev_priv)
 	else
 		default_credits = PFI_CREDIT(8);
 
-	if (DIV_ROUND_CLOSEST(dev_priv->vlv_cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
+	if (DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
 		/* CHV suggested value is 31 or 63 */
 		if (IS_CHERRYVIEW(dev_priv))
 			credits = PFI_CREDIT_31;
@@ -5101,7 +5103,7 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 	int req_cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
 
-	if (req_cdclk != dev_priv->vlv_cdclk_freq) {
+	if (req_cdclk != dev_priv->cdclk_freq) {
 		/*
 		 * FIXME: We can end up here with all power domains off, yet
 		 * with a CDCLK frequency other than the minimum. To account
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#111 lore raw

Re: [PATCH 29/49] drm/i915: Rename vlv_cdclk_freq to cdclk_freq

Quoted 9 lines · Daniel Vetter
Quoted 4 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Rename vlv_cdclk_freq to cdclk_freq so that it can be used for all platforms as required. Needed by the next patch.

Nah, we name functions by the first platform that introduces them, not just drop the prefix when it's used for a bit longer. cdclock goes back as a concept since forever, so this is definitely way too generic a name.

I might go on to point people at my cdclk series:
http://lists.freedesktop.org/archives/intel-gfx/2014-November/055640.html

Quoted 111 lines

-Daniel

Quoted 100 lines
---
 drivers/gpu/drm/i915/i915_drv.h      |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 52e5f18..1b2a294 100644
@@ -1659,7 +1659,7 @@ struct drm_i915_private {
 	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
 
 	unsigned int fsb_freq, mem_freq, is_ddr3;
-	unsigned int vlv_cdclk_freq;
+	unsigned int cdclk_freq;
 	unsigned int hpll_freq;
 
 	/**
drivers/gpu/drm/i915/intel_display.c +10 -8
index e54e948..b91862e 100644
@@ -4879,16 +4879,16 @@ static void vlv_update_cdclk(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	dev_priv->vlv_cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
+	dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
 	DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz\n",
-			 dev_priv->vlv_cdclk_freq);
+			 dev_priv->cdclk_freq);
 
 	/*
 	 * Program the gmbus_freq based on the cdclk frequency.
 	 * BSpec erroneously claims we should aim for 4MHz, but
 	 * in fact 1MHz is the correct frequency.
 	 */
-	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000));
+	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
 }
 
 /* Adjust CDclk dividers to allow high res or save power if possible */
@@ -4897,7 +4897,8 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+					!= dev_priv->cdclk_freq);
 
 	if (cdclk >= 320000) /* jump to highest voltage for 400MHz too */
 		cmd = 2;
@@ -4961,7 +4962,8 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+						!= dev_priv->cdclk_freq);
 
 	switch (cdclk) {
 	case 333333:
@@ -5050,7 +5052,7 @@ static void valleyview_modeset_global_pipes(struct drm_device *dev,
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 
 	if (valleyview_calc_cdclk(dev_priv, max_pixclk) ==
-	    dev_priv->vlv_cdclk_freq)
+	    dev_priv->cdclk_freq)
 		return;
 
 	/* disable/enable all currently active pipes while we change cdclk */
@@ -5068,7 +5070,7 @@ static void vlv_program_pfi_credits(struct drm_i915_private *dev_priv)
 	else
 		default_credits = PFI_CREDIT(8);
 
-	if (DIV_ROUND_CLOSEST(dev_priv->vlv_cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
+	if (DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
 		/* CHV suggested value is 31 or 63 */
 		if (IS_CHERRYVIEW(dev_priv))
 			credits = PFI_CREDIT_31;
@@ -5101,7 +5103,7 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 	int req_cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
 
-	if (req_cdclk != dev_priv->vlv_cdclk_freq) {
+	if (req_cdclk != dev_priv->cdclk_freq) {
 		/*
 		 * FIXME: We can end up here with all power domains off, yet
 		 * with a CDCLK frequency other than the minimum. To account
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 29/49
#112 lore raw

Re: [PATCH 29/49] drm/i915: Rename vlv_cdclk_freq to cdclk_freq

In reply to Imre Deak
Quoted 8 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Rename vlv_cdclk_freq to cdclk_freq so that it can be used for all platforms as required. Needed by the next patch.

Quoted 96 lines
---
 drivers/gpu/drm/i915/i915_drv.h      |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 52e5f18..1b2a294 100644
@@ -1659,7 +1659,7 @@ struct drm_i915_private {
 	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
 
 	unsigned int fsb_freq, mem_freq, is_ddr3;
-	unsigned int vlv_cdclk_freq;
+	unsigned int cdclk_freq;
 	unsigned int hpll_freq;
 
 	/**
drivers/gpu/drm/i915/intel_display.c +10 -8
index e54e948..b91862e 100644
@@ -4879,16 +4879,16 @@ static void vlv_update_cdclk(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	dev_priv->vlv_cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
+	dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
 	DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz\n",
-			 dev_priv->vlv_cdclk_freq);
+			 dev_priv->cdclk_freq);
 
 	/*
 	 * Program the gmbus_freq based on the cdclk frequency.
 	 * BSpec erroneously claims we should aim for 4MHz, but
 	 * in fact 1MHz is the correct frequency.
 	 */
-	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000));
+	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
 }
 
 /* Adjust CDclk dividers to allow high res or save power if possible */
@@ -4897,7 +4897,8 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+					!= dev_priv->cdclk_freq);
 
 	if (cdclk >= 320000) /* jump to highest voltage for 400MHz too */
 		cmd = 2;
@@ -4961,7 +4962,8 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 val, cmd;
 
-	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
+	WARN_ON(dev_priv->display.get_display_clock_speed(dev)
+						!= dev_priv->cdclk_freq);
 
 	switch (cdclk) {
 	case 333333:
@@ -5050,7 +5052,7 @@ static void valleyview_modeset_global_pipes(struct drm_device *dev,
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 
 	if (valleyview_calc_cdclk(dev_priv, max_pixclk) ==
-	    dev_priv->vlv_cdclk_freq)
+	    dev_priv->cdclk_freq)
 		return;
 
 	/* disable/enable all currently active pipes while we change cdclk */
@@ -5068,7 +5070,7 @@ static void vlv_program_pfi_credits(struct drm_i915_private *dev_priv)
 	else
 		default_credits = PFI_CREDIT(8);
 
-	if (DIV_ROUND_CLOSEST(dev_priv->vlv_cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
+	if (DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 1000) >= dev_priv->rps.cz_freq) {
 		/* CHV suggested value is 31 or 63 */
 		if (IS_CHERRYVIEW(dev_priv))
 			credits = PFI_CREDIT_31;
@@ -5101,7 +5103,7 @@ static void valleyview_modeset_global_resources(struct drm_device *dev)
 	int max_pixclk = intel_mode_max_pixclk(dev_priv);
 	int req_cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
 
-	if (req_cdclk != dev_priv->vlv_cdclk_freq) {
+	if (req_cdclk != dev_priv->cdclk_freq) {
 		/*
 		 * FIXME: We can end up here with all power domains off, yet
 		 * with a CDCLK frequency other than the minimum. To account
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#113 lore raw

PATCH 30/49 drm/i915/bxt: add display initialize/uninitialize sequence

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

Add display clock/PHY initialization sequence as per BSpec.

Until GOP/VBIOS provides an upper limit value for CDCLK, comparing clock value with 624 MHz and returning 0 in case it exceeds.

Note that the CD clock and PHY initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #2 is effectively disabled.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always", "Check CDCLK upper limit" patches
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY_A and PHY_BC, instead of open-coding the same

---
 drivers/gpu/drm/i915/i915_reg.h      | 126 +++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     | 291 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  75 +++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   4 +
 4 files changed, 496 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +126 -0
index b4474d3..a3579c0 100644
@@ -1120,6 +1120,110 @@ enum skl_disp_power_wells {
 #define   DPIO_FRC_LATENCY_SHFIT	8
 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
 #define   DPIO_UPAR_SHIFT		30
+
+/* BXT PHY registers */
+enum bxt_phy {
+	BXT_PHY_A,
+	BXT_PHY_BC
+};
+
+#define BXT_PHY(phy, a, b)		((a) + (phy) * ((b) - (a)))
+
+#define BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR	0x138090
+#define   _EDP_POWER_ON				(1 << 1)
+#define   _DDI_POWER_ON				(1 << 0)
+#define   GT_DISPLAY_POWER_ON(phy)		BXT_PHY(phy, _EDP_POWER_ON, \
+							_DDI_POWER_ON)
+
+#define _PHY_CTL_FAMILY_EDP		0x64C80
+#define _PHY_CTL_FAMILY_DDI		0x64C90
+#define   COMMON_RESET_DIS		(1 << 31)
+#define BXT_PHY_CTL_FAMILY(phy)		BXT_PHY(phy, _PHY_CTL_FAMILY_EDP, \
+						     _PHY_CTL_FAMILY_DDI)
+
+/* BXT PHY common lane registers */
+#define _PORT_CL1CM_DW0_A		0x162000
+#define _PORT_CL1CM_DW0_BC		0x6C000
+#define   PHY_POWER_GOOD		(1 << 16)
+#define BXT_PORT_CL1CM_DW0(phy)		BXT_PHY(phy, _PORT_CL1CM_DW0_A,	\
+						     _PORT_CL1CM_DW0_BC)
+
+#define _PORT_CL1CM_DW9_A		0x162024
+#define _PORT_CL1CM_DW9_BC		0x6C024
+#define   IREF0RC_OFFSET_SHIFT		8
+#define   IREF0RC_OFFSET_MASK		(0xFF << IREF0RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW9(phy)		BXT_PHY(phy, _PORT_CL1CM_DW9_A,	\
+						     _PORT_CL1CM_DW9_BC)
+
+#define _PORT_CL1CM_DW10_A		0x162028
+#define _PORT_CL1CM_DW10_BC		0x6C028
+#define   IREF1RC_OFFSET_SHIFT		8
+#define   IREF1RC_OFFSET_MASK		(0xFF << IREF1RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW10(phy)	BXT_PHY(phy, _PORT_CL1CM_DW10_A, \
+						     _PORT_CL1CM_DW10_BC)
+
+#define _PORT_CL1CM_DW28_A		0x162070
+#define _PORT_CL1CM_DW28_BC		0x6C070
+#define   OCL1_POWER_DOWN_EN		(1 << 23)
+#define   DW28_OLDO_DYN_PWR_DOWN_EN	(1 << 22)
+#define   SUS_CLK_CONFIG		0x3
+#define BXT_PORT_CL1CM_DW28(phy)	BXT_PHY(phy, _PORT_CL1CM_DW28_A, \
+						     _PORT_CL1CM_DW28_BC)
+
+#define _PORT_CL1CM_DW30_A		0x162078
+#define _PORT_CL1CM_DW30_BC		0x6C078
+#define   OCL2_LDOFUSE_PWR_DIS		(1 << 6)
+#define BXT_PORT_CL1CM_DW30(phy)	BXT_PHY(phy, _PORT_CL1CM_DW30_A, \
+						     _PORT_CL1CM_DW30_BC)
+
+/* Defined for PHY_BC only */
+#define BXT_PORT_CL2CM_DW6_BC		0x6C358
+#define   DW6_OLDO_DYN_PWR_DOWN_EN	(1 << 28)
+
+/* BXT PHY Ref registers */
+#define _PORT_REF_DW3_A			0x16218C
+#define _PORT_REF_DW3_BC		0x6C18C
+#define   GRC_DONE			(1 << 22)
+#define BXT_PORT_REF_DW3(phy)		BXT_PHY(phy, _PORT_REF_DW3_A,	\
+						     _PORT_REF_DW3_BC)
+
+#define _PORT_REF_DW6_A			0x162198
+#define _PORT_REF_DW6_BC		0x6C198
+/*
+ * FIXME: BSpec disagrees on the following two fields, check them with
+ * HW/documentation people.
+ */
+#define   GRC_CODE_SHIFT		23
+#define   GRC_CODE_MASK			(0x1FF << GRC_CODE_SHIFT)
+#define   GRC_CODE_FAST_SHIFT		16
+#define   GRC_CODE_FAST_MASK		(0x7F << GRC_CODE_FAST_SHIFT)
+#define   GRC_CODE_SLOW_SHIFT		8
+#define   GRC_CODE_SLOW_MASK		(0xFF << GRC_CODE_SLOW_SHIFT)
+#define   GRC_CODE_NOM_MASK		0xFF
+#define BXT_PORT_REF_DW6(phy)		BXT_PHY(phy, _PORT_REF_DW6_A,	\
+						     _PORT_REF_DW6_BC)
+
+#define _PORT_REF_DW8_A			0x1621A0
+#define _PORT_REF_DW8_BC		0x6C1A0
+#define   GRC_DIS			(1 << 15)
+#define   GRC_RDY_OVRD			(1 << 1)
+#define BXT_PORT_REF_DW8(phy)		BXT_PHY(phy, _PORT_REF_DW8_A,	\
+						     _PORT_REF_DW8_BC)
+
+/* BXT PHY TX registers */
+#define BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
+					 ((lane) & 1) * 0x80)
+
+#define _PORT_TX_DW14_LN0_A		0x162538
+#define _PORT_TX_DW14_LN0_B		0x6C538
+#define _PORT_TX_DW14_LN0_C		0x6C938
+#define   LATENCY_OPTIM_SHIFT		30
+#define   LATENCY_OPTIM			(1 << LATENCY_OPTIM_SHIFT)
+#define BXT_PORT_TX_DW14_LN(port, lane)	(_PORT3(port, _PORT_TX_DW14_LN0_A,   \
+						      _PORT_TX_DW14_LN0_B,   \
+						      _PORT_TX_DW14_LN0_C) + \
+					 BXT_LANE_OFFSET(lane))
+
 /*
  * Fence registers
  */
@@ -5326,6 +5430,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)
@@ -6271,6 +6378,7 @@ enum skl_disp_power_wells {
 #define   GEN6_PCODE_WRITE_D_COMP		0x11
 #define   GEN6_ENCODE_RC6_VID(mv)		(((mv) - 245) / 5)
 #define   GEN6_DECODE_RC6_VID(vids)		(((vids) * 5) + 245)
+#define   DISPLAY_PCU_CONTROL			0x17
 #define   DISPLAY_IPS_CONTROL			0x19
 #define	  HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL	0x1A
 #define GEN6_PCODE_DATA				0x138128
@@ -6748,6 +6856,13 @@ enum skl_disp_power_wells {
 #define  CDCLK_FREQ_675_617		(3<<26)
 #define  CDCLK_FREQ_DECIMAL_MASK	(0x7ff)
 
+#define  BXT_CDCLK_CD2X_DIV_SEL_MASK	(3<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1	(0<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1_5	(1<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_2	(2<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_4	(3<<22)
+#define  BXT_CDCLK_SSA_PRECHARGE_ENABLE	(1<<16)
+
 /* LCPLL_CTL */
 #define LCPLL1_CTL		0x46010
 #define LCPLL2_CTL		0x46014
@@ -6812,6 +6927,17 @@ enum skl_disp_power_wells {
 #define GET_CFG_CR1_REG(id) (DPLL1_CFGCR1 + (id - SKL_DPLL1) * 8)
 #define GET_CFG_CR2_REG(id) (DPLL1_CFGCR2 + (id - SKL_DPLL1) * 8)
 
+/* BXT display engine PLL */
+#define BXT_DE_PLL_CTL			0x6d000
+#define   BXT_DE_PLL_RATIO_1152		0x3c
+#define   BXT_DE_PLL_RATIO_1248		0x41
+#define   BXT_DE_PLL_RATIO_DEFAULT	0x64
+#define   BXT_DE_PLL_RATIO_MASK		0x7f
+
+#define BXT_DE_PLL_ENABLE		0x46070
+#define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
+#define   BXT_DE_PLL_LOCK		(1 << 30)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_ddi.c +291 -0

303 lines not on this page · raw message

drivers/gpu/drm/i915/intel_display.c +75 -0

93 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +4 -0
index c77128c..4bc2041 100644
@@ -873,6 +873,7 @@ void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config);
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
+void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency);
 
 /* intel_frontbuffer.c */
 void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
@@ -1020,6 +1021,9 @@ void intel_prepare_reset(struct drm_device *dev);
 void intel_finish_reset(struct drm_device *dev);
 void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
+void bxt_init_cdclk(struct drm_device *dev);
+void bxt_uninit_cdclk(struct drm_device *dev);
+void bxt_ddi_phy_init(struct drm_device *dev);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 6 lines
2.1.0

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

Re: [PATCH 30/49] drm/i915/bxt: add display initialize/uninitialize sequence

On Tue, Mar 17, 2015 at 11:39:56AM +0200, Imre Deak wrote:
<snip>

Quoted 25 lines
drivers/gpu/drm/i915/intel_display.c +17 -0
index b91862e..ba2d1ae 100644
@@ -8284,6 +8284,75 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv)
 	intel_prepare_ddi(dev);
 }
 
+static int broxton_calc_cdclk(struct drm_i915_private *dev_priv,
+				int max_pixclk)
+{
+	/*
+	 * CDclks are supported:
+	 *   144MHz
+	 *   288MHz
+	 *   384MHz
+	 *   576MHz
+	 *   624MHz
+	 * Check to see whether we're above 90% of the lower bin and
+	 * adjust if needed.
+	 */
+
+	/* If max_pixclk is greater than the max allowed clock, return 0.
+	 * FIXME:- The max clock allowed needs to be provided by GOP/VBIOS
+	 * via a scratch pad register. Till that is enabled, use 624MHz as max.

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8313

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+	 */
+	if (max_pixclk > 624000)
+		return 0;
+	else if (max_pixclk > 576000*9/10)
+		return 624000;
+	else if (max_pixclk > 384000*9/10)
+		return 576000;
+	else if (max_pixclk > 288000*9/10)
+		return 384000;
+	else if (max_pixclk > 144000*9/10)

Does BXT really need a 10% guarband for CDCLK? Other HSW+ platforms need no guardband IIRC (assuming we ignore 64bpp and scaling).

I'm not seeing anything specific about BXT max pixel rate in BSpec. The SKL section says EXCLUDE(BXT). Art, can you clarify?

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
+		return 288000;
+	else
+		return 144000;
+}
+
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#115 lore raw

Re: [PATCH 30/49] drm/i915/bxt: add display initialize/uninitialize sequence

In reply to Imre Deak
Quoted 3 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add display clock/PHY initialization sequence as per BSpec.

This should really be two patches I think. I'll go over the cdclk bits first...

Quoted 61 lines

Until GOP/VBIOS provides an upper limit value for CDCLK, comparing clock value with 624 MHz and returning 0 in case it exceeds.

Note that the CD clock and PHY initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #2 is effectively disabled.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always", "Check CDCLK upper limit" patches
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY_A and PHY_BC, instead of open-coding the same

---
 drivers/gpu/drm/i915/i915_reg.h      | 126 +++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     | 291 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  75 +++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   4 +
 4 files changed, 496 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index b4474d3..a3579c0 100644

<snip>

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -5326,6 +5430,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6381

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -6271,6 +6378,7 @@ enum skl_disp_power_wells {
 #define   GEN6_PCODE_WRITE_D_COMP		0x11
 #define   GEN6_ENCODE_RC6_VID(mv)		(((mv) - 245) / 5)
 #define   GEN6_DECODE_RC6_VID(vids)		(((vids) * 5) + 245)
+#define   DISPLAY_PCU_CONTROL			0x17

I called this HSW_PCODE_DE_WRITE_FREQ_REQ in my HSW/BDW cdclk patches, which matches the name in Bspec for HSW/BDW.

Given our established practice of naming things based on the oldest platform supporting them, I'd go with the HSW/BDW name.

Quoted 18 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
 #define   DISPLAY_IPS_CONTROL			0x19
 #define	  HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL	0x1A
 #define GEN6_PCODE_DATA				0x138128
@@ -6748,6 +6856,13 @@ enum skl_disp_power_wells {
 #define  CDCLK_FREQ_675_617		(3<<26)
 #define  CDCLK_FREQ_DECIMAL_MASK	(0x7ff)
 
+#define  BXT_CDCLK_CD2X_DIV_SEL_MASK	(3<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1	(0<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1_5	(1<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_2	(2<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_4	(3<<22)
+#define  BXT_CDCLK_SSA_PRECHARGE_ENABLE	(1<<16)
+
 /* LCPLL_CTL */
 #define LCPLL1_CTL		0x46010
 #define LCPLL2_CTL		0x46014

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6934

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -6812,6 +6927,17 @@ enum skl_disp_power_wells {
 #define GET_CFG_CR1_REG(id) (DPLL1_CFGCR1 + (id - SKL_DPLL1) * 8)
 #define GET_CFG_CR2_REG(id) (DPLL1_CFGCR2 + (id - SKL_DPLL1) * 8)
 
+/* BXT display engine PLL */
+#define BXT_DE_PLL_CTL			0x6d000
+#define   BXT_DE_PLL_RATIO_1152		0x3c
+#define   BXT_DE_PLL_RATIO_1248		0x41
+#define   BXT_DE_PLL_RATIO_DEFAULT	0x64

These are just 60,65,100 decimal in hex. So I might make this something like:
#define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6935

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+#define   BXT_DE_PLL_RATIO_MASK		0x7f

0xff

Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+
+#define BXT_DE_PLL_ENABLE		0x46070
+#define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
+#define   BXT_DE_PLL_LOCK		(1 << 30)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index a203d9d..789682d 100644
@@ -1957,6 +1957,294 @@ static void skl_shared_dplls_init(struct drm_i915_private *dev_priv)

<snip>

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2076

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+
+/*
+ * It is the responsibility of the caller to ensure that
+ * criteria for changing the CD clk frequency is met.

Not sure that note helps anything. It applies to all platforms anyway, not just BXT.

Quoted 4 lines

+ *
+ * This function only changes CD clock frequency.
+ * TODO:- 1. Add functions to change only the divider and
+ * 2. call impacted functions like backlight, WiDi, watermark.

This TODO can be dropped. We'll do all that stuff naturally as part of the crtc enable, so nothing needed here I think.

drivers/gpu/drm/i915/intel_ddi.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+*/
+void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency)

We call it foo_set_cdclk() on other platforms. Also we usually use just a plain old int for most frequency variables.

Also I'd put the code into intel_display.c as that's where we have the rest of the cdclk stuff, and that's where I was going to put the HSW/BDW code too.

If people are into that code movement stuff someone could extract all the cdclk stuff to some new file to reduce intel_display.c a bit.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2089

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t cdclk_ctl, decimal, ratio;
+	uint32_t divider, freq, current_freq;
+	int ret;
+
+	freq = (frequency / 1000 - 1) * 2;

This will lose <1MHz bits. So rewrite as

(frequency - 1000) / 500
or
((frequency - 1000) << 1) / 1000
if you want to advertize the .1 fixed point fact a bit more.

or maybe
frequency / 500 - (1 << 1)
or
(frequency << 1) / 1000 - (1 << 1)

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2090

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+	decimal = DIV_ROUND_UP(frequency, 25000);

I'd call this pcu_freq or somesuch. 'decimal' doesn't really make much sense.

Quoted 27 lines
drivers/gpu/drm/i915/intel_ddi.c +27 -0
+
+	switch (frequency) {
+	case 144000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_4;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 288000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_2;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 384000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1_5;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 576000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 624000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO_1248;
+		break;
+	case 0:
+		/* Incase incoming frequency is 0, only DE PLL has to be
+		 * disabled, divider/ratio need not be programmed.
+		 * Hence, initializing to 0.
+		 */

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2127

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+		divider = ratio = 0;
+		break;
+	default:
+		DRM_ERROR("Unsupported cd frequency %d enable request",
+								frequency);
+		return;
+	}
+
+	current_freq = I915_READ(CDCLK_CTL) & CDCLK_FREQ_DECIMAL_MASK;
+	current_freq = ((current_freq / 2) + 1) * 1000;

Again we lose <1MHz bits here.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2132

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+
+	mutex_lock(&dev_priv->rps.hw_lock);
+	/* Inform power controller of upcoming frequency change */
+	ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL,
+				      0x80000000);

I can't see any name for the magic value in Bspec. So I guess we'll leave it as is.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2137

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	if (ret) {
+		DRM_DEBUG_KMS("pcode write failed, leaving CDCLK unchanged (%d)\n",
+			      ret);

Sounds like DRM_ERROR() would be in order.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2148

Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +11 -0
+		return;
+	}
+
+	/* DE PLL has to be disabled when input frequency is 0 or
+	 * frequency is to be changed to 624MHz or changed from 624 MHz
+	 */
+	if (!frequency || current_freq == 624000 || frequency == 624000) {
+		I915_WRITE(BXT_DE_PLL_ENABLE, ~BXT_DE_PLL_PLL_ENABLE);
+		WARN(wait_for(
+			!(I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK),
+			1), "DE PLL locked\n");

DRM_ERROR() might be enough here. The backtrace won't give is much more information I think. Maybe add a note that the timeout required is at least 200us.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2152

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+	}
+
+	if (frequency) {
+		I915_WRITE(BXT_DE_PLL_CTL, ratio);

The spec says we must not change the other fields in the register, so perhaps we should do an RMW here? Although the default is documented to be 0 for everything else, but maybe that could change on some devices.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2156

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+		I915_WRITE(BXT_DE_PLL_ENABLE, BXT_DE_PLL_PLL_ENABLE);
+		WARN(wait_for(
+			I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK, 1),
+			"DE PLL not locked\n");

Again, not sure the WARN buys us anything extra. Again might mention that the timeout required is 200us.

Quoted 14 lines
drivers/gpu/drm/i915/intel_ddi.c +14 -0
+
+		cdclk_ctl = I915_READ(CDCLK_CTL);
+		cdclk_ctl &= ~BXT_CDCLK_CD2X_DIV_SEL_MASK;
+		cdclk_ctl |= divider;
+
+		/* Disable SSA Precharge when CD clock frequency < 500 MHz,
+		 * enable otherwise.
+		 */
+		cdclk_ctl &= ~BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+		if (frequency >= 500000)
+			cdclk_ctl |= BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+
+		cdclk_ctl &= ~CDCLK_FREQ_DECIMAL_MASK;
+		cdclk_ctl |= freq;

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2180

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+		I915_WRITE(CDCLK_CTL, cdclk_ctl);
+
+		mutex_lock(&dev_priv->rps.hw_lock);
+		ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL,
+					      decimal);
+		mutex_unlock(&dev_priv->rps.hw_lock);
+
+		if (ret) {
+			DRM_DEBUG_KMS("pcode write failed. err = %d decimal = %d\n",
+				      ret, decimal);

The debug message could be a bit more descriptive of what we were trying to do here.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2193

Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +13 -0
+			return;
+		}
+
+		dev_priv->cdclk_freq = frequency;
+	} else {
+		mutex_lock(&dev_priv->rps.hw_lock);
+		ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL, 1);
+		mutex_unlock(&dev_priv->rps.hw_lock);
+
+		if (ret)
+			DRM_DEBUG_KMS("pcode write failed. err = %d decimal = 1\n",
+				      ret);
+	}

Looks like we could avoid the duplicated pcode write easily. Also the spec says that cdclk will actually be 19.2MHz with DE PLL disabled. So seems like we should use that instead of 0 as the value all around.

If we want to keep the set_cdclk(0) as a handy shorthand for "disable the DE PLL" we could then have
if (frequency == 0)

	frequency = 19200;

at the start of the function.

Quoted 19 lines
drivers/gpu/drm/i915/intel_ddi.c +19 -0
+}
+
+void bxt_init_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
+	 * or else the reset will hang because there is no PCH to respond.
+	 * Move the handshake programming to initialization sequence.
+	 * Previously was left up to BIOS.
+	 */
+	u32 temp = I915_READ(HSW_NDE_RSTWRN_OPT);
+
+	temp &= ~RESET_PCH_HANDSHAKE_ENABLE;
+	I915_WRITE(HSW_NDE_RSTWRN_OPT, temp);
+
+	/* Enable PG1 for cdclk */
+	intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
+

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2222

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	/* check if cd clock is enabled */
+	if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
+		DRM_DEBUG_KMS("Display already initialized\n");
+		return;
+	}
+
+	/* FIXME:- The initial CDCLK needs to be read from VBT.
+	 * Need to make this change after VBT has changes for BXT.
+	 */
+	bxt_select_cdclk_freq(dev, 624000);

Do we need to initialize this here? It would get initialized at the first modeset anyway. Or is there some problem with AUX/something with the low 19.2MHz cdclk we'd have w/o DE PLL?

Quoted 56 lines
drivers/gpu/drm/i915/intel_ddi.c +28 -0
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE))
+		DRM_ERROR("DBuf power enable timeout!\n");
+}
+
+void bxt_uninit_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	bxt_ddi_phy_uninit(dev);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
+		DRM_ERROR("DBuf power disable timeout!\n");
+
+	bxt_select_cdclk_freq(dev, 0);
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
+}
+
 void intel_ddi_pll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1973,6 +2261,9 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		bxt_init_cdclk(dev);
+		bxt_ddi_phy_init(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
drivers/gpu/drm/i915/intel_display.c +10 -0
index b91862e..ba2d1ae 100644
@@ -8284,6 +8284,75 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv)
 	intel_prepare_ddi(dev);
 }
 
+static int broxton_calc_cdclk(struct drm_i915_private *dev_priv,
+				int max_pixclk)
+{
+	/*
+	 * CDclks are supported:
+	 *   144MHz
+	 *   288MHz
+	 *   384MHz
+	 *   576MHz
+	 *   624MHz

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8306

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+	 * Check to see whether we're above 90% of the lower bin and
+	 * adjust if needed.
+	 */
+
+	/* If max_pixclk is greater than the max allowed clock, return 0.
+	 * FIXME:- The max clock allowed needs to be provided by GOP/VBIOS
+	 * via a scratch pad register. Till that is enabled, use 624MHz as max.
+	 */
+	if (max_pixclk > 624000)
+		return 0;

I think we can just ignore the max limit for now. That's what we do for VLV/CHV. Once we get my cdclk series in we'll have max_cdclk and can check such limits on all platforms, and in the apprpriate place where we can still fail the operation / reject the mode.

This will avoid having the !req_cdclk special cases below.

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8314

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +8 -0
+	else if (max_pixclk > 576000*9/10)
+		return 624000;
+	else if (max_pixclk > 384000*9/10)
+		return 576000;
+	else if (max_pixclk > 288000*9/10)
+		return 384000;
+	else if (max_pixclk > 144000*9/10)
+		return 288000;

Art confirmed that we don't need any guardband here, so the 9/10 factor should be removed, and the comment adjusted.

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8316

Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+	else
+		return 144000;

Can we drop to DE PLL disabled/19.2MHz when there are no active pipes? If so we should add such check here. So something like:
...
else if (max_pixclk > 0)

	return 144000;
else
	return 19200;
Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +13 -0
+}
+
+static void broxton_modeset_global_pipes(struct drm_device *dev,
+					    unsigned *prepare_pipes)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc;
+	int max_pixclk = intel_mode_max_pixclk(dev_priv);
+	int req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (!req_cdclk) {
+		DRM_ERROR("CDCLK exceeds maximum allowable value\n");
+		return;

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8339

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+	}
+
+	if (req_cdclk == dev_priv->cdclk_freq)
+		return;
+
+	/* disable/enable all currently active pipes while we change cdclk */
+	for_each_intel_crtc(dev, intel_crtc)
+		if (intel_crtc->base.enabled)
+			*prepare_pipes |= (1 << intel_crtc->pipe);
+}

Might make sense to combine this with the VLV/CHV function so that we don't have to add essentially duplicated blocks of code in __intel_set_mode().

Quoted 68 lines
drivers/gpu/drm/i915/intel_display.c +22 -0
+
+static void broxton_modeset_global_resources(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int max_pixclk = intel_mode_max_pixclk(dev_priv);
+	int req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (!req_cdclk) {
+		DRM_ERROR("CDCLK exceeds maximum allowable value\n");
+		return;
+	}
+
+	if (req_cdclk != dev_priv->cdclk_freq)
+		bxt_select_cdclk_freq(dev, req_cdclk);
+}
+
 static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 				      struct intel_crtc_state *crtc_state)
 {
@@ -11239,6 +11308,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 
 		/* may have added more to prepare_pipes than we should */
 		prepare_pipes &= ~disable_pipes;
+	} else if (IS_BROXTON(dev)) {
+		broxton_modeset_global_pipes(dev, &prepare_pipes);
+		prepare_pipes &= ~disable_pipes;
 	}
 
 	ret = __intel_set_mode_setup_plls(dev, modeset_pipes, disable_pipes);
@@ -13133,6 +13205,9 @@ static void intel_init_display(struct drm_device *dev)
 	} else if (IS_VALLEYVIEW(dev)) {
 		dev_priv->display.modeset_global_resources =
 			valleyview_modeset_global_resources;
+	} else if (IS_BROXTON(dev)) {
+		dev_priv->display.modeset_global_resources =
+			broxton_modeset_global_resources;
 	}
 
 	switch (INTEL_INFO(dev)->gen) {
drivers/gpu/drm/i915/intel_drv.h +4 -0
index c77128c..4bc2041 100644
@@ -873,6 +873,7 @@ void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config);
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
+void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency);
 
 /* intel_frontbuffer.c */
 void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
@@ -1020,6 +1021,9 @@ void intel_prepare_reset(struct drm_device *dev);
 void intel_finish_reset(struct drm_device *dev);
 void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
+void bxt_init_cdclk(struct drm_device *dev);
+void bxt_uninit_cdclk(struct drm_device *dev);
+void bxt_ddi_phy_init(struct drm_device *dev);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#116 lore raw

Re: [PATCH 30/49] drm/i915/bxt: add display initialize/uninitialize sequence

Quoted 7 lines · Ville Syrjälä
Quoted 3 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add display clock/PHY initialization sequence as per BSpec.

This should really be two patches I think. I'll go over the cdclk bits first...

Yes, that would've been a better split. Other patches again like the related register definitions needed to be squashed.

Quoted 80 lines
Quoted 60 lines

Until GOP/VBIOS provides an upper limit value for CDCLK, comparing clock value with 624 MHz and returning 0 in case it exceeds.

Note that the CD clock and PHY initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #2 is effectively disabled.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always", "Check CDCLK upper limit" patches
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY_A and PHY_BC, instead of open-coding the same

---
 drivers/gpu/drm/i915/i915_reg.h      | 126 +++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     | 291 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  75 +++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   4 +
 4 files changed, 496 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index b4474d3..a3579c0 100644

<snip>

Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -5326,6 +5430,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6381

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -6271,6 +6378,7 @@ enum skl_disp_power_wells {
 #define   GEN6_PCODE_WRITE_D_COMP		0x11
 #define   GEN6_ENCODE_RC6_VID(mv)		(((mv) - 245) / 5)
 #define   GEN6_DECODE_RC6_VID(vids)		(((vids) * 5) + 245)
+#define   DISPLAY_PCU_CONTROL			0x17

I called this HSW_PCODE_DE_WRITE_FREQ_REQ in my HSW/BDW cdclk patches, which matches the name in Bspec for HSW/BDW.

Quoted 2 lines

Given our established practice of naming things based on the oldest platform supporting them, I'd go with the HSW/BDW name.

Ok, will change it.

Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
 #define   DISPLAY_IPS_CONTROL			0x19
 #define	  HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL	0x1A
 #define GEN6_PCODE_DATA				0x138128
@@ -6748,6 +6856,13 @@ enum skl_disp_power_wells {
 #define  CDCLK_FREQ_675_617		(3<<26)
 #define  CDCLK_FREQ_DECIMAL_MASK	(0x7ff)
 
+#define  BXT_CDCLK_CD2X_DIV_SEL_MASK	(3<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1	(0<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1_5	(1<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_2	(2<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_4	(3<<22)
+#define  BXT_CDCLK_SSA_PRECHARGE_ENABLE	(1<<16)
+
 /* LCPLL_CTL */
 #define LCPLL1_CTL		0x46010
 #define LCPLL2_CTL		0x46014
@@ -6812,6 +6927,17 @@ enum skl_disp_power_wells {
 #define GET_CFG_CR1_REG(id) (DPLL1_CFGCR1 + (id - SKL_DPLL1) * 8)
 #define GET_CFG_CR2_REG(id) (DPLL1_CFGCR2 + (id - SKL_DPLL1) * 8)
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6934

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* BXT display engine PLL */
+#define BXT_DE_PLL_CTL			0x6d000
+#define   BXT_DE_PLL_RATIO_1152		0x3c
+#define   BXT_DE_PLL_RATIO_1248		0x41
+#define   BXT_DE_PLL_RATIO_DEFAULT	0x64

These are just 60,65,100 decimal in hex. So I might make this something like:
#define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */

Makes sense.

Quoted 3 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 6935

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+#define   BXT_DE_PLL_RATIO_MASK		0x7f

0xff

Oops, this wasn't used fortunately, but with your RMW change it will be.

Quoted 22 lines
Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+
+#define BXT_DE_PLL_ENABLE		0x46070
+#define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
+#define   BXT_DE_PLL_LOCK		(1 << 30)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index a203d9d..789682d 100644
@@ -1957,6 +1957,294 @@ static void skl_shared_dplls_init(struct drm_i915_private *dev_priv)

<snip>

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2076

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+
+/*
+ * It is the responsibility of the caller to ensure that
+ * criteria for changing the CD clk frequency is met.

Not sure that note helps anything. It applies to all platforms anyway, not just BXT.

Quoted 9 lines
Quoted 4 lines

+ *
+ * This function only changes CD clock frequency.
+ * TODO:- 1. Add functions to change only the divider and
+ * 2. call impacted functions like backlight, WiDi, watermark.

This TODO can be dropped. We'll do all that stuff naturally as part of the crtc enable, so nothing needed here I think.

Quoted 1 line

+*/

Ok, will remove this comment block.

Quoted 8 lines
Quoted 1 line

+void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency)

We call it foo_set_cdclk() on other platforms. Also we usually use just a plain old int for most frequency variables.

Also I'd put the code into intel_display.c as that's where we have the rest of the cdclk stuff, and that's where I was going to put the HSW/BDW code too.

Ok, will rename/move stuff.

Quoted 19 lines

If people are into that code movement stuff someone could extract all the cdclk stuff to some new file to reduce intel_display.c a bit.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2089

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t cdclk_ctl, decimal, ratio;
+	uint32_t divider, freq, current_freq;
+	int ret;
+
+	freq = (frequency / 1000 - 1) * 2;

This will lose <1MHz bits. So rewrite as

(frequency - 1000) / 500
or
((frequency - 1000) << 1) / 1000
if you want to advertize the .1 fixed point fact a bit more.

Quoted 4 lines

or maybe
frequency / 500 - (1 << 1)
or
(frequency << 1) / 1000 - (1 << 1)

Right, but on Broxton all supported frequencies programmed via CDCLK_CTL are MHz aligned so the above wouldn't change things in practice. But I guess it makes sense to rewrite this if you want to unify more the different platforms in the future.

Quoted 4 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2090

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+	decimal = DIV_ROUND_UP(frequency, 25000);

I'd call this pcu_freq or somesuch. 'decimal' doesn't really make much sense.

Ok, will use pcu_freq.

Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/i915/intel_ddi.c +31 -0
+
+	switch (frequency) {
+	case 144000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_4;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 288000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_2;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 384000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1_5;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 576000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO_1152;
+		break;
+	case 624000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO_1248;
+		break;
+	case 0:
+		/* Incase incoming frequency is 0, only DE PLL has to be
+		 * disabled, divider/ratio need not be programmed.
+		 * Hence, initializing to 0.
+		 */
+		divider = ratio = 0;
+		break;
+	default:
+		DRM_ERROR("Unsupported cd frequency %d enable request",
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2127

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+								frequency);
+		return;
+	}
+
+	current_freq = I915_READ(CDCLK_CTL) & CDCLK_FREQ_DECIMAL_MASK;
+	current_freq = ((current_freq / 2) + 1) * 1000;

Again we lose <1MHz bits here.

Yep, but not in practice.

Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2132

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+
+	mutex_lock(&dev_priv->rps.hw_lock);
+	/* Inform power controller of upcoming frequency change */
+	ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL,
+				      0x80000000);

I can't see any name for the magic value in Bspec. So I guess we'll leave it as is.

I haven't found any description either.

Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2137

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	if (ret) {
+		DRM_DEBUG_KMS("pcode write failed, leaving CDCLK unchanged (%d)\n",
+			      ret);

Sounds like DRM_ERROR() would be in order.

Ok for this and the other DRM_ERROR/WARN changes.

Quoted 17 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2148

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +11 -0
+		return;
+	}
+
+	/* DE PLL has to be disabled when input frequency is 0 or
+	 * frequency is to be changed to 624MHz or changed from 624 MHz
+	 */
+	if (!frequency || current_freq == 624000 || frequency == 624000) {
+		I915_WRITE(BXT_DE_PLL_ENABLE, ~BXT_DE_PLL_PLL_ENABLE);
+		WARN(wait_for(
+			!(I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK),
+			1), "DE PLL locked\n");

DRM_ERROR() might be enough here. The backtrace won't give is much more information I think. Maybe add a note that the timeout required is at least 200us.

Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2152

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+	}
+
+	if (frequency) {
+		I915_WRITE(BXT_DE_PLL_CTL, ratio);

The spec says we must not change the other fields in the register, so perhaps we should do an RMW here? Although the default is documented to be 0 for everything else, but maybe that could change on some devices.

Yea, it's better to do RMW.

Quoted 54 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2156

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+		I915_WRITE(BXT_DE_PLL_ENABLE, BXT_DE_PLL_PLL_ENABLE);
+		WARN(wait_for(
+			I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK, 1),
+			"DE PLL not locked\n");

Again, not sure the WARN buys us anything extra. Again might mention that the timeout required is 200us.

Quoted 14 lines
drivers/gpu/drm/i915/intel_ddi.c +14 -0
+
+		cdclk_ctl = I915_READ(CDCLK_CTL);
+		cdclk_ctl &= ~BXT_CDCLK_CD2X_DIV_SEL_MASK;
+		cdclk_ctl |= divider;
+
+		/* Disable SSA Precharge when CD clock frequency < 500 MHz,
+		 * enable otherwise.
+		 */
+		cdclk_ctl &= ~BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+		if (frequency >= 500000)
+			cdclk_ctl |= BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+
+		cdclk_ctl &= ~CDCLK_FREQ_DECIMAL_MASK;
+		cdclk_ctl |= freq;

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2180

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+		I915_WRITE(CDCLK_CTL, cdclk_ctl);
+
+		mutex_lock(&dev_priv->rps.hw_lock);
+		ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL,
+					      decimal);
+		mutex_unlock(&dev_priv->rps.hw_lock);
+
+		if (ret) {
+			DRM_DEBUG_KMS("pcode write failed. err = %d decimal = %d\n",
+				      ret, decimal);

The debug message could be a bit more descriptive of what we were trying to do here.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2193

Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +13 -0
+			return;
+		}
+
+		dev_priv->cdclk_freq = frequency;
+	} else {
+		mutex_lock(&dev_priv->rps.hw_lock);
+		ret = sandybridge_pcode_write(dev_priv, DISPLAY_PCU_CONTROL, 1);
+		mutex_unlock(&dev_priv->rps.hw_lock);
+
+		if (ret)
+			DRM_DEBUG_KMS("pcode write failed. err = %d decimal = 1\n",
+				      ret);
+	}

Looks like we could avoid the duplicated pcode write easily. Also the spec says that cdclk will actually be 19.2MHz with DE PLL disabled. So seems like we should use that instead of 0 as the value all around.

Quoted 5 lines

If we want to keep the set_cdclk(0) as a handy shorthand for "disable the DE PLL" we could then have
if (frequency == 0)

	frequency = 19200;

at the start of the function.

Yes, it simplifies the code, I can rewrite it.

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/i915/intel_ddi.c +25 -0
+}
+
+void bxt_init_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
+	 * or else the reset will hang because there is no PCH to respond.
+	 * Move the handshake programming to initialization sequence.
+	 * Previously was left up to BIOS.
+	 */
+	u32 temp = I915_READ(HSW_NDE_RSTWRN_OPT);
+
+	temp &= ~RESET_PCH_HANDSHAKE_ENABLE;
+	I915_WRITE(HSW_NDE_RSTWRN_OPT, temp);
+
+	/* Enable PG1 for cdclk */
+	intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
+
+	/* check if cd clock is enabled */
+	if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
+		DRM_DEBUG_KMS("Display already initialized\n");
+		return;
+	}
+
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2222

Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4 -0
+	/* FIXME:- The initial CDCLK needs to be read from VBT.
+	 * Need to make this change after VBT has changes for BXT.
+	 */
+	bxt_select_cdclk_freq(dev, 624000);

Do we need to initialize this here? It would get initialized at the first modeset anyway. Or is there some problem with AUX/something with the low 19.2MHz cdclk we'd have w/o DE PLL?

This is required by the "Broxton Sequences to Initialize Display" in bspec, without specifying the actual clock rate. This whole sequence is done now during driver loading which is not ideal and should be moved to power well enable/modesetting time, but I thought we would do it once we get the HW to test things on.

Quoted 72 lines
Quoted 56 lines
drivers/gpu/drm/i915/intel_ddi.c +28 -0
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE))
+		DRM_ERROR("DBuf power enable timeout!\n");
+}
+
+void bxt_uninit_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	bxt_ddi_phy_uninit(dev);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
+		DRM_ERROR("DBuf power disable timeout!\n");
+
+	bxt_select_cdclk_freq(dev, 0);
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
+}
+
 void intel_ddi_pll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1973,6 +2261,9 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		bxt_init_cdclk(dev);
+		bxt_ddi_phy_init(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
drivers/gpu/drm/i915/intel_display.c +10 -0
index b91862e..ba2d1ae 100644
@@ -8284,6 +8284,75 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv)
 	intel_prepare_ddi(dev);
 }
 
+static int broxton_calc_cdclk(struct drm_i915_private *dev_priv,
+				int max_pixclk)
+{
+	/*
+	 * CDclks are supported:
+	 *   144MHz
+	 *   288MHz
+	 *   384MHz
+	 *   576MHz
+	 *   624MHz

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8306

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+	 * Check to see whether we're above 90% of the lower bin and
+	 * adjust if needed.
+	 */
+
+	/* If max_pixclk is greater than the max allowed clock, return 0.
+	 * FIXME:- The max clock allowed needs to be provided by GOP/VBIOS
+	 * via a scratch pad register. Till that is enabled, use 624MHz as max.
+	 */
+	if (max_pixclk > 624000)
+		return 0;

I think we can just ignore the max limit for now. That's what we do for VLV/CHV. Once we get my cdclk series in we'll have max_cdclk and can check such limits on all platforms, and in the apprpriate place where we can still fail the operation / reject the mode.

Quoted 1 line

This will avoid having the !req_cdclk special cases below.

Ok, will remove the check.

Quoted 12 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8314

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +8 -0
+	else if (max_pixclk > 576000*9/10)
+		return 624000;
+	else if (max_pixclk > 384000*9/10)
+		return 576000;
+	else if (max_pixclk > 288000*9/10)
+		return 384000;
+	else if (max_pixclk > 144000*9/10)
+		return 288000;

Art confirmed that we don't need any guardband here, so the 9/10 factor should be removed, and the comment adjusted.

Thanks for catching this. Again I'd fix this up once we can test it and for now just add a note here.

Quoted 10 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8316

Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+	else
+		return 144000;

Can we drop to DE PLL disabled/19.2MHz when there are no active pipes? If so we should add such check here. So something like:
...
else if (max_pixclk > 0)

	return 144000;
else
	return 19200;

Yea, makes sense to disable the PLL here. Again I'd add a note for now and fix it up later.

Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_display.c +19 -0
+}
+
+static void broxton_modeset_global_pipes(struct drm_device *dev,
+					    unsigned *prepare_pipes)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc;
+	int max_pixclk = intel_mode_max_pixclk(dev_priv);
+	int req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (!req_cdclk) {
+		DRM_ERROR("CDCLK exceeds maximum allowable value\n");
+		return;
+	}
+
+	if (req_cdclk == dev_priv->cdclk_freq)
+		return;
+
+	/* disable/enable all currently active pipes while we change cdclk */
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c void hsw_disable_pc8(struct drm_i915_private *dev_priv) · line 8339

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +4 -0
+	for_each_intel_crtc(dev, intel_crtc)
+		if (intel_crtc->base.enabled)
+			*prepare_pipes |= (1 << intel_crtc->pipe);
+}

Might make sense to combine this with the VLV/CHV function so that we don't have to add essentially duplicated blocks of code in __intel_set_mode().

Ok, will do.

Quoted 64 lines
Quoted 64 lines
drivers/gpu/drm/i915/intel_display.c +22 -0
+
+static void broxton_modeset_global_resources(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int max_pixclk = intel_mode_max_pixclk(dev_priv);
+	int req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (!req_cdclk) {
+		DRM_ERROR("CDCLK exceeds maximum allowable value\n");
+		return;
+	}
+
+	if (req_cdclk != dev_priv->cdclk_freq)
+		bxt_select_cdclk_freq(dev, req_cdclk);
+}
+
 static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 				      struct intel_crtc_state *crtc_state)
 {
@@ -11239,6 +11308,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 
 		/* may have added more to prepare_pipes than we should */
 		prepare_pipes &= ~disable_pipes;
+	} else if (IS_BROXTON(dev)) {
+		broxton_modeset_global_pipes(dev, &prepare_pipes);
+		prepare_pipes &= ~disable_pipes;
 	}
 
 	ret = __intel_set_mode_setup_plls(dev, modeset_pipes, disable_pipes);
@@ -13133,6 +13205,9 @@ static void intel_init_display(struct drm_device *dev)
 	} else if (IS_VALLEYVIEW(dev)) {
 		dev_priv->display.modeset_global_resources =
 			valleyview_modeset_global_resources;
+	} else if (IS_BROXTON(dev)) {
+		dev_priv->display.modeset_global_resources =
+			broxton_modeset_global_resources;
 	}
 
 	switch (INTEL_INFO(dev)->gen) {
drivers/gpu/drm/i915/intel_drv.h +4 -0
index c77128c..4bc2041 100644
@@ -873,6 +873,7 @@ void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config);
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
+void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency);
 
 /* intel_frontbuffer.c */
 void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
@@ -1020,6 +1021,9 @@ void intel_prepare_reset(struct drm_device *dev);
 void intel_finish_reset(struct drm_device *dev);
 void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
+void bxt_init_cdclk(struct drm_device *dev);
+void bxt_uninit_cdclk(struct drm_device *dev);
+void bxt_ddi_phy_init(struct drm_device *dev);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 1 line
2.1.0
Quoted 5 lines
Quoted 4 lines

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

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

#117 lore raw

Re: [PATCH 30/49] drm/i915/bxt: add display initialize/uninitialize sequence

In reply to Imre Deak
Quoted 7 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add display clock/PHY initialization sequence as per BSpec.

Until GOP/VBIOS provides an upper limit value for CDCLK, comparing clock value with 624 MHz and returning 0 in case it exceeds.

Quoted 6 lines

Note that the CD clock and PHY initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #2 is effectively disabled.

OK, I've gone through the PHY stuff a bit now, and skipped the cdclk stuff this time.

Quoted 52 lines

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always", "Check CDCLK upper limit" patches
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY_A and PHY_BC, instead of open-coding the same

---
 drivers/gpu/drm/i915/i915_reg.h      | 126 +++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     | 291 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  75 +++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   4 +
 4 files changed, 496 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index b4474d3..a3579c0 100644

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1128

Quoted 9 lines
drivers/gpu/drm/i915/i915_reg.h +6 -0
@@ -1120,6 +1120,110 @@ enum skl_disp_power_wells {
 #define   DPIO_FRC_LATENCY_SHFIT	8
 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
 #define   DPIO_UPAR_SHIFT		30
+
+/* BXT PHY registers */
+enum bxt_phy {
+	BXT_PHY_A,
+	BXT_PHY_BC
+};

We have enum dpio_phy already. Although here we have defined 0 to be the single channel PHY and 1 is the two channel PHY, whereas on CHV it's the other way around. I'm going to suggest we flip BXT over to use the CHV scheme to avoid any surpises later if we actualy try to unify the code.

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1130

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define BXT_PHY(phy, a, b)		((a) + (phy) * ((b) - (a)))

This seems to be just another _PIPE(), should at least have an underscore so that people don't confuse it with something they are supposed to use.

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1132

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR	0x138090

We can drop the _0_2_0_GTTMMADR suffix, we've never included it for any other platforms either.

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1136

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
+#define   _EDP_POWER_ON				(1 << 1)
+#define   _DDI_POWER_ON				(1 << 0)
+#define   GT_DISPLAY_POWER_ON(phy)		BXT_PHY(phy, _EDP_POWER_ON, \
+							_DDI_POWER_ON)

Using a _PIPE() type of macro for register bits seems a bit unusual. I'd just open code it as (1 << (phy)) or something. That also work better if we the PHYs around so that PHY0 is the dual channel PHY.

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1149

Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h +13 -0
+
+#define _PHY_CTL_FAMILY_EDP		0x64C80
+#define _PHY_CTL_FAMILY_DDI		0x64C90
+#define   COMMON_RESET_DIS		(1 << 31)
+#define BXT_PHY_CTL_FAMILY(phy)		BXT_PHY(phy, _PHY_CTL_FAMILY_EDP, \
+						     _PHY_CTL_FAMILY_DDI)
+
+/* BXT PHY common lane registers */
+#define _PORT_CL1CM_DW0_A		0x162000
+#define _PORT_CL1CM_DW0_BC		0x6C000
+#define   PHY_POWER_GOOD		(1 << 16)
+#define BXT_PORT_CL1CM_DW0(phy)		BXT_PHY(phy, _PORT_CL1CM_DW0_A,	\
+						     _PORT_CL1CM_DW0_BC)

I'm a bit sad these are not sharing the CHV reg defines, or even resemble them in any way.

Quoted 36 lines
drivers/gpu/drm/i915/i915_reg.h +36 -0
+
+#define _PORT_CL1CM_DW9_A		0x162024
+#define _PORT_CL1CM_DW9_BC		0x6C024
+#define   IREF0RC_OFFSET_SHIFT		8
+#define   IREF0RC_OFFSET_MASK		(0xFF << IREF0RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW9(phy)		BXT_PHY(phy, _PORT_CL1CM_DW9_A,	\
+						     _PORT_CL1CM_DW9_BC)
+
+#define _PORT_CL1CM_DW10_A		0x162028
+#define _PORT_CL1CM_DW10_BC		0x6C028
+#define   IREF1RC_OFFSET_SHIFT		8
+#define   IREF1RC_OFFSET_MASK		(0xFF << IREF1RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW10(phy)	BXT_PHY(phy, _PORT_CL1CM_DW10_A, \
+						     _PORT_CL1CM_DW10_BC)
+
+#define _PORT_CL1CM_DW28_A		0x162070
+#define _PORT_CL1CM_DW28_BC		0x6C070
+#define   OCL1_POWER_DOWN_EN		(1 << 23)
+#define   DW28_OLDO_DYN_PWR_DOWN_EN	(1 << 22)
+#define   SUS_CLK_CONFIG		0x3
+#define BXT_PORT_CL1CM_DW28(phy)	BXT_PHY(phy, _PORT_CL1CM_DW28_A, \
+						     _PORT_CL1CM_DW28_BC)
+
+#define _PORT_CL1CM_DW30_A		0x162078
+#define _PORT_CL1CM_DW30_BC		0x6C078
+#define   OCL2_LDOFUSE_PWR_DIS		(1 << 6)
+#define BXT_PORT_CL1CM_DW30(phy)	BXT_PHY(phy, _PORT_CL1CM_DW30_A, \
+						     _PORT_CL1CM_DW30_BC)
+
+/* Defined for PHY_BC only */
+#define BXT_PORT_CL2CM_DW6_BC		0x6C358
+#define   DW6_OLDO_DYN_PWR_DOWN_EN	(1 << 28)
+
+/* BXT PHY Ref registers */
+#define _PORT_REF_DW3_A			0x16218C
+#define _PORT_REF_DW3_BC		0x6C18C

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1195

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+#define   GRC_DONE			(1 << 22)
+#define BXT_PORT_REF_DW3(phy)		BXT_PHY(phy, _PORT_REF_DW3_A,	\
+						     _PORT_REF_DW3_BC)
+
+#define _PORT_REF_DW6_A			0x162198
+#define _PORT_REF_DW6_BC		0x6C198
+/*
+ * FIXME: BSpec disagrees on the following two fields, check them with
+ * HW/documentation people.
+ */

CHV configdb also disagrees.

Quoted 44 lines
drivers/gpu/drm/i915/i915_reg.h +34 -0
+#define   GRC_CODE_SHIFT		23
+#define   GRC_CODE_MASK			(0x1FF << GRC_CODE_SHIFT)
+#define   GRC_CODE_FAST_SHIFT		16
+#define   GRC_CODE_FAST_MASK		(0x7F << GRC_CODE_FAST_SHIFT)
+#define   GRC_CODE_SLOW_SHIFT		8
+#define   GRC_CODE_SLOW_MASK		(0xFF << GRC_CODE_SLOW_SHIFT)
+#define   GRC_CODE_NOM_MASK		0xFF
+#define BXT_PORT_REF_DW6(phy)		BXT_PHY(phy, _PORT_REF_DW6_A,	\
+						     _PORT_REF_DW6_BC)
+
+#define _PORT_REF_DW8_A			0x1621A0
+#define _PORT_REF_DW8_BC		0x6C1A0
+#define   GRC_DIS			(1 << 15)
+#define   GRC_RDY_OVRD			(1 << 1)
+#define BXT_PORT_REF_DW8(phy)		BXT_PHY(phy, _PORT_REF_DW8_A,	\
+						     _PORT_REF_DW8_BC)
+
+/* BXT PHY TX registers */
+#define BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
+					 ((lane) & 1) * 0x80)
+
+#define _PORT_TX_DW14_LN0_A		0x162538
+#define _PORT_TX_DW14_LN0_B		0x6C538
+#define _PORT_TX_DW14_LN0_C		0x6C938
+#define   LATENCY_OPTIM_SHIFT		30
+#define   LATENCY_OPTIM			(1 << LATENCY_OPTIM_SHIFT)
+#define BXT_PORT_TX_DW14_LN(port, lane)	(_PORT3(port, _PORT_TX_DW14_LN0_A,   \
+						      _PORT_TX_DW14_LN0_B,   \
+						      _PORT_TX_DW14_LN0_C) + \
+					 BXT_LANE_OFFSET(lane))
+
 /*
  * Fence registers
  */
@@ -5326,6 +5430,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)

<snip>

Quoted 20 lines
drivers/gpu/drm/i915/intel_ddi.c +12 -0
index a203d9d..789682d 100644
@@ -1957,6 +1957,294 @@ static void skl_shared_dplls_init(struct drm_i915_private *dev_priv)
 	}
 }
 
+static void bxt_init_phy(struct drm_i915_private *dev_priv, enum bxt_phy phy)
+{
+	enum port port;
+	uint32_t val;
+
+	val = I915_READ(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR);
+	val |= GT_DISPLAY_POWER_ON(phy);
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR, val);
+
+	/* Considering 10ms timeout until BSpec is updated */
+	if (wait_for(I915_READ(BXT_PORT_CL1CM_DW0(phy)) & PHY_POWER_GOOD, 10))
+		DRM_ERROR("timeout during PHY#%d power on\n", phy);

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 1981

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+
+	/* Program latency optim setting */
+	for (port =  (phy == BXT_PHY_A ? PORT_A : PORT_B);
+	     port <= (phy == BXT_PHY_A ? PORT_A : PORT_C); port++) {
+		int lane;
+
+		for (lane = 0; lane < 4; lane++) {
+			val = I915_READ(BXT_PORT_TX_DW14_LN(port, lane));
+			val &= ~LATENCY_OPTIM;
+			if (lane == 1)

Should be != 1

Quoted 60 lines
drivers/gpu/drm/i915/intel_ddi.c +60 -0
+				val |= LATENCY_OPTIM;
+
+			I915_WRITE(BXT_PORT_TX_DW14_LN(port, lane), val);
+		}
+	}
+
+	/* Program PLL Rcomp code offset */
+	val = I915_READ(BXT_PORT_CL1CM_DW9(phy));
+	val &= ~IREF0RC_OFFSET_MASK;
+	val |= 0xE4 << IREF0RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW9(phy), val);
+
+	val = I915_READ(BXT_PORT_CL1CM_DW10(phy));
+	val &= ~IREF1RC_OFFSET_MASK;
+	val |= 0xE4 << IREF1RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW10(phy), val);
+
+	/* Program power gating */
+	val = I915_READ(BXT_PORT_CL1CM_DW28(phy));
+	val |= OCL1_POWER_DOWN_EN | DW28_OLDO_DYN_PWR_DOWN_EN |
+		SUS_CLK_CONFIG;
+	I915_WRITE(BXT_PORT_CL1CM_DW28(phy), val);
+
+	if (phy == BXT_PHY_BC) {
+		val = I915_READ(BXT_PORT_CL2CM_DW6_BC);
+		val |= DW6_OLDO_DYN_PWR_DOWN_EN;
+		I915_WRITE(BXT_PORT_CL2CM_DW6_BC, val);
+	}
+
+	val = I915_READ(BXT_PORT_CL1CM_DW30(phy));
+	val &= ~OCL2_LDOFUSE_PWR_DIS;
+	/*
+	 * On PHY_A disable power on the second channel, since no port is
+	 * connected there. On PHY_BC both channels have a port, so leave it
+	 * enabled.
+	 * Note that port C is only connected on BXT-P, so on BXT0/1 we should
+	 * power down the second channel on PHY_BC as well.
+	 */
+	if (phy == BXT_PHY_A)
+		val |= OCL2_LDOFUSE_PWR_DIS;
+	I915_WRITE(BXT_PORT_CL1CM_DW30(phy), val);
+
+	if (phy == BXT_PHY_BC) {
+		uint32_t grc_code;
+		/*
+		 * PHY_BC isn't connected to an RCOMP resistor so copy over
+		 * the corresponding calibrated value from PHY_A, and disable
+		 * the automatic calibration on PHY_BC.
+		 */
+		if (wait_for(I915_READ(BXT_PORT_REF_DW3(BXT_PHY_A)) & GRC_DONE,
+			     10))
+			DRM_ERROR("timeout waiting for PHY#0 GRC\n");
+
+		val = I915_READ(BXT_PORT_REF_DW6(BXT_PHY_A));
+		val = (val & GRC_CODE_MASK) >> GRC_CODE_SHIFT;
+		grc_code = val << GRC_CODE_FAST_SHIFT |
+			   val << GRC_CODE_SLOW_SHIFT |
+			   val;
+		I915_WRITE(BXT_PORT_REF_DW6(BXT_PHY_BC), grc_code);
+

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2051

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+		val = I915_READ(BXT_PORT_REF_DW8(BXT_PHY_BC));
+		val |= GRC_DIS | GRC_RDY_OVRD;
+		I915_WRITE(BXT_PORT_REF_DW8(BXT_PHY_BC), val);
+	}
+
+	/* Release common_reset */
+	val = I915_READ(BXT_PHY_CTL_FAMILY(phy));
+	val |= COMMON_RESET_DIS;
+	I915_WRITE(BXT_PHY_CTL_FAMILY(phy), val);
+}

I suppose we'll want to model this thing as a power well like on CHV eventually, but I guess we can start off with initializing it once.

Quoted 11 lines
drivers/gpu/drm/i915/intel_ddi.c +11 -0
+
+void bxt_ddi_phy_init(struct drm_device *dev)
+{
+	/* Enable PHY_A first since it provides Rcomp for PHY_BC */
+	bxt_init_phy(dev->dev_private, BXT_PHY_A);
+	bxt_init_phy(dev->dev_private, BXT_PHY_BC);
+}
+
+static void bxt_ddi_phy_uninit(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2072

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	uint32_t temp;
+
+	temp = I915_READ(BXT_PHY_CTL_FAMILY(BXT_PHY_A));
+	I915_WRITE(BXT_PHY_CTL_FAMILY(BXT_PHY_A), temp & ~COMMON_RESET_DIS);
+
+	temp = I915_READ(BXT_PHY_CTL_FAMILY(BXT_PHY_BC));
+	I915_WRITE(BXT_PHY_CTL_FAMILY(BXT_PHY_BC), temp & ~COMMON_RESET_DIS);
+
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR, 0);
+}

This should really be per-phy to avoid confusion when comparing with the init function.

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+

<snip>

Quoted 25 lines
drivers/gpu/drm/i915/intel_ddi.c +25 -0
+
+void bxt_init_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
+	 * or else the reset will hang because there is no PCH to respond.
+	 * Move the handshake programming to initialization sequence.
+	 * Previously was left up to BIOS.
+	 */
+	u32 temp = I915_READ(HSW_NDE_RSTWRN_OPT);
+
+	temp &= ~RESET_PCH_HANDSHAKE_ENABLE;
+	I915_WRITE(HSW_NDE_RSTWRN_OPT, temp);
+
+	/* Enable PG1 for cdclk */
+	intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
+
+	/* check if cd clock is enabled */
+	if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
+		DRM_DEBUG_KMS("Display already initialized\n");
+		return;
+	}
+
+	/* FIXME:- The initial CDCLK needs to be read from VBT.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2229

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	 * Need to make this change after VBT has changes for BXT.
+	 */
+	bxt_select_cdclk_freq(dev, 624000);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE))
+		DRM_ERROR("DBuf power enable timeout!\n");
+}

This code seems like power well territory again. Just stuffing it into PG1 would seem like a good enough solution judging by the fact that we hold the PG1 reference as long as we have the DBUF power request enabled.

Or are there actual uses for having PG1 enabled w/o this thing?

Quoted 31 lines
drivers/gpu/drm/i915/intel_ddi.c +21 -0
+
+void bxt_uninit_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	bxt_ddi_phy_uninit(dev);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
+		DRM_ERROR("DBuf power disable timeout!\n");
+
+	bxt_select_cdclk_freq(dev, 0);
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
+}
+
 void intel_ddi_pll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1973,6 +2261,9 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		bxt_init_cdclk(dev);
+		bxt_ddi_phy_init(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#118 lore raw

Re: [PATCH 30/49] drm/i915/bxt: add display initialize/uninitialize sequence

Quoted 77 lines · Ville Syrjälä
Quoted 7 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add display clock/PHY initialization sequence as per BSpec.

Until GOP/VBIOS provides an upper limit value for CDCLK, comparing clock value with 624 MHz and returning 0 in case it exceeds.

Quoted 6 lines

Note that the CD clock and PHY initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #2 is effectively disabled.

OK, I've gone through the PHY stuff a bit now, and skipped the cdclk stuff this time.

Quoted 59 lines

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always", "Check CDCLK upper limit" patches
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY_A and PHY_BC, instead of open-coding the same

---
 drivers/gpu/drm/i915/i915_reg.h      | 126 +++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     | 291 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  75 +++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   4 +
 4 files changed, 496 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index b4474d3..a3579c0 100644
@@ -1120,6 +1120,110 @@ enum skl_disp_power_wells {
 #define   DPIO_FRC_LATENCY_SHFIT	8
 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
 #define   DPIO_UPAR_SHIFT		30
+
+/* BXT PHY registers */
+enum bxt_phy {
+	BXT_PHY_A,
Quoted 8 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1128

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+	BXT_PHY_BC
+};

We have enum dpio_phy already. Although here we have defined 0 to be the single channel PHY and 1 is the two channel PHY, whereas on CHV it's the other way around. I'm going to suggest we flip BXT over to use the CHV scheme to avoid any surpises later if we actualy try to unify the code.

Yea, I haven't noticed it, will use that instead.

Quoted 6 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1130

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define BXT_PHY(phy, a, b)		((a) + (phy) * ((b) - (a)))

This seems to be just another _PIPE(), should at least have an underscore so that people don't confuse it with something they are supposed to use.

Ok, I can rewrite this to
#define _BXT_PHY(phy, a, b) _PIPE(phy, a, b)

Quoted 6 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1132

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR	0x138090

We can drop the _0_2_0_GTTMMADR suffix, we've never included it for any other platforms either.

Ok.

Quoted 8 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1136

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
+#define   _EDP_POWER_ON				(1 << 1)
+#define   _DDI_POWER_ON				(1 << 0)
+#define   GT_DISPLAY_POWER_ON(phy)		BXT_PHY(phy, _EDP_POWER_ON, \
+							_DDI_POWER_ON)

Using a _PIPE() type of macro for register bits seems a bit unusual. I'd just open code it as (1 << (phy)) or something. That also work better if we the PHYs around so that PHY0 is the dual channel PHY.

Ok, will rewrite it.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +8 -0
+
+#define _PHY_CTL_FAMILY_EDP		0x64C80
+#define _PHY_CTL_FAMILY_DDI		0x64C90
+#define   COMMON_RESET_DIS		(1 << 31)
+#define BXT_PHY_CTL_FAMILY(phy)		BXT_PHY(phy, _PHY_CTL_FAMILY_EDP, \
+						     _PHY_CTL_FAMILY_DDI)
+
+/* BXT PHY common lane registers */
Quoted 8 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1149

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+#define _PORT_CL1CM_DW0_A		0x162000
+#define _PORT_CL1CM_DW0_BC		0x6C000
+#define   PHY_POWER_GOOD		(1 << 16)
+#define BXT_PORT_CL1CM_DW0(phy)		BXT_PHY(phy, _PORT_CL1CM_DW0_A,	\
+						     _PORT_CL1CM_DW0_BC)

I'm a bit sad these are not sharing the CHV reg defines, or even resemble them in any way.

I agree this isn't ideal. I've already refactored some parts in the original version of this patch (see the commit version log) to bring it closer to CHV, but there is definitely more to do. I'd say it's better to do this after moving the cdckl/phy init code to the modeset/power well enable time.

Quoted 39 lines
Quoted 39 lines
drivers/gpu/drm/i915/i915_reg.h +39 -0
+#define _PORT_CL1CM_DW9_A		0x162024
+#define _PORT_CL1CM_DW9_BC		0x6C024
+#define   IREF0RC_OFFSET_SHIFT		8
+#define   IREF0RC_OFFSET_MASK		(0xFF << IREF0RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW9(phy)		BXT_PHY(phy, _PORT_CL1CM_DW9_A,	\
+						     _PORT_CL1CM_DW9_BC)
+
+#define _PORT_CL1CM_DW10_A		0x162028
+#define _PORT_CL1CM_DW10_BC		0x6C028
+#define   IREF1RC_OFFSET_SHIFT		8
+#define   IREF1RC_OFFSET_MASK		(0xFF << IREF1RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW10(phy)	BXT_PHY(phy, _PORT_CL1CM_DW10_A, \
+						     _PORT_CL1CM_DW10_BC)
+
+#define _PORT_CL1CM_DW28_A		0x162070
+#define _PORT_CL1CM_DW28_BC		0x6C070
+#define   OCL1_POWER_DOWN_EN		(1 << 23)
+#define   DW28_OLDO_DYN_PWR_DOWN_EN	(1 << 22)
+#define   SUS_CLK_CONFIG		0x3
+#define BXT_PORT_CL1CM_DW28(phy)	BXT_PHY(phy, _PORT_CL1CM_DW28_A, \
+						     _PORT_CL1CM_DW28_BC)
+
+#define _PORT_CL1CM_DW30_A		0x162078
+#define _PORT_CL1CM_DW30_BC		0x6C078
+#define   OCL2_LDOFUSE_PWR_DIS		(1 << 6)
+#define BXT_PORT_CL1CM_DW30(phy)	BXT_PHY(phy, _PORT_CL1CM_DW30_A, \
+						     _PORT_CL1CM_DW30_BC)
+
+/* Defined for PHY_BC only */
+#define BXT_PORT_CL2CM_DW6_BC		0x6C358
+#define   DW6_OLDO_DYN_PWR_DOWN_EN	(1 << 28)
+
+/* BXT PHY Ref registers */
+#define _PORT_REF_DW3_A			0x16218C
+#define _PORT_REF_DW3_BC		0x6C18C
+#define   GRC_DONE			(1 << 22)
+#define BXT_PORT_REF_DW3(phy)		BXT_PHY(phy, _PORT_REF_DW3_A,	\
+						     _PORT_REF_DW3_BC)
+
Quoted 8 lines

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1195

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +6 -0
+#define _PORT_REF_DW6_A			0x162198
+#define _PORT_REF_DW6_BC		0x6C198
+/*
+ * FIXME: BSpec disagrees on the following two fields, check them with
+ * HW/documentation people.
+ */

CHV configdb also disagrees.

Ok, thanks. Before fixing this, I want to wait for the HW to test things.

Quoted 69 lines
Quoted 44 lines
drivers/gpu/drm/i915/i915_reg.h +34 -0
+#define   GRC_CODE_SHIFT		23
+#define   GRC_CODE_MASK			(0x1FF << GRC_CODE_SHIFT)
+#define   GRC_CODE_FAST_SHIFT		16
+#define   GRC_CODE_FAST_MASK		(0x7F << GRC_CODE_FAST_SHIFT)
+#define   GRC_CODE_SLOW_SHIFT		8
+#define   GRC_CODE_SLOW_MASK		(0xFF << GRC_CODE_SLOW_SHIFT)
+#define   GRC_CODE_NOM_MASK		0xFF
+#define BXT_PORT_REF_DW6(phy)		BXT_PHY(phy, _PORT_REF_DW6_A,	\
+						     _PORT_REF_DW6_BC)
+
+#define _PORT_REF_DW8_A			0x1621A0
+#define _PORT_REF_DW8_BC		0x6C1A0
+#define   GRC_DIS			(1 << 15)
+#define   GRC_RDY_OVRD			(1 << 1)
+#define BXT_PORT_REF_DW8(phy)		BXT_PHY(phy, _PORT_REF_DW8_A,	\
+						     _PORT_REF_DW8_BC)
+
+/* BXT PHY TX registers */
+#define BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
+					 ((lane) & 1) * 0x80)
+
+#define _PORT_TX_DW14_LN0_A		0x162538
+#define _PORT_TX_DW14_LN0_B		0x6C538
+#define _PORT_TX_DW14_LN0_C		0x6C938
+#define   LATENCY_OPTIM_SHIFT		30
+#define   LATENCY_OPTIM			(1 << LATENCY_OPTIM_SHIFT)
+#define BXT_PORT_TX_DW14_LN(port, lane)	(_PORT3(port, _PORT_TX_DW14_LN0_A,   \
+						      _PORT_TX_DW14_LN0_B,   \
+						      _PORT_TX_DW14_LN0_C) + \
+					 BXT_LANE_OFFSET(lane))
+
 /*
  * Fence registers
  */
@@ -5326,6 +5430,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)

<snip>

Quoted 24 lines
drivers/gpu/drm/i915/intel_ddi.c +16 -0
index a203d9d..789682d 100644
@@ -1957,6 +1957,294 @@ static void skl_shared_dplls_init(struct drm_i915_private *dev_priv)
 	}
 }
 
+static void bxt_init_phy(struct drm_i915_private *dev_priv, enum bxt_phy phy)
+{
+	enum port port;
+	uint32_t val;
+
+	val = I915_READ(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR);
+	val |= GT_DISPLAY_POWER_ON(phy);
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR, val);
+
+	/* Considering 10ms timeout until BSpec is updated */
+	if (wait_for(I915_READ(BXT_PORT_CL1CM_DW0(phy)) & PHY_POWER_GOOD, 10))
+		DRM_ERROR("timeout during PHY#%d power on\n", phy);
+
+	/* Program latency optim setting */
+	for (port =  (phy == BXT_PHY_A ? PORT_A : PORT_B);
+	     port <= (phy == BXT_PHY_A ? PORT_A : PORT_C); port++) {
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 1981

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+		int lane;
+
+		for (lane = 0; lane < 4; lane++) {
+			val = I915_READ(BXT_PORT_TX_DW14_LN(port, lane));
+			val &= ~LATENCY_OPTIM;
+			if (lane == 1)

Should be != 1

Thanks for catching it, this is a fall-out from my refactoring. Will fix it.

Quoted 65 lines
Quoted 65 lines
drivers/gpu/drm/i915/intel_ddi.c +65 -0
+				val |= LATENCY_OPTIM;
+
+			I915_WRITE(BXT_PORT_TX_DW14_LN(port, lane), val);
+		}
+	}
+
+	/* Program PLL Rcomp code offset */
+	val = I915_READ(BXT_PORT_CL1CM_DW9(phy));
+	val &= ~IREF0RC_OFFSET_MASK;
+	val |= 0xE4 << IREF0RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW9(phy), val);
+
+	val = I915_READ(BXT_PORT_CL1CM_DW10(phy));
+	val &= ~IREF1RC_OFFSET_MASK;
+	val |= 0xE4 << IREF1RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW10(phy), val);
+
+	/* Program power gating */
+	val = I915_READ(BXT_PORT_CL1CM_DW28(phy));
+	val |= OCL1_POWER_DOWN_EN | DW28_OLDO_DYN_PWR_DOWN_EN |
+		SUS_CLK_CONFIG;
+	I915_WRITE(BXT_PORT_CL1CM_DW28(phy), val);
+
+	if (phy == BXT_PHY_BC) {
+		val = I915_READ(BXT_PORT_CL2CM_DW6_BC);
+		val |= DW6_OLDO_DYN_PWR_DOWN_EN;
+		I915_WRITE(BXT_PORT_CL2CM_DW6_BC, val);
+	}
+
+	val = I915_READ(BXT_PORT_CL1CM_DW30(phy));
+	val &= ~OCL2_LDOFUSE_PWR_DIS;
+	/*
+	 * On PHY_A disable power on the second channel, since no port is
+	 * connected there. On PHY_BC both channels have a port, so leave it
+	 * enabled.
+	 * Note that port C is only connected on BXT-P, so on BXT0/1 we should
+	 * power down the second channel on PHY_BC as well.
+	 */
+	if (phy == BXT_PHY_A)
+		val |= OCL2_LDOFUSE_PWR_DIS;
+	I915_WRITE(BXT_PORT_CL1CM_DW30(phy), val);
+
+	if (phy == BXT_PHY_BC) {
+		uint32_t grc_code;
+		/*
+		 * PHY_BC isn't connected to an RCOMP resistor so copy over
+		 * the corresponding calibrated value from PHY_A, and disable
+		 * the automatic calibration on PHY_BC.
+		 */
+		if (wait_for(I915_READ(BXT_PORT_REF_DW3(BXT_PHY_A)) & GRC_DONE,
+			     10))
+			DRM_ERROR("timeout waiting for PHY#0 GRC\n");
+
+		val = I915_READ(BXT_PORT_REF_DW6(BXT_PHY_A));
+		val = (val & GRC_CODE_MASK) >> GRC_CODE_SHIFT;
+		grc_code = val << GRC_CODE_FAST_SHIFT |
+			   val << GRC_CODE_SLOW_SHIFT |
+			   val;
+		I915_WRITE(BXT_PORT_REF_DW6(BXT_PHY_BC), grc_code);
+
+		val = I915_READ(BXT_PORT_REF_DW8(BXT_PHY_BC));
+		val |= GRC_DIS | GRC_RDY_OVRD;
+		I915_WRITE(BXT_PORT_REF_DW8(BXT_PHY_BC), val);
+	}
+
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2051

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	/* Release common_reset */
+	val = I915_READ(BXT_PHY_CTL_FAMILY(phy));
+	val |= COMMON_RESET_DIS;
+	I915_WRITE(BXT_PHY_CTL_FAMILY(phy), val);
+}

I suppose we'll want to model this thing as a power well like on CHV eventually, but I guess we can start off with initializing it once.

Yep, sounds good, but I'd also prefer to do this as a follow-up.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_ddi.c +16 -0
+
+void bxt_ddi_phy_init(struct drm_device *dev)
+{
+	/* Enable PHY_A first since it provides Rcomp for PHY_BC */
+	bxt_init_phy(dev->dev_private, BXT_PHY_A);
+	bxt_init_phy(dev->dev_private, BXT_PHY_BC);
+}
+
+static void bxt_ddi_phy_uninit(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t temp;
+
+	temp = I915_READ(BXT_PHY_CTL_FAMILY(BXT_PHY_A));
+	I915_WRITE(BXT_PHY_CTL_FAMILY(BXT_PHY_A), temp & ~COMMON_RESET_DIS);
+
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2072

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	temp = I915_READ(BXT_PHY_CTL_FAMILY(BXT_PHY_BC));
+	I915_WRITE(BXT_PHY_CTL_FAMILY(BXT_PHY_BC), temp & ~COMMON_RESET_DIS);
+
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON_0_2_0_GTTMMADR, 0);
+}

This should really be per-phy to avoid confusion when comparing with the init function.

Ok, will rewrite it.

Quoted 42 lines
Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+

<snip>

Quoted 25 lines
drivers/gpu/drm/i915/intel_ddi.c +25 -0
+
+void bxt_init_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	/* NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
+	 * or else the reset will hang because there is no PCH to respond.
+	 * Move the handshake programming to initialization sequence.
+	 * Previously was left up to BIOS.
+	 */
+	u32 temp = I915_READ(HSW_NDE_RSTWRN_OPT);
+
+	temp &= ~RESET_PCH_HANDSHAKE_ENABLE;
+	I915_WRITE(HSW_NDE_RSTWRN_OPT, temp);
+
+	/* Enable PG1 for cdclk */
+	intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
+
+	/* check if cd clock is enabled */
+	if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
+		DRM_DEBUG_KMS("Display already initialized\n");
+		return;
+	}
+
+	/* FIXME:- The initial CDCLK needs to be read from VBT.

drivers/gpu/drm/i915/intel_ddi.c static void skl_shared_dplls_init(struct drm_i915_private *dev_priv) · line 2229

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10 -0
+	 * Need to make this change after VBT has changes for BXT.
+	 */
+	bxt_select_cdclk_freq(dev, 624000);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE))
+		DRM_ERROR("DBuf power enable timeout!\n");
+}

This code seems like power well territory again. Just stuffing it into PG1 would seem like a good enough solution judging by the fact that we hold the PG1 reference as long as we have the DBUF power request enabled.

Quoted 1 line

Or are there actual uses for having PG1 enabled w/o this thing?

I don't think so, bspec requires this power request line to be asserted for all display internal functionality. So I agree moving it to the power well code is a good plan (as a follow-up).

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/i915/intel_ddi.c +18 -0
+
+void bxt_uninit_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	bxt_ddi_phy_uninit(dev);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
+		DRM_ERROR("DBuf power disable timeout!\n");
+
+	bxt_select_cdclk_freq(dev, 0);
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
+}
+
 void intel_ddi_pll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1973,6 +2261,9 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_pll_init(struct drm_device *dev) · line 2269

Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		bxt_init_cdclk(dev);
+		bxt_ddi_phy_init(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now

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

author
#119 lore raw

PATCH v4 30/49 drm/i915/bxt: add display initialize/uninitialize sequence (CDCLK)

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

Add CDCLK specific display clock initialization sequence as per BSpec.

Note that the CDCLK initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #1 is effectively disabled.

The call to uninitialize CDCLK during system/runtime suspend will be added later in this patchset.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- add missing masking when programming CDCLK_FREQ_DECIMAL

v4: (ville)
- split the CDCLK/PHY parts into two patches, update commit message accordingly
- s/DISPLAY_PCU_CONTROL/HSW_PCODE_DE_WRITE_FREQ_REQ/
- simplify BXT_DE_PLL_RATIO macros
- fix BXT_DE_PLL_RATIO_MASK
- s/bxt_select_cdclk_freq/broxton_set_cdclk_freq/
- move cdclk init/uninit/set code from intel_ddi.c to intel_display.c
- remove redundant code comments for broxton_set_cdclk_freq()
- sanitize fixed point<->integer frequency value conversion
- use DRM_ERROR instead of WARN
- do RMW when programming BXT_DE_PLL_CTL for safety
- add note about PLL lock timeout being exactly 200us
- make PCU error messages more descriptive
- instead of using 0 freq to mean PLL off/bypass freq use 19200 for clarity, as the latter one is the actual rate
- simplify pcode programming, removing duplicated sandybridge_pcode_write() call
- sanitize code flow, remove unnecessary scratch vars in broxton_set_cdclk() (imre)
- Remove bound check for maxmimum freq to match current code. This check will be added later at a more proper platform independent place once atomic support lands.
- add note to remove freq guard band which isn't needed on BXT
- add note to reduce freq to minimum if no pipe is enabled
- combine broxton_modeset_global_pipes() with valleyview_modeset_global_pipes()

---
 drivers/gpu/drm/i915/i915_reg.h      |  20 ++++
 drivers/gpu/drm/i915/intel_ddi.c     |   2 +
 drivers/gpu/drm/i915/intel_display.c | 226 ++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |   3 +
 4 files changed, 248 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +20 -0
index 4b53b20..c79bf8d 100644
@@ -5452,6 +5452,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)
@@ -6403,6 +6406,7 @@ enum skl_disp_power_wells {
 #define   GEN6_PCODE_WRITE_D_COMP		0x11
 #define   GEN6_ENCODE_RC6_VID(mv)		(((mv) - 245) / 5)
 #define   GEN6_DECODE_RC6_VID(vids)		(((vids) * 5) + 245)
+#define   HSW_PCODE_DE_WRITE_FREQ_REQ		0x17
 #define   DISPLAY_IPS_CONTROL			0x19
 #define	  HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL	0x1A
 #define GEN6_PCODE_DATA				0x138128
@@ -6874,6 +6878,13 @@ enum skl_disp_power_wells {
 #define  CDCLK_FREQ_675_617		(3<<26)
 #define  CDCLK_FREQ_DECIMAL_MASK	(0x7ff)
 
+#define  BXT_CDCLK_CD2X_DIV_SEL_MASK	(3<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1	(0<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1_5	(1<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_2	(2<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_4	(3<<22)
+#define  BXT_CDCLK_SSA_PRECHARGE_ENABLE	(1<<16)
+
 /* LCPLL_CTL */
 #define LCPLL1_CTL		0x46010
 #define LCPLL2_CTL		0x46014
@@ -6938,6 +6949,15 @@ enum skl_disp_power_wells {
 #define GET_CFG_CR1_REG(id) (DPLL1_CFGCR1 + (id - SKL_DPLL1) * 8)
 #define GET_CFG_CR2_REG(id) (DPLL1_CFGCR2 + (id - SKL_DPLL1) * 8)
 
+/* BXT display engine PLL */
+#define BXT_DE_PLL_CTL			0x6d000
+#define   BXT_DE_PLL_RATIO(x)		(x)	/* {60,65,100} * 19.2MHz */
+#define   BXT_DE_PLL_RATIO_MASK		0xff
+
+#define BXT_DE_PLL_ENABLE		0x46070
+#define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
+#define   BXT_DE_PLL_LOCK		(1 << 30)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 5b50484..25d697b 100644
@@ -1880,6 +1880,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		broxton_init_cdclk(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
drivers/gpu/drm/i915/intel_display.c +223 -3

266 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +3 -0
index 6a2ee0c..5ba88eb 100644
@@ -1112,6 +1112,9 @@ void intel_prepare_reset(struct drm_device *dev);
 void intel_finish_reset(struct drm_device *dev);
 void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
+void broxton_init_cdclk(struct drm_device *dev);
+void broxton_uninit_cdclk(struct drm_device *dev);
+void broxton_set_cdclk(struct drm_device *dev, int frequency);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 6 lines
2.1.0

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

PATCH 1/1 drm/i915/bxt: add display initialize/uninitialize sequence (PHY)

From: Vandana Kannan <[email protected]>

Add PHY specific display initialization sequence as per BSpec.

Note that the PHY initialization/uninitialization are done
at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively.

The call to uninitialize the PHY during system/runtime suspend will be added later in this patchset.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always",
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY1 and PHY0, instead of open-coding the same

v4: (ville)
- split the CDCLK/PHY parts into two patches, update commit message accordingly
- use the existing dpio_phy enum instead of adding a new one for the same purpose
- flip the meaning of PHYs so that PHY_A is PHY1 and PHY_BC is PHY0 to better match CHV
- s/BXT_PHY/_BXT_PHY/
- use _PIPE for _BXT_PHY instead of open-coding it
- drop _0_2_0_GTTMMADR suffix from BXT_P_CR_GT_DISP_PWRON
- define GT_DISPLAY_POWER_ON in a more standard way
- make a note that the CHV ConfigDB also disagrees about GRC_CODE field definitions
- fix lane optimization refactoring fumble from v3
- add per PHY uninit functions to match the init counterparts

---
 drivers/gpu/drm/i915/i915_reg.h  |  96 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c | 125 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |   2 +
 3 files changed, 223 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +96 -0
index c79bf8d..1903e37 100644
@@ -1117,6 +1117,102 @@ enum skl_disp_power_wells {
 #define   DPIO_FRC_LATENCY_SHFIT	8
 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
 #define   DPIO_UPAR_SHIFT		30
+
+/* BXT PHY registers */
+#define _BXT_PHY(phy, a, b)		_PIPE((phy), (a), (b))
+
+#define BXT_P_CR_GT_DISP_PWRON		0x138090
+#define   GT_DISPLAY_POWER_ON(phy)	(1 << (phy))
+
+#define _PHY_CTL_FAMILY_EDP		0x64C80
+#define _PHY_CTL_FAMILY_DDI		0x64C90
+#define   COMMON_RESET_DIS		(1 << 31)
+#define BXT_PHY_CTL_FAMILY(phy)		_BXT_PHY((phy), _PHY_CTL_FAMILY_DDI, \
+							_PHY_CTL_FAMILY_EDP)
+
+/* BXT PHY common lane registers */
+#define _PORT_CL1CM_DW0_A		0x162000
+#define _PORT_CL1CM_DW0_BC		0x6C000
+#define   PHY_POWER_GOOD		(1 << 16)
+#define BXT_PORT_CL1CM_DW0(phy)		_BXT_PHY((phy), _PORT_CL1CM_DW0_BC, \
+							_PORT_CL1CM_DW0_A)
+
+#define _PORT_CL1CM_DW9_A		0x162024
+#define _PORT_CL1CM_DW9_BC		0x6C024
+#define   IREF0RC_OFFSET_SHIFT		8
+#define   IREF0RC_OFFSET_MASK		(0xFF << IREF0RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW9(phy)		_BXT_PHY((phy), _PORT_CL1CM_DW9_BC, \
+							_PORT_CL1CM_DW9_A)
+
+#define _PORT_CL1CM_DW10_A		0x162028
+#define _PORT_CL1CM_DW10_BC		0x6C028
+#define   IREF1RC_OFFSET_SHIFT		8
+#define   IREF1RC_OFFSET_MASK		(0xFF << IREF1RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW10(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW10_BC, \
+							_PORT_CL1CM_DW10_A)
+
+#define _PORT_CL1CM_DW28_A		0x162070
+#define _PORT_CL1CM_DW28_BC		0x6C070
+#define   OCL1_POWER_DOWN_EN		(1 << 23)
+#define   DW28_OLDO_DYN_PWR_DOWN_EN	(1 << 22)
+#define   SUS_CLK_CONFIG		0x3
+#define BXT_PORT_CL1CM_DW28(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW28_BC, \
+							_PORT_CL1CM_DW28_A)
+
+#define _PORT_CL1CM_DW30_A		0x162078
+#define _PORT_CL1CM_DW30_BC		0x6C078
+#define   OCL2_LDOFUSE_PWR_DIS		(1 << 6)
+#define BXT_PORT_CL1CM_DW30(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW30_BC, \
+							_PORT_CL1CM_DW30_A)
+
+/* Defined for PHY0 only */
+#define BXT_PORT_CL2CM_DW6_BC		0x6C358
+#define   DW6_OLDO_DYN_PWR_DOWN_EN	(1 << 28)
+
+/* BXT PHY Ref registers */
+#define _PORT_REF_DW3_A			0x16218C
+#define _PORT_REF_DW3_BC		0x6C18C
+#define   GRC_DONE			(1 << 22)
+#define BXT_PORT_REF_DW3(phy)		_BXT_PHY((phy), _PORT_REF_DW3_BC, \
+							_PORT_REF_DW3_A)
+
+#define _PORT_REF_DW6_A			0x162198
+#define _PORT_REF_DW6_BC		0x6C198
+/*
+ * FIXME: BSpec/CHV ConfigDB disagrees on the following two fields, fix them
+ * after testing.
+ */
+#define   GRC_CODE_SHIFT		23
+#define   GRC_CODE_MASK			(0x1FF << GRC_CODE_SHIFT)
+#define   GRC_CODE_FAST_SHIFT		16
+#define   GRC_CODE_FAST_MASK		(0x7F << GRC_CODE_FAST_SHIFT)
+#define   GRC_CODE_SLOW_SHIFT		8
+#define   GRC_CODE_SLOW_MASK		(0xFF << GRC_CODE_SLOW_SHIFT)
+#define   GRC_CODE_NOM_MASK		0xFF
+#define BXT_PORT_REF_DW6(phy)		_BXT_PHY((phy), _PORT_REF_DW6_BC,	\
+						      _PORT_REF_DW6_A)
+
+#define _PORT_REF_DW8_A			0x1621A0
+#define _PORT_REF_DW8_BC		0x6C1A0
+#define   GRC_DIS			(1 << 15)
+#define   GRC_RDY_OVRD			(1 << 1)
+#define BXT_PORT_REF_DW8(phy)		_BXT_PHY((phy), _PORT_REF_DW8_BC,	\
+						      _PORT_REF_DW8_A)
+
+/* BXT PHY TX registers */
+#define _BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
+					  ((lane) & 1) * 0x80)
+
+#define _PORT_TX_DW14_LN0_A		0x162538
+#define _PORT_TX_DW14_LN0_B		0x6C538
+#define _PORT_TX_DW14_LN0_C		0x6C938
+#define   LATENCY_OPTIM_SHIFT		30
+#define   LATENCY_OPTIM			(1 << LATENCY_OPTIM_SHIFT)
+#define BXT_PORT_TX_DW14_LN(port, lane)	(_PORT3((port), _PORT_TX_DW14_LN0_A,   \
+							_PORT_TX_DW14_LN0_B,   \
+							_PORT_TX_DW14_LN0_C) + \
+					 _BXT_LANE_OFFSET(lane))
+
 /*
  * Fence registers
  */
drivers/gpu/drm/i915/intel_ddi.c +125 -0

137 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index 5ba88eb..5266985 100644
@@ -1115,6 +1115,8 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void broxton_init_cdclk(struct drm_device *dev);
 void broxton_uninit_cdclk(struct drm_device *dev);
 void broxton_set_cdclk(struct drm_device *dev, int frequency);
+void broxton_ddi_phy_init(struct drm_device *dev);
+void broxton_ddi_phy_uninit(struct drm_device *dev);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#121 lore raw

Re: [PATCH 30.1/49] drm/i915/bxt: add display initialize/uninitialize sequence (PHY)

Quoted 64 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add PHY specific display initialization sequence as per BSpec.

Note that the PHY initialization/uninitialization are done
at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively.

The call to uninitialize the PHY during system/runtime suspend will be added later in this patchset.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- fix DDI PHY timeout value
- squash in Vandana's "PORT_CL2CM_DW6_A BUN fix",
"DDI PHY programming register defn", "Do ddi_phy_init always",
- move PHY register macros next to the corresponding CHV/VLV macros
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- s/COMMON_RESET/COMMON_RESET_DIS/ and clarify related code comments
- fix incorrect read value for the RMW of BXT_PHY_CTL_FAMILY_DDI
- fix using GT_DISPLAY_EDP_POWER_ON vs. GT_DISPLAY_DDI_POWER_ON when powering on DDI ports
- fix incorrect port when setting BXT_PORT_TX_DW14_LN for DDI ports
- add missing masking when programming CDCLK_FREQ_DECIMAL
- add missing powering on for DDI-C port, rename OCL2_LDOFUSE_PWR_EN to OCL2_LDOFUSE_PWR_DIS to reduce confusion
- add note about mismatch with bspec in the PORT_REF_DW6 fields
- factor out PHY init code to a new function, so we can call it for PHY1 and PHY0, instead of open-coding the same

v4: (ville)
- split the CDCLK/PHY parts into two patches, update commit message accordingly
- use the existing dpio_phy enum instead of adding a new one for the same purpose
- flip the meaning of PHYs so that PHY_A is PHY1 and PHY_BC is PHY0 to better match CHV
- s/BXT_PHY/_BXT_PHY/
- use _PIPE for _BXT_PHY instead of open-coding it
- drop _0_2_0_GTTMMADR suffix from BXT_P_CR_GT_DISP_PWRON
- define GT_DISPLAY_POWER_ON in a more standard way
- make a note that the CHV ConfigDB also disagrees about GRC_CODE field definitions
- fix lane optimization refactoring fumble from v3
- add per PHY uninit functions to match the init counterparts

Quoted 2 lines

Looking OK. Stuffing some/all of it into a power well and/or into the port enable/disable code may be the right thing to do later, but this should at least get it up and running for now.

Quoted 271 lines
---
 drivers/gpu/drm/i915/i915_reg.h  |  96 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c | 125 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |   2 +
 3 files changed, 223 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +96 -0
index c79bf8d..1903e37 100644
@@ -1117,6 +1117,102 @@ enum skl_disp_power_wells {
 #define   DPIO_FRC_LATENCY_SHFIT	8
 #define CHV_TX_DW14(ch, lane) _TXLANE(ch, lane, 0xb8)
 #define   DPIO_UPAR_SHIFT		30
+
+/* BXT PHY registers */
+#define _BXT_PHY(phy, a, b)		_PIPE((phy), (a), (b))
+
+#define BXT_P_CR_GT_DISP_PWRON		0x138090
+#define   GT_DISPLAY_POWER_ON(phy)	(1 << (phy))
+
+#define _PHY_CTL_FAMILY_EDP		0x64C80
+#define _PHY_CTL_FAMILY_DDI		0x64C90
+#define   COMMON_RESET_DIS		(1 << 31)
+#define BXT_PHY_CTL_FAMILY(phy)		_BXT_PHY((phy), _PHY_CTL_FAMILY_DDI, \
+							_PHY_CTL_FAMILY_EDP)
+
+/* BXT PHY common lane registers */
+#define _PORT_CL1CM_DW0_A		0x162000
+#define _PORT_CL1CM_DW0_BC		0x6C000
+#define   PHY_POWER_GOOD		(1 << 16)
+#define BXT_PORT_CL1CM_DW0(phy)		_BXT_PHY((phy), _PORT_CL1CM_DW0_BC, \
+							_PORT_CL1CM_DW0_A)
+
+#define _PORT_CL1CM_DW9_A		0x162024
+#define _PORT_CL1CM_DW9_BC		0x6C024
+#define   IREF0RC_OFFSET_SHIFT		8
+#define   IREF0RC_OFFSET_MASK		(0xFF << IREF0RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW9(phy)		_BXT_PHY((phy), _PORT_CL1CM_DW9_BC, \
+							_PORT_CL1CM_DW9_A)
+
+#define _PORT_CL1CM_DW10_A		0x162028
+#define _PORT_CL1CM_DW10_BC		0x6C028
+#define   IREF1RC_OFFSET_SHIFT		8
+#define   IREF1RC_OFFSET_MASK		(0xFF << IREF1RC_OFFSET_SHIFT)
+#define BXT_PORT_CL1CM_DW10(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW10_BC, \
+							_PORT_CL1CM_DW10_A)
+
+#define _PORT_CL1CM_DW28_A		0x162070
+#define _PORT_CL1CM_DW28_BC		0x6C070
+#define   OCL1_POWER_DOWN_EN		(1 << 23)
+#define   DW28_OLDO_DYN_PWR_DOWN_EN	(1 << 22)
+#define   SUS_CLK_CONFIG		0x3
+#define BXT_PORT_CL1CM_DW28(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW28_BC, \
+							_PORT_CL1CM_DW28_A)
+
+#define _PORT_CL1CM_DW30_A		0x162078
+#define _PORT_CL1CM_DW30_BC		0x6C078
+#define   OCL2_LDOFUSE_PWR_DIS		(1 << 6)
+#define BXT_PORT_CL1CM_DW30(phy)	_BXT_PHY((phy), _PORT_CL1CM_DW30_BC, \
+							_PORT_CL1CM_DW30_A)
+
+/* Defined for PHY0 only */
+#define BXT_PORT_CL2CM_DW6_BC		0x6C358
+#define   DW6_OLDO_DYN_PWR_DOWN_EN	(1 << 28)
+
+/* BXT PHY Ref registers */
+#define _PORT_REF_DW3_A			0x16218C
+#define _PORT_REF_DW3_BC		0x6C18C
+#define   GRC_DONE			(1 << 22)
+#define BXT_PORT_REF_DW3(phy)		_BXT_PHY((phy), _PORT_REF_DW3_BC, \
+							_PORT_REF_DW3_A)
+
+#define _PORT_REF_DW6_A			0x162198
+#define _PORT_REF_DW6_BC		0x6C198
+/*
+ * FIXME: BSpec/CHV ConfigDB disagrees on the following two fields, fix them
+ * after testing.
+ */
+#define   GRC_CODE_SHIFT		23
+#define   GRC_CODE_MASK			(0x1FF << GRC_CODE_SHIFT)
+#define   GRC_CODE_FAST_SHIFT		16
+#define   GRC_CODE_FAST_MASK		(0x7F << GRC_CODE_FAST_SHIFT)
+#define   GRC_CODE_SLOW_SHIFT		8
+#define   GRC_CODE_SLOW_MASK		(0xFF << GRC_CODE_SLOW_SHIFT)
+#define   GRC_CODE_NOM_MASK		0xFF
+#define BXT_PORT_REF_DW6(phy)		_BXT_PHY((phy), _PORT_REF_DW6_BC,	\
+						      _PORT_REF_DW6_A)
+
+#define _PORT_REF_DW8_A			0x1621A0
+#define _PORT_REF_DW8_BC		0x6C1A0
+#define   GRC_DIS			(1 << 15)
+#define   GRC_RDY_OVRD			(1 << 1)
+#define BXT_PORT_REF_DW8(phy)		_BXT_PHY((phy), _PORT_REF_DW8_BC,	\
+						      _PORT_REF_DW8_A)
+
+/* BXT PHY TX registers */
+#define _BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
+					  ((lane) & 1) * 0x80)
+
+#define _PORT_TX_DW14_LN0_A		0x162538
+#define _PORT_TX_DW14_LN0_B		0x6C538
+#define _PORT_TX_DW14_LN0_C		0x6C938
+#define   LATENCY_OPTIM_SHIFT		30
+#define   LATENCY_OPTIM			(1 << LATENCY_OPTIM_SHIFT)
+#define BXT_PORT_TX_DW14_LN(port, lane)	(_PORT3((port), _PORT_TX_DW14_LN0_A,   \
+							_PORT_TX_DW14_LN0_B,   \
+							_PORT_TX_DW14_LN0_C) + \
+					 _BXT_LANE_OFFSET(lane))
+
 /*
  * Fence registers
  */
drivers/gpu/drm/i915/intel_ddi.c +125 -0
index 25d697b..31cadb8 100644
@@ -1864,6 +1864,130 @@ static void skl_shared_dplls_init(struct drm_i915_private *dev_priv)
 	}
 }
 
+static void broxton_phy_init(struct drm_i915_private *dev_priv,
+			     enum dpio_phy phy)
+{
+	enum port port;
+	uint32_t val;
+
+	val = I915_READ(BXT_P_CR_GT_DISP_PWRON);
+	val |= GT_DISPLAY_POWER_ON(phy);
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON, val);
+
+	/* Considering 10ms timeout until BSpec is updated */
+	if (wait_for(I915_READ(BXT_PORT_CL1CM_DW0(phy)) & PHY_POWER_GOOD, 10))
+		DRM_ERROR("timeout during PHY%d power on\n", phy);
+
+	for (port =  (phy == DPIO_PHY0 ? PORT_B : PORT_A);
+	     port <= (phy == DPIO_PHY0 ? PORT_C : PORT_A); port++) {
+		int lane;
+
+		for (lane = 0; lane < 4; lane++) {
+			val = I915_READ(BXT_PORT_TX_DW14_LN(port, lane));
+			/*
+			 * Note that on CHV this flag is called UPAR, but has
+			 * the same function.
+			 */
+			val &= ~LATENCY_OPTIM;
+			if (lane != 1)
+				val |= LATENCY_OPTIM;
+
+			I915_WRITE(BXT_PORT_TX_DW14_LN(port, lane), val);
+		}
+	}
+
+	/* Program PLL Rcomp code offset */
+	val = I915_READ(BXT_PORT_CL1CM_DW9(phy));
+	val &= ~IREF0RC_OFFSET_MASK;
+	val |= 0xE4 << IREF0RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW9(phy), val);
+
+	val = I915_READ(BXT_PORT_CL1CM_DW10(phy));
+	val &= ~IREF1RC_OFFSET_MASK;
+	val |= 0xE4 << IREF1RC_OFFSET_SHIFT;
+	I915_WRITE(BXT_PORT_CL1CM_DW10(phy), val);
+
+	/* Program power gating */
+	val = I915_READ(BXT_PORT_CL1CM_DW28(phy));
+	val |= OCL1_POWER_DOWN_EN | DW28_OLDO_DYN_PWR_DOWN_EN |
+		SUS_CLK_CONFIG;
+	I915_WRITE(BXT_PORT_CL1CM_DW28(phy), val);
+
+	if (phy == DPIO_PHY0) {
+		val = I915_READ(BXT_PORT_CL2CM_DW6_BC);
+		val |= DW6_OLDO_DYN_PWR_DOWN_EN;
+		I915_WRITE(BXT_PORT_CL2CM_DW6_BC, val);
+	}
+
+	val = I915_READ(BXT_PORT_CL1CM_DW30(phy));
+	val &= ~OCL2_LDOFUSE_PWR_DIS;
+	/*
+	 * On PHY1 disable power on the second channel, since no port is
+	 * connected there. On PHY0 both channels have a port, so leave it
+	 * enabled.
+	 * TODO: port C is only connected on BXT-P, so on BXT0/1 we should
+	 * power down the second channel on PHY0 as well.
+	 */
+	if (phy == DPIO_PHY1)
+		val |= OCL2_LDOFUSE_PWR_DIS;
+	I915_WRITE(BXT_PORT_CL1CM_DW30(phy), val);
+
+	if (phy == DPIO_PHY0) {
+		uint32_t grc_code;
+		/*
+		 * PHY0 isn't connected to an RCOMP resistor so copy over
+		 * the corresponding calibrated value from PHY1, and disable
+		 * the automatic calibration on PHY0.
+		 */
+		if (wait_for(I915_READ(BXT_PORT_REF_DW3(DPIO_PHY1)) & GRC_DONE,
+			     10))
+			DRM_ERROR("timeout waiting for PHY1 GRC\n");
+
+		val = I915_READ(BXT_PORT_REF_DW6(DPIO_PHY1));
+		val = (val & GRC_CODE_MASK) >> GRC_CODE_SHIFT;
+		grc_code = val << GRC_CODE_FAST_SHIFT |
+			   val << GRC_CODE_SLOW_SHIFT |
+			   val;
+		I915_WRITE(BXT_PORT_REF_DW6(DPIO_PHY0), grc_code);
+
+		val = I915_READ(BXT_PORT_REF_DW8(DPIO_PHY0));
+		val |= GRC_DIS | GRC_RDY_OVRD;
+		I915_WRITE(BXT_PORT_REF_DW8(DPIO_PHY0), val);
+	}
+
+	val = I915_READ(BXT_PHY_CTL_FAMILY(phy));
+	val |= COMMON_RESET_DIS;
+	I915_WRITE(BXT_PHY_CTL_FAMILY(phy), val);
+}
+
+void broxton_ddi_phy_init(struct drm_device *dev)
+{
+	/* Enable PHY1 first since it provides Rcomp for PHY0 */
+	broxton_phy_init(dev->dev_private, DPIO_PHY1);
+	broxton_phy_init(dev->dev_private, DPIO_PHY0);
+}
+
+static void broxton_phy_uninit(struct drm_i915_private *dev_priv,
+			       enum dpio_phy phy)
+{
+	uint32_t val;
+
+	val = I915_READ(BXT_PHY_CTL_FAMILY(phy));
+	val &= ~COMMON_RESET_DIS;
+	I915_WRITE(BXT_PHY_CTL_FAMILY(phy), val);
+}
+
+void broxton_ddi_phy_uninit(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	broxton_phy_uninit(dev_priv, DPIO_PHY1);
+	broxton_phy_uninit(dev_priv, DPIO_PHY0);
+
+	/* FIXME: do this in broxton_phy_uninit per phy */
+	I915_WRITE(BXT_P_CR_GT_DISP_PWRON, 0);
+}
+
 void intel_ddi_pll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1882,6 +2006,7 @@ void intel_ddi_pll_init(struct drm_device *dev)
 			DRM_ERROR("LCPLL1 is disabled\n");
 	} else if (IS_BROXTON(dev)) {
 		broxton_init_cdclk(dev);
+		broxton_ddi_phy_init(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 5ba88eb..5266985 100644
@@ -1115,6 +1115,8 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void broxton_init_cdclk(struct drm_device *dev);
 void broxton_uninit_cdclk(struct drm_device *dev);
 void broxton_set_cdclk(struct drm_device *dev, int frequency);
+void broxton_ddi_phy_init(struct drm_device *dev);
+void broxton_ddi_phy_uninit(struct drm_device *dev);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 1 line
2.1.0
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#122 lore raw

PATCH v2 31/49 drm/i915/bxt: add description about the BXT PHYs

In reply to Imre Deak

Extend the VLV/CHV DPIO (PHY) documentation with the BXT specifics.

v2:
- add more detail about the mapping between ports and transcoders (ville)

---
 Documentation/DocBook/drm.tmpl  |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)
Documentation/DocBook/drm.tmpl +2 -2
index f4976cd..a8509c2 100644
@@ -4067,7 +4067,7 @@ int num_ioctls;</synopsis>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
 	<table id="dpiox2">
-	  <title>Dual channel PHY (VLV/CHV)</title>
+	  <title>Dual channel PHY (VLV/CHV/BXT)</title>
 	  <tgroup cols="8">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
@@ -4118,7 +4118,7 @@ int num_ioctls;</synopsis>
 	  </tgroup>
 	</table>
 	<table id="dpiox1">
-	  <title>Single channel PHY (CHV)</title>
+	  <title>Single channel PHY (CHV/BXT)</title>
 	  <tgroup cols="4">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
drivers/gpu/drm/i915/i915_reg.h +12 -6
index 1903e37..abea462 100644
@@ -715,7 +715,7 @@ enum skl_disp_power_wells {
 /**
  * DOC: DPIO
  *
- * VLV and CHV have slightly peculiar display PHYs for driving DP/HDMI
+ * VLV, CHV and BXT have slightly peculiar display PHYs for driving DP/HDMI
  * ports. DPIO is the name given to such a display PHY. These PHYs
  * don't follow the standard programming model using direct MMIO
  * registers, and instead their registers must be accessed trough IOSF
@@ -746,7 +746,7 @@ enum skl_disp_power_wells {
  * controlled from the display controller side. No DPIO registers
  * need to be accessed during AUX communication,
  *
- * Generally the common lane corresponds to the pipe and
+ * Generally on VLV/CHV the common lane corresponds to the pipe and
  * the spline (PCS/TX) corresponds to the port.
  *
  * For dual channel PHY (VLV/CHV):
@@ -768,11 +768,17 @@ enum skl_disp_power_wells {
  *
  *  port D == PCS/TX CH0
  *
- * Note: digital port B is DDI0, digital port C is DDI1,
- * digital port D is DDI2
+ * On BXT the entire PHY channel corresponds to the port. That means
+ * the PLL is also now associated with the port rather than the pipe,
+ * and so the clock needs to be routed to the appropriate transcoder.
+ * Port A PLL is directly connected to transcoder EDP and port B/C
+ * PLLs can be routed to any transcoder A/B/C.
+ *
+ * Note: DDI0 is digital port B, DD1 is digital port C, and DDI2 is
+ * digital port D (CHV) or port A (BXT).
  */
 /*
- * Dual channel PHY (VLV/CHV)
+ * Dual channel PHY (VLV/CHV/BXT)
  * ---------------------------------
  * |      CH0      |      CH1      |
  * |  CMN/PLL/REF  |  CMN/PLL/REF  |
@@ -784,7 +790,7 @@ enum skl_disp_power_wells {
  * |     DDI0      |     DDI1      | DP/HDMI ports
  * ---------------------------------
  *
- * Single channel PHY (CHV)
+ * Single channel PHY (CHV/BXT)
  * -----------------
  * |      CH0      |
  * |  CMN/PLL/REF  |
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 31/49
#123 lore raw

Re: [PATCH v2 31/49] drm/i915/bxt: add description about the BXT PHYs

Quoted 6 lines · Imre Deak

Extend the VLV/CHV DPIO (PHY) documentation with the BXT specifics.

v2:
- add more detail about the mapping between ports and transcoders (ville)

Quoted 81 lines
---
 Documentation/DocBook/drm.tmpl  |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)
Documentation/DocBook/drm.tmpl +2 -2
index f4976cd..a8509c2 100644
@@ -4067,7 +4067,7 @@ int num_ioctls;</synopsis>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
 	<table id="dpiox2">
-	  <title>Dual channel PHY (VLV/CHV)</title>
+	  <title>Dual channel PHY (VLV/CHV/BXT)</title>
 	  <tgroup cols="8">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
@@ -4118,7 +4118,7 @@ int num_ioctls;</synopsis>
 	  </tgroup>
 	</table>
 	<table id="dpiox1">
-	  <title>Single channel PHY (CHV)</title>
+	  <title>Single channel PHY (CHV/BXT)</title>
 	  <tgroup cols="4">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
drivers/gpu/drm/i915/i915_reg.h +12 -6
index 1903e37..abea462 100644
@@ -715,7 +715,7 @@ enum skl_disp_power_wells {
 /**
  * DOC: DPIO
  *
- * VLV and CHV have slightly peculiar display PHYs for driving DP/HDMI
+ * VLV, CHV and BXT have slightly peculiar display PHYs for driving DP/HDMI
  * ports. DPIO is the name given to such a display PHY. These PHYs
  * don't follow the standard programming model using direct MMIO
  * registers, and instead their registers must be accessed trough IOSF
@@ -746,7 +746,7 @@ enum skl_disp_power_wells {
  * controlled from the display controller side. No DPIO registers
  * need to be accessed during AUX communication,
  *
- * Generally the common lane corresponds to the pipe and
+ * Generally on VLV/CHV the common lane corresponds to the pipe and
  * the spline (PCS/TX) corresponds to the port.
  *
  * For dual channel PHY (VLV/CHV):
@@ -768,11 +768,17 @@ enum skl_disp_power_wells {
  *
  *  port D == PCS/TX CH0
  *
- * Note: digital port B is DDI0, digital port C is DDI1,
- * digital port D is DDI2
+ * On BXT the entire PHY channel corresponds to the port. That means
+ * the PLL is also now associated with the port rather than the pipe,
+ * and so the clock needs to be routed to the appropriate transcoder.
+ * Port A PLL is directly connected to transcoder EDP and port B/C
+ * PLLs can be routed to any transcoder A/B/C.
+ *
+ * Note: DDI0 is digital port B, DD1 is digital port C, and DDI2 is
+ * digital port D (CHV) or port A (BXT).
  */
 /*
- * Dual channel PHY (VLV/CHV)
+ * Dual channel PHY (VLV/CHV/BXT)
  * ---------------------------------
  * |      CH0      |      CH1      |
  * |  CMN/PLL/REF  |  CMN/PLL/REF  |
@@ -784,7 +790,7 @@ enum skl_disp_power_wells {
  * |     DDI0      |     DDI1      | DP/HDMI ports
  * ---------------------------------
  *
- * Single channel PHY (CHV)
+ * Single channel PHY (CHV/BXT)
  * -----------------
  * |      CH0      |
  * |  CMN/PLL/REF  |
Signature · 1 line
2.1.0
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v4 30/49
#124 lore raw

Re: [PATCH v4 30/49] drm/i915/bxt: add display initialize/uninitialize sequence (CDCLK)

In reply to Imre Deak
Quoted 64 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Add CDCLK specific display clock initialization sequence as per BSpec.

Note that the CDCLK initialization/uninitialization are done at their current place only for simplicity, in a future patch - when more of the runtime PM features will be enabled - these will be moved to power well#1 and modeset encoder enabling/disabling hooks respectively. This also means that atm dynamic power gating power well #1 is effectively disabled.

The call to uninitialize CDCLK during system/runtime suspend will be added later in this patchset.

v1: Added function definitions in header files
v2: Imre's review comments addressed
- Moved CDCLK related definitions to i915_reg.h
- Removed defintions for CDCLK frequency
- Split uninit_cdclk() by adding a phy_uninit function
- Calculate freq and decimal based on input frequency
- Program SSA precharge based on input frequency
- Use wait_for 1ms instead 200us udelay for DE PLL locking
- Removed initial value for divider, freq, decimal, ratio.
- Replaced polling loops with wait_for
- Parameterized latency optim setting
- Fix the parts where DE PLL has to be disabled.
- Call CDCLK selection from mode set

v3: (imre)
- add note about the plan to move the cdclk/phy init to a better place
- take rps.hw_lock around pcode access
- move DE PLL register macros here from another patch since they are used here first
- add BXT_ prefix to CDCLK flags
- add missing masking when programming CDCLK_FREQ_DECIMAL

v4: (ville)
- split the CDCLK/PHY parts into two patches, update commit message accordingly
- s/DISPLAY_PCU_CONTROL/HSW_PCODE_DE_WRITE_FREQ_REQ/
- simplify BXT_DE_PLL_RATIO macros
- fix BXT_DE_PLL_RATIO_MASK
- s/bxt_select_cdclk_freq/broxton_set_cdclk_freq/
- move cdclk init/uninit/set code from intel_ddi.c to intel_display.c
- remove redundant code comments for broxton_set_cdclk_freq()
- sanitize fixed point<->integer frequency value conversion
- use DRM_ERROR instead of WARN
- do RMW when programming BXT_DE_PLL_CTL for safety
- add note about PLL lock timeout being exactly 200us
- make PCU error messages more descriptive
- instead of using 0 freq to mean PLL off/bypass freq use 19200 for clarity, as the latter one is the actual rate
- simplify pcode programming, removing duplicated sandybridge_pcode_write() call
- sanitize code flow, remove unnecessary scratch vars in broxton_set_cdclk() (imre)
- Remove bound check for maxmimum freq to match current code. This check will be added later at a more proper platform independent place once atomic support lands.
- add note to remove freq guard band which isn't needed on BXT
- add note to reduce freq to minimum if no pipe is enabled
- combine broxton_modeset_global_pipes() with valleyview_modeset_global_pipes()

Quoted 2 lines

That's quite a changelog I caused. Sorry :)

But I like how it's looking now. A few minor FIXMEs in there, but I agree that those can be dealt with later.

Quoted 364 lines
---
 drivers/gpu/drm/i915/i915_reg.h      |  20 ++++
 drivers/gpu/drm/i915/intel_ddi.c     |   2 +
 drivers/gpu/drm/i915/intel_display.c | 226 ++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |   3 +
 4 files changed, 248 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +20 -0
index 4b53b20..c79bf8d 100644
@@ -5452,6 +5452,9 @@ enum skl_disp_power_wells {
 #define  DISP_FBC_WM_DIS		(1<<15)
 #define DISP_ARB_CTL2	0x45004
 #define  DISP_DATA_PARTITION_5_6	(1<<6)
+#define DBUF_CTL	0x45008
+#define  DBUF_POWER_REQUEST		(1<<31)
+#define  DBUF_POWER_STATE		(1<<30)
 #define GEN7_MSG_CTL	0x45010
 #define  WAIT_FOR_PCH_RESET_ACK		(1<<1)
 #define  WAIT_FOR_PCH_FLR_ACK		(1<<0)
@@ -6403,6 +6406,7 @@ enum skl_disp_power_wells {
 #define   GEN6_PCODE_WRITE_D_COMP		0x11
 #define   GEN6_ENCODE_RC6_VID(mv)		(((mv) - 245) / 5)
 #define   GEN6_DECODE_RC6_VID(vids)		(((vids) * 5) + 245)
+#define   HSW_PCODE_DE_WRITE_FREQ_REQ		0x17
 #define   DISPLAY_IPS_CONTROL			0x19
 #define	  HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL	0x1A
 #define GEN6_PCODE_DATA				0x138128
@@ -6874,6 +6878,13 @@ enum skl_disp_power_wells {
 #define  CDCLK_FREQ_675_617		(3<<26)
 #define  CDCLK_FREQ_DECIMAL_MASK	(0x7ff)
 
+#define  BXT_CDCLK_CD2X_DIV_SEL_MASK	(3<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1	(0<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_1_5	(1<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_2	(2<<22)
+#define  BXT_CDCLK_CD2X_DIV_SEL_4	(3<<22)
+#define  BXT_CDCLK_SSA_PRECHARGE_ENABLE	(1<<16)
+
 /* LCPLL_CTL */
 #define LCPLL1_CTL		0x46010
 #define LCPLL2_CTL		0x46014
@@ -6938,6 +6949,15 @@ enum skl_disp_power_wells {
 #define GET_CFG_CR1_REG(id) (DPLL1_CFGCR1 + (id - SKL_DPLL1) * 8)
 #define GET_CFG_CR2_REG(id) (DPLL1_CFGCR2 + (id - SKL_DPLL1) * 8)
 
+/* BXT display engine PLL */
+#define BXT_DE_PLL_CTL			0x6d000
+#define   BXT_DE_PLL_RATIO(x)		(x)	/* {60,65,100} * 19.2MHz */
+#define   BXT_DE_PLL_RATIO_MASK		0xff
+
+#define BXT_DE_PLL_ENABLE		0x46070
+#define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
+#define   BXT_DE_PLL_LOCK		(1 << 30)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 5b50484..25d697b 100644
@@ -1880,6 +1880,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+	} else if (IS_BROXTON(dev)) {
+		broxton_init_cdclk(dev);
 	} else {
 		/*
 		 * The LCPLL register should be turned on by the BIOS. For now
drivers/gpu/drm/i915/intel_display.c +223 -3
index bb5f2a5..5ee5d8c 100644
@@ -5196,6 +5196,181 @@ static void modeset_update_crtc_power_domains(struct drm_atomic_state *state)
 	intel_display_set_init_power(dev_priv, false);
 }
 
+void broxton_set_cdclk(struct drm_device *dev, int frequency)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t divider;
+	uint32_t ratio;
+	uint32_t current_freq;
+	int ret;
+
+	/* frequency = 19.2MHz * ratio / 2 / div{1,1.5,2,4} */
+	switch (frequency) {
+	case 144000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_4;
+		ratio = BXT_DE_PLL_RATIO(60);
+		break;
+	case 288000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_2;
+		ratio = BXT_DE_PLL_RATIO(60);
+		break;
+	case 384000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1_5;
+		ratio = BXT_DE_PLL_RATIO(60);
+		break;
+	case 576000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO(60);
+		break;
+	case 624000:
+		divider = BXT_CDCLK_CD2X_DIV_SEL_1;
+		ratio = BXT_DE_PLL_RATIO(65);
+		break;
+	case 19200:
+		/*
+		 * Bypass frequency with DE PLL disabled. Init ratio, divider
+		 * to suppress GCC warning.
+		 */
+		ratio = 0;
+		divider = 0;
+		break;
+	default:
+		DRM_ERROR("unsupported CDCLK freq %d", frequency);
+
+		return;
+	}
+
+	mutex_lock(&dev_priv->rps.hw_lock);
+	/* Inform power controller of upcoming frequency change */
+	ret = sandybridge_pcode_write(dev_priv, HSW_PCODE_DE_WRITE_FREQ_REQ,
+				      0x80000000);
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	if (ret) {
+		DRM_ERROR("PCode CDCLK freq change notify failed (err %d, freq %d)\n",
+			  ret, frequency);
+		return;
+	}
+
+	current_freq = I915_READ(CDCLK_CTL) & CDCLK_FREQ_DECIMAL_MASK;
+	/* convert from .1 fixpoint MHz with -1MHz offset to kHz */
+	current_freq = current_freq * 500 + 1000;
+
+	/*
+	 * DE PLL has to be disabled when
+	 * - setting to 19.2MHz (bypass, PLL isn't used)
+	 * - before setting to 624MHz (PLL needs toggling)
+	 * - before setting to any frequency from 624MHz (PLL needs toggling)
+	 */
+	if (frequency == 19200 || frequency == 624000 ||
+	    current_freq == 624000) {
+		I915_WRITE(BXT_DE_PLL_ENABLE, ~BXT_DE_PLL_PLL_ENABLE);
+		/* Timeout 200us */
+		if (wait_for(!(I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK),
+			     1))
+			DRM_ERROR("timout waiting for DE PLL unlock\n");
+	}
+
+	if (frequency != 19200) {
+		uint32_t val;
+
+		val = I915_READ(BXT_DE_PLL_CTL);
+		val &= ~BXT_DE_PLL_RATIO_MASK;
+		val |= ratio;
+		I915_WRITE(BXT_DE_PLL_CTL, val);
+
+		I915_WRITE(BXT_DE_PLL_ENABLE, BXT_DE_PLL_PLL_ENABLE);
+		/* Timeout 200us */
+		if (wait_for(I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_LOCK, 1))
+			DRM_ERROR("timeout waiting for DE PLL lock\n");
+
+		val = I915_READ(CDCLK_CTL);
+		val &= ~BXT_CDCLK_CD2X_DIV_SEL_MASK;
+		val |= divider;
+		/*
+		 * Disable SSA Precharge when CD clock frequency < 500 MHz,
+		 * enable otherwise.
+		 */
+		val &= ~BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+		if (frequency >= 500000)
+			val |= BXT_CDCLK_SSA_PRECHARGE_ENABLE;
+
+		val &= ~CDCLK_FREQ_DECIMAL_MASK;
+		/* convert from kHz to .1 fixpoint MHz with -1MHz offset */
+		val |= (frequency - 1000) / 500;
+		I915_WRITE(CDCLK_CTL, val);
+	}
+
+	mutex_lock(&dev_priv->rps.hw_lock);
+	ret = sandybridge_pcode_write(dev_priv, HSW_PCODE_DE_WRITE_FREQ_REQ,
+				      DIV_ROUND_UP(frequency, 25000));
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	if (ret) {
+		DRM_ERROR("PCode CDCLK freq set failed, (err %d, freq %d)\n",
+			  ret, frequency);
+		return;
+	}
+
+	dev_priv->cdclk_freq = frequency;
+}
+
+void broxton_init_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t val;
+
+	/*
+	 * NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
+	 * or else the reset will hang because there is no PCH to respond.
+	 * Move the handshake programming to initialization sequence.
+	 * Previously was left up to BIOS.
+	 */
+	val = I915_READ(HSW_NDE_RSTWRN_OPT);
+	val &= ~RESET_PCH_HANDSHAKE_ENABLE;
+	I915_WRITE(HSW_NDE_RSTWRN_OPT, val);
+
+	/* Enable PG1 for cdclk */
+	intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
+
+	/* check if cd clock is enabled */
+	if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
+		DRM_DEBUG_KMS("Display already initialized\n");
+		return;
+	}
+
+	/*
+	 * FIXME:
+	 * - The initial CDCLK needs to be read from VBT.
+	 *   Need to make this change after VBT has changes for BXT.
+	 * - check if setting the max (or any) cdclk freq is really necessary
+	 *   here, it belongs to modeset time
+	 */
+	broxton_set_cdclk(dev, 624000);
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE))
+		DRM_ERROR("DBuf power enable timeout!\n");
+}
+
+void broxton_uninit_cdclk(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
+	udelay(10);
+
+	if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
+		DRM_ERROR("DBuf power disable timeout!\n");
+
+	/* Set minimum (bypass) frequency, in effect turning off the DE PLL */
+	broxton_set_cdclk(dev, 19200);
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
+}
+
 /* returns HPLL frequency in kHz */
 static int valleyview_get_vco(struct drm_i915_private *dev_priv)
 {
@@ -5363,6 +5538,26 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
 		return 200000;
 }
 
+static int broxton_calc_cdclk(struct drm_i915_private *dev_priv,
+			      int max_pixclk)
+{
+	/*
+	 * FIXME:
+	 * - remove the guardband, it's not needed on BXT
+	 * - set 19.2MHz bypass frequency if there are no active pipes
+	 */
+	if (max_pixclk > 576000*9/10)
+		return 624000;
+	else if (max_pixclk > 384000*9/10)
+		return 576000;
+	else if (max_pixclk > 288000*9/10)
+		return 384000;
+	else if (max_pixclk > 144000*9/10)
+		return 288000;
+	else
+		return 144000;
+}
+
 /* compute the max pixel clock for new configuration */
 static int intel_mode_max_pixclk(struct drm_atomic_state *state)
 {
@@ -5392,12 +5587,17 @@ static int valleyview_modeset_global_pipes(struct drm_atomic_state *state,
 	struct drm_i915_private *dev_priv = to_i915(state->dev);
 	struct intel_crtc *intel_crtc;
 	int max_pixclk = intel_mode_max_pixclk(state);
+	int cdclk;
 
 	if (max_pixclk < 0)
 		return max_pixclk;
 
-	if (valleyview_calc_cdclk(dev_priv, max_pixclk) ==
-	    dev_priv->cdclk_freq)
+	if (IS_VALLEYVIEW(dev_priv))
+		cdclk = valleyview_calc_cdclk(dev_priv, max_pixclk);
+	else
+		cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (cdclk == dev_priv->cdclk_freq)
 		return 0;
 
 	/* disable/enable all currently active pipes while we change cdclk */
@@ -8827,6 +9027,23 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv)
 	intel_prepare_ddi(dev);
 }
 
+static void broxton_modeset_global_resources(struct drm_atomic_state *state)
+{
+	struct drm_device *dev = state->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int max_pixclk = intel_mode_max_pixclk(state);
+	int req_cdclk;
+
+	/* see the comment in valleyview_modeset_global_resources */
+	if (WARN_ON(max_pixclk < 0))
+		return;
+
+	req_cdclk = broxton_calc_cdclk(dev_priv, max_pixclk);
+
+	if (req_cdclk != dev_priv->cdclk_freq)
+		broxton_set_cdclk(dev, req_cdclk);
+}
+
 static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 				      struct intel_crtc_state *crtc_state)
 {
@@ -11983,7 +12200,7 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 	 * mode set on this crtc.  For other crtcs we need to use the
 	 * adjusted_mode bits in the crtc directly.
 	 */
-	if (IS_VALLEYVIEW(dev)) {
+	if (IS_VALLEYVIEW(dev) || IS_BROXTON(dev)) {
 		ret = valleyview_modeset_global_pipes(state, &prepare_pipes);
 		if (ret)
 			goto done;
@@ -14005,6 +14222,9 @@ static void intel_init_display(struct drm_device *dev)
 	} else if (IS_VALLEYVIEW(dev)) {
 		dev_priv->display.modeset_global_resources =
 			valleyview_modeset_global_resources;
+	} else if (IS_BROXTON(dev)) {
+		dev_priv->display.modeset_global_resources =
+			broxton_modeset_global_resources;
 	}
 
 	switch (INTEL_INFO(dev)->gen) {
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 6a2ee0c..5ba88eb 100644
@@ -1112,6 +1112,9 @@ void intel_prepare_reset(struct drm_device *dev);
 void intel_finish_reset(struct drm_device *dev);
 void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
+void broxton_init_cdclk(struct drm_device *dev);
+void broxton_uninit_cdclk(struct drm_device *dev);
+void broxton_set_cdclk(struct drm_device *dev, int frequency);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 1 line
2.1.0
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#125 lore raw

PATCH 31/49 drm/i915/bxt: add description about the BXT PHYs

In reply to Imre Deak

Extend the VLV/CHV DPIO (PHY) documentation with the BXT specifics.

---
 Documentation/DocBook/drm.tmpl  |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
Documentation/DocBook/drm.tmpl +2 -2
index 7a45775..327757f 100644
@@ -4067,7 +4067,7 @@ int num_ioctls;</synopsis>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
 	<table id="dpiox2">
-	  <title>Dual channel PHY (VLV/CHV)</title>
+	  <title>Dual channel PHY (VLV/CHV/BXT)</title>
 	  <tgroup cols="8">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
@@ -4118,7 +4118,7 @@ int num_ioctls;</synopsis>
 	  </tgroup>
 	</table>
 	<table id="dpiox1">
-	  <title>Single channel PHY (CHV)</title>
+	  <title>Single channel PHY (CHV/BXT)</title>
 	  <tgroup cols="4">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
drivers/gpu/drm/i915/i915_reg.h +7 -3
index a3579c0..95532b4 100644
@@ -718,7 +718,7 @@ enum skl_disp_power_wells {
 /**
  * DOC: DPIO
  *
- * VLV and CHV have slightly peculiar display PHYs for driving DP/HDMI
+ * VLV, CHV and BXT have slightly peculiar display PHYs for driving DP/HDMI
  * ports. DPIO is the name given to such a display PHY. These PHYs
  * don't follow the standard programming model using direct MMIO
  * registers, and instead their registers must be accessed trough IOSF
@@ -773,9 +773,13 @@ enum skl_disp_power_wells {
  *
  * Note: digital port B is DDI0, digital port C is DDI1,
  * digital port D is DDI2
+ *
+ * On BXT the above mappings apply for both the dual and single channel PHY,
+ * with the difference that any of the three ports can connect to any of the
+ * three pipes. Also the single channel PHY is used for port A (DDI2/EDP).
  */
 /*
- * Dual channel PHY (VLV/CHV)
+ * Dual channel PHY (VLV/CHV/BXT)
  * ---------------------------------
  * |      CH0      |      CH1      |
  * |  CMN/PLL/REF  |  CMN/PLL/REF  |
@@ -787,7 +791,7 @@ enum skl_disp_power_wells {
  * |     DDI0      |     DDI1      | DP/HDMI ports
  * ---------------------------------
  *
- * Single channel PHY (CHV)
+ * Single channel PHY (CHV/BXT)
  * -----------------
  * |      CH0      |
  * |  CMN/PLL/REF  |
Signature · 6 lines
2.1.0

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

Re: [PATCH 31/49] drm/i915/bxt: add description about the BXT PHYs

Quoted 44 lines · Imre Deak

Extend the VLV/CHV DPIO (PHY) documentation with the BXT specifics.

---
 Documentation/DocBook/drm.tmpl  |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
Documentation/DocBook/drm.tmpl +2 -2
index 7a45775..327757f 100644
@@ -4067,7 +4067,7 @@ int num_ioctls;</synopsis>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
 	<table id="dpiox2">
-	  <title>Dual channel PHY (VLV/CHV)</title>
+	  <title>Dual channel PHY (VLV/CHV/BXT)</title>
 	  <tgroup cols="8">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
@@ -4118,7 +4118,7 @@ int num_ioctls;</synopsis>
 	  </tgroup>
 	</table>
 	<table id="dpiox1">
-	  <title>Single channel PHY (CHV)</title>
+	  <title>Single channel PHY (CHV/BXT)</title>
 	  <tgroup cols="4">
 	    <colspec colname="c0" />
 	    <colspec colname="c1" />
drivers/gpu/drm/i915/i915_reg.h +1 -1
index a3579c0..95532b4 100644
@@ -718,7 +718,7 @@ enum skl_disp_power_wells {
 /**
  * DOC: DPIO
  *
- * VLV and CHV have slightly peculiar display PHYs for driving DP/HDMI
+ * VLV, CHV and BXT have slightly peculiar display PHYs for driving DP/HDMI
  * ports. DPIO is the name given to such a display PHY. These PHYs
  * don't follow the standard programming model using direct MMIO
  * registers, and instead their registers must be accessed trough IOSF

drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 779

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -773,9 +773,13 @@ enum skl_disp_power_wells {
  *
  * Note: digital port B is DDI0, digital port C is DDI1,
  * digital port D is DDI2
+ *
+ * On BXT the above mappings apply for both the dual and single channel PHY,
+ * with the difference that any of the three ports can connect to any of the
+ * three pipes. Also the single channel PHY is used for port A (DDI2/EDP).

I think we might need to split the VLV/CHV vs. BXT descriptions a bit more. The pipe->CMN/PLL/REF port->PCS/TX rule doesn't seem to hold anymore due to the more flexible pipe<->port mapping.

So maybe something like:
"
Generally on VLV/CHV the common lane...
...
port D == PCS/TX CH0

On BXT the entire PHY channel corresponds to the port. That means the PLL is also now associated with the port rather than the pipe, and so the clock needs to be routed to the appropriate transcoder. Port A PLL is directly connected to transcoder EDP and port B/C PLLs can be routed to any transcoder A/B/C.
"

Also maybe reverse the DDI<->port mapping note to make it simpler. Eg:

"Note: DDI0 is digital port B, DDI1 is digital port C, and DDI2 is digital port D (CHV) or port A (BXT)."

Quoted 23 lines
drivers/gpu/drm/i915/i915_reg.h +2 -2
  */
 /*
- * Dual channel PHY (VLV/CHV)
+ * Dual channel PHY (VLV/CHV/BXT)
  * ---------------------------------
  * |      CH0      |      CH1      |
  * |  CMN/PLL/REF  |  CMN/PLL/REF  |
@@ -787,7 +791,7 @@ enum skl_disp_power_wells {
  * |     DDI0      |     DDI1      | DP/HDMI ports
  * ---------------------------------
  *
- * Single channel PHY (CHV)
+ * Single channel PHY (CHV/BXT)
  * -----------------
  * |      CH0      |
  * |  CMN/PLL/REF  |
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#127 lore raw

PATCH 32/49 drm/i915/bxt: Implement enable/disable for Display C9 state

In reply to Imre Deak

From: "A.Sunil Kamath" <[email protected]>

v2: Modified as per review comments from Imre
- Mention enabling instead of allowing in the debug trace and remove unnecessary comments.

v3:
- Rebase to latest.
- Move DC9-related functions from intel_display.c to intel_runtime_pm.c.

v4: (imre)
- remove DC5 disabling, it's a nop at this point
- squashed in Suketu's "Assert the requirements to enter or exit DC9" patch
- remove check for RUNTIME_PM from assert_can_enable_dc9, it's not a dependency

---
 drivers/gpu/drm/i915/i915_reg.h         |  5 +++
 drivers/gpu/drm/i915/intel_drv.h        |  2 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 66 +++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 95532b4..4c781cb 100644
@@ -6942,6 +6942,11 @@ enum bxt_phy {
 #define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
 #define   BXT_DE_PLL_LOCK		(1 << 30)
 
+/* GEN9 DC */
+#define DC_STATE_EN			0x45504
+#define  DC_STATE_EN_UPTO_DC5		(1<<0)
+#define  DC_STATE_EN_DC9		(1<<3)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 4bc2041..262314b 100644
@@ -1024,6 +1024,8 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void bxt_init_cdclk(struct drm_device *dev);
 void bxt_uninit_cdclk(struct drm_device *dev);
 void bxt_ddi_phy_init(struct drm_device *dev);
+void bxt_enable_dc9(struct drm_i915_private *dev_priv);
+void bxt_disable_dc9(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
drivers/gpu/drm/i915/intel_runtime_pm.c +66 -0

72 lines not on this page · raw message

Signature · 6 lines
2.1.0

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

PATCH 32/49 drm/i915/bxt: Implement enable/disable for Display C9 state

These are review comments for
1) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062167.html
2) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062168.html

Couple of comments:
1) Defines for DC_STATE_EN* are coming up as part of http://lists.freedesktop.org/archives/intel-gfx/2015-April/063640.html.
Need to rebase this patch on top of it then or vice-versa.
2) DC5 has to enabled back after disabling DC9 if PW2 is power gated.

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

author
#129 lore raw

Re: [PATCH 32/49] drm/i915/bxt: Implement enable/disable for Display C9 state

Quoted 3 lines · On su, 2015-04-12 at 16:02 +0530, [email protected] wrote:

These are review comments for
1) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062167.html
2) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062168.html

It'd be better to have inlined review comments responding to the original email.

Quoted 4 lines

Couple of comments:
1) Defines for DC_STATE_EN* are coming up as part of
http://lists.freedesktop.org/archives/intel-gfx/2015-April/063640.html.
Need to rebase this patch on top of it then or vice-versa.

Yes, I can rebase this once Animesh's patchset gets merged. It's also a trivial conflict that can be easily resolved while merging, so it's not an issue imo.

Quoted 1 line

2) DC5 has to enabled back after disabling DC9 if PW2 is power gated.

BXT DC5/runtime PM support will be added only later. At that point the enabling of DC5 should be done from bxt_resume_prepare() if the the DMC firmware is loaded. For now I'd just add the missing TODO comment about this to bxt_resume_prepare() as you suggested elsewhere.

--Imre

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

#130 lore raw

Re: [PATCH 32/49] drm/i915/bxt: Implement enable/disable for Display C9 state

Quoted 7 lines · Imre Deak
Quoted 3 lines · On su, 2015-04-12 at 16:02 +0530, [email protected] wrote:

These are review comments for
1) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062167.html
2) http://lists.freedesktop.org/archives/intel-gfx/2015-March/062168.html

It'd be better to have inlined review comments responding to the original email.

Yes. Sorry for the inconvenience. My ML subscription was in digest mode. So replied using only message-id knowing from Deepak. Now I have switched to individual mails.

Quoted 10 lines
Quoted 5 lines

Couple of comments:
1) Defines for DC_STATE_EN* are coming up as part of
http://lists.freedesktop.org/archives/intel-gfx/2015-April/063640.html.
Need to rebase this patch on top of it then or vice-versa.

Yes, I can rebase this once Animesh's patchset gets merged. It's also a trivial conflict that can be easily resolved while merging, so it's not an issue imo.

Quoted 6 lines
Quoted 1 line

2) DC5 has to enabled back after disabling DC9 if PW2 is power gated.

BXT DC5/runtime PM support will be added only later. At that point the enabling of DC5 should be done from bxt_resume_prepare() if the the DMC firmware is loaded. For now I'd just add the missing TODO comment about this to bxt_resume_prepare() as you suggested elsewhere.

Thanks.
Reviewed-by: Sagar Kamble <sagar.a.kamble at intel.com>

Quoted 3 lines

--Imre

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

#131 lore raw

Re: [PATCH 32/49] drm/i915/bxt: Implement enable/disable for Display C9 state

In reply to Imre Deak
Quoted 117 lines · Imre Deak

From: "A.Sunil Kamath" <[email protected]>

v2: Modified as per review comments from Imre
- Mention enabling instead of allowing in the debug trace and remove unnecessary comments.

v3:
- Rebase to latest.
- Move DC9-related functions from intel_display.c to intel_runtime_pm.c.

v4: (imre)
- remove DC5 disabling, it's a nop at this point
- squashed in Suketu's "Assert the requirements to enter or exit DC9" patch
- remove check for RUNTIME_PM from assert_can_enable_dc9, it's not a dependency

---
 drivers/gpu/drm/i915/i915_reg.h         |  5 +++
 drivers/gpu/drm/i915/intel_drv.h        |  2 +
 drivers/gpu/drm/i915/intel_runtime_pm.c | 66 +++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 95532b4..4c781cb 100644
@@ -6942,6 +6942,11 @@ enum bxt_phy {
 #define   BXT_DE_PLL_PLL_ENABLE		(1 << 31)
 #define   BXT_DE_PLL_LOCK		(1 << 30)
 
+/* GEN9 DC */
+#define DC_STATE_EN			0x45504
+#define  DC_STATE_EN_UPTO_DC5		(1<<0)
+#define  DC_STATE_EN_DC9		(1<<3)
+
 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
  * since on HSW we can't write to it using I915_WRITE. */
 #define D_COMP_HSW			(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 4bc2041..262314b 100644
@@ -1024,6 +1024,8 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void bxt_init_cdclk(struct drm_device *dev);
 void bxt_uninit_cdclk(struct drm_device *dev);
 void bxt_ddi_phy_init(struct drm_device *dev);
+void bxt_enable_dc9(struct drm_i915_private *dev_priv);
+void bxt_disable_dc9(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
drivers/gpu/drm/i915/intel_runtime_pm.c +55 -0
index ff5cce3..8fe2fde 100644
@@ -351,6 +351,72 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv,
 	BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS)) |	\
 	BIT(POWER_DOMAIN_INIT))
 
+static void assert_can_enable_dc9(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	WARN(!IS_BROXTON(dev), "Platform doesn't support DC9.\n");
+	WARN((I915_READ(DC_STATE_EN) & DC_STATE_EN_DC9),
+		"DC9 already programmed to be enabled.\n");
+	WARN(I915_READ(DC_STATE_EN) & DC_STATE_EN_UPTO_DC5,
+		"DC5 still not disabled to enable DC9.\n");
+	WARN(I915_READ(HSW_PWR_WELL_DRIVER), "Power well on.\n");
+	WARN(intel_irqs_enabled(dev_priv), "Interrupts not disabled yet.\n");
+
+	 /*
+	  * TODO: check for the following to verify the conditions to enter DC9
+	  * state are satisfied:
+	  * 1] Check relevant display engine registers to verify if mode set
+	  * disable sequence was followed.
+	  * 2] Check if display uninitialize sequence is initialized.
+	  */
+}
+
+static void assert_can_disable_dc9(struct drm_i915_private *dev_priv)
+{
+	WARN(intel_irqs_enabled(dev_priv), "Interrupts not disabled yet.\n");
+	WARN(!(I915_READ(DC_STATE_EN) & DC_STATE_EN_DC9),
+		"DC9 already programmed to be disabled.\n");
+	WARN(I915_READ(DC_STATE_EN) & DC_STATE_EN_UPTO_DC5,
+		"DC5 still not disabled.\n");
+
+	 /*
+	  * TODO: check for the following to verify DC9 state was indeed
+	  * entered before programming to disable it:
+	  * 1] Check relevant display engine registers to verify if mode
+	  *  set disable sequence was followed.
+	  * 2] Check if display uninitialize sequence is initialized.
+	  */
+}
+
+void bxt_enable_dc9(struct drm_i915_private *dev_priv)
+{
+	uint32_t val;
+
+	assert_can_enable_dc9(dev_priv);
+
+	DRM_DEBUG_KMS("Enabling DC9\n");
+
+	val = I915_READ(DC_STATE_EN);
+	val |= DC_STATE_EN_DC9;
+	I915_WRITE(DC_STATE_EN, val);
+	POSTING_READ(DC_STATE_EN);
+}
+
+void bxt_disable_dc9(struct drm_i915_private *dev_priv)
+{
+	uint32_t val;

drivers/gpu/drm/i915/intel_runtime_pm.c static void hsw_set_power_well(struct drm_i915_private *dev_priv, · line 418

Quoted 10 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +10 -0
+
+	assert_can_disable_dc9(dev_priv);
+
+	DRM_DEBUG_KMS("Disabling DC9\n");
+
+	val = I915_READ(DC_STATE_EN);
+	val &= ~DC_STATE_EN_DC9;
+	I915_WRITE(DC_STATE_EN, val);
+	POSTING_READ(DC_STATE_EN);
+}

Standard comment about patch splitting: Please don't add functions or structures (or new member fields and other variables) without using them in the same patch: That way the patch can't be understood fully when just linearly reading through patches and hence somewhat defeats the purpose of patch splitting.

Instead I recommend to first wire up dummy functions to sketch the larger picture and then in the next patch fill in details.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#132 lore raw

PATCH 33/49 drm/i915/bxt: Add DC9 Trigger sequence

In reply to Imre Deak

From: Suketu Shah <[email protected]>

Add triggers for DC9 as per details provided in bxt_enable_dc9 and bxt_disable_dc9 implementations.

v1:
- Add SKL check in gen9_disable_dc5 as it is possible for DC5 to remain disabled only for SKL.
- Add additional checks for whether DC5 is already disabled during DC5-disabling only for BXT.

v2:
- rebase to latest.
- Load CSR during DC9 disabling in the beginning before DC9 is disabled.
- Make gen9_disable_dc5 function non-static as it's being called by functions in i915_drv.c.
- Enable DC9-related functionality using a macro.

v3: (imre)
- remove BXT_ENABLE_DC9, we want DC9 always, and it's only valid on BXT
- remove DC5 disabling and CSR FW loaded check, these are nop atm
- squash in Vandana's "Do ddi_phy_init always" patch

---
 drivers/gpu/drm/i915/i915_drv.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +30 -0
index 48434cb6..396606a 100644
@@ -1002,6 +1002,18 @@ static int i915_pm_resume(struct device *dev)
 	return i915_drm_resume(drm_dev);
 }
 
+static int bxt_suspend_complete(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	/* TODO: when DC5 support is added disable DC5 here. */
+
+	bxt_uninit_cdclk(dev);
+	bxt_enable_dc9(dev_priv);
+
+	return 0;
+}
+
 static int hsw_suspend_complete(struct drm_i915_private *dev_priv)
 {
 	hsw_enable_pc8(dev_priv);
@@ -1009,6 +1021,20 @@ static int hsw_suspend_complete(struct drm_i915_private *dev_priv)
 	return 0;
 }
 
+static int bxt_resume_prepare(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	/* TODO: When CSR FW support is added make sure the FW is loaded. */
+
+	bxt_disable_dc9(dev_priv);
+	bxt_init_cdclk(dev);
+	bxt_ddi_phy_init(dev);
+	intel_prepare_ddi(dev);
+
+	return 0;
+}
+
 /*
  * Save all Gunit registers that may be lost after a D3 and a subsequent
  * S0i[R123] transition. The list of registers needing a save/restore is
@@ -1477,6 +1503,8 @@ static int intel_runtime_resume(struct device *device)
 
 	if (IS_GEN6(dev_priv))
 		intel_init_pch_refclk(dev);
+	else if (IS_BROXTON(dev))
+		ret = bxt_resume_prepare(dev_priv);
 	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		hsw_disable_pc8(dev_priv);
 	else if (IS_VALLEYVIEW(dev_priv))
@@ -1509,6 +1537,8 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	int ret;
 
+	if (IS_BROXTON(dev))
+		ret = bxt_suspend_complete(dev_priv);
 	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		ret = hsw_suspend_complete(dev_priv);
 	else if (IS_VALLEYVIEW(dev))
Signature · 6 lines
2.1.0

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

PATCH 33/49 drm/i915/bxt: Add DC9 Trigger sequence

+static int bxt_suspend_complete(struct drm_i915_private *dev_priv) +{
+ struct drm_device *dev = dev_priv->dev;
+
+ /* TODO: when DC5 support is added disable DC5 here. */
+
+ bxt_uninit_cdclk(dev);
+ bxt_enable_dc9(dev_priv);
+
+ return 0;
+}
+
static int hsw_suspend_complete(struct drm_i915_private *dev_priv)

 {
        hsw_enable_pc8(dev_priv);
@@ -1009,6 +1021,20 @@ static int hsw_suspend_complete(struct
drm_i915_private *dev_priv)
        return 0;

}

+static int bxt_resume_prepare(struct drm_i915_private *dev_priv) +{
+ struct drm_device *dev = dev_priv->dev;
+
+ /* TODO: When CSR FW support is added make sure the FW is loaded. */
+
+ bxt_disable_dc9(dev_priv);
Kindly add below comment as well:
/* TODO: when DC5 support is added enable DC5 here if conditions are met. */

+       bxt_init_cdclk(dev);
+       bxt_ddi_phy_init(dev);
+       intel_prepare_ddi(dev);

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

author
#134 lore raw

PATCH v4 33/49 drm/i915/bxt: Add DC9 Trigger sequence

In reply to Imre Deak

From: Suketu Shah <[email protected]>

Add triggers for DC9 as per details provided in bxt_enable_dc9 and bxt_disable_dc9 implementations.

v1:
- Add SKL check in gen9_disable_dc5 as it is possible for DC5 to remain disabled only for SKL.
- Add additional checks for whether DC5 is already disabled during DC5-disabling only for BXT.

v2:
- rebase to latest.
- Load CSR during DC9 disabling in the beginning before DC9 is disabled.
- Make gen9_disable_dc5 function non-static as it's being called by functions in i915_drv.c.
- Enable DC9-related functionality using a macro.

v3: (imre)
- remove BXT_ENABLE_DC9, we want DC9 always, and it's only valid on BXT
- remove DC5 disabling and CSR FW loaded check, these are nop atm
- squash in Vandana's "Do ddi_phy_init always" patch

v4:
- add TODO to re-enable DC5 during resume if CSR FW is available (sagar)

---
 drivers/gpu/drm/i915/i915_drv.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +38 -1
index c3fdbb0..f9754c3 100644
@@ -1009,6 +1009,38 @@ static int hsw_suspend_complete(struct drm_i915_private *dev_priv)
 	return 0;
 }
 
+static int bxt_suspend_complete(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	/* TODO: when DC5 support is added disable DC5 here. */
+
+	broxton_ddi_phy_uninit(dev);
+	broxton_uninit_cdclk(dev);
+	bxt_enable_dc9(dev_priv);
+
+	return 0;
+}
+
+static int bxt_resume_prepare(struct drm_i915_private *dev_priv)
+{
+	struct drm_device *dev = dev_priv->dev;
+
+	/* TODO: when CSR FW support is added make sure the FW is loaded */
+
+	bxt_disable_dc9(dev_priv);
+
+	/*
+	 * TODO: when DC5 support is added enable DC5 here if the CSR FW
+	 * is available.
+	 */
+	broxton_init_cdclk(dev);
+	broxton_ddi_phy_init(dev);
+	intel_prepare_ddi(dev);
+
+	return 0;
+}
+
 /*
  * Save all Gunit registers that may be lost after a D3 and a subsequent
  * S0i[R123] transition. The list of registers needing a save/restore is
@@ -1467,6 +1499,9 @@ static int intel_runtime_resume(struct device *device)
 
 	if (IS_GEN6(dev_priv))
 		intel_init_pch_refclk(dev);
+
+	if (IS_BROXTON(dev))
+		ret = bxt_resume_prepare(dev_priv);
 	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		hsw_disable_pc8(dev_priv);
 	else if (IS_VALLEYVIEW(dev_priv))
@@ -1499,7 +1534,9 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	int ret;
 
-	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
+	if (IS_BROXTON(dev))
+		ret = bxt_suspend_complete(dev_priv);
+	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		ret = hsw_suspend_complete(dev_priv);
 	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_suspend_complete(dev_priv);
Signature · 6 lines
2.1.0

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

PATCH 34/49 drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

PORT_CLK_SEL programming is needed only on HSW/BDW.

v2:
- don't program PORT_CLK_SEL from mst encoders either (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c    | 4 ++--
 drivers/gpu/drm/i915/intel_dp_mst.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
index 789682d..9203d81 100644
@@ -1559,7 +1559,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else {
+	} else if (INTEL_INFO(dev)->gen < 9) {
 		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
 		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
 	}
@@ -1618,7 +1618,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 	if (IS_SKYLAKE(dev))
 		I915_WRITE(DPLL_CTRL2, (I915_READ(DPLL_CTRL2) |
 					DPLL_CTRL2_DDI_CLK_OFF(port)));
-	else
+	else if (INTEL_INFO(dev)->gen < 9)
 		I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
 }
 
drivers/gpu/drm/i915/intel_dp_mst.c +4 -2
index be12492..76f32bb 100644
@@ -158,8 +158,10 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	if (intel_dp->active_mst_links == 0) {
 		enum port port = intel_ddi_get_encoder_port(encoder);
 
-		I915_WRITE(PORT_CLK_SEL(port),
-			   intel_crtc->config->ddi_pll_sel);
+		/* FIXME: add support for SKL */
+		if (!INTEL_INFO(dev)->gen < 9)
+			I915_WRITE(PORT_CLK_SEL(port),
+				   intel_crtc->config->ddi_pll_sel);
 
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
Signature · 6 lines
2.1.0

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

PATCH v3 34/49 drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9

From: Satheeshakrishna M <[email protected]>

PORT_CLK_SEL programming is needed only on HSW/BDW.

v2:
- don't program PORT_CLK_SEL from mst encoders either (imre) v3:
- fix the check for GEN9+ in intel_mst_pre_enable_dp() (damien)

---
 drivers/gpu/drm/i915/intel_ddi.c    | 4 ++--
 drivers/gpu/drm/i915/intel_dp_mst.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
index 31cadb8..6bdccb2 100644
@@ -1565,7 +1565,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else {
+	} else if (INTEL_INFO(dev)->gen < 9) {
 		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
 		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
 	}
@@ -1624,7 +1624,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 	if (IS_SKYLAKE(dev))
 		I915_WRITE(DPLL_CTRL2, (I915_READ(DPLL_CTRL2) |
 					DPLL_CTRL2_DDI_CLK_OFF(port)));
-	else
+	else if (INTEL_INFO(dev)->gen < 9)
 		I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
 }
 
drivers/gpu/drm/i915/intel_dp_mst.c +4 -2
index 7335089..3945057 100644
@@ -173,8 +173,10 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	if (intel_dp->active_mst_links == 0) {
 		enum port port = intel_ddi_get_encoder_port(encoder);
 
-		I915_WRITE(PORT_CLK_SEL(port),
-			   intel_crtc->config->ddi_pll_sel);
+		/* FIXME: add support for SKL */
+		if (INTEL_INFO(dev)->gen < 9)
+			I915_WRITE(PORT_CLK_SEL(port),
+				   intel_crtc->config->ddi_pll_sel);
 
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by Sagar Kamble on v3 34/49
#137 lore raw

Re: [PATCH v3 34/49] drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9

Quoted 11 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

PORT_CLK_SEL programming is needed only on HSW/BDW.

v2:
- don't program PORT_CLK_SEL from mst encoders either (imre) v3:
- fix the check for GEN9+ in intel_mst_pre_enable_dp() (damien)

Reviewed-by Sagar Kamble <sagar.a.kamble at intel.com>
Quoted 34 lines
---
 drivers/gpu/drm/i915/intel_ddi.c    | 4 ++--
 drivers/gpu/drm/i915/intel_dp_mst.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
index 31cadb8..6bdccb2 100644
@@ -1565,7 +1565,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else {
+	} else if (INTEL_INFO(dev)->gen < 9) {
 		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
 		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
 	}
@@ -1624,7 +1624,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 	if (IS_SKYLAKE(dev))
 		I915_WRITE(DPLL_CTRL2, (I915_READ(DPLL_CTRL2) |
 					DPLL_CTRL2_DDI_CLK_OFF(port)));
-	else
+	else if (INTEL_INFO(dev)->gen < 9)
 		I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
 }
 
drivers/gpu/drm/i915/intel_dp_mst.c +0 -0
index 7335089..3945057 100644
@@ -173,8 +173,10 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	if (intel_dp->active_mst_links == 0) {
 		enum port port = intel_ddi_get_encoder_port(encoder);

drivers/gpu/drm/i915/intel_dp_mst.c static void intel_mst_pre_enable_dp(struct intel_encoder *encoder) · line 182

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp_mst.c +4 -2
 
-		I915_WRITE(PORT_CLK_SEL(port),
-			   intel_crtc->config->ddi_pll_sel);
+		/* FIXME: add support for SKL */
+		if (INTEL_INFO(dev)->gen < 9)
+			I915_WRITE(PORT_CLK_SEL(port),
+				   intel_crtc->config->ddi_pll_sel);
 
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 

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

author
#138 lore raw

PATCH 35/49 drm/i915/bxt: fix panel fitter setup in crtc disable/enable

In reply to Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -3
index ba2d1ae..95ce0a8 100644
@@ -4532,7 +4532,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)
 		skylake_pfit_enable(intel_crtc);
 	else
 		ironlake_pfit_enable(intel_crtc);
@@ -4695,7 +4695,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)
 		skylake_pfit_disable(intel_crtc);
 	else
 		ironlake_pfit_disable(intel_crtc);
@@ -8504,7 +8504,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 
 	pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
 	if (intel_display_power_is_enabled(dev_priv, pfit_domain)) {
-		if (IS_SKYLAKE(dev))
+		if (INTEL_INFO(dev)->gen == 9)
 			skylake_get_pfit_config(crtc, pipe_config);
 		else
 			ironlake_get_pfit_config(crtc, pipe_config);
Signature · 6 lines
2.1.0

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

Re: [PATCH 35/49] drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Quoted 15 lines · Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index ba2d1ae..95ce0a8 100644

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_enable(struct drm_crtc *crtc) · line 4535

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -4532,7 +4532,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)

Shouldn't we go with gen >= 9 here while at it?
-Daniel

Quoted 28 lines
drivers/gpu/drm/i915/intel_display.c +2 -2
 		skylake_pfit_enable(intel_crtc);
 	else
 		ironlake_pfit_enable(intel_crtc);
@@ -4695,7 +4695,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)
 		skylake_pfit_disable(intel_crtc);
 	else
 		ironlake_pfit_disable(intel_crtc);
@@ -8504,7 +8504,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 
 	pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
 	if (intel_display_power_is_enabled(dev_priv, pfit_domain)) {
-		if (IS_SKYLAKE(dev))
+		if (INTEL_INFO(dev)->gen == 9)
 			skylake_get_pfit_config(crtc, pipe_config);
 		else
 			ironlake_get_pfit_config(crtc, pipe_config);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#140 lore raw

Re: [PATCH 35/49] drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index ba2d1ae..95ce0a8 100644
@@ -4532,7 +4532,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_enable(struct drm_crtc *crtc) · line 4535

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)

Shouldn't we go with gen >= 9 here while at it?

== 9 looks like the right choice based on bspec.

--Imre

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

#141 lore raw

Re: [PATCH 35/49] drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Quoted 18 lines · Imre Deak
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index ba2d1ae..95ce0a8 100644
@@ -4532,7 +4532,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_enable(struct drm_crtc *crtc) · line 4535

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)

Shouldn't we go with gen >= 9 here while at it?

== 9 looks like the right choice based on bspec.

Then maybe add a else if (gen > 9) MISSING_CASE(gen); afterwards? Just trying to avoid surprises when enabling skl/bxt+1 ... -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#142 lore raw

Re: [PATCH 35/49] drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Quoted 26 lines · Daniel Vetter
Quoted 25 lines · Imre Deak
Quoted 23 lines · Daniel Vetter
Quoted 15 lines · Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index ba2d1ae..95ce0a8 100644

drivers/gpu/drm/i915/intel_display.c static void haswell_crtc_enable(struct drm_crtc *crtc) · line 4535

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -4532,7 +4532,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)

Shouldn't we go with gen >= 9 here while at it?

Quoted 4 lines
Quoted 1 line

== 9 looks like the right choice based on bspec.

Then maybe add a else if (gen > 9) MISSING_CASE(gen); afterwards? Just trying to avoid surprises when enabling skl/bxt+1 ...

Yea, makes sense. I'll update the patch.

--Imre

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

#144 lore raw

Re: [PATCH 34/49] drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9

Quoted 2 lines · On Sun, Apr 12, 2015 at 03:52:12PM +0530, [email protected] wrote:

For patch at http://lists.freedesktop.org/archives/intel-gfx/2015-March/062169.html
Reviewed-by: Sagar Kamble <sagar.a.kamble at intel.com>

Usually reviews are done as a reply to the patch, but maybe you didn't receive the earlier mail?

- I915_WRITE(PORT_CLK_SEL(port),
- intel_crtc->config->ddi_pll_sel);
+ /* FIXME: add support for SKL */
+ if (!INTEL_INFO(dev)->gen < 9)
+ I915_WRITE(PORT_CLK_SEL(port),
+ intel_crtc->config->ddi_pll_sel);

This '!' looks fishy to me.

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#145 lore raw

Re: [PATCH 34/49] drm/i915/bxt: Restrict PORT_CLK_SEL programming below gen9

Quoted 14 lines · Damien Lespiau
Quoted 2 lines · On Sun, Apr 12, 2015 at 03:52:12PM +0530, [email protected] wrote:

For patch at http://lists.freedesktop.org/archives/intel-gfx/2015-March/062169.html
Reviewed-by: Sagar Kamble <sagar.a.kamble at intel.com>

Usually reviews are done as a reply to the patch, but maybe you didn't receive the earlier mail?

(quoted diff) +4 -2
-		I915_WRITE(PORT_CLK_SEL(port),
-			   intel_crtc->config->ddi_pll_sel);
+		/* FIXME: add support for SKL */
+		if (!INTEL_INFO(dev)->gen < 9)
+			I915_WRITE(PORT_CLK_SEL(port),
+				   intel_crtc->config->ddi_pll_sel);
Quoted 1 line

This '!' looks fishy to me.

Yes, that's a typo from me. Will fix it, thanks for catching it.

--Imre

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