[Intel-gfx] [PATCH] drm/i915: DisplayPort hot remove notification to audio driver

2011-12-09 Thread Wu Fengguang
On DP monitor hot remove, clear DP_AUDIO_OUTPUT_ENABLE accordingly,
so that the audio driver will receive hot plug events and take action
to refresh its device state and ELD contents.

Note that the DP_AUDIO_OUTPUT_ENABLE bit may be enabled or disabled
only when the link training is complete and set to Normal.

Signed-off-by: Wu Fengguang fengguang...@intel.com
---
 drivers/gpu/drm/i915/intel_dp.c |1 +
 1 file changed, 1 insertion(+)

This works both on KMS console and gnome desktop.
Hot plug/unplug and DPMS on/off are all tested OK.

--- linux.orig/drivers/gpu/drm/i915/intel_dp.c  2011-12-09 16:51:21.0 
+0800
+++ linux/drivers/gpu/drm/i915/intel_dp.c   2011-12-09 16:59:45.0 
+0800
@@ -1771,6 +1771,7 @@ intel_dp_link_down(struct intel_dp *inte
intel_wait_for_vblank(dev, to_intel_crtc(crtc)-pipe);
}
 
+   DP = ~DP_AUDIO_OUTPUT_ENABLE;
I915_WRITE(intel_dp-output_reg, DP  ~DP_PORT_EN);
POSTING_READ(intel_dp-output_reg);
msleep(intel_dp-panel_power_down_delay);
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: fix infinite recursion on unbind due to ilk vt-d w/a

2011-12-09 Thread Bobby Powers
On Fri, Dec 9, 2011 at 6:32 AM, Bobby Powers bobbypow...@gmail.com wrote:
 On Thu, Dec 8, 2011 at 11:05 PM, Bobby Powers bobbypow...@gmail.com wrote:
 On Tue, Dec 6, 2011 at 12:43 PM, Ben Widawsky b...@bwidawsk.net wrote:
 On Tue, Dec 06, 2011 at 12:12:33PM +0100, Daniel Vetter wrote:
 The recursion loop goes retire_requests-unbind-gpu_idle-retire_reqeusts.

 Every time we go through this we need a
 - active object that can be retired
 - and there are no other references to that object than the one from
   the active list, so that it gets unbound and freed immediately.
 Otherwise the recursion stops. So the recursion is only limited by the
 number of objects that fit these requirements sitting in the active list
 any time retire_request is called.

 Issue exercised by tests/gem_unref_active_buffers from i-g-t.

 There's been a decent bikeshed discussion whether it wouldn't be
 better to pass around a flag, but imo this is o.k. for such a limited
 case that only supports a w/a.

 Signed-Off-by: Daniel Vetter daniel.vet...@ffwll.ch
 Reviewed-by: Chris Wilson chris@chris-wilson # we built better
       bikesheds, but this keeps the rain off for now
 ---

 What about:
 http://lists.freedesktop.org/archives/intel-gfx/2011-October/012984.html


 Did someone prove that doesn't work?

 This patch caused hard lockups for me after ~35 minutes of casual use
 (twice).  I've attached the oopses.  I'm running a Fedora 16 machine,
 Lenovo T420 (i5-2540M w/ VT-d enabled), and at each time had a Windows
 7 KVM guest idling (not sure if that is relevant).  With this patch
 reverted, I've had ~ 6 hours of oops free uptime.

 To be clear, by 'this patch' I mean commit eb1711bb [PATCH] drm/i915:
 fix infinite recursion on unbind due to ilk vt-d w/a on Linus's
 branch, not the patch Ben linked to.

 Let me know what additional information I can provide, or if there is
 anything I can test to help narrow the issue down.

