From patchwork Mon Feb 27 17:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 62072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2561909wrd; Mon, 27 Feb 2023 10:00:58 -0800 (PST) X-Google-Smtp-Source: AK7set/cjrFFp5SZZJJF40cTAPRiUd5AdleQwaTb9VxIdwM3VBWfZ3yRnIHLxQWlrGz+1NAZBscy X-Received: by 2002:a05:6a20:3d02:b0:bc:f45f:ecf7 with SMTP id y2-20020a056a203d0200b000bcf45fecf7mr476614pzi.2.1677520857856; Mon, 27 Feb 2023 10:00:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677520857; cv=none; d=google.com; s=arc-20160816; b=0m8A2FeOj1KeLvy8G+eFipoXR04Tb8zwCZUDSmZRNX0AZyS6T/dBRA0TPLS8opkEAg AN5Qioflucy3IgBZfQSV2uVhxNR4xlZesHp2dAZ8CSd/TqDLaExBk9uw1FDm/iMvrpJ9 J9kp0jnqN1fsgO7tnGDoHdoQMtNEshcB4LBSXNS7LE6VrjPIp+c4TCsv6IWOY0R2ihCZ MjTpHk/VuR5qbqsbtzkR+fNTE1OMjgdagge4Wjar7+Q+R7mg7q2k6iPGyCiowSXCwwl5 qfdttId0eRTSOxf/aLsuuuGv0QQlJVHG8kGMqqGBPysEQWget3T8J2V71UH2cEl5+dN/ DfvA== 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=sxlK/dYV0ak5B9qHymTAjJFaSXLib2XJVaYWuBBEzbA=; b=ccvUxU2FmsCtkZfb5LVCkGnxsQ0x8iMZcZsa4kH85yymUM3RSHYUc1P9K0r6OXcj3r H047U84glZYi3rlOqcO4aVn/0cPoPTp3KA3zH/q8mdszwrT79fihOsZTBRoShnfeEOHt AUwVI6/QqrE940BCzMjHq2PaWpSyjmxi5aaQUQyVWhDr1B9tYE4AIuCQuPaq7RMTtQh2 by/UQFA0jUsnr5kt5uC337hSCoGUaNlDhqRTwrEkl/q3+Wzg2OorhaSTLeYMDILf0Z4u x9KYPW3USRpDrFe6wEZgMEoMYAeUYe6RVZuzwJJbt2+T8jw2/MWQeyeVaMrkGhI4ffev FBrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KJArGZg5; 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 v10-20020a63610a000000b004fb97a4c535si7531240pgb.876.2023.02.27.10.00.44; Mon, 27 Feb 2023 10:00:57 -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=KJArGZg5; 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 S230448AbjB0R6w (ORCPT + 99 others); Mon, 27 Feb 2023 12:58:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbjB0R6P (ORCPT ); Mon, 27 Feb 2023 12:58:15 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834B126AC; 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=sxlK/dYV0ak5B9qHymTAjJFaSXLib2XJVaYWuBBEzbA=; b=KJArGZg5ykb/Jt6MrUMbaOQqDd UnMjz5PSAOd/w5pETz+CjwQDQ6ckLaC2VobWTEa9SBodl7MPmdlHlNGKktbfKpGOfOsumfcLXwB67 lpmiE7axvL4uExQ5lnOl67durBwmWg4ZP3kkly1SwvjwaYj8bJtVY9L4hxVwBRLIDtsrWqBf/+2ce Ipuk59BoCRUfc2NYdkGz4zXmBWMrGqW4PBFJMHel9wuHi2Xl6xsMts8Xep9d5Y0AfTev9G8LXypdg TRRlSzCBok51T+YaD9NzrQ4G+tQ794Piz+yjO2KqsXpBBINYOdQIkLzcCoL89nSDxn2zDk3bGfxzL pjYGDM4g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWhkt-000IX4-Sk; Mon, 27 Feb 2023 17:57:43 +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 Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org Subject: [PATCH v2 05/30] alpha: Implement the new page table range API Date: Mon, 27 Feb 2023 17:57:16 +0000 Message-Id: <20230227175741.71216-6-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?1759008110968446702?= X-GMAIL-MSGID: =?utf-8?q?1759008110968446702?= Add set_ptes(), update_mmu_cache_range() and flush_icache_pages(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: linux-alpha@vger.kernel.org --- arch/alpha/include/asm/cacheflush.h | 10 ++++++++++ arch/alpha/include/asm/pgtable.h | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/arch/alpha/include/asm/cacheflush.h b/arch/alpha/include/asm/cacheflush.h index 9945ff483eaf..3956460e69e2 100644 --- a/arch/alpha/include/asm/cacheflush.h +++ b/arch/alpha/include/asm/cacheflush.h @@ -57,6 +57,16 @@ extern void flush_icache_user_page(struct vm_area_struct *vma, #define flush_icache_page(vma, page) \ flush_icache_user_page((vma), (page), 0, 0) +/* + * Both implementations of flush_icache_user_page flush the entire + * address space, so one call, no matter how many pages. + */ +static inline void flush_icache_pages(struct vm_area_struct *vma, + struct page *page, unsigned int nr) +{ + flush_icache_user_page(vma, page, 0, 0); +} + #include #endif /* _ALPHA_CACHEFLUSH_H */ diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h index ba43cb841d19..1e3354e9731b 100644 --- a/arch/alpha/include/asm/pgtable.h +++ b/arch/alpha/include/asm/pgtable.h @@ -26,7 +26,18 @@ struct vm_area_struct; * hook is made available. */ #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) +static inline void set_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte, unsigned int nr) +{ + for (;;) { + set_pte(ptep, pte); + if (--nr == 0) + break; + ptep++; + pte_val(pte) += 1UL << 32; + } +} +#define set_pte_at(mm, addr, ptep, pte) set_ptes(mm, addr, ptep, pte, 1) /* PMD_SHIFT determines the size of the area a second-level page table can map */ #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3)) @@ -303,6 +314,11 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, { } +static inline void update_mmu_cache_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr) +{ +} + /* * Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that * are !pte_none() && !pte_present().