From patchwork Mon Dec 9 19:13:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11280065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D99B188B for ; Mon, 9 Dec 2019 19:14:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 44D1C206E0 for ; Mon, 9 Dec 2019 19:14:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44D1C206E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=deltatee.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1ADD36B283D; Mon, 9 Dec 2019 14:14:08 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1611E6B283E; Mon, 9 Dec 2019 14:14:08 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F41046B283F; Mon, 9 Dec 2019 14:14:07 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id D88666B283D for ; Mon, 9 Dec 2019 14:14:07 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7AEBF180AD81D for ; Mon, 9 Dec 2019 19:14:06 +0000 (UTC) X-FDA: 76246553292.01.boats77_7b1fb7eb60010 X-Spam-Summary: 2,0,0,a1030ae7e0887055,d41d8cd98f00b204,gunthorp@deltatee.com,:linux-kernel@vger.kernel.org:linux-arm-kernel@lists.infradead.org:linux-ia64@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:linux-s390@vger.kernel.org:linux-sh@vger.kernel.org:platform-driver-x86@vger.kernel.org::hch@lst.de:dan.j.williams@intel.com:akpm@linux-foundation.org:catalin.marinas@arm.com:will@kernel.org:benh@kernel.crashing.org:tglx@linutronix.de:mingo@redhat.com:bp@alien8.de:dave.hansen@linux.intel.com:luto@kernel.org:peterz@infradead.org:logang@deltatee.com:jgg@ziepe.ca,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2705:3138:3139:3140:3141:3142:3352:3865:3867:3868:3872:4250:4321:5007:6117:6261:6737:6742:7809:7903:7974:10004:11026:11473:11658:11914:12048:12296:12297:12438:12517:12519:12555:12895:13069:13149:13161:13229:13230:13311:13357:13894:13972:14096:14181:14384:14394:14721:21080:21451:21627: 21795:30 X-HE-Tag: boats77_7b1fb7eb60010 X-Filterd-Recvd-Size: 4077 Received: from ale.deltatee.com (ale.deltatee.com [207.54.116.67]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Dec 2019 19:14:05 +0000 (UTC) Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ieOTk-00025q-NL; Mon, 09 Dec 2019 12:13:57 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1ieOTd-0001Mv-Me; Mon, 09 Dec 2019 12:13:49 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Dan Williams , Andrew Morton Cc: Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Logan Gunthorpe , Jason Gunthorpe Date: Mon, 9 Dec 2019 12:13:46 -0700 Message-Id: <20191209191346.5197-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191209191346.5197-1-logang@deltatee.com> References: <20191209191346.5197-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, hch@lst.de, dan.j.williams@intel.com, akpm@linux-foundation.org, catalin.marinas@arm.com, benh@kernel.crashing.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, will@kernel.org, luto@kernel.org, peterz@infradead.org, logang@deltatee.com, jgg@ziepe.ca X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH 6/6] mm/memremap: Set caching mode for PCI P2PDMA memory to WC X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: PCI BAR IO memory should never be mapped as WB, however prior to this the PAT bits were set WB and it was typically overridden by MTRR registers set by the firmware. Set PCI P2PDMA memory to be WC (writecombining) as the only current user (the NVMe CMB) was originally mapped WC before the P2PDMA code replaced the mapping with devm_memremap_pages(). Future use-cases may need to generalize this by adding flags to select the caching type, as some P2PDMA cases will not want WC. However, those use-cases are not upstream yet and this can be changed when they arrive. Cc: Dan Williams Cc: Christoph Hellwig Cc: Jason Gunthorpe Signed-off-by: Logan Gunthorpe --- mm/memremap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memremap.c b/mm/memremap.c index 4edcca074e15..ced32593e4a7 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -187,7 +187,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) } break; case MEMORY_DEVICE_DEVDAX: + need_devmap_managed = false; + break; case MEMORY_DEVICE_PCI_P2PDMA: + pgprot = pgprot_writecombine(pgprot); need_devmap_managed = false; break; default: