* [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions
@ 2020-03-05 3:33 Dominic Chen
2020-03-09 7:28 ` Wu Hao
2020-03-21 20:15 ` Moritz Fischer
0 siblings, 2 replies; 4+ messages in thread
From: Dominic Chen @ 2020-03-05 3:33 UTC (permalink / raw)
To: hao.wu, mdf, linux-fpga; +Cc: Dominic Chen
Allow debug access to memory-mapped regions using e.g. gdb.
Signed-off-by: Dominic Chen <d.c.ddcc@gmail.com>
---
drivers/fpga/dfl-afu-main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
index 02baa6a227c0..8fa1666b5b20 100644
--- a/drivers/fpga/dfl-afu-main.c
+++ b/drivers/fpga/dfl-afu-main.c
@@ -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,
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions
2020-03-05 3:33 [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions Dominic Chen
@ 2020-03-09 7:28 ` Wu Hao
2020-03-09 18:53 ` Dominic Chen
2020-03-21 20:15 ` Moritz Fischer
1 sibling, 1 reply; 4+ messages in thread
From: Wu Hao @ 2020-03-09 7:28 UTC (permalink / raw)
To: Dominic Chen; +Cc: mdf, linux-fpga
On Wed, Mar 04, 2020 at 10:33:10PM -0500, Dominic Chen wrote:
> Allow debug access to memory-mapped regions using e.g. gdb.
>
> Signed-off-by: Dominic Chen <d.c.ddcc@gmail.com>
> ---
> drivers/fpga/dfl-afu-main.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
> index 02baa6a227c0..8fa1666b5b20 100644
> --- a/drivers/fpga/dfl-afu-main.c
> +++ b/drivers/fpga/dfl-afu-main.c
> @@ -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
Acked-by: Wu Hao <hao.wu@intel.com>
Thanks
Hao
> +};
> +
> 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,
> --
> 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions
2020-03-09 7:28 ` Wu Hao
@ 2020-03-09 18:53 ` Dominic Chen
0 siblings, 0 replies; 4+ messages in thread
From: Dominic Chen @ 2020-03-09 18:53 UTC (permalink / raw)
To: Wu Hao; +Cc: mdf, linux-fpga
On 3/9/2020 3:28 AM, Wu Hao wrote:
> On Wed, Mar 04, 2020 at 10:33:10PM -0500, Dominic Chen wrote:
>> +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
>
> Acked-by: Wu Hao <hao.wu@intel.com>
>
> Thanks
> Hao
Thanks, sent out v4.
Dominic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions
2020-03-05 3:33 [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions Dominic Chen
2020-03-09 7:28 ` Wu Hao
@ 2020-03-21 20:15 ` Moritz Fischer
1 sibling, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2020-03-21 20:15 UTC (permalink / raw)
To: Dominic Chen; +Cc: hao.wu, mdf, linux-fpga
On Wed, Mar 04, 2020 at 10:33:10PM -0500, Dominic Chen wrote:
> Allow debug access to memory-mapped regions using e.g. gdb.
>
> Signed-off-by: Dominic Chen <d.c.ddcc@gmail.com>
> ---
> drivers/fpga/dfl-afu-main.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
> index 02baa6a227c0..8fa1666b5b20 100644
> --- a/drivers/fpga/dfl-afu-main.c
> +++ b/drivers/fpga/dfl-afu-main.c
> @@ -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,
> --
> 2.17.1
>
Applied to for-next.
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-21 20:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-05 3:33 [PATCH v3] fpga: dfl: afu: support debug access to memory-mapped afu regions Dominic Chen
2020-03-09 7:28 ` Wu Hao
2020-03-09 18:53 ` Dominic Chen
2020-03-21 20:15 ` Moritz Fischer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.