From patchwork Thu Jun 9 00:00:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 9166035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C75C60467 for ; Thu, 9 Jun 2016 00:03:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636F526E5D for ; Thu, 9 Jun 2016 00:03:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5807528047; Thu, 9 Jun 2016 00:03:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE0E526E5D for ; Thu, 9 Jun 2016 00:03:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAnPM-0005s6-RC; Thu, 09 Jun 2016 00:01:12 +0000 Received: from mail-vk0-x243.google.com ([2607:f8b0:400c:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAnPJ-0005dE-P1 for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2016 00:01:10 +0000 Received: by mail-vk0-x243.google.com with SMTP id t7so3882755vkf.2 for ; Wed, 08 Jun 2016 17:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wmvDU1LtFWJWiuucwj2eNRASPxKcH+PlkW8uS28I+5U=; b=JJGMt3+CCVl6066hT53Cf5V8fTnxynVHfLyikFxDzmCdJDj3Akx0nZDSrlauBEqeG1 0mF3IAxas/nAqdjDYDjHEkVGaVr/5V1jyDgWlgzCDc9VMYiKefH7PIVdZhWJ0iZFg0Kt rFx6f7js7wnR0yUwCI7CQNuhC6v1DnShjz4n3WPCAbhvcxPmHj0hSLRboG9Hj//az3YK Lxl94L+egyR1UBW9R8zAvUIa53/aveq5n6zVr4Un8yTFDY5DjRrBkVJESVnG5Iw9jnuI d1p1DwznRILT210flnvJm2itJOHLjZ8oZUNcS18gisrRbDHmIW5NNG7yQEia1hDbzqjB KmBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wmvDU1LtFWJWiuucwj2eNRASPxKcH+PlkW8uS28I+5U=; b=Be+uhox0h2HBzfAJQMgDutLlMM78OBnKVTgmcGBdzhSTFu/0w5+/FlRkwgrsJkBKmA oYkeyshvflsdsrAuftClyiXNfENoGrPFrbr/DGgdT8FiKuw6eCEAWLKIZRQ0af7QM4cw YShXP5CKKvrq0KgJIseDQ9ZAINyg1e+1Mr0ghZkK105V1X3bFb2Y8x7ki/xW0I7saALh DM3Pgm7Abv1phRXbgOwFUv+pMUfLr8gt7NMx4A0S5NtA/Z1WVdUkxbNbZ/YWZjyxC2EN 7GDGGukovzwtb97ynGcVGdRFiXyHHyWcUqeZ8hdp4hIOQOqwAWtXaHdzWcoPfmMhnsFa BmaQ== X-Gm-Message-State: ALyK8tLoO6d/rN0nB2bd5yOQ1GJvt/tQhG+QGp0TF0Kh5G6j9ANq0sPUULXnBkXLSruTGbFIH2jE+JFWAA5gDg== X-Received: by 10.176.3.72 with SMTP id 66mr3425821uat.146.1465430448568; Wed, 08 Jun 2016 17:00:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.81.11 with HTTP; Wed, 8 Jun 2016 17:00:47 -0700 (PDT) In-Reply-To: References: <20160604000642.28162-1-yinghai@kernel.org> <20160604000642.28162-2-yinghai@kernel.org> <20160608210322.GA4248@localhost> From: Yinghai Lu Date: Wed, 8 Jun 2016 17:00:47 -0700 X-Google-Sender-Auth: z1Fi83VDkSmDYQsnrl48WM2oheg Message-ID: Subject: Re: [PATCH v12 01/15] PCI: Let pci_mmap_page_range() take extra resource pointer To: Bjorn Helgaas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_170109_909071_4C5BA67C X-CRM114-Status: GOOD ( 18.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-mips@linux-mips.org" , Wei Yang , linux-am33-list@redhat.com, "linux-ia64@vger.kernel.org" , linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com, linux-sh@vger.kernel.org, Benjamin Herrenschmidt , linux-xtensa@linux-xtensa.org, linuxppc-dev , Linux Kernel Mailing List , "sparclinux@vger.kernel.org" , Khalid Aziz , "linux-pci@vger.kernel.org" , Bjorn Helgaas , Linus Torvalds , David Miller , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jun 8, 2016 at 3:35 PM, Yinghai Lu 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 From: Bjorn Helgaas 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 --- 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);