Additionally I have i915.i915_enable_rc6=1 on the kernel command line.


 yours,
 Bobby

 ~~~

 [bpowers@fina linux]$ lspci
 00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor
 Family DRAM Controller (rev 09)
 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation
 Core Processor Family Integrated Graphics Controller (rev 09)
 00:16.0 Communication controller: Intel Corporation 6 Series/C200
 Series Chipset Family MEI Controller #1 (rev 04)
 00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network
 Connection (rev 04)
 00:1a.0 USB Controller: Intel Corporation 6 Series/C200 Series Chipset
 Family USB Enhanced Host Controller #2 (rev 04)
 00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset
 Family High Definition Audio Controller (rev 04)
 00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
 Family PCI Express Root Port 1 (rev b4)
 00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
 Family PCI Express Root Port 2 (rev b4)
 00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
 Family PCI Express Root Port 4 (rev b4)
 00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset
 Family PCI Express Root Port 5 (rev b4)
 00:1d.0 USB Controller: Intel Corporation 6 Series/C200 Series Chipset
 Family USB Enhanced Host Controller #1 (rev 04)
 00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC
 Controller (rev 04)
 00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series
 Chipset Family 6 port SATA AHCI Controller (rev 04)
 00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family
 SMBus Controller (rev 04)
 03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 
 34)
 0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 08)
 0d:00.3 FireWire (IEEE 1394): Ricoh Co Ltd FireWire Host Controller (rev 04)
 [bpowers@fina linux]$ cat /proc/cpuinfo
 processor       : 0
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 42
 model name      : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
 stepping        : 7
 microcode       : 0x18
 cpu MHz         : 800.000
 cache size      : 3072 KB
 physical id     : 0
 siblings        : 4
 core id         : 0
 cpu cores       : 2
 apicid          : 0
 initial apicid  : 0
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 13
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
 cmov
 pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
 rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology
 nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est
 tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt
 tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts
 dts tpr_shadow vnmi flexpriority ept vpid
 bogomips        : 5184.24
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:

 [3 other processors omitted]

[Intel-gfx] [PATCH 0/5] Intel HDMI ELD fixes v2

2011-12-09 Thread Wu Fengguang
Keith,

The complete set of fixes for passing HDMI/DP ELD to audio driver.

 [PATCH 1/5] drm/i915: fix ELD writing for SandyBridge
 [PATCH 2/5] drm/i915: rename audio ELD registers
 [PATCH 3/5] drm/i915: dont trigger hotplug events on unchanged ELD
 [PATCH 4/5] drm/i915: HDMI hot remove notification to audio driver
 [PATCH 5/5] drm/i915: DisplayPort hot remove notification to audio driver

 drivers/gpu/drm/i915/i915_reg.h  |   22 +++
 drivers/gpu/drm/i915/intel_display.c |   75 +++--
 drivers/gpu/drm/i915/intel_dp.c  |1 
 drivers/gpu/drm/i915/intel_hdmi.c|8 ++
 4 files changed, 76 insertions(+), 30 deletions(-)

Thanks,
Fengguang

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/5] drm/i915: rename audio ELD registers

2011-12-09 Thread Wu Fengguang
Change the definitions from GEN5 to IBX as they aren't in the CPU and
some SNB systems actually shipped with IBX chipsets (or, at least that's
a supported configuration).

The GEN7_* register addresses actually take effect since GEN6 and should
be prefixed by CPT, the PCH code name.

Suggested-by: Keith Packard kei...@keithp.com
Signed-off-by: Wu Fengguang fengguang...@intel.com
---
 drivers/gpu/drm/i915/i915_reg.h  |   22 +++---
 drivers/gpu/drm/i915/intel_display.c |   22 +++---
 2 files changed, 22 insertions(+), 22 deletions(-)

--- linux.orig/drivers/gpu/drm/i915/i915_reg.h  2011-11-29 19:50:27.0 
+0800
+++ linux/drivers/gpu/drm/i915/i915_reg.h   2011-11-29 19:51:38.0 
+0800
@@ -3534,17 +3534,17 @@
 #define G4X_ELD_ACK(1  4)
 #define G4X_HDMIW_HDMIEDID 0x6210C
 
-#define GEN5_HDMIW_HDMIEDID_A  0xE2050
-#define GEN5_AUD_CNTL_ST_A 0xE20B4
-#define GEN5_ELD_BUFFER_SIZE   (0x1f  10)
-#define GEN5_ELD_ADDRESS   (0x1f  5)
-#define GEN5_ELD_ACK   (1  4)
-#define GEN5_AUD_CNTL_ST2  0xE20C0
-#define GEN5_ELD_VALIDB(1  0)
-#define GEN5_CP_READYB (1  1)
+#define IBX_HDMIW_HDMIEDID_A   0xE2050
+#define IBX_AUD_CNTL_ST_A  0xE20B4
+#define IBX_ELD_BUFFER_SIZE(0x1f  10)
+#define IBX_ELD_ADDRESS(0x1f  5)
+#define IBX_ELD_ACK(1  4)
+#define IBX_AUD_CNTL_ST2   0xE20C0
+#define IBX_ELD_VALIDB (1  0)
+#define IBX_CP_READYB  (1  1)
 
