aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_vm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
commit2d65a9f48fcdf7866aab6457bc707ca233e0c791 (patch)
treef93e5838d6ac2e59434367f4ff905f7d9c45fc2b /drivers/gpu/drm/drm_vm.c
parentda92da3638a04894afdca8b99e973ddd20268471 (diff)
parentdfda0df3426483cf5fc7441f23f318edbabecb03 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main git pull for the drm, I pretty much froze major pulls at -rc5/6 time, and haven't had much fallout, so will probably continue doing that. Lots of changes all over, big internal header cleanup to make it clear drm features are legacy things and what are things that modern KMS drivers should be using. Also big move to use the new generic fences in all the TTM drivers. core: atomic prep work, vblank rework changes, allows immediate vblank disables major header reworking and cleanups to better delinate legacy interfaces from what KMS drivers should be using. cursor planes locking fixes ttm: move to generic fences (affects all TTM drivers) ppc64 caching fixes radeon: userptr support, uvd for old asics, reset rework for fence changes better buffer placement changes, dpm feature enablement hdmi audio support fixes intel: Cherryview work, 180 degree rotation, skylake prep work, execlist command submission full ppgtt prep work cursor improvements edid caching, vdd handling improvements nouveau: fence reworking kepler memory clock work gt21x clock work fan control improvements hdmi infoframe fixes DP audio ast: ppc64 fixes caching fix rcar: rcar-du DT support ipuv3: prep work for capture support msm: LVDS support for mdp4, new panel, gpu refactoring exynos: exynos3250 SoC support, drop bad mmap interface, mipi dsi changes, and component match support" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (640 commits) drm/mst: rework payload table allocation to conform better. drm/ast: Fix HW cursor image drm/radeon/kv: add uvd/vce info to dpm debugfs output drm/radeon/ci: add uvd/vce info to dpm debugfs output drm/radeon: export reservation_object from dmabuf to ttm drm/radeon: cope with foreign fences inside the reservation object drm/radeon: cope with foreign fences inside display drm/core: use helper to check driver features drm/radeon/cik: write gfx ucode version to ucode addr reg drm/radeon/si: print full CS when we hit a packet 0 drm/radeon: remove unecessary includes drm/radeon/combios: declare legacy_connector_convert as static drm/radeon/atombios: declare connector convert tables as static drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table drm/radeon/dpm: drop clk/voltage dependency filters for BTC drm/radeon/dpm: drop clk/voltage dependency filters for CI drm/radeon/dpm: drop clk/voltage dependency filters for SI drm/radeon/dpm: drop clk/voltage dependency filters for NI drm/radeon: disable audio when we disable hdmi (v2) drm/radeon: split audio enable between eg and r600 (v2) ...
Diffstat (limited to 'drivers/gpu/drm/drm_vm.c')
-rw-r--r--drivers/gpu/drm/drm_vm.c89
1 files changed, 79 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 24e045c4f531..4a2c328959e5 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -35,10 +35,19 @@
35 35
36#include <drm/drmP.h> 36#include <drm/drmP.h>
37#include <linux/export.h> 37#include <linux/export.h>
38#include <linux/seq_file.h>
38#if defined(__ia64__) 39#if defined(__ia64__)
39#include <linux/efi.h> 40#include <linux/efi.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#endif 42#endif
43#include <asm/pgtable.h>
44#include "drm_legacy.h"
45
46struct drm_vma_entry {
47 struct list_head head;
48 struct vm_area_struct *vma;
49 pid_t pid;
50};
42 51
43static void drm_vm_open(struct vm_area_struct *vma); 52static void drm_vm_open(struct vm_area_struct *vma);
44static void drm_vm_close(struct vm_area_struct *vma); 53static void drm_vm_close(struct vm_area_struct *vma);
@@ -48,15 +57,11 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
48{ 57{
49 pgprot_t tmp = vm_get_page_prot(vma->vm_flags); 58 pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
50 59
51#if defined(__i386__) || defined(__x86_64__) 60#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__)
52 if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING)) 61 if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING))
53 tmp = pgprot_noncached(tmp); 62 tmp = pgprot_noncached(tmp);
54 else 63 else
55 tmp = pgprot_writecombine(tmp); 64 tmp = pgprot_writecombine(tmp);
56#elif defined(__powerpc__)
57 pgprot_val(tmp) |= _PAGE_NO_CACHE;
58 if (map->type == _DRM_REGISTERS)
59 pgprot_val(tmp) |= _PAGE_GUARDED;
60#elif defined(__ia64__) 65#elif defined(__ia64__)
61 if (efi_range_is_wc(vma->vm_start, vma->vm_end - 66 if (efi_range_is_wc(vma->vm_start, vma->vm_end -
62 vma->vm_start)) 67 vma->vm_start))
@@ -263,7 +268,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
263 dmah.vaddr = map->handle; 268 dmah.vaddr = map->handle;
264 dmah.busaddr = map->offset; 269 dmah.busaddr = map->offset;
265 dmah.size = map->size; 270 dmah.size = map->size;
266 __drm_pci_free(dev, &dmah); 271 __drm_legacy_pci_free(dev, &dmah);
267 break; 272 break;
268 } 273 }
269 kfree(map); 274 kfree(map);
@@ -412,7 +417,6 @@ void drm_vm_open_locked(struct drm_device *dev,
412 list_add(&vma_entry->head, &dev->vmalist); 417 list_add(&vma_entry->head, &dev->vmalist);
413 } 418 }
414} 419}
415EXPORT_SYMBOL_GPL(drm_vm_open_locked);
416 420
417static void drm_vm_open(struct vm_area_struct *vma) 421static void drm_vm_open(struct vm_area_struct *vma)
418{ 422{
@@ -532,7 +536,7 @@ static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
532 * according to the mapping type and remaps the pages. Finally sets the file 536 * according to the mapping type and remaps the pages. Finally sets the file
533 * pointer and calls vm_open(). 537 * pointer and calls vm_open().
534 */ 538 */
535int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) 539static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
536{ 540{
537 struct drm_file *priv = filp->private_data; 541 struct drm_file *priv = filp->private_data;
538 struct drm_device *dev = priv->minor->dev; 542 struct drm_device *dev = priv->minor->dev;
@@ -646,7 +650,7 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
646 return 0; 650 return 0;
647} 651}
648 652
649int drm_mmap(struct file *filp, struct vm_area_struct *vma) 653int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma)
650{ 654{
651 struct drm_file *priv = filp->private_data; 655 struct drm_file *priv = filp->private_data;
652 struct drm_device *dev = priv->minor->dev; 656 struct drm_device *dev = priv->minor->dev;
@@ -661,4 +665,69 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
661 665
662 return ret; 666 return ret;
663} 667}
664EXPORT_SYMBOL(drm_mmap); 668EXPORT_SYMBOL(drm_legacy_mmap);
669
670void drm_legacy_vma_flush(struct drm_device *dev)
671{
672 struct drm_vma_entry *vma, *vma_temp;
673
674 /* Clear vma list (only needed for legacy drivers) */
675 list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
676 list_del(&vma->head);
677 kfree(vma);
678 }
679}
680
681int drm_vma_info(struct seq_file *m, void *data)
682{
683 struct drm_info_node *node = (struct drm_info_node *) m->private;
684 struct drm_device *dev = node->minor->dev;
685 struct drm_vma_entry *pt;
686 struct vm_area_struct *vma;
687 unsigned long vma_count = 0;
688#if defined(__i386__)
689 unsigned int pgprot;
690#endif
691
692 mutex_lock(&dev->struct_mutex);
693 list_for_each_entry(pt, &dev->vmalist, head)
694 vma_count++;
695
696 seq_printf(m, "vma use count: %lu, high_memory = %pK, 0x%pK\n",
697 vma_count, high_memory,
698 (void *)(unsigned long)virt_to_phys(high_memory));
699
700 list_for_each_entry(pt, &dev->vmalist, head) {
701 vma = pt->vma;
702 if (!vma)
703 continue;
704 seq_printf(m,
705 "\n%5d 0x%pK-0x%pK %c%c%c%c%c%c 0x%08lx000",
706 pt->pid,
707 (void *)vma->vm_start, (void *)vma->vm_end,
708 vma->vm_flags & VM_READ ? 'r' : '-',
709 vma->vm_flags & VM_WRITE ? 'w' : '-',
710 vma->vm_flags & VM_EXEC ? 'x' : '-',
711 vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
712 vma->vm_flags & VM_LOCKED ? 'l' : '-',
713 vma->vm_flags & VM_IO ? 'i' : '-',
714 vma->vm_pgoff);
715
716#if defined(__i386__)
717 pgprot = pgprot_val(vma->vm_page_prot);
718 seq_printf(m, " %c%c%c%c%c%c%c%c%c",
719 pgprot & _PAGE_PRESENT ? 'p' : '-',
720 pgprot & _PAGE_RW ? 'w' : 'r',
721 pgprot & _PAGE_USER ? 'u' : 's',
722 pgprot & _PAGE_PWT ? 't' : 'b',
723 pgprot & _PAGE_PCD ? 'u' : 'c',
724 pgprot & _PAGE_ACCESSED ? 'a' : '-',
725 pgprot & _PAGE_DIRTY ? 'd' : '-',
726 pgprot & _PAGE_PSE ? 'm' : 'k',
727 pgprot & _PAGE_GLOBAL ? 'g' : 'l');
728#endif
729 seq_printf(m, "\n");
730 }
731 mutex_unlock(&dev->struct_mutex);
732 return 0;
733}