PCI: Add BAR index argument to pci_mmap_page_range()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 12 Apr 2017 12:25:58 +0000 (13:25 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 20 Apr 2017 13:47:47 +0000 (08:47 -0500)
In all cases we know which BAR it is.  Passing it in means that arch code
(or generic code; watch this space) won't have to go looking for it again.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
16 files changed:
arch/arm/kernel/bios32.c
arch/cris/arch-v32/drivers/pci/bios.c
arch/ia64/pci/pci.c
arch/microblaze/pci/pci-common.c
arch/mips/pci/pci.c
arch/mn10300/unit-asb2305/pci-asb2305.c
arch/parisc/kernel/pci.c
arch/powerpc/kernel/pci-common.c
arch/sh/drivers/pci/pci.c
arch/sparc/kernel/pci.c
arch/unicore32/kernel/pci.c
arch/x86/pci/i386.c
arch/xtensa/kernel/pci.c
drivers/pci/pci-sysfs.c
drivers/pci/proc.c
include/linux/pci.h

index 2f0e07735d1d4715234d94d6bd0e0d7c49f442c0..a4fc3f46eeaefdfadd31e00198a835e6d758b77d 100644 (file)
@@ -597,7 +597,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
        return start;
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        if (mmap_state == pci_mmap_io)
index 212266a2c5d9a50705c5181dd71b81003fc30dc7..a589686d5448c8daf7df8c6e4ca209543b701264 100644 (file)
@@ -14,7 +14,8 @@ void pcibios_set_master(struct pci_dev *dev)
        pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long prot;
index 8f6ac2f8ae4c8cebea5cd85d79b11251d7b09979..053c688b15a585a51e6dedd6aa8cae0187b8e787 100644 (file)
@@ -419,7 +419,8 @@ pcibios_align_resource (void *data, const struct resource *res,
 }
 
 int
-pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
+pci_mmap_page_range (struct pci_dev *dev, int bar,
+                    struct vm_area_struct *vma,
                     enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long size = vma->vm_end - vma->vm_start;
index 13bc93242c0c571c71dc4afe5a7947a47bd7051d..404fb38d06b7627525998909ebfeac5653996401 100644 (file)
@@ -278,7 +278,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
  *
  * Returns a negative error code on failure, zero on success.
  */
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar, struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        resource_size_t offset =
index f6325fa657fb6538dbbc512d53254cf611b60aa1..f189502041a62ab936daa22a5726cec28bb80d56 100644 (file)
@@ -58,7 +58,8 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
        *end = rsrc->start + size;
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long prot;
index b7ab8378964ce5e9ca55acdd869d249f18a3d49b..4abbbd54ac7d2e72dd28084ac2c8d1e7788bffb2 100644 (file)
@@ -211,7 +211,8 @@ void __init pcibios_resource_survey(void)
        pcibios_allocate_resources(1);
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long prot;
index 0903c6abd7a4ce4ebc5fc6652740656483465e6f..653877553acd94594e2a1818406b5eca075cfc72 100644 (file)
@@ -228,7 +228,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
 }
 
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long prot;
index ffda24a38dda278d2ffabf387cd0b1b6256cc652..6dda4a20de6e8f82c1e329123d70a0aa63ee276e 100644 (file)
@@ -513,7 +513,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
  *
  * Returns a negative error code on failure, zero on success.
  */
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        resource_size_t offset =
index 84563e39a5b821cef555af1185b60b815080a84c..c8b36b7ceb982c2b87ea365ef7231b43dab6f286 100644 (file)
@@ -269,7 +269,8 @@ void __ref pcibios_report_status(unsigned int status_mask, int warn)
        }
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        /*
index 015e55a7495d40cc3fd93c535b0723cd6ce147b4..7eceaa10836f0141472a7b71c445b4a65140a3e6 100644 (file)
@@ -862,9 +862,9 @@ static void __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vm
  *
  * Returns a negative error code on failure, zero on success.
  */
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
-                       enum pci_mmap_state mmap_state,
-                       int write_combine)
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
+                       enum pci_mmap_state mmap_state, int write_combine)
 {
        int ret;
 
index 62137d13c6f9d2d75783dca25139217f23b09d54..1b438857e91f2472bdb29de5a2ce44ed1d05f27f 100644 (file)
@@ -357,7 +357,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
        return 0;
 }
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long phys;
index 0a9f2caf358ff7230e6afa569219234127490c1a..8ca5e5d9f2516725acb826129292a94866d39009 100644 (file)
@@ -411,7 +411,8 @@ static const struct vm_operations_struct pci_mmap_ops = {
        .access = generic_access_phys,
 };
 
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine)
 {
        unsigned long prot;
index 5b73fc2f076ccd729ef89a55134f48075c5bf58f..903963ee495d50807d2e0e039a1b1ee044caf245 100644 (file)
@@ -343,7 +343,8 @@ __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
  *
  * Returns a negative error code on failure, zero on success.
  */
-int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *dev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state,
                        int write_combine)
 {
index 534844df8bf50eaeff0fbead6ec93dd1962ffafe..bfd9efe637c4def6179f79eb1e8d9d62540312a4 100644 (file)
@@ -1041,7 +1041,7 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
        pci_resource_to_user(pdev, bar, res, &start, &end);
        vma->vm_pgoff += start >> PAGE_SHIFT;
        mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
-       return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
+       return pci_mmap_page_range(pdev, bar, vma, mmap_type, write_combine);
 }
 
 static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
index 45e5cf7e91931056bdcba5ed5a282cd0ea2e3c90..098360d7ff81639c90e6ec9bcc0fe56a2a01fd7d 100644 (file)
@@ -262,7 +262,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
                else
                        return -EINVAL;
        }
-       ret = pci_mmap_page_range(dev, vma,
+       ret = pci_mmap_page_range(dev, i, vma,
                                  fpriv->mmap_state, write_combine);
        if (ret < 0)
                return ret;
index 590cfcf6acf59361a7de2e7bab4f44d872997e03..7173a677d6ddbb716f9d43d2a4fab3b525400a0b 100644 (file)
@@ -1630,7 +1630,8 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
  * Architectures provide this function if they set HAVE_PCI_MMAP, and
  * it accepts the 'write_combine' argument when arch_can_pci_mmap_wc()
  * evaluates to nonzero. */
-int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
+int pci_mmap_page_range(struct pci_dev *pdev, int bar,
+                       struct vm_area_struct *vma,
                        enum pci_mmap_state mmap_state, int write_combine);
 
 #ifndef arch_can_pci_mmap_wc