Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2182721ybv; Fri, 21 Feb 2020 10:27:39 -0800 (PST) X-Google-Smtp-Source: APXvYqwE0USLExbryNODLknQ+TV69ggIsBaY1O/JHpb3SFjsj52GNSRJqeiRIw6mRl43ElTsuwxh X-Received: by 2002:a9d:6a90:: with SMTP id l16mr27594596otq.353.1582309659525; Fri, 21 Feb 2020 10:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582309659; cv=none; d=google.com; s=arc-20160816; b=SNWUU0CLBGp6U3nFpz4gMAIhgtDktKPhDmXBh6n7My5kby3AzYgdPXmJtFcW3K1A6+ 2lzg2DKg0dTccBGcf7GBB2jX4FIdKiPcsqtVsmQm4Y7MVHjEBRuBgB4ItCYwitnMv++y HlC+0HS+D7CxgA5kQzmYV22BSFDCph2QzH6FiDlVd5LWsPDKh3Z3DsnkXSBTih0GkJGa S4LZBcUL+c+odpK0nf3dvwkP+55IBfQ1pFcKQUJsZYXCIOUkLa49gXi7HnX/jgz3wsMy ZoJZkxPyajYQAvsaAB7cXcvpPxQWlOQgAQ8dFywSaxqJjMTyYsQYByQS8pSB3Jgy4cUw 8KOA== 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=xxgOYR1iHFu0i4p9mGPGjNEHakGCHkW8C18zD46f/0Q=; b=F5tnDtCbFhzdsIW9ns59Dv6HmLQf33erjk1buOGwv/9g5yLnnIPXDOCdhLoigkrD89 l8KVBKd0CgoGEeZJvNLMeRY3SF/QLzvMsEBtz18tsqKqqPsZCBrs4T7oJ8jDOf40jShf wGQTHDin0m6+oYJsXMmtpzYd+CIoFSET06iJh3MSkjvHSmZCFnAXjwFeBRsDs4GoF3ww /QzV/ElvJtwdosJ7eGyuG+wFkd8ItoSnC2AHKeuI3liLsT1qQYA7LDz76YC755YQ5OeO E0P8Pi7DTDs5BR0TZP48n5x9owGHp6fLtvJd91jKPKYpUy9GdA5jZaagPNozQX8qVz+B 2Qjw== 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 t26si1723379otq.264.2020.02.21.10.27.27; Fri, 21 Feb 2020 10:27:39 -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 S1729677AbgBUSZb (ORCPT + 99 others); Fri, 21 Feb 2020 13:25:31 -0500 Received: from ale.deltatee.com ([207.54.116.67]:59186 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729318AbgBUSZa (ORCPT ); Fri, 21 Feb 2020 13:25:30 -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 1j5CzA-00057o-9o; Fri, 21 Feb 2020 11:25:24 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1j5Cz3-0007Nk-Dq; Fri, 21 Feb 2020 11:25:05 -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 , "H. Peter Anvin" , x86@kernel.org Date: Fri, 21 Feb 2020 11:25:00 -0700 Message-Id: <20200221182503.28317-5-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200221182503.28317-1-logang@deltatee.com> References: <20200221182503.28317-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, peterz@infradead.org, ebadger@gigaio.com, logang@deltatee.com, hpa@zytor.com, mhocko@kernel.org, will@kernel.org, luto@kernel.org, x86@kernel.org 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,SURBL_BLOCKED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Subject: [PATCH v3 4/7] x86/mm: Introduce _set_memory_prot() 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 For use in the 32bit arch_add_memory() to set the pgprot type of the memory to add. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Logan Gunthorpe --- arch/x86/include/asm/set_memory.h | 1 + arch/x86/mm/pat/set_memory.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h index 64c3dce374e5..0aca959cf9a4 100644 --- a/arch/x86/include/asm/set_memory.h +++ b/arch/x86/include/asm/set_memory.h @@ -34,6 +34,7 @@ * The caller is required to take care of these. */ +int _set_memory_prot(unsigned long addr, int numpages, pgprot_t prot); int _set_memory_uc(unsigned long addr, int numpages); int _set_memory_wc(unsigned long addr, int numpages); int _set_memory_wt(unsigned long addr, int numpages); diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index c4aedd00c1ba..2ba83d53d835 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -1792,6 +1792,13 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages, CPA_PAGES_ARRAY, pages); } +int _set_memory_prot(unsigned long addr, int numpages, pgprot_t prot) +{ + return change_page_attr_set_clr(&addr, numpages, prot, + __pgprot(~pgprot_val(prot)), 0, 0, + NULL); +} + int _set_memory_uc(unsigned long addr, int numpages) { /* -- 2.20.1