aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2014-06-11 04:14:08 -0400
committerJani Nikula <jani.nikula@intel.com>2014-06-11 04:38:41 -0400
commitce9557b9fe17012dea2447e643a1047c27a00838 (patch)
treeb0ba245c242cd07406ee729f14c0f02691a5599b
parent329ff963fd4c1356af66b878b11460388cb5f5dd (diff)
parenta4de05268e674e8ed31df6348269e22d6c6a1803 (diff)
Merge remote-tracking branch 'drm-intel/topic/kicking-dogs-and-vgacon' into drm-intel-fixes
vt/vgacon fixes to avoid hangs, unclaimed register errors on module load, reload: vt: Fix replacement console check when unbinding vt: Fix up unregistration of vt drivers vt: Don't ignore unbind errors in vt_unbind drm/i915: Fixup global gtt cleanup drm/i915: Kick out vga console Link: http://lkml.kernel.org/r/1401980308-5116-1-git-send-email-daniel.vetter@ffwll.ch Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c47
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c9
-rw-r--r--drivers/tty/vt/vt.c24
-rw-r--r--drivers/video/console/dummycon.c1
-rw-r--r--drivers/video/console/vgacon.c1
5 files changed, 66 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 4c22a5b7f4c5..6c656392d67d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -36,6 +36,8 @@
36#include "i915_drv.h" 36#include "i915_drv.h"
37#include "i915_trace.h" 37#include "i915_trace.h"
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/console.h>
40#include <linux/vt.h>
39#include <linux/vgaarb.h> 41#include <linux/vgaarb.h>
40#include <linux/acpi.h> 42#include <linux/acpi.h>
41#include <linux/pnp.h> 43#include <linux/pnp.h>
@@ -1386,7 +1388,6 @@ cleanup_gem:
1386 i915_gem_context_fini(dev); 1388 i915_gem_context_fini(dev);
1387 mutex_unlock(&dev->struct_mutex); 1389 mutex_unlock(&dev->struct_mutex);
1388 WARN_ON(dev_priv->mm.aliasing_ppgtt); 1390 WARN_ON(dev_priv->mm.aliasing_ppgtt);
1389 drm_mm_takedown(&dev_priv->gtt.base.mm);
1390cleanup_irq: 1391cleanup_irq:
1391 drm_irq_uninstall(dev); 1392 drm_irq_uninstall(dev);
1392cleanup_gem_stolen: 1393cleanup_gem_stolen:
@@ -1450,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
1450} 1451}
1451#endif 1452#endif
1452 1453
1454#if !defined(CONFIG_VGA_CONSOLE)
1455static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1456{
1457 return 0;
1458}
1459#elif !defined(CONFIG_DUMMY_CONSOLE)
1460static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1461{
1462 return -ENODEV;
1463}
1464#else
1465static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1466{
1467 int ret;
1468
1469 DRM_INFO("Replacing VGA console driver\n");
1470
1471 console_lock();
1472 ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
1473 if (ret == 0) {
1474 ret = do_unregister_con_driver(&vga_con);
1475
1476 /* Ignore "already unregistered". */
1477 if (ret == -ENODEV)
1478 ret = 0;
1479 }
1480 console_unlock();
1481
1482 return ret;
1483}
1484#endif
1485
1453static void i915_dump_device_info(struct drm_i915_private *dev_priv) 1486static void i915_dump_device_info(struct drm_i915_private *dev_priv)
1454{ 1487{
1455 const struct intel_device_info *info = &dev_priv->info; 1488 const struct intel_device_info *info = &dev_priv->info;
@@ -1623,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1623 if (ret) 1656 if (ret)
1624 goto out_regs; 1657 goto out_regs;
1625 1658
1626 if (drm_core_check_feature(dev, DRIVER_MODESET)) 1659 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1660 ret = i915_kick_out_vgacon(dev_priv);
1661 if (ret) {
1662 DRM_ERROR("failed to remove conflicting VGA console\n");
1663 goto out_gtt;
1664 }
1665
1627 i915_kick_out_firmware_fb(dev_priv); 1666 i915_kick_out_firmware_fb(dev_priv);
1667 }
1628 1668
1629 pci_set_master(dev->pdev); 1669 pci_set_master(dev->pdev);
1630 1670
@@ -1756,8 +1796,6 @@ out_mtrrfree:
1756 arch_phys_wc_del(dev_priv->gtt.mtrr); 1796 arch_phys_wc_del(dev_priv->gtt.mtrr);
1757 io_mapping_free(dev_priv->gtt.mappable); 1797 io_mapping_free(dev_priv->gtt.mappable);
1758out_gtt: 1798out_gtt:
1759 list_del(&dev_priv->gtt.base.global_link);
1760 drm_mm_takedown(&dev_priv->gtt.base.mm);
1761 dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); 1799 dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
1762out_regs: 1800out_regs:
1763 intel_uncore_fini(dev); 1801 intel_uncore_fini(dev);
@@ -1846,7 +1884,6 @@ int i915_driver_unload(struct drm_device *dev)
1846 i915_free_hws(dev); 1884 i915_free_hws(dev);
1847 } 1885 }
1848 1886
1849 list_del(&dev_priv->gtt.base.global_link);
1850 WARN_ON(!list_empty(&dev_priv->vm_list)); 1887 WARN_ON(!list_empty(&dev_priv->vm_list));
1851 1888
1852 drm_vblank_cleanup(dev); 1889 drm_vblank_cleanup(dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index eec820aec022..8b3cde703364 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1992,7 +1992,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
1992 1992
1993 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); 1993 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
1994 1994
1995 drm_mm_takedown(&vm->mm); 1995 if (drm_mm_initialized(&vm->mm)) {
1996 drm_mm_takedown(&vm->mm);
1997 list_del(&vm->global_link);
1998 }
1996 iounmap(gtt->gsm); 1999 iounmap(gtt->gsm);
1997 teardown_scratch_page(vm->dev); 2000 teardown_scratch_page(vm->dev);
1998} 2001}
@@ -2025,6 +2028,10 @@ static int i915_gmch_probe(struct drm_device *dev,
2025 2028
2026static void i915_gmch_remove(struct i915_address_space *vm) 2029static void i915_gmch_remove(struct i915_address_space *vm)
2027{ 2030{
2031 if (drm_mm_initialized(&vm->mm)) {
2032 drm_mm_takedown(&vm->mm);
2033 list_del(&vm->global_link);
2034 }
2028 intel_gmch_remove(); 2035 intel_gmch_remove();
2029} 2036}
2030 2037
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3ad0b61e35b4..3c00dcb3b145 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3155,8 +3155,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
3155 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3155 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3156 con_back = &registered_con_driver[i]; 3156 con_back = &registered_con_driver[i];
3157 3157
3158 if (con_back->con && 3158 if (con_back->con && con_back->con != csw) {
3159 !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
3160 defcsw = con_back->con; 3159 defcsw = con_back->con;
3161 retval = 0; 3160 retval = 0;
3162 break; 3161 break;
@@ -3261,6 +3260,7 @@ static int vt_unbind(struct con_driver *con)
3261{ 3260{
3262 const struct consw *csw = NULL; 3261 const struct consw *csw = NULL;
3263 int i, more = 1, first = -1, last = -1, deflt = 0; 3262 int i, more = 1, first = -1, last = -1, deflt = 0;
3263 int ret;
3264 3264
3265 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || 3265 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) ||
3266 con_is_graphics(con->con, con->first, con->last)) 3266 con_is_graphics(con->con, con->first, con->last))
@@ -3286,8 +3286,10 @@ static int vt_unbind(struct con_driver *con)
3286 3286
3287 if (first != -1) { 3287 if (first != -1) {
3288 console_lock(); 3288 console_lock();
3289 do_unbind_con_driver(csw, first, last, deflt); 3289 ret = do_unbind_con_driver(csw, first, last, deflt);
3290 console_unlock(); 3290 console_unlock();
3291 if (ret != 0)
3292 return ret;
3291 } 3293 }
3292 3294
3293 first = -1; 3295 first = -1;
@@ -3574,17 +3576,20 @@ err:
3574 */ 3576 */
3575int do_unregister_con_driver(const struct consw *csw) 3577int do_unregister_con_driver(const struct consw *csw)
3576{ 3578{
3577 int i, retval = -ENODEV; 3579 int i;
3578 3580
3579 /* cannot unregister a bound driver */ 3581 /* cannot unregister a bound driver */
3580 if (con_is_bound(csw)) 3582 if (con_is_bound(csw))
3581 goto err; 3583 return -EBUSY;
3584
3585 if (csw == conswitchp)
3586 return -EINVAL;
3582 3587
3583 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3588 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3584 struct con_driver *con_driver = &registered_con_driver[i]; 3589 struct con_driver *con_driver = &registered_con_driver[i];
3585 3590
3586 if (con_driver->con == csw && 3591 if (con_driver->con == csw &&
3587 con_driver->flag & CON_DRIVER_FLAG_MODULE) { 3592 con_driver->flag & CON_DRIVER_FLAG_INIT) {
3588 vtconsole_deinit_device(con_driver); 3593 vtconsole_deinit_device(con_driver);
3589 device_destroy(vtconsole_class, 3594 device_destroy(vtconsole_class,
3590 MKDEV(0, con_driver->node)); 3595 MKDEV(0, con_driver->node));
@@ -3595,12 +3600,11 @@ int do_unregister_con_driver(const struct consw *csw)
3595 con_driver->flag = 0; 3600 con_driver->flag = 0;
3596 con_driver->first = 0; 3601 con_driver->first = 0;
3597 con_driver->last = 0; 3602 con_driver->last = 0;
3598 retval = 0; 3603 return 0;
3599 break;
3600 } 3604 }
3601 } 3605 }
3602err: 3606
3603 return retval; 3607 return -ENODEV;
3604} 3608}
3605EXPORT_SYMBOL_GPL(do_unregister_con_driver); 3609EXPORT_SYMBOL_GPL(do_unregister_con_driver);
3606 3610
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index b63860f7beab..40bec8d64b0a 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -77,3 +77,4 @@ const struct consw dummy_con = {
77 .con_set_palette = DUMMY, 77 .con_set_palette = DUMMY,
78 .con_scrolldelta = DUMMY, 78 .con_scrolldelta = DUMMY,
79}; 79};
80EXPORT_SYMBOL_GPL(dummy_con);
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 9d8feac67637..84acd6223dc5 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1440,5 +1440,6 @@ const struct consw vga_con = {
1440 .con_build_attr = vgacon_build_attr, 1440 .con_build_attr = vgacon_build_attr,
1441 .con_invert_region = vgacon_invert_region, 1441 .con_invert_region = vgacon_invert_region,
1442}; 1442};
1443EXPORT_SYMBOL(vga_con);
1443 1444
1444MODULE_LICENSE("GPL"); 1445MODULE_LICENSE("GPL");