-#define GEN7_HDMIW_HDMIEDID_A  0xE5050
-#define GEN7_AUD_CNTRL_ST_A0xE50B4
-#define GEN7_AUD_CNTRL_ST2 0xE50C0
+#define CPT_HDMIW_HDMIEDID_A   0xE5050
+#define CPT_AUD_CNTL_ST_A  0xE50B4
+#define CPT_AUD_CNTRL_ST2  0xE50C0
 
 #endif /* _I915_REG_H_ */
--- linux.orig/drivers/gpu/drm/i915/intel_display.c 2011-11-29 
19:51:28.0 +0800
+++ linux/drivers/gpu/drm/i915/intel_display.c  2011-11-29 19:52:01.0 
+0800
@@ -5858,13 +5858,13 @@ static void ironlake_write_eld(struct dr
int aud_cntrl_st2;
 
if (HAS_PCH_IBX(connector-dev)) {
-   hdmiw_hdmiedid = GEN5_HDMIW_HDMIEDID_A;
-   aud_cntl_st = GEN5_AUD_CNTL_ST_A;
-   aud_cntrl_st2 = GEN5_AUD_CNTL_ST2;
+   hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID_A;
+   aud_cntl_st = IBX_AUD_CNTL_ST_A;
+   aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
} else {
-   hdmiw_hdmiedid = GEN7_HDMIW_HDMIEDID_A;
-   aud_cntl_st = GEN7_AUD_CNTRL_ST_A;
-   aud_cntrl_st2 = GEN7_AUD_CNTRL_ST2;
+   hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID_A;
+   aud_cntl_st = CPT_AUD_CNTL_ST_A;
+   aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
}
 
i = to_intel_crtc(crtc)-pipe;
@@ -5878,12 +5878,12 @@ static void ironlake_write_eld(struct dr
if (!i) {
DRM_DEBUG_DRIVER(Audio directed to unknown port\n);
/* operate blindly on all ports */
-   eldv = GEN5_ELD_VALIDB;
-   eldv |= GEN5_ELD_VALIDB  4;
-   eldv |= GEN5_ELD_VALIDB  8;
+   eldv = IBX_ELD_VALIDB;
+   eldv |= IBX_ELD_VALIDB  4;
+   eldv |= IBX_ELD_VALIDB  8;
} else {
DRM_DEBUG_DRIVER(ELD on port %c\n, 'A' + i);
-   eldv = GEN5_ELD_VALIDB  ((i - 1) * 4);
+   eldv = IBX_ELD_VALIDB  ((i - 1) * 4);
}
 
i = I915_READ(aud_cntrl_st2);
@@ -5899,7 +5899,7 @@ static void ironlake_write_eld(struct dr
}
 
i = I915_READ(aud_cntl_st);
-   i = ~GEN5_ELD_ADDRESS;
+   i = ~IBX_ELD_ADDRESS;
I915_WRITE(aud_cntl_st, i);
 
len = min_t(uint8_t, eld[2], 21);   /* 84 bytes of hw ELD buffer */


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 3/5] drm/i915: dont trigger hotplug events on unchanged ELD

2011-12-09 Thread Wu Fengguang
The ELD may or may not change when switching the video mode.
If unchanged, don't trigger hot plug events to HDMI audio driver.

This avoids disturbing the user with repeated printks.

Reported-by: Nick Bowler nbow...@elliptictech.com
Signed-off-by: Wu Fengguang fengguang...@intel.com
---
 drivers/gpu/drm/i915/intel_display.c |   51 ++---
 1 file changed, 46 insertions(+), 5 deletions(-)

--- linux.orig/drivers/gpu/drm/i915/intel_display.c 2011-11-24 
08:25:26.0 +0800
+++ linux/drivers/gpu/drm/i915/intel_display.c  2011-11-24 08:25:27.0 
+0800
@@ -5811,6 +5811,35 @@ static int intel_crtc_mode_set(struct dr
return ret;
 }
 
+static bool intel_eld_uptodate(struct drm_connector *connector,
+  int reg_eldv, uint32_t bits_eldv,
+  int reg_elda, uint32_t bits_elda,
+  int reg_edid)
+{
+   struct drm_i915_private *dev_priv = connector-dev-dev_private;
+   uint8_t *eld = connector-eld;
+   uint32_t i;
+
+   i = I915_READ(reg_eldv);
+   i = bits_eldv;
+
+   if (!eld[0])
+   return !i;
+
+   if (!i)
+   return false;
+
+   i = I915_READ(reg_elda);
+   i = ~bits_elda;
+   I915_WRITE(reg_elda, i);
+
+   for (i = 0; i  eld[2]; i++)
+   if (I915_READ(reg_edid) != *((uint32_t *)eld + i))
+   return false;
+
+   return true;
+}
+
 static void g4x_write_eld(struct drm_connector *connector,
  struct drm_crtc *crtc)
 {
@@ -5827,6 +5856,12 @@ static void g4x_write_eld(struct drm_con
else
eldv = G4X_ELDV_DEVCTG;
 
+   if (intel_eld_uptodate(connector,
+  G4X_AUD_CNTL_ST, eldv,
+  G4X_AUD_CNTL_ST, G4X_ELD_ADDR,
+  G4X_HDMIW_HDMIEDID))
+   return;
+
i = I915_READ(G4X_AUD_CNTL_ST);
i = ~(eldv | G4X_ELD_ADDR);
len = (i  9)  0x1f;  /* ELD buffer size */
@@ -5886,6 +5921,17 @@ static void ironlake_write_eld(struct dr
eldv = IBX_ELD_VALIDB  ((i - 1) * 4);
}
 
+   if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+   DRM_DEBUG_DRIVER(ELD: DisplayPort detected\n);
+   eld[5] |= (1  2); /* Conn_Type, 0x1 = DisplayPort */
+   }
+
+   if (intel_eld_uptodate(connector,
+  aud_cntrl_st2, eldv,
+  aud_cntl_st, IBX_ELD_ADDRESS,
+  hdmiw_hdmiedid))
+   return;
+
i = I915_READ(aud_cntrl_st2);
i = ~eldv;
I915_WRITE(aud_cntrl_st2, i);
@@ -5893,11 +5939,6 @@ static void ironlake_write_eld(struct dr
if (!eld[0])
return;
 
-   if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
-   DRM_DEBUG_DRIVER(ELD: DisplayPort detected\n);
-   eld[5] |= (1  2); /* Conn_Type, 0x1 = DisplayPort */
-   }
-
i = I915_READ(aud_cntl_st);
i = ~IBX_ELD_ADDRESS;
I915_WRITE(aud_cntl_st, i);


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/5] drm/i915: fix ELD writing for SandyBridge

2011-12-09 Thread Wu Fengguang
SandyBridge should be using the same register addresses as IvyBridge.

Signed-off-by: Wu Fengguang fengguang...@intel.com
---
 drivers/gpu/drm/i915/intel_display.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

--- linux.orig/drivers/gpu/drm/i915/intel_display.c 2011-11-28 
15:33:04.0 +0800
+++ linux/drivers/gpu/drm/i915/intel_display.c  2011-11-29 19:51:28.0 
+0800
@@ -5857,14 +5857,14 @@ static void ironlake_write_eld(struct dr
int aud_cntl_st;
int aud_cntrl_st2;
 
-   if (IS_IVYBRIDGE(connector-dev)) {
-   hdmiw_hdmiedid = GEN7_HDMIW_HDMIEDID_A;
-   aud_cntl_st = GEN7_AUD_CNTRL_ST_A;
-   aud_cntrl_st2 = GEN7_AUD_CNTRL_ST2;
-   } else {
+   if (HAS_PCH_IBX(connector-dev)) {
hdmiw_hdmiedid = GEN5_HDMIW_HDMIEDID_A;
aud_cntl_st = GEN5_AUD_CNTL_ST_A;
aud_cntrl_st2 = GEN5_AUD_CNTL_ST2;
+   } else {
+   hdmiw_hdmiedid = GEN7_HDMIW_HDMIEDID_A;
+   aud_cntl_st = GEN7_AUD_CNTRL_ST_A;
+   aud_cntrl_st2 = GEN7_AUD_CNTRL_ST2;
}
 
i = to_intel_crtc(crtc)-pipe;


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] Philips 221P3LPYEB has working DP audio

2011-12-09 Thread Wu Fengguang
On Mon, Nov 28, 2011 at 04:06:37PM +0800, Wu Fengguang wrote:
  The only missing part is hot plug notification for DP -- most DP monitors in
  the market don't support DP audio well. So I cannot test this for now.
 
 btw, we'd like to buy a Philips 221P3LPYEB that _seems_ to have DP
 audio support. I'd appreciate if any one can help confirm.

I'm glad to say that its DP audio works great! And the built in
speakers make the testing really convenient :-)

For the record, here is the ELD:

monitor_present 1
eld_valid   1
monitor_name221P3LPY
connection_type DisplayPort
eld_version [0x2] CEA-861D or below
edid_version[0x3] CEA-861-B, C or D
manufacture_id  0xc41
product_id  0x8a3
port_id 0x0
support_hdcp0
support_ai  0
audio_sync_delay0
speakers[0x1] FL/FR
sad_count   1
sad0_coding_type[0x1] LPCM
sad0_channels   2
sad0_rates  [0x6e0] 32000 44100 48000 96000 176400
sad0_bits   [0xe] 16 20 24

Note that we didn't buy the 24 241P3LYEB because it's temporarily not
available.

Thanks,
Fengguang
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 0/5] Intel HDMI ELD fixes v2

