From patchwork Mon Feb 27 15:14:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9593359 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 310CE601D7 for ; Mon, 27 Feb 2017 15:16:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20E3E28487 for ; Mon, 27 Feb 2017 15:16:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 140512848D; Mon, 27 Feb 2017 15:16:55 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 811D328487 for ; Mon, 27 Feb 2017 15:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XKPoCZvvmu1FvpY+BF7JKzWJzli0saTdqsUdVjSaI7w=; b=n1MIhxcUfoUfm+7mk6XOpMptHT f9pwyer0/C5xp4J4qa0VdMs9YwoNNTOtzZWvLtanjSYD1g0T+BTb+UVlHFL+C4zAB7EqdT9aLQHZK CoYhA1W8W9sBy8wGs7fXkisXBtHeVgLAyqf4ZeSC4QllgVlEgqZxDlcGzGRWUx/zBod0K8QGPOlmL 8m/8GO5wtgcrmmQNph0X25UCDIi4GBspzIz+hYfiTQk+GUFLRaIslFRTIk4BlmW5Tgg/g/okc3Tam HFP4IBFbO128IvK9B430wBAAxm0ZBcF7Dq4su3K+9Rrbcj7ycWaRK8ay8fwlx43IFtpt/DhB+jigb KH2aJY9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciN2c-0008Hw-Ap; Mon, 27 Feb 2017 15:16:46 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciN16-0006Dk-9I for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 15:15:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E55D4139F; Mon, 27 Feb 2017 07:14:55 -0800 (PST) Received: from red-moon.cambridge.arm.com (red-moon.cambridge.arm.com [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2530B3F77C; Mon, 27 Feb 2017 07:14:51 -0800 (PST) From: Lorenzo Pieralisi To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 02/20] PCI: fix pci_remap_iospace() remap attribute Date: Mon, 27 Feb 2017 15:14:13 +0000 Message-Id: <20170227151436.18698-3-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170227151436.18698-1-lorenzo.pieralisi@arm.com> References: <20170227151436.18698-1-lorenzo.pieralisi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_071512_479402_E21E664D X-CRM114-Status: GOOD ( 10.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wenrui Li , Gabriele Paoloni , Catalin Marinas , Shawn Lin , Will Deacon , Michal Simek , Thierry Reding , Tanmay Inamdar , linux-arch@vger.kernel.org, Lorenzo Pieralisi , Pratyush Anand , Russell King , Jon Mason , Murali Karicheri , Arnd Bergmann , Bharat Kumar Gogada , Ray Jui , John Garry , Joao Pinto , Bjorn Helgaas , Mingkai Hu , Thomas Petazzoni , Jingoo Han , linux-kernel@vger.kernel.org, Stanimir Varbanov , Minghuan Lian , Zhou Wang , Roy Zang MIME-Version: 1.0 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 According to the PCI local bus specifications (Revision 3.0, 3.2.5), I/O Address space transactions are non-posted. On architectures where I/O space is implemented through a chunk of memory mapped space mapped to PCI address space (ie IA64/ARM/ARM64) the memory mapping for the region backing I/O Address Space transactions determines the I/O transactions attributes (before the transactions actually reaches the PCI bus where it is handled according to the PCI specifications). Current pci_remap_iospace() interface, that is used to map the PCI I/O Address Space into virtual address space, use pgprot_device() as memory attribute for the virtual address mapping, that in some architectures (ie ARM64) provides non-cacheable but write bufferable mappings (ie posted writes), which clash with the non-posted write behaviour for I/O Address Space mandated by the PCI specifications. Update the prot ioremap_page_range() parameter in pci_remap_iospace() to pgprot_noncached to ensure that the virtual mapping backing I/O Address Space guarantee non-posted write transactions issued when addressing I/O Address Space through the MMIO mapping. Signed-off-by: Lorenzo Pieralisi Cc: Arnd Bergmann Cc: Will Deacon Cc: Bjorn Helgaas Cc: Russell King Cc: Catalin Marinas --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index bd98674..bfb3c6e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3375,7 +3375,7 @@ int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr) return -EINVAL; return ioremap_page_range(vaddr, vaddr + resource_size(res), phys_addr, - pgprot_device(PAGE_KERNEL)); + pgprot_noncached(PAGE_KERNEL)); #else /* this architecture does not have memory mapped I/O space, so this function should never be called */