aboutsummaryrefslogtreecommitdiffstats
path: root/meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch')
-rw-r--r--meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch b/meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch
new file mode 100644
index 00000000..5cabdf25
--- /dev/null
+++ b/meta-steppeeagle/recipes-kernel/linux/linux-yocto/0010-yocto-amd-drm-radeon-add-GART-debugfs-access-v3.patch
@@ -0,0 +1,119 @@
+From ee6e4aae828077d7503a2baf5acb54df222fa922 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Wed, 11 Dec 2013 06:13:22 -0700
+Subject: [PATCH 10/44] drm/radeon: add GART debugfs access v3
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+v2: add default_llseek
+v3: set inode size in the open callback
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+---
+ drivers/gpu/drm/radeon/radeon.h | 1 +
+ drivers/gpu/drm/radeon/radeon_ttm.c | 63 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 64 insertions(+)
+
+diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
+index 14df551..7a483c9 100644
+--- a/drivers/gpu/drm/radeon/radeon.h
++++ b/drivers/gpu/drm/radeon/radeon.h
+@@ -416,6 +416,7 @@ struct radeon_mman {
+
+ #if defined(CONFIG_DEBUG_FS)
+ struct dentry *vram;
++ struct dentry *gtt;
+ #endif
+ };
+
+diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
+index 83ef24d..381782d 100644
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -917,6 +917,60 @@ static const struct file_operations radeon_ttm_vram_fops = {
+ .llseek = default_llseek
+ };
+
++static int radeon_ttm_gtt_open(struct inode *inode, struct file *filep)
++{
++ struct radeon_device *rdev = inode->i_private;
++ i_size_write(inode, rdev->mc.gtt_size);
++ filep->private_data = inode->i_private;
++ return 0;
++}
++
++static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf,
++ size_t size, loff_t *pos)
++{
++ struct radeon_device *rdev = f->private_data;
++ ssize_t result = 0;
++ int r;
++
++ while (size) {
++ loff_t p = *pos / PAGE_SIZE;
++ unsigned off = *pos & ~PAGE_MASK;
++ ssize_t cur_size = min(size, PAGE_SIZE - off);
++ struct page *page;
++ void *ptr;
++
++ if (p >= rdev->gart.num_cpu_pages)
++ return result;
++
++ page = rdev->gart.pages[p];
++ if (page) {
++ ptr = kmap(page);
++ ptr += off;
++
++ r = copy_to_user(buf, ptr, cur_size);
++ kunmap(rdev->gart.pages[p]);
++ } else
++ r = clear_user(buf, cur_size);
++
++ if (r)
++ return -EFAULT;
++
++ result += cur_size;
++ buf += cur_size;
++ *pos += cur_size;
++ size -= cur_size;
++ }
++
++ return result;
++}
++
++static const struct file_operations radeon_ttm_gtt_fops = {
++ .owner = THIS_MODULE,
++ .open = radeon_ttm_gtt_open,
++ .read = radeon_ttm_gtt_read,
++ .llseek = default_llseek
++};
++
+ #endif
+
+ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
+@@ -933,6 +987,12 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
+ return PTR_ERR(ent);
+ rdev->mman.vram = ent;
+
++ ent = debugfs_create_file("radeon_gtt", S_IFREG | S_IRUGO, root,
++ rdev, &radeon_ttm_gtt_fops);
++ if (IS_ERR(ent))
++ return PTR_ERR(ent);
++ rdev->mman.gtt = ent;
++
+ count = ARRAY_SIZE(radeon_ttm_debugfs_list);
+
+ #ifdef CONFIG_SWIOTLB
+@@ -953,5 +1013,8 @@ static void radeon_ttm_debugfs_fini(struct radeon_device *rdev)
+
+ debugfs_remove(rdev->mman.vram);
+ rdev->mman.vram = NULL;
++
++ debugfs_remove(rdev->mman.gtt);
++ rdev->mman.gtt = NULL;
+ #endif
+ }
+--
+1.7.9.5
+