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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45498C433EF for ; Mon, 23 May 2022 03:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355597AbiEWD6O (ORCPT ); Sun, 22 May 2022 23:58:14 -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 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. 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 F0885C433FE for ; Mon, 23 May 2022 09:03:07 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oMQjiXjChx7u7y1Zc8NCBG4otS23tf+6G3rGhBN4Ic4=; b=hhvtnF4cD7zhPA 1B3HGL5M6J4j4+fieEtpHisz8NeSc05T3YScsl2L97VVThyCB6rRyQAmKqfK38a5U8xik0sLvG166 yTZ4suMarJFmAAAx9DzuOV9FxEDHT5zG3JZ4CHREbs/ny2AarAJ/OKPzzzqeACgkR6lPAbd3CLHOq 5nJKOT+RAoeYCTe003mbBB1MDpQgjVqXrSmdKoXxqNJ1LzkATkWCZ0RJZXCvi2Jq/wFjpex50Ne/G uRZsrpfCVgMbNUYAV2MTfXNOSV+M0MHIX2oaPMVgyjiuW8+7gj3byMRJXkJMJPMSLIIIRFlO9eyS9 +btMPHJcV9XmqBL+qmAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt3wV-002eU5-D8; Mon, 23 May 2022 09:01:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt2r6-002A7b-Il for linux-arm-kernel@bombadil.infradead.org; Mon, 23 May 2022 07:51:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=mtOZgWd7Sg0dEitc54lTmt0iya3B7Rtro7H66Enfdu4=; b=Fzysv2mFwuWVJ+TBTcNeqPFG2J T7orZ0sFkB5qHsWKrCPoNG97gkkMRvGHoTM164PzEh2a48hQfTM2xKc7gEgiTcBhSxsSlR3fCK8Pn JoFwP56vfOEe6Byx0FA38UiL8/GN3TYErF+tm7I+JucjCLG9vtPr1FXCqgQbhbYEsG2hrcECgD7A6 yK8xx6sE5BqkY6s4+rqxPSbRJrzJ2848XvJ3GEEpaP6KqaSaCelOUWFE0R+TbCIQcep8SDWIDZZSU +6Itas0I7CtxHD31xzvnJYr95M2Ok3C/uu4gs91sR0uEKItvOvHHlRHKZZMVGTzN3HEzMOSnB+1lp sykRwPEQ==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nszDG-000oPV-Gg for linux-arm-kernel@lists.infradead.org; Mon, 23 May 2022 03:58:36 +0000 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220523_045835_007773_FC2E4F8C X-CRM114-Status: GOOD ( 15.22 ) 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 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel