aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-12-11 20:39:49 -0500
committerDave Airlie <airlied@redhat.com>2014-12-11 20:39:49 -0500
commitb59f78228ca3d81ecb491fb17d348b07002dbe03 (patch)
treed3600fbc2382128962fefb24e2d956f1fee0803a
parentf41c2581bc2b6b21f774596845952a7cb4c15c74 (diff)
parent9f49c37635d5c2a801f7670d5fbf0b25ec461f2c (diff)
Merge tag 'drm-intel-next-fixes-2014-12-11' of git://anongit.freedesktop.org/drm-intel into drm-next
Here's a batch of i915 fixes for 3.19. * tag 'drm-intel-next-fixes-2014-12-11' of git://anongit.freedesktop.org/drm-intel: drm/i915: save/restore GMBUS freq across suspend/resume on gen4 drm/i915: Remove '& 0xffff' from the mask given to WA_REG() drm/i915: Invert the mask and val arguments in wa_add() and WA_REG() drm/i915/bdw: Fix the write setting up the WIZ hashing mode drm/i915: Don't complain about stolen conflicts on gen3 drm/i915: resume MST after reading back hw state drm/i915: Handle inaccurate time conversion issues drm/i915: compute wait_ioctl timeout correctly drm/i915: don't always do full mode sets when infoframes are enabled
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h6
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c13
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c6
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h18
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c8
-rw-r--r--drivers/gpu/drm/i915/intel_display.c10
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c6
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c24
-rw-r--r--kernel/time/time.c1
10 files changed, 72 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 1e9c136a874c..f990ab4c3efb 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -706,11 +706,12 @@ static int i915_drm_resume(struct drm_device *dev)
706 dev_priv->display.hpd_irq_setup(dev); 706 dev_priv->display.hpd_irq_setup(dev);
707 spin_unlock_irq(&dev_priv->irq_lock); 707 spin_unlock_irq(&dev_priv->irq_lock);
708 708
709 intel_dp_mst_resume(dev);
710 drm_modeset_lock_all(dev); 709 drm_modeset_lock_all(dev);
711 intel_modeset_setup_hw_state(dev, true); 710 intel_modeset_setup_hw_state(dev, true);
712 drm_modeset_unlock_all(dev); 711 drm_modeset_unlock_all(dev);
713 712
713 intel_dp_mst_resume(dev);
714
714 /* 715 /*
715 * ... but also need to make sure that hotplug processing 716 * ... but also need to make sure that hotplug processing
716 * doesn't cause havoc. Like in the driver load code we don't 717 * doesn't cause havoc. Like in the driver load code we don't
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index bb1892d72efe..63bcda5541ec 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -924,6 +924,7 @@ struct i915_suspend_saved_registers {
924 u32 savePIPEB_LINK_N1; 924 u32 savePIPEB_LINK_N1;
925 u32 saveMCHBAR_RENDER_STANDBY; 925 u32 saveMCHBAR_RENDER_STANDBY;
926 u32 savePCH_PORT_HOTPLUG; 926 u32 savePCH_PORT_HOTPLUG;
927 u16 saveGCDGMBUS;
927}; 928};
928 929
929struct vlv_s0ix_state { 930struct vlv_s0ix_state {
@@ -3032,6 +3033,11 @@ static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m)
3032 return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); 3033 return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
3033} 3034}
3034 3035
3036static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
3037{
3038 return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
3039}
3040
3035static inline unsigned long 3041static inline unsigned long
3036timespec_to_jiffies_timeout(const struct timespec *value) 3042timespec_to_jiffies_timeout(const struct timespec *value)
3037{ 3043{
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d2ba315f4c92..4a9faea626db 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1227,7 +1227,8 @@ int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno,
1227 if (i915_seqno_passed(ring->get_seqno(ring, true), seqno)) 1227 if (i915_seqno_passed(ring->get_seqno(ring, true), seqno))
1228 return 0; 1228 return 0;
1229 1229
1230 timeout_expire = timeout ? jiffies + nsecs_to_jiffies((u64)*timeout) : 0; 1230 timeout_expire = timeout ?
1231 jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0;
1231 1232
1232 if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) { 1233 if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) {
1233 gen6_rps_boost(dev_priv); 1234 gen6_rps_boost(dev_priv);
@@ -1303,6 +1304,16 @@ int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno,
1303 s64 tres = *timeout - (now - before); 1304 s64 tres = *timeout - (now - before);
1304 1305
1305 *timeout = tres < 0 ? 0 : tres; 1306 *timeout = tres < 0 ? 0 : tres;
1307
1308 /*
1309 * Apparently ktime isn't accurate enough and occasionally has a
1310 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
1311 * things up to make the test happy. We allow up to 1 jiffy.
1312 *
1313 * This is a regrssion from the timespec->ktime conversion.
1314 */
1315 if (ret == -ETIME && *timeout < jiffies_to_usecs(1)*1000)
1316 *timeout = 0;
1306 } 1317 }
1307 1318
1308 return ret; 1319 return ret;
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index c38891892547..a2045848bd1a 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -137,7 +137,11 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
137 r = devm_request_mem_region(dev->dev, base + 1, 137 r = devm_request_mem_region(dev->dev, base + 1,
138 dev_priv->gtt.stolen_size - 1, 138 dev_priv->gtt.stolen_size - 1,
139 "Graphics Stolen Memory"); 139 "Graphics Stolen Memory");
140 if (r == NULL) { 140 /*
141 * GEN3 firmware likes to smash pci bridges into the stolen
142 * range. Apparently this works.
143 */
144 if (r == NULL && !IS_GEN3(dev)) {
141 DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", 145 DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
142 base, base + (uint32_t)dev_priv->gtt.stolen_size); 146 base, base + (uint32_t)dev_priv->gtt.stolen_size);
143 base = 0; 147 base = 0;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 544675895c8d..eefdc238f70b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -32,8 +32,19 @@
32#define _PIPE3(pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \ 32#define _PIPE3(pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \
33 (pipe) == PIPE_B ? (b) : (c)) 33 (pipe) == PIPE_B ? (b) : (c))
34 34
35#define _MASKED_BIT_ENABLE(a) (((a) << 16) | (a)) 35#define _MASKED_FIELD(mask, value) ({ \
36#define _MASKED_BIT_DISABLE(a) ((a) << 16) 36 if (__builtin_constant_p(mask)) \
37 BUILD_BUG_ON_MSG(((mask) & 0xffff0000), "Incorrect mask"); \
38 if (__builtin_constant_p(value)) \
39 BUILD_BUG_ON_MSG((value) & 0xffff0000, "Incorrect value"); \
40 if (__builtin_constant_p(mask) && __builtin_constant_p(value)) \
41 BUILD_BUG_ON_MSG((value) & ~(mask), \
42 "Incorrect value for mask"); \
43 (mask) << 16 | (value); })
44#define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); })
45#define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0))
46
47
37 48
38/* PCI config space */ 49/* PCI config space */
39 50
@@ -74,6 +85,7 @@
74#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0) 85#define I915_GC_RENDER_CLOCK_166_MHZ (0 << 0)
75#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0) 86#define I915_GC_RENDER_CLOCK_200_MHZ (1 << 0)
76#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0) 87#define I915_GC_RENDER_CLOCK_333_MHZ (4 << 0)
88#define GCDGMBUS 0xcc
77#define PCI_LBPC 0xf4 /* legacy/combination backlight modes, also called LBB */ 89#define PCI_LBPC 0xf4 /* legacy/combination backlight modes, also called LBB */
78 90
79 91
@@ -1282,7 +1294,7 @@ enum punit_power_well {
1282#define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0) 1294#define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0)
1283#define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1) 1295#define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1)
1284#define GEN6_WIZ_HASHING_16x4 GEN6_WIZ_HASHING(1, 0) 1296#define GEN6_WIZ_HASHING_16x4 GEN6_WIZ_HASHING(1, 0)
1285#define GEN6_WIZ_HASHING_MASK (GEN6_WIZ_HASHING(1, 1) << 16) 1297#define GEN6_WIZ_HASHING_MASK GEN6_WIZ_HASHING(1, 1)
1286#define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5) 1298#define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
1287 1299
1288#define GFX_MODE 0x02520 1300#define GFX_MODE 0x02520
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index dfe661743398..26368822a33f 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -303,6 +303,10 @@ int i915_save_state(struct drm_device *dev)
303 } 303 }
304 } 304 }
305 305
306 if (IS_GEN4(dev))
307 pci_read_config_word(dev->pdev, GCDGMBUS,
308 &dev_priv->regfile.saveGCDGMBUS);
309
306 /* Cache mode state */ 310 /* Cache mode state */
307 if (INTEL_INFO(dev)->gen < 7) 311 if (INTEL_INFO(dev)->gen < 7)
308 dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0); 312 dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
@@ -331,6 +335,10 @@ int i915_restore_state(struct drm_device *dev)
331 mutex_lock(&dev->struct_mutex); 335 mutex_lock(&dev->struct_mutex);
332 336
333 i915_gem_restore_fences(dev); 337 i915_gem_restore_fences(dev);
338
339 if (IS_GEN4(dev))
340 pci_write_config_word(dev->pdev, GCDGMBUS,
341 dev_priv->regfile.saveGCDGMBUS);
334 i915_restore_display(dev); 342 i915_restore_display(dev);
335 343
336 if (!drm_core_check_feature(dev, DRIVER_MODESET)) { 344 if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 63247c64b1e0..fb3e3d429191 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11580,10 +11580,12 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
11580 to_intel_crtc(set->crtc)->config.has_audio) 11580 to_intel_crtc(set->crtc)->config.has_audio)
11581 config->mode_changed = true; 11581 config->mode_changed = true;
11582 11582
11583 /* Force mode sets for any infoframe stuff */ 11583 /*
11584 if (pipe_config->has_infoframe || 11584 * Note we have an issue here with infoframes: current code
11585 to_intel_crtc(set->crtc)->config.has_infoframe) 11585 * only updates them on the full mode set path per hw
11586 config->mode_changed = true; 11586 * requirements. So here we should be checking for any
11587 * required changes and forcing a mode set.
11588 */
11587 } 11589 }
11588 11590
11589 /* set_mode will free it in the mode_changed case */ 11591 /* set_mode will free it in the mode_changed case */
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9af0af49382e..1f4b56e273c8 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -6508,7 +6508,7 @@ static void gen6_init_clock_gating(struct drm_device *dev)
6508 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). 6508 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM).
6509 */ 6509 */
6510 I915_WRITE(GEN6_GT_MODE, 6510 I915_WRITE(GEN6_GT_MODE,
6511 GEN6_WIZ_HASHING_MASK | GEN6_WIZ_HASHING_16x4); 6511 _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4));
6512 6512
6513 ilk_init_lp_watermarks(dev); 6513 ilk_init_lp_watermarks(dev);
6514 6514
@@ -6706,7 +6706,7 @@ static void haswell_init_clock_gating(struct drm_device *dev)
6706 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). 6706 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM).
6707 */ 6707 */
6708 I915_WRITE(GEN7_GT_MODE, 6708 I915_WRITE(GEN7_GT_MODE,
6709 GEN6_WIZ_HASHING_MASK | GEN6_WIZ_HASHING_16x4); 6709 _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4));
6710 6710
6711 /* WaSwitchSolVfFArbitrationPriority:hsw */ 6711 /* WaSwitchSolVfFArbitrationPriority:hsw */
6712 I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL); 6712 I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
@@ -6803,7 +6803,7 @@ static void ivybridge_init_clock_gating(struct drm_device *dev)
6803 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). 6803 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM).
6804 */ 6804 */
6805 I915_WRITE(GEN7_GT_MODE, 6805 I915_WRITE(GEN7_GT_MODE,
6806 GEN6_WIZ_HASHING_MASK | GEN6_WIZ_HASHING_16x4); 6806 _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4));
6807 6807
6808 snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); 6808 snpcr = I915_READ(GEN6_MBCUNIT_SNPCR);
6809 snpcr &= ~GEN6_MBC_SNPCR_MASK; 6809 snpcr &= ~GEN6_MBC_SNPCR_MASK;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 1d01b51ff058..9f445e9a75d1 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -701,7 +701,7 @@ static int intel_ring_workarounds_emit(struct intel_engine_cs *ring,
701} 701}
702 702
703static int wa_add(struct drm_i915_private *dev_priv, 703static int wa_add(struct drm_i915_private *dev_priv,
704 const u32 addr, const u32 val, const u32 mask) 704 const u32 addr, const u32 mask, const u32 val)
705{ 705{
706 const u32 idx = dev_priv->workarounds.count; 706 const u32 idx = dev_priv->workarounds.count;
707 707
@@ -717,22 +717,25 @@ static int wa_add(struct drm_i915_private *dev_priv,
717 return 0; 717 return 0;
718} 718}
719 719
720#define WA_REG(addr, val, mask) { \ 720#define WA_REG(addr, mask, val) { \
721 const int r = wa_add(dev_priv, (addr), (val), (mask)); \ 721 const int r = wa_add(dev_priv, (addr), (mask), (val)); \
722 if (r) \ 722 if (r) \
723 return r; \ 723 return r; \
724 } 724 }
725 725
726#define WA_SET_BIT_MASKED(addr, mask) \ 726#define WA_SET_BIT_MASKED(addr, mask) \
727 WA_REG(addr, _MASKED_BIT_ENABLE(mask), (mask) & 0xffff) 727 WA_REG(addr, (mask), _MASKED_BIT_ENABLE(mask))
728 728
729#define WA_CLR_BIT_MASKED(addr, mask) \ 729#define WA_CLR_BIT_MASKED(addr, mask) \
730 WA_REG(addr, _MASKED_BIT_DISABLE(mask), (mask) & 0xffff) 730 WA_REG(addr, (mask), _MASKED_BIT_DISABLE(mask))
731 731
732#define WA_SET_BIT(addr, mask) WA_REG(addr, I915_READ(addr) | (mask), mask) 732#define WA_SET_FIELD_MASKED(addr, mask, value) \
733#define WA_CLR_BIT(addr, mask) WA_REG(addr, I915_READ(addr) & ~(mask), mask) 733 WA_REG(addr, mask, _MASKED_FIELD(mask, value))
734 734
735#define WA_WRITE(addr, val) WA_REG(addr, val, 0xffffffff) 735#define WA_SET_BIT(addr, mask) WA_REG(addr, mask, I915_READ(addr) | (mask))
736#define WA_CLR_BIT(addr, mask) WA_REG(addr, mask, I915_READ(addr) & ~(mask))
737
738#define WA_WRITE(addr, val) WA_REG(addr, 0xffffffff, val)
736 739
737static int bdw_init_workarounds(struct intel_engine_cs *ring) 740static int bdw_init_workarounds(struct intel_engine_cs *ring)
738{ 741{
@@ -773,8 +776,9 @@ static int bdw_init_workarounds(struct intel_engine_cs *ring)
773 * disable bit, which we don't touch here, but it's good 776 * disable bit, which we don't touch here, but it's good
774 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). 777 * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM).
775 */ 778 */
776 WA_SET_BIT_MASKED(GEN7_GT_MODE, 779 WA_SET_FIELD_MASKED(GEN7_GT_MODE,
777 GEN6_WIZ_HASHING_MASK | GEN6_WIZ_HASHING_16x4); 780 GEN6_WIZ_HASHING_MASK,
781 GEN6_WIZ_HASHING_16x4);
778 782
779 return 0; 783 return 0;
780} 784}
diff --git a/kernel/time/time.c b/kernel/time/time.c
index a9ae20fb0b11..8fae82ca5cbf 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -745,6 +745,7 @@ u64 nsecs_to_jiffies64(u64 n)
745 return div_u64(n * 9, (9ull * NSEC_PER_SEC + HZ / 2) / HZ); 745 return div_u64(n * 9, (9ull * NSEC_PER_SEC + HZ / 2) / HZ);
746#endif 746#endif
747} 747}
748EXPORT_SYMBOL(nsecs_to_jiffies64);
748 749
749/** 750/**
750 * nsecs_to_jiffies - Convert nsecs in u64 to jiffies 751 * nsecs_to_jiffies - Convert nsecs in u64 to jiffies