Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7037369ybf; Fri, 6 Mar 2020 09:09:35 -0800 (PST) X-Google-Smtp-Source: ADFU+vv4C09oJd01CCSyJPfpqPQajhYDkdN1OJ6/YOGypP+sCsukNRRNOy/XHGsh7lY6CLcu0LgY X-Received: by 2002:aca:af97:: with SMTP id y145mr3269383oie.24.1583514575050; Fri, 06 Mar 2020 09:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583514575; cv=none; d=google.com; s=arc-20160816; b=cpo88mlv3kr6zsT8LIiazhHo5SGTPCj7lWE7cQVn/uxAFGpl2t+bpUUIVHbnn3k3Rc EeHzGf+yNEMdKPyO1OgzfjkJladWE3/4qMcVC4yC8d2hg2S6cN+HygZJ58QL8KPcbZh5 iUnVdWIvNkDhfMZ2v711n08U8OvCa3YBb15ozwgoWRDqKNcII4/suhxsMQfNi9rHyJvR dvwgJLsXKgzKIHvMUXmGQjskI+uP0hZrDo7OddrP2WepFkLhNAbyBGn1FtmcdPDCf+Gd psZ0fqk+GRBFLU1hRwEtgQBJE15IhtjBx5TTNpRm/VK0QNH2Er+4IHrN2j1raVTY5WtC Zbfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=jMaw4yo1lodhD9VIe5PLPFwCXLlOdchjThkj1RnBZ2Q=; b=hw9DKocjgRDIXwc2L4wJZ1ixLUUIboDZhtzabhT/scY5FFEgrrF+jbU6/2hcdRE54c Yio8sK2IH532VnmvMn4QjqQrXpB95cABeldSkhkOTgEWqz8+VqAgmg6V3eRGbgyfC9o9 k2gHc7AdoXdGXrDZgYyhUn1uf/7OwkJQnlWMu9PZbDPOKg6Ere0GE9mSTXzUqHBLT0Kw Pu7TItYtDCLuvHOtu2Tyrm04fRgbKWP4nxiUYfoM0+3VNtMDx+g6DO5/d04SlFdEqHHA l8AILBk9W0Tf8wzORG0+B3em0Sfcdsa9LUva84u7aT37jEldeVxa3cPNcL2fmFVdBxPa fgsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j36si1688139ota.58.2020.03.06.09.09.22; Fri, 06 Mar 2020 09:09:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgCFRJF (ORCPT + 99 others); Fri, 6 Mar 2020 12:09:05 -0500 Received: from ale.deltatee.com ([207.54.116.67]:38408 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbgCFRJD (ORCPT ); Fri, 6 Mar 2020 12:09:03 -0500 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 1jAGSz-0004aX-Qx; Fri, 06 Mar 2020 10:08:56 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1jAGSw-0002Ri-1E; Fri, 06 Mar 2020 10:08:50 -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, Dan Williams , Michal Hocko , David Hildenbrand , Andrew Morton Cc: Christoph Hellwig , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Eric Badger , Logan Gunthorpe , Jason Gunthorpe Date: Fri, 6 Mar 2020 10:08:46 -0700 Message-Id: <20200306170846.9333-8-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200306170846.9333-1-logang@deltatee.com> References: <20200306170846.9333-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, dan.j.williams@intel.com, akpm@linux-foundation.org, hch@lst.de, catalin.marinas@arm.com, benh@kernel.crashing.org, tglx@linutronix.de, david@redhat.com, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, mhocko@kernel.org, will@kernel.org, luto@kernel.org, peterz@infradead.org, ebadger@gigaio.com, 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=-8.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Subject: [PATCH v4 7/7] 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 UC as this is what it currently, typically, ends up being mapped as on x86 after the MTRR registers override the cache setting. Future use-cases may need to generalize this by adding flags to select the caching type, as some P2PDMA cases may not want UC. However, those use-cases are not upstream yet and this can be changed when they arrive. Cc: Christoph Hellwig Cc: Jason Gunthorpe Signed-off-by: Logan Gunthorpe Reviewed-by: Dan Williams --- mm/memremap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memremap.c b/mm/memremap.c index 06742372a203..9033ae401448 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -190,7 +190,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: + params.pgprot = pgprot_noncached(params.pgprot); need_devmap_managed = false; break; default: -- 2.20.1