From patchwork Sat Sep 19 09:17:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11786943 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C10F6CB for ; Sat, 19 Sep 2020 10:13:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A42621D42 for ; Sat, 19 Sep 2020 10:13:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yoqC5cWT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iLcOHwCT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uE/cx/Xr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fAWa6oS2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A42621D42 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=BLb301SYPZttzSy2V9VHGD5diQ+vYCeFNo8nyBarauE=; b=yoqC5cWTMl2hUFvXMNC0Ihsng TNeMNuC7fntB87nQX+S6AJdOsPv51VssZ15rHFwG93/8zBC6waDUzrwOIzDDID7IsvTF74ckZSM4F Wzb4rNhPKNJRz1qsmkCJe2Ly/Pi6XqY2G9Ve4ra0EvCtlgdEY+HIqk9jtZSu4xK775tost93X/Oxv jZCKDY6/jmB20sEKAtDJlux262VDLH20Q5fBR5RGVQlbfvgIe4aV2meD14WouFAlrZYZaqPRPwquE NLRfoZnI9mpc0O5CjkSRcPXmJ737qexaNMPTwrXA4m3S1GCqSJcsROaqnX//c17wW+VpOguLutsze 8ilEPk17g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJZqm-0006nN-Q7; Sat, 19 Sep 2020 10:12:13 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJZqF-0006cm-KA; Sat, 19 Sep 2020 10:11:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-transfer-encoding:Content-Type: MIME-Version:References:Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To; bh=l6UaD+dzOnnTICZKZqhj1RzFfIiirpVtGOULH7No/gI=; b=iLcOHwCTEa2Te8h3n8rRpUFV6Z ND0Xl7S6j0qN4afhvjoR06+dPe5kzU4syj7i4DEKlaLGaTWOGDfsy8JhaG1a+GNFvQstEmGISctlW 7XHZuZhFEoSOhjcwhtSXbhrQMbBKhdpMKazoiGrbLXDZir+yg8sK0mp1SJAINNdKhB1IhRLh7iiep KbDp3ntTgL1GIZBpUDQoD01Li87GzRNXfx3UyaTtILquA0NhmK4mD6f7UVqIimgVpnbh8KTFT7nJi NDdThihdSx4Ou/eqDyfQqga1fuZoUb5qisd/qVVpCDNRCsN+K3R555QKR+PHab8b8PqMtQcieZbgW UH3UqTSg==; Received: from galois.linutronix.de ([193.142.43.55]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJZVV-0005yX-Vp; Sat, 19 Sep 2020 09:50:18 +0000 Message-Id: <20200919092616.639345384@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600509010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=l6UaD+dzOnnTICZKZqhj1RzFfIiirpVtGOULH7No/gI=; b=uE/cx/XrCkHRif0a8B/w0YwDHTFwWo03DlSB7Y+loKY8xMmLrHOwc8lpWUZbqY8QApMA/g sajhDKXTCP5FGncBXxctNRnl24aPkXZ5mv6xZo09Vm65NwvEPuEKm4NDcrFjm7NB7Xa5rL zLEnYLoAoiyvMOCaPzqFZF6tElKTJcVZW7CuQoeaoTHUXkP4aGYvq3FQAmpkOCBkhmSWvq IG0ndfdvEjaQLn5Ju2RKkWSDGRuzWFI6CkmEbdALZYxEo8CkRTP9sK54SFr+pnSrrJ8Gkd 16VmQoNyueVyGeLZSsaOk2wsU8WpIK+uORXYGRVbugHbjD4igNrb9PYU9pU6IA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600509010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=l6UaD+dzOnnTICZKZqhj1RzFfIiirpVtGOULH7No/gI=; b=fAWa6oS2xwanh/X+hPgArDKmCI7Jk7grG3LDqIrJ5eHdpm+qaq2QoU3UJXACE7I1r07ARu 5m000yHhlPwxwMDA== Date: Sat, 19 Sep 2020 11:17:59 +0200 From: Thomas Gleixner To: LKML Subject: [patch RFC 08/15] mips/mm/highmem: Switch to generic kmap atomic References: <20200919091751.011116649@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200919_105014_418343_82020422 X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: -4.4 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [193.142.43.55 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , Joonas Lahtinen , dri-devel , Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Vincent Guittot , Herbert Xu , Michael Ellerman , x86@kernel.org, Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , linux-snps-arc@lists.infradead.org, linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev@lists.ozlabs.org, Steven Rostedt , Linus Torvalds , Jani Nikula , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , linux-mips@vger.kernel.org, Arnd Bergmann , Daniel Vetter , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Thomas Gleixner Cc: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org --- Note: Completely untested --- arch/mips/Kconfig | 1 arch/mips/include/asm/highmem.h | 4 +- arch/mips/mm/highmem.c | 77 ---------------------------------------- arch/mips/mm/init.c | 3 - 4 files changed, 3 insertions(+), 82 deletions(-) --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2654,6 +2654,7 @@ config MIPS_CRC_SUPPORT config HIGHMEM bool "High Memory Support" depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !CPU_MIPS32_3_5_EVA + select KMAP_ATOMIC_GENERIC config CPU_SUPPORTS_HIGHMEM bool --- a/arch/mips/include/asm/highmem.h +++ b/arch/mips/include/asm/highmem.h @@ -48,11 +48,11 @@ extern pte_t *pkmap_page_table; #define ARCH_HAS_KMAP_FLUSH_TLB extern void kmap_flush_tlb(unsigned long addr); -extern void *kmap_atomic_pfn(unsigned long pfn); #define flush_cache_kmaps() BUG_ON(cpu_has_dc_aliases) -extern void kmap_init(void); +#define arch_kmap_temp_post_map(vaddr, pteval) local_flush_tlb_one(vaddr) +#define arch_kmap_temp_post_unmap(vaddr) local_flush_tlb_one(vaddr) #endif /* __KERNEL__ */ --- a/arch/mips/mm/highmem.c +++ b/arch/mips/mm/highmem.c @@ -8,8 +8,6 @@ #include #include -static pte_t *kmap_pte; - unsigned long highstart_pfn, highend_pfn; void kmap_flush_tlb(unsigned long addr) @@ -17,78 +15,3 @@ void kmap_flush_tlb(unsigned long addr) flush_tlb_one(addr); } EXPORT_SYMBOL(kmap_flush_tlb); - -void *kmap_atomic_high_prot(struct page *page, pgprot_t prot) -{ - unsigned long vaddr; - int idx, type; - - type = kmap_atomic_idx_push(); - idx = type + KM_TYPE_NR*smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); -#ifdef CONFIG_DEBUG_HIGHMEM - BUG_ON(!pte_none(*(kmap_pte - idx))); -#endif - set_pte(kmap_pte-idx, mk_pte(page, prot)); - local_flush_tlb_one((unsigned long)vaddr); - - return (void*) vaddr; -} -EXPORT_SYMBOL(kmap_atomic_high_prot); - -void kunmap_atomic_high(void *kvaddr) -{ - unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; - int type __maybe_unused; - - if (vaddr < FIXADDR_START) - return; - - type = kmap_atomic_idx(); -#ifdef CONFIG_DEBUG_HIGHMEM - { - int idx = type + KM_TYPE_NR * smp_processor_id(); - - BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); - - /* - * force other mappings to Oops if they'll try to access - * this pte without first remap it - */ - pte_clear(&init_mm, vaddr, kmap_pte-idx); - local_flush_tlb_one(vaddr); - } -#endif - kmap_atomic_idx_pop(); -} -EXPORT_SYMBOL(kunmap_atomic_high); - -/* - * This is the same as kmap_atomic() but can map memory that doesn't - * have a struct page associated with it. - */ -void *kmap_atomic_pfn(unsigned long pfn) -{ - unsigned long vaddr; - int idx, type; - - preempt_disable(); - pagefault_disable(); - - type = kmap_atomic_idx_push(); - idx = type + KM_TYPE_NR*smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); - set_pte(kmap_pte-idx, pfn_pte(pfn, PAGE_KERNEL)); - flush_tlb_one(vaddr); - - return (void*) vaddr; -} - -void __init kmap_init(void) -{ - unsigned long kmap_vstart; - - /* cache the first kmap pte */ - kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); - kmap_pte = virt_to_kpte(kmap_vstart); -} --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -402,9 +402,6 @@ void __init paging_init(void) pagetable_init(); -#ifdef CONFIG_HIGHMEM - kmap_init(); -#endif #ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; #endif