From patchwork Fri Jun 9 07:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 105348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp782381vqr; Fri, 9 Jun 2023 01:01:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YI6VaLF+WXi+X+WNlVxyYSnT2Lz9oThJlStqIvNkO2HZEf5f6PSeivgUXUayCg/tslYY1 X-Received: by 2002:a17:902:f54f:b0:1ac:b449:3528 with SMTP id h15-20020a170902f54f00b001acb4493528mr721745plf.46.1686297665206; Fri, 09 Jun 2023 01:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686297665; cv=none; d=google.com; s=arc-20160816; b=0V219jA/6FEGQyoPQ+m35ecP3PcX0yxFHYpE2xZeCqu1Uv/GqwWaHB7FjvHMrLcYPz 6d4PjXAEYsxErt9nvQvVW75Lm3zHWT6vYqDk7DhsQjj7Xqps7vlNO/LNCaBBY3ssfAWt 9L3AWDhwzwJmMDMKYPK+lGWmyZGJhEkru8SMaueVeuPPT22llqW612bRykIHLPBBnpiQ lg7zim+azWSi1lYzp+oENYmRlDviKVWAEKve42MQAfhAF/nLtRchCLhPy5DmqDVmqGeh cLIS4d3bsRidFXqFY5IbJkx2kOtdkml0ib5oD+gGD/UXR7YGOtn16/Ac7QWu6bPCu8Bv +nZw== 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=b1cwgKpxB+oYTQq0br6utRWEYNI4guxqhcfHp/vK96c=; b=jUC/im9vWD+O3pFI8SIptOOGxZ7C9YomQB1zavS1Y+mRuWMF+8v0QsOkQqn+5Q2R4g BomuAADi5uRiWvCUwxpj0WV83VTfK3t2lDh8a9zg0GZYkuPymvrmtUGhcdxBuEzRuWT8 NhS5uBSrSes/qXLqCaDyd0iXqkY9achrzYb26PSs7yKt2JcJS3ktJxLEZyxlpIHVfjL7 RUsa3msrJGteNHd7YvBTV86XRtFIpnzZHBMqwtNkIHKbeSaC/iLreBNfYCD7f+NCSylO qgMwxuvyq7pttj84SacelOrXxBevEKgGPspUh1B20EI0yhUSKOP8MNbuw0JYHhwFK5Ap bqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hmD3SnBU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a170903011100b001a986e5bd92si2235665plc.83.2023.06.09.01.00.48; Fri, 09 Jun 2023 01:01:05 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=hmD3SnBU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239599AbjFIH6D (ORCPT + 99 others); Fri, 9 Jun 2023 03:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239479AbjFIH53 (ORCPT ); Fri, 9 Jun 2023 03:57:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488C03AAA for ; Fri, 9 Jun 2023 00:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297375; 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=hmD3SnBUvWOR9U03gxZ0MZpRH3T0wH+srnXs1WA3FiPXYBeZKmWoFtmAdCBAmWiLXrfIGW WD4+0nY4CYM0B00VJVZY4z5ZsO0HLVoBHIGo4s175QFNsqAktql8N8y3ccJWRAHS2SJW/G RjwoHkMoPF+G4/pkOQr4Hr8omwP79p8= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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?1768211260479609129?= X-GMAIL-MSGID: =?utf-8?q?1768211260479609129?= 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 Reviewed-by: Christoph Hellwig Reviewed-by: Mike Rapoport (IBM) --- 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);