Message ID | 20230515090848.833045-4-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6777665vqo; Mon, 15 May 2023 02:15:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ55ed8eUgpoBFUT6GkVLFK64j+1T0Yx+eXe1jJ3Xe//AemZIeUQRnYCIVUkL+VlxAtLwLLF X-Received: by 2002:a05:6a20:12cf:b0:104:1016:dd4d with SMTP id v15-20020a056a2012cf00b001041016dd4dmr17332189pzg.57.1684142110672; Mon, 15 May 2023 02:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684142110; cv=none; d=google.com; s=arc-20160816; b=hDhoClmm0zOci2oDPlUO4MEyuD7kKO6AfiwVZ23DPD407G+UTiAXC5onCygo6jfDig v6C7ZwbDN4VqWupL64qRHgQT0kbYGEs7SyDdP3WLPYffh2x2TLIHnAQ8ez81KLUFTG7y j9ZqpeJw0uILw1HhE85D2EgD1zunP3uHt3s0FuuYQf33HX5xiZ69gwwjMYHOAgVwPWIJ 4/c2pENns42cAIlOd05Jl6HiXyAfJnMyaKmr3pdJ1EBiKaID2fcfdzb2FP8zMHpQB4yc L/yomiXhAnJXai8IJkPuyWI9AR1pAYwMKi0F0ysjzfz2PSJy+yJI0QXx7fp9ZXDsNi9i 4rqg== 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=jHZa8mu+sMxKIWEAwvYcXi8mFXnonAyjIbMLTnXCGN4=; b=WS1OtxYp/IS710VKFXY3BlelCA3qdQy4UGVrz1cL6AE0Gjgd3XOK3LC61JZVn23LSG ICcoxtyXun0m4J7bxn4G/ZDW0Hi0ecPtN1hsEWlS1YshNPlCCAcUESkh42zxQCyrVeVq yxMxsQSWVNstRNRE3E0LyipIJjKJ1YWpynnChFFO1H5qds187PBmJCXJN56LZIEKmBij +onr+sMAvSZVRjtFzJf3NhWfBSr0lBo8aJY5C8VL0dmUANcXYc8styIc1N9+LsVR6dyn 5ImNWRiIGi+nI3REsXrgsZYr+D2jv889JLwTXtFdvcrzfdtgsXPc/5AA4f+hsYvQnbHu uZIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CUIOMLhF; 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 g130-20020a636b88000000b005138de75d17si15257103pgc.116.2023.05.15.02.14.58; Mon, 15 May 2023 02:15:10 -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=CUIOMLhF; 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 S239655AbjEOJKl (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Mon, 15 May 2023 05:10:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238803AbjEOJKM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 15 May 2023 05:10:12 -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 F1A48E5D for <linux-kernel@vger.kernel.org>; Mon, 15 May 2023 02:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684141769; 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=jHZa8mu+sMxKIWEAwvYcXi8mFXnonAyjIbMLTnXCGN4=; b=CUIOMLhFqXoMmNzwyJpNa4ORFdydvVtpkvgA2U+17WVeNJYVlB0zJV++A9B1Qv19D72w+X 5zovLSkMV39mLEkCw9sfhOtwFop/q8Dx+MLlLXYH0hoJPJnoFU/OY8lx3DhWcsjLxVCiBx 29iQaczgy+RG0gJr2eT7fKinZ9b9qCE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-F9OGOUBiNvmyjtoAQ6ukpQ-1; Mon, 15 May 2023 05:09:25 -0400 X-MC-Unique: F9OGOUBiNvmyjtoAQ6ukpQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB38B1C08780; Mon, 15 May 2023 09:09:24 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1006440C2063; Mon, 15 May 2023 09:09:15 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, willy@infradead.org, deller@gmx.de, Baoquan He <bhe@redhat.com>, Jonas Bonn <jonas@southpole.se>, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>, openrisc@lists.librecores.org Subject: [PATCH v5 RESEND 03/17] openrisc: mm: remove unneeded early ioremap code Date: Mon, 15 May 2023 17:08:34 +0800 Message-Id: <20230515090848.833045-4-bhe@redhat.com> In-Reply-To: <20230515090848.833045-1-bhe@redhat.com> References: <20230515090848.833045-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.1 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_H2,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765950997445127287?= X-GMAIL-MSGID: =?utf-8?q?1765950997445127287?= |
Series |
mm: ioremap: Convert architectures to take GENERIC_IOREMAP way
|
|
Commit Message
Baoquan He
May 15, 2023, 9:08 a.m. UTC
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. Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/ Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Stafford Horne <shorne@gmail.com> Cc: Jonas Bonn <jonas@southpole.se> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Cc: Stafford Horne <shorne@gmail.com> Cc: openrisc@lists.librecores.org --- arch/openrisc/mm/ioremap.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
Comments
On Mon, May 15, 2023 at 05:08:34PM +0800, Baoquan He wrote: > 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. It looks like early ioremap was the only user of fixmap on openrisc, so it can be removed as well. > Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/ > Signed-off-by: Baoquan He <bhe@redhat.com> > Acked-by: Stafford Horne <shorne@gmail.com> > Cc: Jonas Bonn <jonas@southpole.se> > Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> > Cc: Stafford Horne <shorne@gmail.com> > Cc: openrisc@lists.librecores.org > --- > arch/openrisc/mm/ioremap.c | 22 +++++----------------- > 1 file changed, 5 insertions(+), 17 deletions(-) > > diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c > index 8ec0dafecf25..90b59bc53c8c 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; > } > > -- > 2.34.1 > >
On 05/16/23 at 09:17am, Mike Rapoport wrote: > On Mon, May 15, 2023 at 05:08:34PM +0800, Baoquan He wrote: > > 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. > > It looks like early ioremap was the only user of fixmap on openrisc, so it > can be removed as well. You are right, and you are saying the relic in iounmap() about fixmap handling, hope I got it right. I will remove it, the code will be more cleaner. Thanks. > > > Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/ > > Signed-off-by: Baoquan He <bhe@redhat.com> > > Acked-by: Stafford Horne <shorne@gmail.com> > > Cc: Jonas Bonn <jonas@southpole.se> > > Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> > > Cc: Stafford Horne <shorne@gmail.com> > > Cc: openrisc@lists.librecores.org > > --- > > arch/openrisc/mm/ioremap.c | 22 +++++----------------- > > 1 file changed, 5 insertions(+), 17 deletions(-) > > > > diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c > > index 8ec0dafecf25..90b59bc53c8c 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; > > } > > > > -- > > 2.34.1 > > > > > > -- > Sincerely yours, > Mike. >
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index 8ec0dafecf25..90b59bc53c8c 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; }