Skip to content

Commit b81e059

Browse files
committed
Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
So here's my promised pile of fixes for 3.9. I've dropped the core prep patches for vt-switchless suspend/resume as discussed on irc. Highlights: - Fix dmar on g4x. Not really gfx related, but I'm fed up with getting blamed for dmar crapouts. - Disable wc ptes updates on ilk when dmar is enabled (Chris). So again, dmar, but this time gfx related :( - Reduced range support for hsw, using the pipe CSC (Ville). - Fixup pll limits for gen3/4 (Patrick Jakobsson). The sdvo patch is already confirmed to fix 2 bug reports, so added cc: stable on that one. - Regression fix for 8bit fb console (Ville). - Preserve lane reversal bits on DDI/FDI ports (Damien). - Page flip vs. gpu hang fixes (Ville). Unfortuntely not quite all of them, need to decide what to do with the currently still in-flight ones. - Panel fitter regression fix from Mika Kuoppala (was accidentally left on on some pipes with the new modset code since 3.7). This also improves the modeset sequence and might help a few other unrelated issues with lvds. - Write backlight regs even harder ... another installement in our eternal fight against the BIOS and backlights. - Fixup lid notifier vs. suspend/resume races (Zhang Rui). Prep work for new ACPI stuff, but closing the race itself seems worthwile on its own. - A few other small fixes and tiny cleanups all over. Lots of the patches are cc: stable since I've stalled on a few not-so-important fixes for 3.8 due to the grumpy noise Linus made. * 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel: (33 commits) intel/iommu: force writebuffer-flush quirk on Gen 4 Chipsets drm/i915: Disable WC PTE updates to w/a buggy IOMMU on ILK drm/i915: Implement pipe CSC based limited range RGB output drm/i915: inverted brightness quirk for Acer Aspire 4736Z drm/i915: Print the hw context status is debugfs drm/i915: Use HAS_L3_GPU_CACHE in i915_gem_l3_remap drm/i915: Fix PIPE_CONTROL DW/QW write through global GTT on IVB+ drm/i915: Set i9xx sdvo clock limits according to specifications drm/i915: Set i9xx lvds clock limits according to specifications drm/i915: Preserve the DDI link reversal configuration drm/i915: Preserve the FDI line reversal override bit on CPT drm/i915: add missing \n to UTS_RELEASE in the error_state drm: Use C8 instead of RGB332 when determining the format from depth/bpp drm: Fill depth/bits_per_pixel for C8 format drm/i915: don't clflush gem objects in stolen memory drm/i915: Don't wait for page flips if there was GPU reset drm/i915: Kill obj->pending_flip drm/i915: Fix a typo in a intel_modeset_stage_output_state() comment drm/i915: remove bogus mutex_unlock from error-path drm/i915: Print the pipe control page GTT address ...
2 parents 35f8bad + 210561f commit b81e059

24 files changed

Lines changed: 482 additions & 238 deletions

‎drivers/char/agp/intel-gtt.c‎

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,40 @@ static void intel_gtt_cleanup(void)
572572
intel_gtt_teardown_scratch_page();
573573
}
574574

575+
/* Certain Gen5 chipsets require require idling the GPU before
576+
* unmapping anything from the GTT when VT-d is enabled.
577+
*/
578+
static inline int needs_ilk_vtd_wa(void)
579+
{
580+
#ifdef CONFIG_INTEL_IOMMU
581+
const unsigned short gpu_devid = intel_private.pcidev->device;
582+
583+
/* Query intel_iommu to see if we need the workaround. Presumably that
584+
* was loaded first.
585+
*/
586+
if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB ||
587+
gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
588+
intel_iommu_gfx_mapped)
589+
return 1;
590+
#endif
591+
return 0;
592+
}
593+
594+
static bool intel_gtt_can_wc(void)
595+
{
596+
if (INTEL_GTT_GEN <= 2)
597+
return false;
598+
599+
if (INTEL_GTT_GEN >= 6)
600+
return false;
601+
602+
/* Reports of major corruption with ILK vt'd enabled */
603+
if (needs_ilk_vtd_wa())
604+
return false;
605+
606+
return true;
607+
}
608+
575609
static int intel_gtt_init(void)
576610
{
577611
u32 gma_addr;
@@ -601,7 +635,7 @@ static int intel_gtt_init(void)
601635
gtt_map_size = intel_private.gtt_total_entries * 4;
602636

603637
intel_private.gtt = NULL;
604-
if (INTEL_GTT_GEN < 6 && INTEL_GTT_GEN > 2)
638+
if (intel_gtt_can_wc())
605639
intel_private.gtt = ioremap_wc(intel_private.gtt_bus_addr,
606640
gtt_map_size);
607641
if (intel_private.gtt == NULL)
@@ -1072,7 +1106,6 @@ static void i965_write_entry(dma_addr_t addr,
10721106
writel(addr | pte_flags, intel_private.gtt + entry);
10731107
}
10741108

1075-
10761109
static int i9xx_setup(void)
10771110
{
10781111
u32 reg_addr, gtt_addr;
@@ -1371,10 +1404,13 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
13711404
}
13721405
EXPORT_SYMBOL(intel_gmch_probe);
13731406

1374-
void intel_gtt_get(size_t *gtt_total, size_t *stolen_size)
1407+
void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
1408+
phys_addr_t *mappable_base, unsigned long *mappable_end)
13751409
{
13761410
*gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
13771411
*stolen_size = intel_private.stolen_size;
1412+
*mappable_base = intel_private.gma_bus_addr;
1413+
*mappable_end = intel_private.gtt_mappable_entries << PAGE_SHIFT;
13781414
}
13791415
EXPORT_SYMBOL(intel_gtt_get);
13801416