2011-12-09 Thread Takashi Iwai
At Fri, 09 Dec 2011 20:42:16 +0800,
Wu Fengguang wrote:
 
 Keith,
 
 The complete set of fixes for passing HDMI/DP ELD to audio driver.
 
  [PATCH 1/5] drm/i915: fix ELD writing for SandyBridge
  [PATCH 2/5] drm/i915: rename audio ELD registers
  [PATCH 3/5] drm/i915: dont trigger hotplug events on unchanged ELD
  [PATCH 4/5] drm/i915: HDMI hot remove notification to audio driver
  [PATCH 5/5] drm/i915: DisplayPort hot remove notification to audio driver
 
  drivers/gpu/drm/i915/i915_reg.h  |   22 +++
  drivers/gpu/drm/i915/intel_display.c |   75 +++--
  drivers/gpu/drm/i915/intel_dp.c  |1 
  drivers/gpu/drm/i915/intel_hdmi.c|8 ++
  4 files changed, 76 insertions(+), 30 deletions(-)

Thanks.  Feel free to add my ack to all these.

Acked-by: Takashi Iwai ti...@suse.de


Takashi
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] kernel BUG at drivers/gpu/drm/i915/i915_gem

2011-12-09 Thread Daniel Vetter
Hi Rocko,

Thanks for the bug report. Please report bugs always on the public
mailing list so that all interest people can join in (also I'm
travelling atm, so I can't do much).
Afaics we're hitting

BUG_ON(seqno == 0)

in wait_requst. Unfortunately you've cut out the backtrace from the
kernel oops, so I can't tell anything more.

Please add the full dmesg and the usual details about your macine.

Yours, Daniel

On Fri, Dec 9, 2011 at 00:11, Rocko Requin rockoreq...@hotmail.com wrote:
 Hi Daniel,

 Since I applied commit eb1711bb94991e93669c5a1b5f84f11be2d51ea1 (drm/i915:
 fix infinite recursion on unbind due to ilk vt-d w/a) to my kernel yesterday
 afternoon, I've had the kernel lock up completely three times on me, so I'm
 assuming it might have been the cause. (I was previously using a kernel
 compiled from git on Dec 4th without problems.)

 The last lockup showed this in the syslog:

 Dec  9 06:23:15 sierra kernel: [44486.289428] kernel BUG at
 drivers/gpu/drm/i915/i915_gem.c:1952!
 Dec  9 06:23:15 sierra kernel: [44486.289460] invalid opcode:  [#1] SMP
 ...
 Dec  9 06:23:15 sierra kernel: [44486.289844] RIP:
 0010:[a02eccd3]  [a02eccd3]
 i915_wait_request+0x563/0x580 [i915]

 I have attached a longer version of the log (but note that it was truncated
 by the crash).

 I am booting the kernel with i915.i915_enable_rc6=1 but I didn't have any
 lockup issues until yesterday.

 Thanks,
 rocko



-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Clean up multi-threaded forcewake patch

2011-12-09 Thread Keith Packard
We learned that the ECOBUS register was inside the GT power well, and
so *did* need force wake to be read, so it gets removed from the list
of 'doesn't need force wake' registers.

That means the code reading ECOBUS after forcing the mt_force_wake
function to be called needs to use I915_READ_NOTRACE; it doesn't need
to do more force wake fun as it's already done it manually.

This also adds a comment explaining why the MT forcewake testing code
only needs to call mt_forcewake_get/put and not disable RC6 manually
-- the ECOBUS read will return 0 if the device is in RC6 and isn't
using MT forcewake, causing the test to work correctly.

Signed-off-by: Keith Packard kei...@keithp.com
Cc: Jesse Barnes jbar...@virtuousgeek.org
---
 drivers/gpu/drm/i915/i915_drv.c  |7 ---
 drivers/gpu/drm/i915/i915_drv.h  |3 +--
 drivers/gpu/drm/i915/intel_display.c |8 +++-
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 28836fe..e63a0f0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -922,13 +922,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE(GPL and additional rights);
 
-/* We give fast paths for the really cool registers */
-#define NEEDS_FORCE_WAKE(dev_priv, reg) \
-   (((dev_priv)-info-gen = 6)  \
-((reg)  0x4) \
-((reg) != FORCEWAKE)  \
-((reg) != ECOBUS))
-
 #define __i915_read(x, y) \
 u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
u##x val = 0; \
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1421118..bbd0604 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1364,8 +1364,7 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private 
*dev_priv);
 #define NEEDS_FORCE_WAKE(dev_priv, reg) \
(((dev_priv)-info-gen = 6)  \
 ((reg)  0x4) \
-((reg) != FORCEWAKE)  \
-((reg) != ECOBUS))
+((reg) != FORCEWAKE))
 
 #define __i915_read(x, y) \
