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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0431FC28D13 for ; Sat, 20 Aug 2022 00:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gAcjBPiBFA4rY36BgZ2mQ9nGQHLEeZXXSzlwHi1XylQ=; b=gbtUSZXn2qMLT1 527hQ3d2fO89aDTLowMMC1V/yGMUHfUC2x6xkpFNThpxrTHpeTkNZeGRV3mB90qNaLsL1tC9Y6qkM AidZ8uBbbWtiYyyUhFdBe1HG0WURGBnCxfDWW8zGzC1k5tRwy+VbFjUwseG2eJQm73tIshtg/BVeL C0D8D2Fmi4Gm5QG3liG/QfkJUJasDRuJZafHeDtsk28QWUr/3ZDobxR3Tm5QjLhT+lqisHZ11ZblQ LaT1nj/Y8FE6LVkFyMN6zXop5QXEUAUA19R05Kdlt6ZNzU0yYumMMTK60qRT42gkamxoM0wVpzYuM A0y8fksCNbe6FQHs9acg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oPCgT-00E9ZE-HW; Sat, 20 Aug 2022 00:49:53 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oPCgP-00E9T3-To for linux-arm-kernel@lists.infradead.org; Sat, 20 Aug 2022 00:49:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660956587; 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: in-reply-to:in-reply-to:references:references; bh=mPu0DQxVRwEmhdXyi4XLwQIkOlrmj+flVHHMJnG7VVM=; b=M8DR2GWPTu2R3mqo2qr21NiOaZwxnndlkS/pNnPXRv9L576zeVHAKeGmMQkXjBzMv13ZAk vik+Gnv+FFcIX2Uk3dxA31edooP68TdHQffYBV4LldHcVVuqUC5ZpKEpAxitJKJ4b0SHTq P2Ik5g1YweSIzraeZgJmhFpIPAVvgj8= 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-589-ekivVkyVM0izy3AZ4RrpYQ-1; Fri, 19 Aug 2022 20:49:45 -0400 X-MC-Unique: ekivVkyVM0izy3AZ4RrpYQ-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 6F9F9185A794; Sat, 20 Aug 2022 00:49:45 +0000 (UTC) Received: from localhost (ovpn-12-17.pek2.redhat.com [10.72.12.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 607DA90A04; Sat, 20 Aug 2022 00:49:44 +0000 (UTC) Date: Sat, 20 Aug 2022 08:49:41 +0800 From: Baoquan He To: Alexander Gordeev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, hch@infradead.org, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 02/11] mm: ioremap: fixup the physical address Message-ID: References: <20220801144029.57829-1-bhe@redhat.com> <20220801144029.57829-3-bhe@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220819_174950_083424_093BDE41 X-CRM114-Status: GOOD ( 19.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/04/22 at 06:02pm, Alexander Gordeev wrote: > On Mon, Aug 01, 2022 at 10:40:20PM +0800, Baoquan He wrote: > > This is a preparation patch, no functionality change. > > There is, please see below. > > > @@ -3,11 +3,17 @@ > > #include > > #include > > > > -void __iomem *ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot) > > +void __iomem * > > +ioremap_allowed(phys_addr_t *paddr, size_t size, unsigned long *prot_val) > > { > > - unsigned long last_addr = phys_addr + size - 1; > > + unsigned long last_addr, offset, phys_addr = *paddr; > > int ret = -EINVAL; > > > > + offset = phys_addr & (~PAGE_MASK); > > + phys_addr -= offset; > > FWIW, phys_addr &= PAGE_MASK looks much more usual. > > > @@ -11,13 +11,20 @@ > > #include > > #include > > > > -void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, > > +void __iomem *ioremap_prot(phys_addr_t paddr, size_t size, > > unsigned long prot) > > { > > unsigned long offset, vaddr; > > - phys_addr_t last_addr; > > + phys_addr_t last_addr, phys_addr = paddr; > > struct vm_struct *area; > > void __iomem *base; > > + unsigned long prot_val = prot; > > Why prot_val is needed? > > > + base = ioremap_allowed(&phys_addr, size, &prot_val); > > + if (IS_ERR(base)) > > + return NULL; > > + else if (base) > > + return base; > > By moving ioremap_allowed() here you allow it to be called > before the wrap-around check, including architectures that > do not do fixups. > > And now ioremap_allowed() semantics, prototype and name turn > less than obvious. Why not introduce a separate fixup callback? I finally renamed ioremap_allowed()/iounmap_allowed() to arch_ioremap() and arch_iounmap(). I didn't introduce a separate fixup callback, and have added more explanation to log of patch 1~2, please check that. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel