diff options
author | Bharat Bhushan <Bharat.Bhushan@nxp.com> | 2017-05-19 07:48:57 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:38 (GMT) |
commit | b98027a9e95cc645c96586f82d553a8173f8d163 (patch) | |
tree | ecf7fb73e0554682159db4eee4dbc4e8e59bd367 /arch/arm64/kernel/pci.c | |
parent | 1fc41969f9d78f5fbf229a0d9b36fe72e44a0339 (diff) | |
download | linux-b98027a9e95cc645c96586f82d553a8173f8d163.tar.xz |
ARM64/PCI: Allow userspace to mmap PCI resources
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>
Diffstat (limited to 'arch/arm64/kernel/pci.c')
-rw-r--r-- | arch/arm64/kernel/pci.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 63815fb..0568ec3 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. */ |