‎drivers/gpu/drm/drm_crtc.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
22672267

22682268
switch (bpp) {
22692269
case 8:
2270-
fmt = DRM_FORMAT_RGB332;
2270+
fmt = DRM_FORMAT_C8;
22712271
break;
22722272
case 16:
22732273
if (depth == 15)
@@ -3870,6 +3870,7 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
38703870
int *bpp)
38713871
{
38723872
switch (format) {
3873+
case DRM_FORMAT_C8:
38733874
case DRM_FORMAT_RGB332:
38743875
case DRM_FORMAT_BGR233:
38753876
*depth = 8;

‎drivers/gpu/drm/i915/i915_debugfs.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
694694

695695
seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
696696
error->time.tv_usec);
697-
seq_printf(m, "Kernel: " UTS_RELEASE);
697+
seq_printf(m, "Kernel: " UTS_RELEASE "\n");
698698
seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
699699
seq_printf(m, "EIR: 0x%08x\n", error->eir);
700700
seq_printf(m, "IER: 0x%08x\n", error->ier);
@@ -1484,7 +1484,8 @@ static int i915_context_status(struct seq_file *m, void *unused)
14841484
struct drm_info_node *node = (struct drm_info_node *) m->private;
14851485
struct drm_device *dev = node->minor->dev;
14861486
drm_i915_private_t *dev_priv = dev->dev_private;
1487-
int ret;
1487+
struct intel_ring_buffer *ring;
1488+
int ret, i;
14881489

14891490
ret = mutex_lock_interruptible(&dev->mode_config.mutex);
14901491
if (ret)
@@ -1502,6 +1503,14 @@ static int i915_context_status(struct seq_file *m, void *unused)
15021503
seq_printf(m, "\n");
15031504
}
15041505

1506+
for_each_ring(ring, dev_priv, i) {
1507+
if (ring->default_context) {
1508+
seq_printf(m, "HW default context %s ring ", ring->name);
1509+
describe_obj(m, ring->default_context->obj);
1510+
seq_printf(m, "\n");
1511+
}
1512+
}
1513+
15051514
mutex_unlock(&dev->mode_config.mutex);
15061515

15071516
return 0;

‎drivers/gpu/drm/i915/i915_dma.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
16101610
mutex_init(&dev_priv->dpio_lock);
16111611

16121612
mutex_init(&dev_priv->rps.hw_lock);
1613+
mutex_init(&dev_priv->modeset_restore_lock);
16131614

16141615
if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
16151616
dev_priv->num_pipe = 3;

