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 9D2E7C433F5 for ; Sun, 9 Oct 2022 11:15:36 +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-Type: Content-Transfer-Encoding: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=tyr8iX5/HlL4E9Mg+4q2E/dCQaRL/ABeqIGnsjkJI6A=; b=0xMD9F8J93LoG8 YDwUc8HP3Pm/0IiBFuN4yRXY0CjAdg9zUZ9b+9/vlf0mG+jHdJv16E4qWvDXWSxsDQlIEjuHhlnlb k+aPH70KFOpimKhRGi60q20I6hTtB7WUomSGZYzuRf2pkS/4XYzBC7JpU0yRVtTjYm+lILDU6+4Cf p/S+XvYGlBH/7D/WUrE5Z95Vl8ZW8Jvukiw3fOuxpBGOSrXhOJarc5Cytrny7JjsxG1xvbqJ4dmyj LhWPCH05QOha5A+4NRa5sgsfdT8J4ZqTTH8dRpuKawajMmamYKDn+FAaxxc+KQ+kQRfk6s08cWXXY +h6wfNgoiiy87+NU1WnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohUG6-00FMba-Qq; Sun, 09 Oct 2022 11:14:14 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ohUG2-00FMYm-25 for linux-arm-kernel@lists.infradead.org; Sun, 09 Oct 2022 11:14:12 +0000 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MlfSg0MX3z1P75B; Sun, 9 Oct 2022 19:09:23 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 19:13:53 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 19:13:52 +0800 Message-ID: <10ada8f0-0931-b6a6-e240-fc8b500e578d@huawei.com> Date: Sun, 9 Oct 2022 19:13:52 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3 03/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename Content-Language: en-US To: Baoquan He , CC: , , , , , , , , "Arnd Bergmann" , , References: <20221009103114.149036-1-bhe@redhat.com> <20221009103114.149036-4-bhe@redhat.com> From: Kefeng Wang In-Reply-To: <20221009103114.149036-4-bhe@redhat.com> X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221009_041410_491322_82A53045 X-CRM114-Status: GOOD ( 15.48 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022/10/9 18:31, Baoquan He wrote: > Currently, hooks ioremap_allowed() and iounmap_allowed() are used to > check if it's qualified to do ioremap, and now this is done on ARM64. > However, in oder to convert more architectures to take GENERIC_IOREMAP > method, several more things need be done in those two hooks: > 1) The io address mapping need be handled specifically on architectures, > e.g arc, ia64, s390; > 2) The original physical address passed into ioremap_prot() need be > fixed up, e.g arc; > 3) The 'prot' passed into ioremap_prot() need be adjusted, e.g on arc > and xtensa. > > To handle these three issues, > > 1) Rename ioremap_allowed() and iounmap_allowed() to arch_ioremap() > and arch_iounmap() since the old name can't reflect their > functionality after change; > 2) Change the return value of arch_ioremap() so that arch can add > specifical io address mapping handling inside and return the maped > address. Now their returned value means: > === > arch_ioremap() return a bool, pointer? > - IS_ERR means return an error > - 0 means continue to remap > - a non-zero, non-IS_ERR pointer is returned directly > arch_iounmap() return a bool, > - true means continue to vunmap > - false means skip vunmap and return directly ... > /* > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h > index a68f8fbf423b..2ae16906f3be 100644 > --- a/include/asm-generic/io.h > +++ b/include/asm-generic/io.h > @@ -1049,25 +1049,26 @@ static inline void iounmap(volatile void __iomem *addr) > > /* > * Arch code can implement the following two hooks when using GENERIC_IOREMAP > - * ioremap_allowed() return a bool, > - * - true means continue to remap > - * - false means skip remap and return directly > - * iounmap_allowed() return a bool, > + * arch_ioremap() return a bool, ditto... > area = get_vm_area_caller(size, VM_IOREMAP, > __builtin_return_address(0)); > if (!area) > @@ -52,7 +57,7 @@ void iounmap(volatile void __iomem *addr) > { > void *vaddr = (void *)((unsigned long)addr & PAGE_MASK); > > - if (!iounmap_allowed(vaddr)) > + if (!arch_iounmap((void __iomem *)addr)) vaddr? > return; > > if (is_vmalloc_addr(vaddr)) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel