fpga: support debug access to memory-mapped afu regions
Subsystems (2)
PATCH RESEND 1/1 fpga: 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 | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/fpga/dfl-afu-main.c +11 -0
@@ -459,6 +459,12 @@ static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)return -EINVAL ; } +#ifdef CONFIG_HAVE_IOREMAP_PROT +const struct vm_operations_struct afu_vma_ops = { + .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,11 @@ 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 +#ifdef CONFIG_HAVE_IOREMAP_PROT + vma->vm_ops = &afu_vma_ops; +#endif /* CONFIG_HAVE_IOREMAP_PROT */ + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start,
Signature · 1 line
2.17.1
Hi Dominic,
Thanks a lot for this patch. Please see my comments inline.
Quoted 1 line · Dominic Chen
Allow debug access to memory-mapped regions using e.g. gdb.
Do you mind improving the title to something like
"fpga: dfl: afu: ...."
Quoted 11 lines
Signed-off-by Dominic Chen <[email protected]>--- drivers/fpga/dfl-afu-main.c | 11 +++++++++++ 1 file changed, 11 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 463
Quoted 5 lines
drivers/fpga/dfl-afu-main.c +2
-0@@ -459,6 +459,12 @@ static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)return -EINVAL ; } +#ifdef CONFIG_HAVE_IOREMAP_PROT +const struct vm_operations_struct afu_vma_ops = {
let's add "static" for afu_vma_ops here.
drivers/fpga/dfl-afu-main.c static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 467
Quoted 4 lines
drivers/fpga/dfl-afu-main.c +4
-0+ .access = generic_access_phys, +}; +#endif /* CONFIG_HAVE_IOREMAP_PROT */ +
What about
static const struct vm_operations_struct afu_vma_ops = {
#ifdef CONFIG_HAVE_IOREMAP_PROT
.access = generic_access_phys,
#endif
};Then we just need one line below.
vma->vm_ops = &afu_vma_ops;
Thanks
Hao
Quoted 17 lines
drivers/fpga/dfl-afu-main.c +5
-0static int afu_mmap (struct file *filp,struct vm_area_struct *vma) {struct platform_device *pdev = filp->private_data;@@ -488,6 +494,11 @@ 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 +#ifdef CONFIG_HAVE_IOREMAP_PROT + vma->vm_ops = &afu_vma_ops; +#endif /* CONFIG_HAVE_IOREMAP_PROT */ + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start,Signature · 1 line
2.17.1
Sure, I will send out a v2.
Thanks,
Dominic
Quoted 64 lines · Wu Hao
Hi Dominic,
Thanks a lot for this patch. Please see my comments inline.
Quoted 1 line · Dominic Chen
Allow debug access to memory-mapped regions using e.g. gdb.
Do you mind improving the title to something like
"fpga: dfl: afu: ...."Quoted 10 lines
Signed-off-by Dominic Chen <[email protected]>--- drivers/fpga/dfl-afu-main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/fpga/dfl-afu-main.c +0
-0drivers/fpga/dfl-afu-main.c static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 463
Quoted 5 lines
drivers/fpga/dfl-afu-main.c +2
-0@@ -459,6 +459,12 @@ static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)return -EINVAL ; } +#ifdef CONFIG_HAVE_IOREMAP_PROT +const struct vm_operations_struct afu_vma_ops = {let's add "static" for
afu_vma_opshere.drivers/fpga/dfl-afu-main.c static long afu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · line 467
Quoted 4 lines
drivers/fpga/dfl-afu-main.c +4
-0+ .access = generic_access_phys, +}; +#endif /* CONFIG_HAVE_IOREMAP_PROT */ +What about
static const struct vm_operations_struct afu_vma_ops = { #ifdef CONFIG_HAVE_IOREMAP_PROT .access = generic_access_phys, #endif };Then we just need one line below.
vma->vm_ops = &afu_vma_ops;Thanks
HaoQuoted 17 lines
drivers/fpga/dfl-afu-main.c +5
-0static int afu_mmap (struct file *filp,struct vm_area_struct *vma) {struct platform_device *pdev = filp->private_data;@@ -488,6 +494,11 @@ 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 +#ifdef CONFIG_HAVE_IOREMAP_PROT + vma->vm_ops = &afu_vma_ops; +#endif /* CONFIG_HAVE_IOREMAP_PROT */ + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start,Signature · 1 line
2.17.1