‎drivers/gpu/drm/i915/i915_drv.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,11 @@ static int i915_drm_freeze(struct drm_device *dev)
470470
{
471471
struct drm_i915_private *dev_priv = dev->dev_private;
472472

473+
/* ignore lid events during suspend */
474+
mutex_lock(&dev_priv->modeset_restore_lock);
475+
dev_priv->modeset_restore = MODESET_SUSPENDED;
476+
mutex_unlock(&dev_priv->modeset_restore_lock);
477+
473478
intel_set_power_well(dev, true);
474479

475480
drm_kms_helper_poll_disable(dev);
@@ -496,9 +501,6 @@ static int i915_drm_freeze(struct drm_device *dev)
496501

497502
intel_opregion_fini(dev);
498503

499-
/* Modeset on resume, not lid events */
500-
dev_priv->modeset_on_lid = 0;
501-
502504
console_lock();
503505
intel_fbdev_set_suspend(dev, 1);
504506
console_unlock();
@@ -574,8 +576,6 @@ static int __i915_drm_thaw(struct drm_device *dev)
574576

575577
intel_opregion_init(dev);
576578

577-
dev_priv->modeset_on_lid = 0;
578-
579579
/*
580580
* The console lock can be pretty contented on resume due
581581
* to all the printk activity. Try to keep it out of the hot
@@ -588,6 +588,9 @@ static int __i915_drm_thaw(struct drm_device *dev)
588588
schedule_work(&dev_priv->console_resume_work);
589589
}
590590

591+
mutex_lock(&dev_priv->modeset_restore_lock);
592+
dev_priv->modeset_restore = MODESET_DONE;
593+
mutex_unlock(&dev_priv->modeset_restore_lock);
591594
return error;
592595
}
593596

‎drivers/gpu/drm/i915/i915_drv.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ struct i915_gtt {
399399

400400
/* global gtt ops */
401401
int (*gtt_probe)(struct drm_device *dev, size_t *gtt_total,
402-
size_t *stolen);
402+
size_t *stolen, phys_addr_t *mappable_base,
403+
unsigned long *mappable_end);
403404
void (*gtt_remove)(struct drm_device *dev);
404405
void (*gtt_clear_range)(struct drm_device *dev,
405406
unsigned int first_entry,
@@ -846,6 +847,12 @@ struct i915_gpu_error {
846847
unsigned int stop_rings;
847848
};
848849

850+
enum modeset_restore {
851+
MODESET_ON_LID_OPEN,
852+
MODESET_DONE,
853+
MODESET_SUSPENDED,
854+
};
855+
849856
typedef struct drm_i915_private {
850857
struct drm_device *dev;
851858
struct kmem_cache *slab;
@@ -919,7 +926,7 @@ typedef struct drm_i915_private {
919926

920927
/* overlay */
921928
struct intel_overlay *overlay;
922-
bool sprite_scaling_enabled;
929+
unsigned int sprite_scaling_enabled;
923930

924931
/* LVDS info */
925932
int backlight_level; /* restore backlight to this value */
@@ -967,8 +974,8 @@ typedef struct drm_i915_private {
967974

968975
unsigned long quirks;
969976

970-
/* Register state */
971-
bool modeset_on_lid;
977+
enum modeset_restore modeset_restore;
978+
struct mutex modeset_restore_lock;
972979

973980
struct i915_gtt gtt;
974981

@@ -1033,7 +1040,7 @@ typedef struct drm_i915_private {
10331040
bool hw_contexts_disabled;
10341041
uint32_t hw_context_size;
10351042

1036-
bool fdi_rx_polarity_reversed;
1043+
u32 fdi_rx_config;
10371044

10381045
struct i915_suspend_saved_registers regfile;
10391046

@@ -1208,13 +1215,6 @@ struct drm_i915_gem_object {
12081215

12091216
/** for phy allocated objects */
12101217
struct drm_i915_gem_phys_object *phys_obj;
1211-
1212-
/**
1213-
* Number of crtcs where this object is currently the fb, but
1214-
* will be page flipped away on the next vblank. When it
1215-
* reaches 0, dev_priv->pending_flip_queue will be woken up.
1216-
*/
1217-
atomic_t pending_flip;
12181218
};
12191219
#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)
12201220

‎drivers/gpu/drm/i915/i915_gem.c‎

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,13 @@ i915_gem_clflush_object(struct drm_i915_gem_object *obj)
30213021
if (obj->pages == NULL)
30223022
return;
30233023

3024+
/*
3025+
* Stolen memory is always coherent with the GPU as it is explicitly
3026+
* marked as wc by the system, or the system is cache-coherent.
3027+
*/
3028+
if (obj->stolen)
3029+
return;
3030+
30243031
/* If the GPU is snooping the contents of the CPU cache,
30253032
* we do not need to manually clear the CPU cache lines. However,
30263033
* the caches are only snooped when the render cache is
@@ -3865,7 +3872,7 @@ void i915_gem_l3_remap(struct drm_device *dev)
38653872
u32 misccpctl;
38663873
int i;
38673874

3868-
if (!IS_IVYBRIDGE(dev))
3875+
if (!HAS_L3_GPU_CACHE(dev))
38693876
return;
38703877

38713878
if (!dev_priv->l3_parity.remap_info)
@@ -3930,22 +3937,11 @@ intel_enable_blt(struct drm_device *dev)
39303937
return true;
39313938
}
39323939

3933-
int
3934-
i915_gem_init_hw(struct drm_device *dev)
3940+
static int i915_gem_init_rings(struct drm_device *dev)
39353941
{
3936-
drm_i915_private_t *dev_priv = dev->dev_private;
3942+
struct drm_i915_private *dev_priv = dev->dev_private;
39373943
int ret;
39383944

3939-
if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
3940-
return -EIO;
3941-
3942-
if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
3943-
I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
3944-
3945-
i915_gem_l3_remap(dev);
3946-
3947-
i915_gem_init_swizzling(dev);
3948-
39493945
ret = intel_init_render_ring_buffer(dev);
39503946
if (ret)
39513947
return ret;
@@ -3963,6 +3959,38 @@ i915_gem_init_hw(struct drm_device *dev)
39633959
}
39643960

39653961
ret = i915_gem_set_seqno(dev, ((u32)~0 - 0x1000));
3962+
if (ret)
3963+
goto cleanup_blt_ring;
3964+
3965+
return 0;
3966+
3967+
cleanup_blt_ring:
3968+
intel_cleanup_ring_buffer(&dev_priv->ring[BCS]);
3969+
cleanup_bsd_ring:
3970+
intel_cleanup_ring_buffer(&dev_priv->ring[VCS]);
3971+
cleanup_render_ring:
3972+
intel_cleanup_ring_buffer(&dev_priv->ring[RCS]);
3973+
3974+
return ret;
3975+
}
3976+
3977+
int
3978+
i915_gem_init_hw(struct drm_device *dev)
3979+
{
3980+
drm_i915_private_t *dev_priv = dev->dev_private;
3981+
int ret;
3982+
3983+
if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
3984+
return -EIO;
3985+
3986+
if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
3987+
I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
3988+
3989+
i915_gem_l3_remap(dev);
3990+
3991+
i915_gem_init_swizzling(dev);
3992+
3993+
ret = i915_gem_init_rings(dev);
39663994
if (ret)
39673995
return ret;
39683996

@@ -3974,12 +4002,6 @@ i915_gem_init_hw(struct drm_device *dev)
39744002
i915_gem_init_ppgtt(dev);
39754003

39764004
return 0;
3977-
3978-
cleanup_bsd_ring:
3979-
intel_cleanup_ring_buffer(&dev_priv->ring[VCS]);
3980-
cleanup_render_ring:
3981-
intel_cleanup_ring_buffer(&dev_priv->ring[RCS]);
3982-
return ret;
39834005
}
39844006

39854007
int i915_gem_init(struct drm_device *dev)

‎drivers/gpu/drm/i915/i915_gem_context.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,8 @@ static int get_context_size(struct drm_device *dev)
126126

127127
static void do_destroy(struct i915_hw_context *ctx)
128128
{
129-
struct drm_device *dev = ctx->obj->base.dev;
130-
struct drm_i915_private *dev_priv = dev->dev_private;
131-
132129
if (ctx->file_priv)
133130
idr_remove(&ctx->file_priv->context_idr, ctx->id);
134-
else
135-
BUG_ON(ctx != dev_priv->ring[RCS].default_context);
136131

137132
drm_gem_object_unreference(&ctx->obj->base);
138133
kfree(ctx);
@@ -242,7 +237,6 @@ static int create_default_context(struct drm_i915_private *dev_priv)
242237
void i915_gem_context_init(struct drm_device *dev)
243238
{
244239
struct drm_i915_private *dev_priv = dev->dev_private;
245-
uint32_t ctx_size;
246240

247241
if (!HAS_HW_CONTEXTS(dev)) {
248242
dev_priv->hw_contexts_disabled = true;
@@ -254,11 +248,9 @@ void i915_gem_context_init(struct drm_device *dev)
254248
dev_priv->ring[RCS].default_context)
255249
return;
256250

257-
ctx_size = get_context_size(dev);
258-
dev_priv->hw_context_size = get_context_size(dev);
259-
dev_priv->hw_context_size = round_up(dev_priv->hw_context_size, 4096);
251+
dev_priv->hw_context_size = round_up(get_context_size(dev), 4096);
260252

261-
if (ctx_size <= 0 || ctx_size > (1<<20)) {
253+
if (dev_priv->hw_context_size > (1<<20)) {
262254
dev_priv->hw_contexts_disabled = true;
263255
return;
264256
}

0 commit comments

Comments
 (0)