aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2013-08-28 11:39:08 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-03 13:17:59 -0400
commit81b5c7bc8de3e6f63419139c2fc91bf81dea8a7d (patch)
treef7b04c2dad467cc072c774c7b7dbbd6d179f4eee
parent5c0f6ee766d7c689e71a7df5e5fa87941affd75a (diff)
i915: Update VGA arbiter support for newer devices
This is intended to add VGA arbiter support for Intel HD graphics on Core processors. The old GMCH registers no longer exist, so even though it appears that i915 participates in VGA arbitration, it doesn't work. On Intel HD graphics we already attempt to disable VGA regions of the device. This makes registering as a VGA client unnecessary since we don't intend to operate differently depending on how many VGA devices are present. We can disable VGA memory regions by clearing the memory enable bit in the VGA MSR. That only leaves VGA IO, which we update the VGA arbiter to know that we don't participate in VGA memory arbitration. We also add a hook on unload to re-enable memory and reinstate VGA memory arbitration. v3: Use explicit LEGACY_IO | LEGACY_MEM when restoring rather than LEGACY_MASK, per Ville's comments. v2: I915_READ/WRITE accessors don't work in i915_disable_vga, use inb/outb directly. Also, on the driver unbind VGA enable path, acquire legacy IO to re-enable VGA memory. Correct comment. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> [danvet: Add patch changelog. Also squash in a fixup to have a dummy static inline for vga_set_legacy_decoding for CONFIG_VGA_ARB=n as reported by the 0-day kernel build bot.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> fixup 2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c9
-rw-r--r--drivers/gpu/drm/i915/intel_display.c25
-rw-r--r--include/linux/vgaarb.h7
3 files changed, 38 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index fdaa0915ce56..3de60503378e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1290,9 +1290,12 @@ static int i915_load_modeset_init(struct drm_device *dev)
1290 * then we do not take part in VGA arbitration and the 1290 * then we do not take part in VGA arbitration and the
1291 * vga_client_register() fails with -ENODEV. 1291 * vga_client_register() fails with -ENODEV.
1292 */ 1292 */
1293 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); 1293 if (!HAS_PCH_SPLIT(dev)) {
1294 if (ret && ret != -ENODEV) 1294 ret = vga_client_register(dev->pdev, dev, NULL,
1295 goto out; 1295 i915_vga_set_decode);
1296 if (ret && ret != -ENODEV)
1297 goto out;
1298 }
1296 1299
1297 intel_register_dsm_handler(); 1300 intel_register_dsm_handler();
1298 1301
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a1e502b07266..73dec62f871f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10041,6 +10041,15 @@ static void i915_disable_vga(struct drm_device *dev)
10041 outb(SR01, VGA_SR_INDEX); 10041 outb(SR01, VGA_SR_INDEX);
10042 sr1 = inb(VGA_SR_DATA); 10042 sr1 = inb(VGA_SR_DATA);
10043 outb(sr1 | 1<<5, VGA_SR_DATA); 10043 outb(sr1 | 1<<5, VGA_SR_DATA);
10044
10045 /* Disable VGA memory on Intel HD */
10046 if (HAS_PCH_SPLIT(dev)) {
10047 outb(inb(VGA_MSR_READ) & ~VGA_MSR_MEM_EN, VGA_MSR_WRITE);
10048 vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
10049 VGA_RSRC_NORMAL_IO |
10050 VGA_RSRC_NORMAL_MEM);
10051 }
10052
10044 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); 10053 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
10045 udelay(300); 10054 udelay(300);
10046 10055
@@ -10048,6 +10057,20 @@ static void i915_disable_vga(struct drm_device *dev)
10048 POSTING_READ(vga_reg); 10057 POSTING_READ(vga_reg);
10049} 10058}
10050 10059
10060static void i915_enable_vga(struct drm_device *dev)
10061{
10062 /* Enable VGA memory on Intel HD */
10063 if (HAS_PCH_SPLIT(dev)) {
10064 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
10065 outb(inb(VGA_MSR_READ) | VGA_MSR_MEM_EN, VGA_MSR_WRITE);
10066 vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
10067 VGA_RSRC_LEGACY_MEM |
10068 VGA_RSRC_NORMAL_IO |
10069 VGA_RSRC_NORMAL_MEM);
10070 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
10071 }
10072}
10073
10051void intel_modeset_init_hw(struct drm_device *dev) 10074void intel_modeset_init_hw(struct drm_device *dev)
10052{ 10075{
10053 intel_init_power_well(dev); 10076 intel_init_power_well(dev);
@@ -10539,6 +10562,8 @@ void intel_modeset_cleanup(struct drm_device *dev)
10539 10562
10540 intel_disable_fbc(dev); 10563 intel_disable_fbc(dev);
10541 10564
10565 i915_enable_vga(dev);
10566
10542 intel_disable_gt_powersave(dev); 10567 intel_disable_gt_powersave(dev);
10543 10568
10544 ironlake_teardown_rc6(dev); 10569 ironlake_teardown_rc6(dev);
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..80cf8173a65b 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,8 +65,15 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
68extern void vga_set_legacy_decoding(struct pci_dev *pdev, 69extern void vga_set_legacy_decoding(struct pci_dev *pdev,
69 unsigned int decodes); 70 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes)
74{
75}
76#endif
70 77
71/** 78/**
72 * vga_get - acquire & locks VGA resources 79 * vga_get - acquire & locks VGA resources