From patchwork Tue Apr 11 12:28:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9675089 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 AC96B60234 for ; Tue, 11 Apr 2017 12:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FA1428384 for ; Tue, 11 Apr 2017 12:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 940092852D; Tue, 11 Apr 2017 12:30:25 +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 048F228384 for ; Tue, 11 Apr 2017 12:30:25 +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=M5ru+rBjj504eL6+GC99KDbiuMyHojikAvw4rGwS2Ak=; b=Rxztwd2l3iMa/K2CDBoVuPbSDv S3CTyG0iWqRU1X2tBeep/NtREXxQsq7DuNuGqP5yYEXurSAi0yOvv8/B0Y0YS+MjDl47bzgcMwA3b ErdRvolhP2IMhCQ+hHJyhrLHsKYvTcawyp42Lj5oCmg+EHaco13oemVOJOmAfQL1CzgdaHPkfh1GM mrvV2UFQhctS1XxiOcHwKuZEmQ83J6n5Rv0BL3FN75GKxBvH+FNOJ0ieKs2HQD7VneyvrfpSaGqKQ peCnL//c0Am07Xbn8ZzAXI16Etl+VHhY/IzIhyy6RRUlyuPXCv5goYyV6RE6Ih6no1vdkgztw4nrK sL6qj1AQ==; 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 1cxuwB-0000TQ-MV; Tue, 11 Apr 2017 12:30:23 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cxuvi-0006Gn-7a for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2017 12:29:58 +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 A99891684; Tue, 11 Apr 2017 05:29:34 -0700 (PDT) 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 A8A4F3F23B; Tue, 11 Apr 2017 05:29:27 -0700 (PDT) From: Lorenzo Pieralisi To: linux-pci@vger.kernel.org Subject: [PATCH v3 04/32] asm-generic: add ioremap_nopost() remap interface Date: Tue, 11 Apr 2017 13:28:44 +0100 Message-Id: <20170411122923.6285-5-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170411122923.6285-1-lorenzo.pieralisi@arm.com> References: <20170411122923.6285-1-lorenzo.pieralisi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170411_052954_449305_D017DE8E X-CRM114-Status: GOOD ( 12.03 ) 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: Jonas Bonn , Rich Felker , Catalin Marinas , Will Deacon , "James E.J. Bottomley" , David Howells , Max Filippov , Paul Mackerras , Huacai Chen , Guan Xuetao , Thomas Gleixner , Hans-Christian Egtvedt , linux-arch@vger.kernel.org, Jesper Nilsson , Lorenzo Pieralisi , Yoshinori Sato , Michael Ellerman , Helge Deller , Russell King , Ingo Molnar , Geert Uytterhoeven , Benjamin Herrenschmidt , Matt Turner , Haavard Skinnemoen , Fenghua Yu , James Hogan , Chris Metcalf , Arnd Bergmann , Heiko Carstens , Stefan Kristiansson , Mikael Starvik , Ivan Kokshaysky , Bjorn Helgaas , Stafford Horne , linux-arm-kernel@lists.infradead.org, Richard Henderson , Chris Zankel , Michal Simek , Tony Luck , Vineet Gupta , linux-kernel@vger.kernel.org, Ralf Baechle , Richard Kuo , Niklas Cassel , "Luis R . Rodriguez" , Martin Schwidefsky , Ley Foon Tan , "David S. Miller" 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 The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and Posting") mandate non-posted configuration transactions. As further highlighted in the PCIe specifications (4.0 - Rev0.3, "Ordering Considerations for the Enhanced Configuration Access Mechanism"), through ECAM and ECAM-derivative configuration mechanism, the memory mapped transactions from the host CPU into Configuration Requests on the PCI express fabric may create ordering problems for software because writes to memory address are typically posted transactions (unless the architecture can enforce through virtual address mapping non-posted write transactions behaviour) but writes to Configuration Space are not posted on the PCI express fabric. Current DT and ACPI host bridge controllers map PCI configuration space (ECAM and ECAM-derivative) into the virtual address space through ioremap() calls, that are non-cacheable device accesses on most architectures, but may provide "bufferable" or "posted" write semantics in architecture like eg ARM/ARM64 that allow ioremap'ed regions writes to be buffered in the bus connecting the host CPU to the PCI fabric; this behaviour, as underlined in the PCIe specifications, may trigger transactions ordering rules and must be prevented. Introduce a new generic and explicit API to create a memory mapping for ECAM and ECAM-derivative config space area (and a corresponding generic asm-generic header file) that defaults to ioremap_nocache() (which should provide a sane default behaviour) and can be included by all architectures that do not require an arch specific memory mapping for ioremap_nopost() to guarantee non-posted writes behaviour. Signed-off-by: Lorenzo Pieralisi Cc: Arnd Bergmann Cc: Bjorn Helgaas Cc: Russell King Cc: Luis R. Rodriguez --- include/asm-generic/ioremap-nopost.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 include/asm-generic/ioremap-nopost.h diff --git a/include/asm-generic/ioremap-nopost.h b/include/asm-generic/ioremap-nopost.h new file mode 100644 index 0000000..015911f --- /dev/null +++ b/include/asm-generic/ioremap-nopost.h @@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_IOREMAP_NOPOST_H +#define __ASM_GENERIC_IOREMAP_NOPOST_H + +static inline void __iomem *ioremap_nopost(phys_addr_t offset, size_t size) +{ + return ioremap_nocache(offset, size); +} + +#endif /* __ASM_GENERIC_IOREMAP_NOPOST_H */