u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg);
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index a03ebf6..5abfc36 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8539,9 +8539,15 @@ static void intel_init_display(struct drm_device *dev)
if (IS_IVYBRIDGE(dev)) {
u32 ecobus;
 
+   /* A small trick here - if the bios hasn't configured 
MT forcewake,
+* and if the device is in RC6, then force_wake_mt_get 
will not wake
+* the device and the ECOBUS read will return zero. 
Which will be
+* (correctly) interpreted by the test below as MT 
forcewake being
+* disabled.
+*/
mutex_lock(dev-struct_mutex);
__gen6_gt_force_wake_mt_get(dev_priv);
-   ecobus = I915_READ(ECOBUS);
+   ecobus = I915_READ_NOTRACE(ECOBUS);
__gen6_gt_force_wake_mt_put(dev_priv);
mutex_unlock(dev-struct_mutex);
 
-- 
1.7.7.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915: By default, enable RC6 on IVB and SNB when reasonable

2011-12-09 Thread Keith Packard
RC6 should always work on IVB, and should work on SNB whenever IO
remapping is disabled. RC6 never works on Ironlake. Make the default
value for the parameter follow these guidelines. Setting the value
to either 0 or 1 will force the specified behavior.

Signed-off-by: Keith Packard kei...@keithp.com
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Eugeni Dodonov eugeni.dodo...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38567
Cc: Ted Phelps phe...@gnusto.com
Cc: Peter pab1...@gmail.com
Cc: Lukas Hejtmanek xhejt...@fi.muni.cz
Cc: Andrew Lutomirski l...@mit.edu
---
 drivers/gpu/drm/i915/i915_drv.c  |4 ++--
 drivers/gpu/drm/i915/i915_drv.h  |2 +-
 drivers/gpu/drm/i915/intel_display.c |   33 ++---
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 28836fe..47a42eb 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -63,10 +63,10 @@ module_param_named(semaphores, i915_semaphores, int, 0600);
 MODULE_PARM_DESC(semaphores,
Use semaphores for inter-ring sync (default: false));
 
-unsigned int i915_enable_rc6 __read_mostly = 0;
+int i915_enable_rc6 __read_mostly = -1;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
 MODULE_PARM_DESC(i915_enable_rc6,
-   Enable power-saving render C-state 6 (default: true));
+   Enable power-saving render C-state 6 (default: -1 (use 
per-chip default));
 
 int i915_enable_fbc __read_mostly = -1;
 module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1421118..bb82ef8 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1008,7 +1008,7 @@ extern unsigned int i915_semaphores __read_mostly;
 extern unsigned int i915_lvds_downclock __read_mostly;
 extern int i915_panel_use_ssc __read_mostly;
 extern int i915_vbt_sdvo_panel_type __read_mostly;
-extern unsigned int i915_enable_rc6 __read_mostly;
+extern int i915_enable_rc6 __read_mostly;
 extern int i915_enable_fbc __read_mostly;
 extern bool i915_enable_hangcheck __read_mostly;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index a03ebf6..3097104 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -38,8 +38,8 @@
 #include i915_drv.h
 #include i915_trace.h
 #include drm_dp_helper.h
-
 #include drm_crtc_helper.h
+#include linux/dma_remapping.h
 
 #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))
 
@@ -7928,6 +7928,33 @@ void intel_init_emon(struct drm_device *dev)
dev_priv-corr = (lcfuse  LCFUSE_HIV_MASK);
 }
 
