From mboxrd@z Thu Jan 1 00:00:00 1970 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 DCD26C7EE25 for ; Fri, 9 Jun 2023 07:56:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72A038E0007; Fri, 9 Jun 2023 03:56:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B40F8E0001; Fri, 9 Jun 2023 03:56:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 553688E0007; Fri, 9 Jun 2023 03:56:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 48BFF8E0001 for ; Fri, 9 Jun 2023 03:56:17 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 27BE31A014F for ; Fri, 9 Jun 2023 07:56:17 +0000 (UTC) X-FDA: 80882451594.15.77F59DA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 2F1FE140004 for ; Fri, 9 Jun 2023 07:56:13 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EJNzIF94; spf=pass (imf26.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.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=1686297374; 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=b1cwgKpxB+oYTQq0br6utRWEYNI4guxqhcfHp/vK96c=; b=eobFRYTgQMv0EGWihIEV7fcpX/YRJ7sC9pGx2vkrQ8RXXb5A3x29bxiqD7n87jky6s1iAy vVgvGuiL09ykGbQ233/DQhFTvEe5LjZQo9Bq+o3EmmTTsFgwjXoNdC0emGnOLvvH+k8l2g 7sJGCUOPP4TWyigiCGR1Om6au8ohj48= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EJNzIF94; spf=pass (imf26.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686297374; a=rsa-sha256; cv=none; b=Ft/P4DBVXoGu3Kzjp/5q6Hlbz4gcR4OZWYCe2RT4+FexbbMN0GovaPjG6cHL+so3cpD4zd 4+HOnmj2LMHOhhDEJGX/IwUaWddA4a1gy8MbreeFJMmTSCbuu3ICN4Pc+9UpDiA3QANWB9 suY9FaqkxOw2WwkYWZI0IgMJ+8Kv1fo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297373; 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=b1cwgKpxB+oYTQq0br6utRWEYNI4guxqhcfHp/vK96c=; b=EJNzIF94IwbqgQXcnfvUbQ3VVTHH/jEkuTICrENZH9d8/IQ5istLZ7LQUhQIdxbhucSjRU pP33qG2piWzOztJH62PZOm2B7oJ6xeyKA4wH/dicUou89GvxwAk4IeT+HFwKE7Td8RskLZ zxc3HXm3ZSWZzmxhLuM9OsIxFpDcV0Y= 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-668-KXU_qVZcOVSgr_rQs7LwAQ-1; Fri, 09 Jun 2023 03:56:01 -0400 X-MC-Unique: KXU_qVZcOVSgr_rQs7LwAQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4B8085A5BA; Fri, 9 Jun 2023 07:56:00 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 012CE20268C6; Fri, 9 Jun 2023 07:55:53 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@lst.de, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, deller@gmx.de, Baoquan He , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: [PATCH v6 03/19] openrisc: mm: remove unneeded early ioremap code Date: Fri, 9 Jun 2023 15:55:12 +0800 Message-Id: <20230609075528.9390-4-bhe@redhat.com> In-Reply-To: <20230609075528.9390-1-bhe@redhat.com> References: <20230609075528.9390-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 2F1FE140004 X-Rspam-User: X-Stat-Signature: 78qndfg5jwm6a3tjw6ozyrux85zhs98p X-Rspamd-Server: rspam01 X-HE-Tag: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0T1remlPVwVUXUlnEcCUpOf4tMA68RiFhtDmvAtZtOHY+HJbRRI4v7len9ufvkqCmUfiFZf1auFd2nQ0+ANI/fIrxMgupyqADXoFV1I3Qt9jrgkKhAPm/lVtGm/2sgOMo66VLYSFgSDKKjL4/W7EhWoj6QV+eSsFgGxev78IyU6YEmpJnuRoMVP+RY+zg7HMxIdxyccwJuSO+fWkaocY+mgA7E0sdpClQYGiyJbPk68um9o2yN 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 Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: openrisc@lists.librecores.org --- v5->v6: Remove the special handling in iounmap() because no page is got from fixmap pool along with early ioremap code removing in ioremap() - Mike. 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); -- 2.34.1