All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm64: pci: add support for pci_mmap_page_range
Date: Fri, 15 Apr 2016 14:09:53 +0100	[thread overview]
Message-ID: <20160415130953.GI22906@arm.com> (raw)
In-Reply-To: <1460581856-12380-1-git-send-email-jerin.jacob@caviumnetworks.com>

On Thu, Apr 14, 2016 at 02:40:56AM +0530, Jerin Jacob wrote:
> Certain X11 servers and user space network drivers frameworks
> need PCI mmaped /sys/bus/pci/devices/B:D:F/resourceX file to
> access PCI bar address space from user space.
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> Changes in v2:
>   - Rebased to 4.6.0-rc3.
>   - Tested and verified the change on Thunderx and xgene1 arm64 platforms
> 
>  arch/arm64/include/asm/pci.h |  6 ++++++
>  arch/arm64/kernel/pci.c      | 20 ++++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
> index b9a7ba9..9d7e460 100644
> --- a/arch/arm64/include/asm/pci.h
> +++ b/arch/arm64/include/asm/pci.h
> @@ -37,5 +37,11 @@ static inline int pci_proc_domain(struct pci_bus *bus)
>  }
>  #endif  /* CONFIG_PCI */
>  
> +#define HAVE_PCI_MMAP

By defining this symbol, we also get lumbered with the legacy /proc
interface, which I'd be keen to avoid exposing until we have people
explicitly asking for it.

Any chance you could expose only the /sysfs interface on arm64?

> +
> +extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
> +	enum pci_mmap_state mmap_state, int write_combine);
> +
> +
>  #endif  /* __KERNEL__ */
>  #endif  /* __ASM_PCI_H */
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index c72de66..be7ddf1 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -82,3 +82,23 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  	return NULL;
>  }
>  #endif
> +
> +int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
> +		enum pci_mmap_state mmap_state, int write_combine)
> +{
> +	/*
> +	* I/O space can be accessed via normal processor loads and stores on
> +	* this platform but for now we elect not to do this and portable
> +	* drivers should not do this anyway.
> +	*/
> +	if (mmap_state == pci_mmap_io)
> +		return -EINVAL;
> +
> +	if (write_combine)
> +		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
> +	else
> +		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

For consistency with ioremap, this should be pgprot_device.

Will

  reply	other threads:[~2016-04-15 13:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 21:10 [PATCH v2] arm64: pci: add support for pci_mmap_page_range Jerin Jacob
2016-04-15 13:09 ` Will Deacon [this message]
2016-04-15 18:45   ` Arnd Bergmann
2016-04-18 14:01     ` Jerin Jacob
2016-04-18 14:15       ` Arnd Bergmann
2016-04-18 14:53         ` Jerin Jacob
2016-04-18 15:00           ` Arnd Bergmann
2016-04-18 15:21             ` Jerin Jacob
2016-04-18 15:31               ` Arnd Bergmann
2016-04-18 15:40                 ` Will Deacon
2016-04-18 17:45                   ` Jerin Jacob
2016-04-18 17:46                     ` Arnd Bergmann
2017-03-15 21:01                 ` David Woodhouse
2017-03-20 13:18                   ` Will Deacon
2017-03-20 14:07                     ` David Woodhouse
2017-03-20 14:07                       ` David Woodhouse
2016-04-18 13:43   ` Jerin Jacob
2017-03-16 12:17   ` David Woodhouse
2017-03-16 12:17     ` David Woodhouse
2017-03-20 13:21     ` Will Deacon
2017-03-20 13:21       ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160415130953.GI22906@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.