+static bool intel_enable_rc6(struct drm_device *dev)
+{
+   /*
+* Respect the kernel parameter if it is set
+*/
+   if (i915_enable_rc6 = 0)
+   return i915_enable_rc6;
+
+   /*
+* Disable RC6 on Ironlake
+*/
+   if (INTEL_INFO(dev)-gen == 5)
+   return 0;
+
+   /*
+* Enable rc6 on Sandybridge if DMA remapping is disabled
+*/
+   if (INTEL_INFO(dev)-gen == 6) {
+   DRM_DEBUG_DRIVER(Sandybridge: intel_iommu_enabled %s -- RC6 
%sabled\n,
+intel_iommu_enabled ? true : false,
+!intel_iommu_enabled ? en : dis);
+   return !intel_iommu_enabled;
+   }
+   DRM_DEBUG_DRIVER(RC6 enabled\n);
+   return 1;
+}
+
 void gen6_enable_rps(struct drm_i915_private *dev_priv)
 {
u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
@@ -7964,7 +7991,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
I915_WRITE(GEN6_RC6p_THRESHOLD, 10);
I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */
 
-   if (i915_enable_rc6)
+   if (intel_enable_rc6(dev_priv-dev))
rc6_mask = GEN6_RC_CTL_RC6p_ENABLE |
GEN6_RC_CTL_RC6_ENABLE;
 
@@ -8413,7 +8440,7 @@ void ironlake_enable_rc6(struct drm_device *dev)
/* rc6 disabled by default due to repeated reports of hanging during
 * boot and resume.
 */
-   if (!i915_enable_rc6)
+   if (!intel_enable_rc6(dev))
return;
 
mutex_lock(dev-struct_mutex);
-- 
1.7.7.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 6/8] drm/i915: enable semaphores on per-device defaults

