linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	David Miller <davem@davemloft.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Wei Yang <weiyang@linux.vnet.ibm.com>,
	Khalid Aziz <khalid.aziz@oracle.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	linux-cris-kernel@axis.com,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	linux-am33-list@redhat.com, linux-parisc@vger.kernel.org,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	linux-sh@vger.kernel.org,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	linux-xtensa@linux-xtensa.org
Subject: Re: [PATCH v12 01/15] PCI: Let pci_mmap_page_range() take extra resource pointer
Date: Wed, 8 Jun 2016 17:00:47 -0700	[thread overview]
Message-ID: <CAE9FiQWw0pUB=1iDrX_1qyMFAUGQidSaV7CPc0aNb2CzPB-fZw@mail.gmail.com> (raw)
In-Reply-To: <CAE9FiQXPmG6UYYGHG52_i8vaBJ5yPm6Z4Zfx_BhQxVhyWC5fnw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

On Wed, Jun 8, 2016 at 3:35 PM, Yinghai Lu <yinghai@kernel.org> wrote:

> At the same time, can you kill __pci_mmap_set_pgprot() for powerpc.

Can you please put your two patches and this attached one into to pci/next?

Then I could send updated PCI: Let pci_mmap_page_range() take resource address.

Thanks

Yinghai

[-- Attachment #2: remove_powerpc_pci_prot.patch --]
[-- Type: text/x-patch, Size: 2652 bytes --]

From: Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] powerpc/PCI: Remove __pci_mmap_set_pgprot()

  PCI: Ignore write-combining when mapping I/O port space
already handle the io port mmap path.

For mmio mmap path, caller should state that correctly if write_combine
is really needed.

via proc path it should look like:
  mmap(fd, ...)                           # default is I/O, non-combining
  ioctl(fd, PCIIOC_WRITE_COMBINE, 1);     # request write-combining
  ioctl(fd, PCIIOC_MMAP_IS_MEM);          # request memory space
  mmap(fd, ...)

sysfs path, it should use resource]?]_wc.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

---
 arch/powerpc/kernel/pci-common.c |   37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)

Index: linux-2.6/arch/powerpc/kernel/pci-common.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/pci-common.c
+++ linux-2.6/arch/powerpc/kernel/pci-common.c
@@ -356,36 +356,6 @@ static struct resource *__pci_mmap_make_
 }
 
 /*
- * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
- * device mapping.
- */
-static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
-				      pgprot_t protection,
-				      enum pci_mmap_state mmap_state,
-				      int write_combine)
-{
-
-	/* Write combine is always 0 on non-memory space mappings. On
-	 * memory space, if the user didn't pass 1, we check for a
-	 * "prefetchable" resource. This is a bit hackish, but we use
-	 * this to workaround the inability of /sysfs to provide a write
-	 * combine bit
-	 */
-	if (mmap_state != pci_mmap_mem)
-		write_combine = 0;
-	else if (write_combine == 0) {
-		if (rp->flags & IORESOURCE_PREFETCH)
-			write_combine = 1;
-	}
-
-	/* XXX would be nice to have a way to ask for write-through */
-	if (write_combine)
-		return pgprot_noncached_wc(protection);
-	else
-		return pgprot_noncached(protection);
-}
-
-/*
  * This one is used by /dev/mem and fbdev who have no clue about the
  * PCI device, it tries to find the PCI device first and calls the
  * above routine
@@ -458,9 +428,10 @@ int pci_mmap_page_range(struct pci_dev *
 		return -EINVAL;
 
 	vma->vm_pgoff = offset >> PAGE_SHIFT;
-	vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
-						  vma->vm_page_prot,
-						  mmap_state, write_combine);
+	if (write_combine)
+		vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
+	else
+		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
 			       vma->vm_end - vma->vm_start, vma->vm_page_prot);

  reply	other threads:[~2016-06-09  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04  0:06 [PATCH v12 00/15] PCI: Fixup for 64bit resource with sparc Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 01/15] PCI: Let pci_mmap_page_range() take extra resource pointer Yinghai Lu
2016-06-07  8:04   ` Jesper Nilsson
2016-06-08 21:03   ` Bjorn Helgaas
2016-06-08 22:35     ` Yinghai Lu
2016-06-09  0:00       ` Yinghai Lu [this message]
2016-06-09 22:36         ` Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 02/15] PCI: Let pci_mmap_page_range() take resource address Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 03/15] sparc/PCI: Use correct offset for bus address to resource Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 04/15] PCI: Add pci_find_bus_resource() Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 05/15] sparc/PCI: Reserve legacy mmio after PCI mmio Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 06/15] sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 07/15] sparc/PCI: Keep resource idx order with bridge register number Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 08/15] powerpc/PCI: " Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 09/15] powerpc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 10/15] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 11/15] PCI: Check pref compatible bit for mem64 resource of PCIe device Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 12/15] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64 Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 13/15] PCI: Add has_mem64 for struct host_bridge Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 14/15] PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64 Yinghai Lu
2016-06-04  0:06 ` [PATCH v12 15/15] PCI: Restore pref MMIO allocation logic for host bridge without mmio64 Yinghai Lu

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='CAE9FiQWw0pUB=1iDrX_1qyMFAUGQidSaV7CPc0aNb2CzPB-fZw@mail.gmail.com' \
    --to=yinghai@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=helgaas@kernel.org \
    --cc=khalid.aziz@oracle.com \
    --cc=linux-am33-list@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=weiyang@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).