From patchwork Mon Feb 27 17:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 62074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2562205wrd; Mon, 27 Feb 2023 10:01:23 -0800 (PST) X-Google-Smtp-Source: AK7set+JntIc1Xcaw4GrdfOr/c2bjklQUN7TQKPSKOmub6NpjD6j5d1/9V3I3psucMcw1ijqt0nW X-Received: by 2002:a17:90a:3ec7:b0:234:106a:3490 with SMTP id k65-20020a17090a3ec700b00234106a3490mr21404pjc.40.1677520883327; Mon, 27 Feb 2023 10:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677520883; cv=none; d=google.com; s=arc-20160816; b=Cg03AUl5w6p76V8uuJUiN/cyN3RIFxCcVh5AA1OjuJkuQwS9c7qo89MsslT3Dgq1k3 wftMIGRWgIrLTT/hnMjkdUUqf8lvp6Kt3TijwS4mGb4lIBzrpBKbEPC9+eOYul00GBxh Srmg4IuexNORcBstlyTlFnu3nibFUNbZ/nt/wEr0NX0qoQqIYtyp5ITGH6OvqLol8q/S eMzIXEerNwxFF5ZbbcsiPCq/9vlEI2yibh3S0Hx4cPC+OiUw1qblurtCyVWPv9gHxtUd pZ38VvISKnBG9DgwrCs/zHFU/Y0gLhssaxBW6/sPzGikTqauEXgpNJhHZUma+t46LFR1 U74w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dtiP3hUvA6nDur052lXOuZXkJQbzfHLCDQRu6Y0/CbA=; b=EoxYKZc31ylGdDx/nGLEcsCPwwP15rGUHaka/Ph9YVe6Ui63UX51q8cjSuXlMT4h5f Cszfak7It2YacZ3qwZm+UrPszA4vfyej4u29ZFOmZuAXRl4c+Ao5IFACXBv+rYaPfe3N qgBWwqaY6smXT/PJtYPbre+2P9wBYKTFFPzFLCPZHk+Ma+YH2RytLVlpWILo6HoBG//s 5FYPSp91XbL9DovgOSPB5Pyg+ZGSW9J2GOjDOzxBDBJWY1JRPnB9QnkuC5R6MDn/zWL7 YxwgdS9zfeABcAXHjSK3+XWtOBX9qrYLGmonsjrlaXwqfU9L2uj07d0SYj5ChgAFENC7 trCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XBOe25D8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a17090a398f00b00234bf8d76f7si8151664pjb.2.2023.02.27.10.01.10; Mon, 27 Feb 2023 10:01:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XBOe25D8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjB0R7B (ORCPT + 99 others); Mon, 27 Feb 2023 12:59:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbjB0R6Q (ORCPT ); Mon, 27 Feb 2023 12:58:16 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 792E8269E; Mon, 27 Feb 2023 09:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=dtiP3hUvA6nDur052lXOuZXkJQbzfHLCDQRu6Y0/CbA=; b=XBOe25D8ILBHFTarSSJcSeNA9I 1ho9edMN4WMOW+STKHU1Fjrea3rZodyLYFfxge7XDJMmfzMLJ5pCij5ce+T8U8wF/UdpEm7/Bz/qs 9nM2/FbCHKKykm8iTTCuAlGyTgQE/GycxrAz4ODI7DXc3tJUA+rJSGPORBHP1Q1tDn6els/rAcXNu nyYSpLPPd/TdxuXWCWgvTme17TJDDIgRhLDaoyZ4+jc4P1FBu1uKCgWDbTmRzt9YGRbp3MINfC48D n14ezuCiX8fXSt33c5Q2tTPA1dQpdTi3Rtl9mrNc5frwFSRQaNc0nMoT7sy55aFkqJjuw/TB8oH1V MaBmNMxg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWhkw-000IYY-7M; Mon, 27 Feb 2023 17:57:46 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org, linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org Subject: [PATCH v2 24/30] um: Implement the new page table range API Date: Mon, 27 Feb 2023 17:57:35 +0000 Message-Id: <20230227175741.71216-25-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230227175741.71216-1-willy@infradead.org> References: <20230227175741.71216-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759008137789590239?= X-GMAIL-MSGID: =?utf-8?q?1759008137789590239?= Add set_ptes() and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index a70d1618eb35..ca78c90ae74f 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h @@ -242,12 +242,20 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr); } -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *pteptr, pte_t pteval) +static inline void set_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte, unsigned int nr) { - set_pte(pteptr, pteval); + for (;;) { + set_pte(ptep, pte); + if (--nr == 0) + break; + ptep++; + pte_val(pte) += PAGE_SIZE; + } } +#define set_pte_at(mm, addr, ptep, pte) set_ptes(mm, addr, ptep, pte, 1) + #define __HAVE_ARCH_PTE_SAME static inline int pte_same(pte_t pte_a, pte_t pte_b) { @@ -290,6 +298,7 @@ struct mm_struct; extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); #define update_mmu_cache(vma,address,ptep) do {} while (0) +#define update_mmu_cache_range(vma, address, ptep, nr) do {} while (0) /* * Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that