2011-12-09 Thread Keith Packard
On Mon, 28 Nov 2011 16:15:19 -0200, Eugeni Dodonov eugeni.dodo...@intel.com 
wrote:

 For now, as semaphores interaction with VTd causes random issues on SNB,
 we do not enable them by default. But they can still be enabled via the
 semaphores=1 kernel parameter.

Could we enable semaphores on SNB when VTd is not running, just like
we're going to do for RC6?

-- 
keith.pack...@intel.com


pgp0bOvaqam6v.pgp
Description: PGP signature
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: enable semaphores on per-device defaults

2011-12-09 Thread Eugeni Dodonov
This adds a default setting for semaphores parameter, and enables
semaphores by default on IVB.

For now, as semaphores interaction with VTd causes random issues on SNB,
we do not enable them by default. But they can still be enabled via the
semaphores=1 kernel parameter.

v2: enables semaphores on SNB when IO remapping is disabled, with base on
Keith Packard patch.

CC: Daniel Vetter daniel.vet...@ffwll.ch
CC: Ben Widawsky b...@bwidawsk.net
CC: Keith Packard kei...@keithp.com
CC: Jesse Barnes jbar...@virtuousgeek.org
CC: Chris Wilson ch...@chris-wilson.co.uk
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42696
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40564
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41353
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38862
Reviewed-by: Chris Wilson ch...@chris-wilson.co.uk
Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch
Signed-off-by: Eugeni Dodonov eugeni.dodo...@intel.com
---
 drivers/gpu/drm/i915/i915_drv.c|4 ++--
 drivers/gpu/drm/i915/i915_drv.h|2 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |   19 ++-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7e7b4b2..cd0a625 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -58,10 +58,10 @@ module_param_named(powersave, i915_powersave, int, 0600);
 MODULE_PARM_DESC(powersave,
Enable powersavings, fbc, downclocking, etc. (default: true));
 
