From patchwork Thu Jul 6 15:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13303957 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 45C91EB64D9 for ; Thu, 6 Jul 2023 15:46:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F4D66B007D; Thu, 6 Jul 2023 11:46:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A48C6B007E; Thu, 6 Jul 2023 11:46:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 847246B0080; Thu, 6 Jul 2023 11:46:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7342B6B007D for ; Thu, 6 Jul 2023 11:46:10 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 01AE6A04FF for ; Thu, 6 Jul 2023 15:46:09 +0000 (UTC) X-FDA: 80981613300.01.81E3642 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id D5361140020 for ; Thu, 6 Jul 2023 15:46:06 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CFWen3+B; spf=pass (imf09.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688658366; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pQumlSibFcTmcmpj3o91A5K5Zwuz/UGXp5mnVQ2pvKA=; b=FhcUF4roxWaimnhcArPmZ8Kc5mr3a5O0VKpzjJcrw6YpCJV56Lf/q0237PyzIFImmIb+sU /RocuGhyQ4fyTmIc3a0STLKhdSQ09e6lulKh/W8+i7FYV3sKGEmxBOsV7WMojpJv1G0Nqy /MTs5Q3qsuBpOakjl/eaoJ/6JBhZYHc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688658366; a=rsa-sha256; cv=none; b=XJdFSg1h2aFJJsWxv5IbquC/EcrUU07pLXln+mZK+grZCvdkxDP+FqfVrSm/p4XFRq8tkX 6WcyV2SVhK2C/l50bWBFw+KrKcucm7MW/CBK0QUSvUc8EQ2uNqGb3Pg0kF0h7dZJRLFyph rnxYSm7ob9y7IyJw0pjTLftB9h1h/ZY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CFWen3+B; spf=pass (imf09.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658365; 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: in-reply-to:in-reply-to:references:references; bh=pQumlSibFcTmcmpj3o91A5K5Zwuz/UGXp5mnVQ2pvKA=; b=CFWen3+BhzJlvJOGQHi0G5J6x8PURDbx2VosF8ANJEAbAoHk+GpMbx0sz2tbH82A71V5lS c2CiG+Ci1cq/SiMu0ea3sKKG/qLlngRqIrLXcU2+axyKW8CUujJWJfNpgWU6PEV564LJLf ImGj/GiE6ckaI0HPZjEhMhvEzxGNbRc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-pVjnAUWyOpa14DMQOD0ttQ-1; Thu, 06 Jul 2023 11:46:02 -0400 X-MC-Unique: pVjnAUWyOpa14DMQOD0ttQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55F7B101A528; Thu, 6 Jul 2023 15:46:00 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22C8FF5CF0; Thu, 6 Jul 2023 15:45:50 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, arnd@arndb.de, hch@lst.de, christophe.leroy@csgroup.eu, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, shorne@gmail.com, David.Laight@ACULAB.COM, deller@gmx.de, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: [PATCH v8 03/19] openrisc: mm: remove unneeded early ioremap code Date: Thu, 6 Jul 2023 23:45:04 +0800 Message-Id: <20230706154520.11257-4-bhe@redhat.com> In-Reply-To: <20230706154520.11257-1-bhe@redhat.com> References: <20230706154520.11257-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspamd-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UG9QwTgY08zK 9iPvK4Bq xFfHOVr1s2pTlolHT9V0+PUJbyrytKCEG/UrUuZK99b4OXB+TAvgrWrBXuiiwgpuCMcTzHpcSVzSt54YMckkQgqG9y+khDZ/6NmUEV6kSqCBPXrIoBaxd5Gu89o0B73d2qUIQsuFmY6cBbY1UM1sB+Z9DcM0FO4sCnXAvM7OdnP5G4cby9M6IzbdjRyxHOPKyD9wMt0zrsAyFksSXVBu7F/W+qQwI1hVPphiuywBNSYGU726uJjU+OSNd26ZebSFaCE8UTOw7SGNyd6sGXGS6x4haYCux/7eGdhoam+0HHRbtwgN2EeS/bR6R+ZNnKyb06X6P 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: Under arch/openrisc, there isn't any place where ioremap() is called. It means that there isn't early ioremap handling needed in openrisc, So the early ioremap handling code in ioremap() of arch/openrisc/mm/ioremap.c is unnecessary and can be removed. And also remove the special handling in iounmap() since no page is got from fixmap pool along with early ioremap code removing in ioremap(). Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/ Signed-off-by: Baoquan He Acked-by: Stafford Horne Reviewed-by: Christoph Hellwig Reviewed-by: Mike Rapoport (IBM) Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: openrisc@lists.librecores.org --- arch/openrisc/mm/ioremap.c | 43 +++++--------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index 8ec0dafecf25..cdbcc7e73684 100644 --- a/arch/openrisc/mm/ioremap.c +++ b/arch/openrisc/mm/ioremap.c @@ -22,8 +22,6 @@ extern int mem_init_done; -static unsigned int fixmaps_used __initdata; - /* * Remap an arbitrary physical address space into the kernel virtual * address space. Needed when the kernel wants to access high addresses @@ -52,24 +50,14 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size) p = addr & PAGE_MASK; size = PAGE_ALIGN(last_addr + 1) - p; - if (likely(mem_init_done)) { - area = get_vm_area(size, VM_IOREMAP); - if (!area) - return NULL; - v = (unsigned long)area->addr; - } else { - if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS) - return NULL; - v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used); - fixmaps_used += (size >> PAGE_SHIFT); - } + area = get_vm_area(size, VM_IOREMAP); + if (!area) + return NULL; + v = (unsigned long)area->addr; if (ioremap_page_range(v, v + size, p, __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) { - if (likely(mem_init_done)) - vfree(area->addr); - else - fixmaps_used -= (size >> PAGE_SHIFT); + vfree(area->addr); return NULL; } @@ -79,27 +67,6 @@ EXPORT_SYMBOL(ioremap); void iounmap(volatile void __iomem *addr) { - /* If the page is from the fixmap pool then we just clear out - * the fixmap mapping. - */ - if (unlikely((unsigned long)addr > FIXADDR_START)) { - /* This is a bit broken... we don't really know - * how big the area is so it's difficult to know - * how many fixed pages to invalidate... - * just flush tlb and hope for the best... - * consider this a FIXME - * - * Really we should be clearing out one or more page - * table entries for these virtual addresses so that - * future references cause a page fault... for now, we - * rely on two things: - * i) this code never gets called on known boards - * ii) invalid accesses to the freed areas aren't made - */ - flush_tlb_all(); - return; - } - return vfree((void *)(PAGE_MASK & (unsigned long)addr)); } EXPORT_SYMBOL(iounmap);