Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1655088ioo; Sun, 22 May 2022 23:11:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylTVanc1Yjg0uojMhZPvFjVVhL1PUi3QSOHu/K1sDnAc/CKnhfl9WTzzeEPHkTwvHC9TlB X-Received: by 2002:a17:903:1c6:b0:161:9fbc:5a6 with SMTP id e6-20020a17090301c600b001619fbc05a6mr21454348plh.65.1653286309251; Sun, 22 May 2022 23:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653286309; cv=none; d=google.com; s=arc-20160816; b=kkCevZcfGm2Ixg17dfNMe4zoFfQmgDdBsfur8rKno6369U5F4vBuSrEjq7FMOILO3u PJAmnyJINmHJPucx8Mpswk+rSBEC6Aed4niR5gLL1oKHKaNW5ePm+F3XGYO4Lag7adg1 WmIiZMDOZDAu43b7qkcFWEtVW9p5Myl3k1fD+Df1+Qi7gLPGjmobdj0nxwI/9t/6FEtq WHwESQIgO/x7QPacX8/Ti1iuggJl3Ttq+yJSxrmxZWAuqlFb9VnnuSIycZq1zLpsuxCn 783Qh6rw/Vg6tdM+c5fBH4fvvIEg3JzTHW9g07rmP7fm8jLDRiJJ+Za7TUz7I2/1vruE gNRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=mtOZgWd7Sg0dEitc54lTmt0iya3B7Rtro7H66Enfdu4=; b=w9f9H7iz2y8fgNsIsql7dwqNhwcv9+vgxtZqEbjVjvJx/9aKD3N8fabRFrRbroA8xm VebXcEKctc9GXGpG2CeEL3zmf3gypAzrhdRMTSv1PHA4VrjnYXS3euNnOolg7oBMwdxm 9heaPR5oTr+M6D3+P31gomnTqA+0H85Q9iyr9t2wd5ybs0Y2hFcD2fMALzM6iD+C7/Ko usYCQozbaCtm7BOTOGJc2dIntVpLeZ7BqfxhBv1NCMLxUwaPZKm7+vqoEWYCm2kwPdgS 0zsaD5/wJ0tijGce85DmPUfDHJP7m1pcRsJnKtYO4/WpjR8SIb24tEccpKy/Z3rJYcmj Ls2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id np17-20020a17090b4c5100b001dc2957df61si14763123pjb.104.2022.05.22.23.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 00C7034B82; Sun, 22 May 2022 23:00:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355561AbiEWD6M (ORCPT + 99 others); Sun, 22 May 2022 23:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353324AbiEWD6C (ORCPT ); Sun, 22 May 2022 23:58:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1DC624F3E for ; Sun, 22 May 2022 20:58:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94B0C113E; Sun, 22 May 2022 20:58:00 -0700 (PDT) Received: from [10.163.36.114] (unknown [10.163.36.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A5223F66F; Sun, 22 May 2022 20:57:56 -0700 (PDT) Message-ID: Date: Mon, 23 May 2022 09:27:57 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() Content-Language: en-US To: Andrew Morton , Kefeng Wang Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, arnd@arndb.de References: <20220519082552.117736-1-wangkefeng.wang@huawei.com> <20220519082552.117736-5-wangkefeng.wang@huawei.com> <20220519115210.a6e41d5a997921354400557e@linux-foundation.org> From: Anshuman Khandual In-Reply-To: <20220519115210.a6e41d5a997921354400557e@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 5/20/22 00:22, Andrew Morton wrote: > On Thu, 19 May 2022 16:25:50 +0800 Kefeng Wang wrote: > >> Add special hook for architecture to verify or setup addr, size >> or prot when ioremap() or iounmap(), which will make the generic >> ioremap more useful. >> >> arch_ioremap() return a pointer, >> - IS_ERR means return an error >> - NULL means continue to remap >> - a non-NULL, non-IS_ERR pointer is directly returned >> arch_iounmap() return a int value, >> - 0 means continue to vunmap >> - error code means skip vunmap and return directly >> >> ... >> >> --- a/include/asm-generic/io.h >> +++ b/include/asm-generic/io.h >> @@ -964,6 +964,30 @@ static inline void iounmap(volatile void __iomem *addr) >> #elif defined(CONFIG_GENERIC_IOREMAP) >> #include >> >> +/* >> + * Arch code can implement the following two special hooks when using GENERIC_IOREMAP >> + * arch_ioremap() return a pointer, >> + * - IS_ERR means return an error >> + * - NULL means continue to remap >> + * - a non-NULL, non-IS_ERR pointer is returned directly >> + * arch_iounmap() return a int, >> + * - 0 means continue to vunmap >> + * - error code means skip vunmap and return directly >> + */ >> +#ifndef arch_ioremap >> +static inline void __iomem *arch_ioremap(phys_addr_t phys_addr, size_t size, unsigned long prot) >> +{ >> + return NULL; >> +} > > Maybe should do > > #define arch_ioremap arch_ioremap > > here > >> +#endif >> + >> +#ifndef arch_iounmap >> +static inline int arch_iounmap(void __iomem *addr) >> +{ >> + return 0; >> +} > > and here. > > It shouldn't matter a lot because this file has inclusion guards. > However it seems tidier and perhaps other code will want to know > whether this was defined. Dunno. +1, agreed.