fpga: dfl: afu: support debug access to memory-mapped afu regions
Subsystems (2)
PATCH v3 1/1 fpga: dfl: afu: support debug access to memory-mapped afu regions
Allow debug access to memory-mapped regions using e.g. gdb.
--- drivers/fpga/dfl-afu-main.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/fpga/dfl-afu-main.c +9 -0
@@ -459,6 +459,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 /* CONFIG_HAVE_IOREMAP_PROT */ +}; +static int afu_mmap (struct file *filp,struct vm_area_struct *vma) {struct platform_device *pdev = filp->private_data;
@@ -488,6 +494,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,
Signature · 1 line
2.17.1
Quoted 12 lines · Dominic Chen
Allow debug access to memory-mapped regions using e.g. gdb.
Signed-off-by Dominic Chen <[email protected]>--- drivers/fpga/dfl-afu-main.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/fpga/dfl-afu-main.c +0
-0
drivers/fpga/dfl-afu-main.c static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 465
Quoted 7 lines
drivers/fpga/dfl-afu-main.c +4
-0@@ -459,6 +459,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 /* CONFIG_HAVE_IOREMAP_PROT */
To me, it's very clear for #ifdef - #end. So looks like this /* CONFIG_HAVE_IOREMAP_PROT */ comments is not needed.
Could you please remove it?
Then
Thanks
Hao
Quoted 17 lines
drivers/fpga/dfl-afu-main.c +5
-0+}; +static int afu_mmap (struct file *filp,struct vm_area_struct *vma) {struct platform_device *pdev = filp->private_data;@@ -488,6 +494,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,Signature · 1 line
2.17.1
Quoted 8 lines · Wu Hao
drivers/fpga/dfl-afu-main.c static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 465
Quoted 4 lines · Dominic Chen
drivers/fpga/dfl-afu-main.c +4
-0+static const struct vm_operations_struct afu_vma_ops = { +#ifdef CONFIG_HAVE_IOREMAP_PROT + .access = generic_access_phys, +#endif /* CONFIG_HAVE_IOREMAP_PROT */To me, it's very clear for #ifdef - #end. So looks like this /*
CONFIG_HAVE_IOREMAP_PROT*/ comments is not needed.
Quoted 8 lines
Could you please remove it?
Then
Acked-by Wu Hao <[email protected]>Thanks
Hao
Thanks, sent out v4.
Dominic
Quoted 37 lines · Dominic Chen
Allow debug access to memory-mapped regions using e.g. gdb.
Signed-off-by Dominic Chen <[email protected]>--- drivers/fpga/dfl-afu-main.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/fpga/dfl-afu-main.c +9
-0@@ -459,6 +459,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 /* CONFIG_HAVE_IOREMAP_PROT */ +}; +static int afu_mmap (struct file *filp,struct vm_area_struct *vma) {struct platform_device *pdev = filp->private_data;@@ -488,6 +494,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,Signature · 1 line
2.17.1
Applied to for-next.
Thanks