-unsigned int i915_semaphores __read_mostly = 0;
+int i915_semaphores __read_mostly = -1;
 module_param_named(semaphores, i915_semaphores, int, 0600);
 MODULE_PARM_DESC(semaphores,
-   Use semaphores for inter-ring sync (default: false));
+   Use semaphores for inter-ring sync (default: -1 (use per-chip 
defaults)));
 
 int i915_enable_rc6 __read_mostly = -1;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 42de1ba..939a8bc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -997,7 +997,7 @@ extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc __always_unused;
 extern int i915_panel_ignore_lid __read_mostly;
 extern unsigned int i915_powersave __read_mostly;
-extern unsigned int i915_semaphores __read_mostly;
+extern int i915_semaphores __read_mostly;
 extern unsigned int i915_lvds_downclock __read_mostly;
 extern unsigned int i915_panel_use_ssc __read_mostly;
 extern int i915_vbt_sdvo_panel_type __read_mostly;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3693e83..c681dc1 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -32,6 +32,7 @@
 #include i915_drv.h
 #include i915_trace.h
 #include intel_drv.h
+#include linux/dma_remapping.h
 
 struct change_domains {
uint32_t invalidate_domains;
@@ -746,6 +747,22 @@ i915_gem_execbuffer_flush(struct drm_device *dev,
return 0;
 }
 
+static bool
+intel_enable_semaphores(struct drm_device *dev)
+{
+   if (INTEL_INFO(dev)-gen  6)
+   return 0;
+
+   if (i915_semaphores = 0)
+   return i915_semaphores;
+
+   /* Enable semaphores on SNB when IO remapping is off */
+   if (INTEL_INFO(dev)-gen == 6)
+   return !intel_iommu_enabled;
+
+   return 1;
+}
+
 static int
 i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
   struct intel_ring_buffer *to)
@@ -758,7 +775,7 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object 
*obj,
return 0;
 
/* XXX gpu semaphores are implicated in various hard hangs on SNB */
-   if (INTEL_INFO(obj-base.dev)-gen  6 || !i915_semaphores)
+   if (!intel_enable_semaphores(obj-base.dev))
return i915_gem_object_wait_rendering(obj);
 
idx = intel_ring_sync_index(from, to);
-- 
1.7.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] kernel BUG at drivers/gpu/drm/i915/i915_gem

2011-12-09 Thread Daniel Vetter
On Sat, Dec 10, 2011 at 03:09, Rocko Requin rockoreq...@hotmail.com wrote:
 Please report bugs always on the public
 mailing list so that all interest people can join in

 Apologies, I used to log them to the kernel bug tracker, which never came
 back up after kernel.org was rebuilt, and I didn't want to bother the public
 list.

You've trimmed the cc: list and removed intel-gfx and linux-kernel.
Don't do that, people won't see your reply otherwise. Re-added to the
cc: list.

 Unfortunately you've cut out the backtrace from the
 kernel oops, so I can't tell anything more.

 It wasn't me! The kernel locked up before it could complete writing the
 backtrace to the log, so it simply isn't there (and unfortunately the PC
 didn't switch to a tty to display it). There is the beginning of a backtrace
 from the same bug the day before, but it doesn't get much past the invalid
 opcode line

If you can wire up netconsole you should be able to gather the full
backtrace and that would be really useful. Otherwise can you please
confirm by reverting that commit from your current tree that it is
indeed the culprit? Otherwise please bisect the issue.
-Daniel
-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx