summaryrefslogtreecommitdiff
path: root/drivers/fpga
diff options
context:
space:
mode:
authorDominic Chen <d.c.ddcc@gmail.com>2020-03-09 21:53:23 +0300
committerMoritz Fischer <mdf@kernel.org>2020-04-30 06:37:12 +0300
commita2b9d4eadb7727772698d06e4cbeb1a1e2538675 (patch)
treeb0212825d1ab2e2f44dc27d0b3e476b2208d43a5 /drivers/fpga
parent5a53881580f90a5e4404954af16a5646ee9d7842 (diff)
downloadlinux-a2b9d4eadb7727772698d06e4cbeb1a1e2538675.tar.xz
fpga: dfl: afu: support debug access to memory-mapped afu regions
Allow debug access to memory-mapped regions using e.g. gdb. Signed-off-by: Dominic Chen <d.c.ddcc@gmail.com> Acked-by: Wu Hao <hao.wu@intel.com> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga')
-rw-r--r--drivers/fpga/dfl-afu-main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
index 435bde40f361..b0c31789a909 100644
--- a/drivers/fpga/dfl-afu-main.c
+++ b/drivers/fpga/dfl-afu-main.c
@@ -750,6 +750,12 @@ static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return -EINVAL;
}
+static const struct vm_operations_struct afu_vma_ops = {
+#ifdef CONFIG_HAVE_IOREMAP_PROT
+ .access = generic_access_phys,
+#endif
+};
+
static int afu_mmap(struct file *filp, struct vm_area_struct *vma)
{
struct platform_device *pdev = filp->private_data;
@@ -779,6 +785,9 @@ static int afu_mmap(struct file *filp, struct vm_area_struct *vma)
!(region.flags & DFL_PORT_REGION_WRITE))
return -EPERM;
+ /* Support debug access to the mapping */
+ vma->vm_ops = &afu_vma_ops;
+
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
return remap_pfn_range(vma, vma->vm_start,