diff options
| author | Dave Airlie <airlied@redhat.com> | 2015-03-12 19:15:56 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2015-03-12 19:15:56 -0400 |
| commit | 552d6643412980044dfb9b38fcfe0179dbd77b28 (patch) | |
| tree | 79dda8f73fc57a4b2cc88dce84e242a694192525 | |
| parent | 17b263f6ea4692b031775df1028e367cfcaad950 (diff) | |
| parent | fd3e4d6e26288d12b566912f692e278e8db15b82 (diff) | |
Merge branch 'vmwgfx-fixes-4.0' of git://people.freedesktop.org/~thomash/linux into drm-fixes
A couple of fixes for vmwgfx.
* 'vmwgfx-fixes-4.0' of git://people.freedesktop.org/~thomash/linux:
drm/vmwgfx: Fix an issue with the device losing its irq line on module unload
drm/vmwgfx: Correctly NULLify dma buffer pointer on failure
drm/vmwgfx: Reorder device takedown somewhat
drm/vmwgfx: Fix a couple of lock dependency violations
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 78 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 |
3 files changed, 53 insertions, 57 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 6c6b655defcf..e13b9cbc304e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
| @@ -725,32 +725,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 725 | goto out_err1; | 725 | goto out_err1; |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, | ||
| 729 | (dev_priv->vram_size >> PAGE_SHIFT)); | ||
| 730 | if (unlikely(ret != 0)) { | ||
| 731 | DRM_ERROR("Failed initializing memory manager for VRAM.\n"); | ||
| 732 | goto out_err2; | ||
| 733 | } | ||
| 734 | |||
| 735 | dev_priv->has_gmr = true; | ||
| 736 | if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) || | ||
| 737 | refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR, | ||
| 738 | VMW_PL_GMR) != 0) { | ||
| 739 | DRM_INFO("No GMR memory available. " | ||
| 740 | "Graphics memory resources are very limited.\n"); | ||
| 741 | dev_priv->has_gmr = false; | ||
| 742 | } | ||
| 743 | |||
| 744 | if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { | ||
| 745 | dev_priv->has_mob = true; | ||
| 746 | if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB, | ||
| 747 | VMW_PL_MOB) != 0) { | ||
| 748 | DRM_INFO("No MOB memory available. " | ||
| 749 | "3D will be disabled.\n"); | ||
| 750 | dev_priv->has_mob = false; | ||
| 751 | } | ||
| 752 | } | ||
| 753 | |||
| 754 | dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start, | 728 | dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start, |
| 755 | dev_priv->mmio_size); | 729 | dev_priv->mmio_size); |
| 756 | 730 | ||
| @@ -813,6 +787,33 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 813 | goto out_no_fman; | 787 | goto out_no_fman; |
| 814 | } | 788 | } |
| 815 | 789 | ||
| 790 | |||
| 791 | ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, | ||
| 792 | (dev_priv->vram_size >> PAGE_SHIFT)); | ||
| 793 | if (unlikely(ret != 0)) { | ||
| 794 | DRM_ERROR("Failed initializing memory manager for VRAM.\n"); | ||
| 795 | goto out_no_vram; | ||
| 796 | } | ||
| 797 | |||
| 798 | dev_priv->has_gmr = true; | ||
| 799 | if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) || | ||
| 800 | refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR, | ||
| 801 | VMW_PL_GMR) != 0) { | ||
| 802 | DRM_INFO("No GMR memory available. " | ||
| 803 | "Graphics memory resources are very limited.\n"); | ||
| 804 | dev_priv->has_gmr = false; | ||
| 805 | } | ||
| 806 | |||
| 807 | if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { | ||
| 808 | dev_priv->has_mob = true; | ||
| 809 | if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB, | ||
| 810 | VMW_PL_MOB) != 0) { | ||
| 811 | DRM_INFO("No MOB memory available. " | ||
| 812 | "3D will be disabled.\n"); | ||
| 813 | dev_priv->has_mob = false; | ||
| 814 | } | ||
| 815 | } | ||
| 816 | |||
| 816 | vmw_kms_save_vga(dev_priv); | 817 | vmw_kms_save_vga(dev_priv); |
| 817 | 818 | ||
| 818 | /* Start kms and overlay systems, needs fifo. */ | 819 | /* Start kms and overlay systems, needs fifo. */ |
| @@ -838,6 +839,12 @@ out_no_fifo: | |||
| 838 | vmw_kms_close(dev_priv); | 839 | vmw_kms_close(dev_priv); |
| 839 | out_no_kms: | 840 | out_no_kms: |
| 840 | vmw_kms_restore_vga(dev_priv); | 841 | vmw_kms_restore_vga(dev_priv); |
| 842 | if (dev_priv->has_mob) | ||
| 843 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); | ||
| 844 | if (dev_priv->has_gmr) | ||
| 845 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); | ||
| 846 | (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
| 847 | out_no_vram: | ||
| 841 | vmw_fence_manager_takedown(dev_priv->fman); | 848 | vmw_fence_manager_takedown(dev_priv->fman); |
| 842 | out_no_fman: | 849 | out_no_fman: |
| 843 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | 850 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) |
| @@ -853,12 +860,6 @@ out_err4: | |||
| 853 | iounmap(dev_priv->mmio_virt); | 860 | iounmap(dev_priv->mmio_virt); |
| 854 | out_err3: | 861 | out_err3: |
| 855 | arch_phys_wc_del(dev_priv->mmio_mtrr); | 862 | arch_phys_wc_del(dev_priv->mmio_mtrr); |
| 856 | if (dev_priv->has_mob) | ||
| 857 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); | ||
| 858 | if (dev_priv->has_gmr) | ||
| 859 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); | ||
| 860 | (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
| 861 | out_err2: | ||
| 862 | (void)ttm_bo_device_release(&dev_priv->bdev); | 863 | (void)ttm_bo_device_release(&dev_priv->bdev); |
| 863 | out_err1: | 864 | out_err1: |
| 864 | vmw_ttm_global_release(dev_priv); | 865 | vmw_ttm_global_release(dev_priv); |
| @@ -887,6 +888,13 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
| 887 | } | 888 | } |
| 888 | vmw_kms_close(dev_priv); | 889 | vmw_kms_close(dev_priv); |
| 889 | vmw_overlay_close(dev_priv); | 890 | vmw_overlay_close(dev_priv); |
| 891 | |||
| 892 | if (dev_priv->has_mob) | ||
| 893 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); | ||
| 894 | if (dev_priv->has_gmr) | ||
| 895 | (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); | ||
| 896 | (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
| 897 | |||
| 890 | vmw_fence_manager_takedown(dev_priv->fman); | 898 | vmw_fence_manager_takedown(dev_priv->fman); |
| 891 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | 899 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) |
| 892 | drm_irq_uninstall(dev_priv->dev); | 900 | drm_irq_uninstall(dev_priv->dev); |
| @@ -898,11 +906,6 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
| 898 | ttm_object_device_release(&dev_priv->tdev); | 906 | ttm_object_device_release(&dev_priv->tdev); |
| 899 | iounmap(dev_priv->mmio_virt); | 907 | iounmap(dev_priv->mmio_virt); |
| 900 | arch_phys_wc_del(dev_priv->mmio_mtrr); | 908 | arch_phys_wc_del(dev_priv->mmio_mtrr); |
| 901 | if (dev_priv->has_mob) | ||
| 902 | (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB); | ||
| 903 | if (dev_priv->has_gmr) | ||
| 904 | (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR); | ||
| 905 | (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
| 906 | (void)ttm_bo_device_release(&dev_priv->bdev); | 909 | (void)ttm_bo_device_release(&dev_priv->bdev); |
| 907 | vmw_ttm_global_release(dev_priv); | 910 | vmw_ttm_global_release(dev_priv); |
| 908 | 911 | ||
| @@ -1235,6 +1238,7 @@ static void vmw_remove(struct pci_dev *pdev) | |||
| 1235 | { | 1238 | { |
| 1236 | struct drm_device *dev = pci_get_drvdata(pdev); | 1239 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 1237 | 1240 | ||
| 1241 | pci_disable_device(pdev); | ||
| 1238 | drm_put_dev(dev); | 1242 | drm_put_dev(dev); |
| 1239 | } | 1243 | } |
| 1240 | 1244 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 33176d05db35..654c8daeb5ab 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
| @@ -890,7 +890,8 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, | |||
| 890 | ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); | 890 | ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); |
| 891 | if (unlikely(ret != 0)) { | 891 | if (unlikely(ret != 0)) { |
| 892 | DRM_ERROR("Could not find or use MOB buffer.\n"); | 892 | DRM_ERROR("Could not find or use MOB buffer.\n"); |
| 893 | return -EINVAL; | 893 | ret = -EINVAL; |
| 894 | goto out_no_reloc; | ||
| 894 | } | 895 | } |
| 895 | bo = &vmw_bo->base; | 896 | bo = &vmw_bo->base; |
| 896 | 897 | ||
| @@ -914,7 +915,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, | |||
| 914 | 915 | ||
| 915 | out_no_reloc: | 916 | out_no_reloc: |
| 916 | vmw_dmabuf_unreference(&vmw_bo); | 917 | vmw_dmabuf_unreference(&vmw_bo); |
| 917 | vmw_bo_p = NULL; | 918 | *vmw_bo_p = NULL; |
| 918 | return ret; | 919 | return ret; |
| 919 | } | 920 | } |
| 920 | 921 | ||
| @@ -951,7 +952,8 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv, | |||
| 951 | ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); | 952 | ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); |
| 952 | if (unlikely(ret != 0)) { | 953 | if (unlikely(ret != 0)) { |
| 953 | DRM_ERROR("Could not find or use GMR region.\n"); | 954 | DRM_ERROR("Could not find or use GMR region.\n"); |
| 954 | return -EINVAL; | 955 | ret = -EINVAL; |
| 956 | got | ||
