From patchwork Wed Aug 2 15:13:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13338346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D409CC05051 for ; Wed, 2 Aug 2023 15:14:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38842280196; Wed, 2 Aug 2023 11:14:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F335A280197; Wed, 2 Aug 2023 11:14:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D160828019B; Wed, 2 Aug 2023 11:14:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 95FAC280193 for ; Wed, 2 Aug 2023 11:14:16 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5CC3B1CA00D for ; Wed, 2 Aug 2023 15:14:16 +0000 (UTC) X-FDA: 81079510512.28.5C3AFA3 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id BBBC816000B for ; Wed, 2 Aug 2023 15:14:14 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b9dkXpP3; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690989254; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9RHDmDB95v1l5T7Qwsk5FiocHYrmlic3rJL0E8q61Fc=; b=1IqCmLRtIMI/SSms045BZLHVklARAjo1jUf7potNHoAL8l1C91StUkwFff8pCYXu4PW5IE tB5fAjG5LuW0/3XvS4AtacKs/MzK6/fJe/ioe5+s9Db6xDSRXgHlmTAa2RuFY3u69ZsbsS uwxCHxPk7pSZrOi2gxVUoMe6y+0fdLM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b9dkXpP3; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690989254; a=rsa-sha256; cv=none; b=eIVan7zcGPDLCG5QBg5m5JELmGyeCY1wFrTBIIjxntJMszRJS4Y60QhHdnWCUn/YrdXOgF pWYEgz/BufL71OuecD8gQ1081dXLAVXOFnA8L5htswx/XpSwFvOIlIFJG7Yo7KRICQea7l MReSm+ggfTBbs/4dDHJ9b10LFHNYVAY= 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=9RHDmDB95v1l5T7Qwsk5FiocHYrmlic3rJL0E8q61Fc=; b=b9dkXpP35uwjKsyy9T0Nzk4a6L w7afQQ1eQRV2xf6D5i591kgMjsl5ex3XJeSgYsnyMfblmncIZp6y/FffNATtxVIVW+aJGswyDJ2FP tKdKGqTn0nVd6RRIk6DKZMpzgFSrCc+8MQ1PN1gQmlHtfdgPtYoprNvrIVcoQwez7dNY4ALKlPvTj +Mtr/4x3fxQhc3P8atSuRKXjOhmqG0hAFSkotVTVWY7wzlA1+Jpl1nhkLMNRwLpA4+QeHvbl+vUXn O1eB80/BTSTKYq01EwFFOKSHmWoyr5LQQTP3mb+pAi8L/8CE4owYLwYSeOL4gWDXgUQxs9iykwP0H +DvhJhqQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRDY9-00FfjG-43; Wed, 02 Aug 2023 15:14:09 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Brian Cain , Mike Rapoport Subject: [PATCH v6 12/38] hexagon: Implement the new page table range API Date: Wed, 2 Aug 2023 16:13:40 +0100 Message-Id: <20230802151406.3735276-13-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230802151406.3735276-1-willy@infradead.org> References: <20230802151406.3735276-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: BBBC816000B X-Stat-Signature: b9796b7oyjrco816mainhs8pog4mcyfu X-Rspam-User: X-HE-Tag: 1690989254-98700 X-HE-Meta: U2FsdGVkX19EVpl90qllRQ0nLZQUXhhAo5gKBpK8k4oP3HYtmEwm+q+1zwjfxohWaI1LX1AgLKXCkJFP9lzsb+lQ1WegtPIbOfq11L3VhcXeofmOLQ6cl4i10qhrzHKEk7z65v57+cXefN00sSlg8E8oCa/WRTVENemIuEpNEREoqKRAlLCbmM6HUQfMLpApK2iSWlqNw+xtnwhbeHmIgDYRcimdsI5/ththjukmcjfWegN+wEsj/97zylA+bPOgm3igmWvYe1OAaFsmcm7x/0AdBeQTyTeopbmZu3EiYwqBFv6dn8Nv44LGg4s9598caYK86v1/B70CCH7cv8VOAbQI0FrI6+XrixpeJvQ/pjFnR/skgJS5C+pa5XqyHnyTR75CcDaI2j+nUx+C3Ifc/L5ELgj5VgNG1vWsxOVbvxBxKnpoli1jRXnbpymC0QGARJRD30Od0H1vGlSz7cWpAE0ZaDGRTjDBl4NiAN2MokP9ALMeBlkmlAjfu9sS/5cBO3/WW+V/fospexXk+1hbO4NNb8Xr5HTwTej9j7EBR0j8gbTX0cb2hOene8sfvD5U3w6ln6rX3kHqU7uwlvEqK5jMQ2pmYnpjssBBHAEQpZnIHZtT4Si3Bna9NtkAJvWTG59y5lfNBOShA+Z1/ZrkNjK7pzCjcYlfujH2PQ577TjFyHUU348mTO3+4WIy6UVrKMA2YamsKCeVo2Nwp5lRAmVlhOPKiP2o3o8+CSwGNLqAUIGGPZ4vaRwMxJsIEohh/5mqPZfbZY0FEVwY455XwEyt785iaZ6i24lHsJzPNzdOl3scaYLOb4ARcN6sQ/89RhDXORxwCXXM7FWjeMJ8uC7XMTzfd3fLuW3or8HUuvOWmTwoa5w7KUU4xZIinTHfCgtEhaKd3+zvfJerV2XZrlfca6x4wlAwSdkYUrHBQAD6cM/ZAbDlUMr6ZKwmK7t0hNSY15mYXntzGItQhxf CQxnD20B w4Dsl/4Z6QIKf2yga5X9Y42Ht30vy4zS07+Fyw8QbZf09I+mCcC9xtOTJWj80ebvHl3HS9n4DrZvWjC83os447rlf30wKGC+fs8Qad3K5b1HDUX/62XD51Id1KXBf30emDrG+j5iIu59Oskw1hYn4KAiM/up9Iuthm9G6KBFvIaMtQQ7fSefd4/GfReuHikZLOJpQtotjPCD5JTd0+t44m0e7HECZKZmfOwHa8xr/5GcpWU2x78niitPWKee4dkdTcUQPjKzhA6D7s1IlTC9cNaCsxryTvekesQN+kvxloQLKUhU= 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: Add PFN_PTE_SHIFT and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Brian Cain Acked-by: Mike Rapoport (IBM) --- arch/hexagon/include/asm/cacheflush.h | 8 ++++++-- arch/hexagon/include/asm/pgtable.h | 9 +-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/hexagon/include/asm/cacheflush.h b/arch/hexagon/include/asm/cacheflush.h index 6eff0730e6ef..dc3f500a5a01 100644 --- a/arch/hexagon/include/asm/cacheflush.h +++ b/arch/hexagon/include/asm/cacheflush.h @@ -58,12 +58,16 @@ extern void flush_cache_all_hexagon(void); * clean the cache when the PTE is set. * */ -static inline void update_mmu_cache(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep) +static inline void update_mmu_cache_range(struct vm_fault *vmf, + struct vm_area_struct *vma, unsigned long address, + pte_t *ptep, unsigned int nr) { /* generic_ptrace_pokedata doesn't wind up here, does it? */ } +#define update_mmu_cache(vma, addr, ptep) \ + update_mmu_cache_range(NULL, vma, addr, ptep, 1) + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr, void *dst, void *src, int len); #define copy_to_user_page copy_to_user_page diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h index 59393613d086..dd05dd71b8ec 100644 --- a/arch/hexagon/include/asm/pgtable.h +++ b/arch/hexagon/include/asm/pgtable.h @@ -338,6 +338,7 @@ static inline int pte_exec(pte_t pte) /* __swp_entry_to_pte - extract PTE from swap entry */ #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) +#define PFN_PTE_SHIFT PAGE_SHIFT /* pfn_pte - convert page number and protection value to page table entry */ #define pfn_pte(pfn, pgprot) __pte((pfn << PAGE_SHIFT) | pgprot_val(pgprot)) @@ -345,14 +346,6 @@ static inline int pte_exec(pte_t pte) #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) -/* - * set_pte_at - update page table and do whatever magic may be - * necessary to make the underlying hardware/firmware take note. - * - * VM may require a virtual instruction to alert the MMU. - */ -#define set_pte_at(mm, addr, ptep, pte) set_pte(ptep, pte) - static inline unsigned long pmd_page_vaddr(pmd_t pmd) { return (unsigned long)__va(pmd_val(pmd) & PAGE_MASK);