Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1635087 > unrolled thread

Re: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources

Started byLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
First post2017-05-03 18:00 +0200
Last post2017-05-03 18:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2017-05-03 18:00 +0200
    RE: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources Bharat Bhushan <bharat.bhushan@nxp.com> - 2017-05-03 18:10 +0200

#1635087 — Re: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources

FromLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Date2017-05-03 18:00 +0200
SubjectRe: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources
Message-ID<tD4R4-7ok-3@gated-at.bofh.it>
On Wed, May 03, 2017 at 09:18:58PM +0530, Bharat Bhushan wrote:
> This patch allows user-space to mmap PCI resources. This
> patch is inline to arm32 bit implementation.
> 
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
> ---
>  arch/arm64/include/asm/pci.h |  4 ++++
>  arch/arm64/kernel/pci.c      | 19 +++++++++++++++++++
>  2 files changed, 23 insertions(+)

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/arm64/include/asm/pci.h?id=f719582435afe9c7985206e42d804ea6aa315d33

> 
> diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
> index b9a7ba9..8a18915 100644
> --- a/arch/arm64/include/asm/pci.h
> +++ b/arch/arm64/include/asm/pci.h
> @@ -31,6 +31,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
>  	return -ENODEV;
>  }
>  
> +#define HAVE_PCI_MMAP
> +extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
> +			       enum pci_mmap_state mmap_state,
> +			       int write_combine);
>  static inline int pci_proc_domain(struct pci_bus *bus)
>  {
>  	return 1;
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index ce20f4c..2e45a83 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -97,6 +97,25 @@ int pcibios_check_service_irqs(struct pci_dev *dev, int *irqs, int mask)
>  	return count;
>  }
>  
> +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
> +			enum pci_mmap_state mmap_state, int write_combine)
> +{
> +	if (mmap_state == pci_mmap_io)
> +		return -EINVAL;
> +
> +	/*
> +	 * Mark this as IO
> +	 */
> +	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> +
> +	if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
> +			     vma->vm_end - vma->vm_start,
> +			     vma->vm_page_prot))
> +		return -EAGAIN;
> +
> +	return 0;
> +}
> +
>  /*
>   * raw_pci_read/write - Platform-specific PCI config space access.
>   */
> -- 
> 1.9.3
> 

[toc] | [next] | [standalone]


#1635107

FromBharat Bhushan <bharat.bhushan@nxp.com>
Date2017-05-03 18:10 +0200
Message-ID<tD50K-7GP-25@gated-at.bofh.it>
In reply to#1635087

> -----Original Message-----
> From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> Sent: Wednesday, May 03, 2017 9:29 PM
> To: Bharat Bhushan <bharat.bhushan@nxp.com>
> Cc: catalin.marinas@arm.com; will.deacon@arm.com;
> bhelgaas@google.com; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] ARM64/PCI: Allow userspace to mmap PCI resources
> 
> On Wed, May 03, 2017 at 09:18:58PM +0530, Bharat Bhushan wrote:
> > This patch allows user-space to mmap PCI resources. This patch is
> > inline to arm32 bit implementation.
> >
> > Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
> > ---
> >  arch/arm64/include/asm/pci.h |  4 ++++
> >  arch/arm64/kernel/pci.c      | 19 +++++++++++++++++++
> >  2 files changed, 23 insertions(+)
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-
> next.git/commit/arch/arm64/include/asm/pci.h?id=f719582435afe9c7985206
> e42d804ea6aa315d33

Oh, I missed this patch series,

Thanks
-Bharat

> 
> >
> > diff --git a/arch/arm64/include/asm/pci.h
> > b/arch/arm64/include/asm/pci.h index b9a7ba9..8a18915 100644
> > --- a/arch/arm64/include/asm/pci.h
> > +++ b/arch/arm64/include/asm/pci.h
> > @@ -31,6 +31,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev
> *dev, int channel)
> >  	return -ENODEV;
> >  }
> >
> > +#define HAVE_PCI_MMAP
> > +extern int pci_mmap_page_range(struct pci_dev *dev, struct
> vm_area_struct *vma,
> > +			       enum pci_mmap_state mmap_state,
> > +			       int write_combine);
> >  static inline int pci_proc_domain(struct pci_bus *bus)  {
> >  	return 1;
> > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index
> > ce20f4c..2e45a83 100644
> > --- a/arch/arm64/kernel/pci.c
> > +++ b/arch/arm64/kernel/pci.c
> > @@ -97,6 +97,25 @@ int pcibios_check_service_irqs(struct pci_dev *dev,
> int *irqs, int mask)
> >  	return count;
> >  }
> >
> > +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct
> *vma,
> > +			enum pci_mmap_state mmap_state, int
> write_combine) {
> > +	if (mmap_state == pci_mmap_io)
> > +		return -EINVAL;
> > +
> > +	/*
> > +	 * Mark this as IO
> > +	 */
> > +	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> > +
> > +	if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
> > +			     vma->vm_end - vma->vm_start,
> > +			     vma->vm_page_prot))
> > +		return -EAGAIN;
> > +
> > +	return 0;
> > +}
> > +
> >  /*
> >   * raw_pci_read/write - Platform-specific PCI config space access.
> >   */
> > --
> > 1.9.3
> >

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web