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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA232C28D13 for ; Tue, 23 Aug 2022 02:42:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AF8A8D0002; Mon, 22 Aug 2022 22:42:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35F2A8D0001; Mon, 22 Aug 2022 22:42:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 226E98D0002; Mon, 22 Aug 2022 22:42:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 107368D0001 for ; Mon, 22 Aug 2022 22:42:55 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D728EA01E8 for ; Tue, 23 Aug 2022 02:42:54 +0000 (UTC) X-FDA: 79829309868.17.2B5D71D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 5C5FE4000F for ; Tue, 23 Aug 2022 02:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661222573; 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=YgbO8iFV6P0Cia6+3yhw+UCHidRLj9zT3dgvk0gufSI=; b=StAsM2OZzPqoI83hBNGKIFcsc4RLzI/vq955buAhx1A9g20Zwx7rdLfTiMJekc27zp8o+x mAgs1LodJfyD66T6aogdv2flSBbtRA9lnuxg2I5a0zEQWB/MhLEZuSu8u8LyFcVYCU9v6I tTSkuBugcfPO5Kdel0ZJyuiokdVESKU= 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-628-h3Fs69brOC2KXtLqff6kzw-1; Mon, 22 Aug 2022 22:42:50 -0400 X-MC-Unique: h3Fs69brOC2KXtLqff6kzw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 283A13C01E12; Tue, 23 Aug 2022 02:42:50 +0000 (UTC) Received: from localhost (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5017D492C3B; Tue, 23 Aug 2022 02:42:48 +0000 (UTC) Date: Tue, 23 Aug 2022 10:42:44 +0800 From: Baoquan He To: Christoph Hellwig Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 03/11] mm: ioremap: allow ARCH to have its own ioremap definition Message-ID: References: <20220820003125.353570-1-bhe@redhat.com> <20220820003125.353570-4-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=StAsM2OZ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661222574; a=rsa-sha256; cv=none; b=EgzP5J4yoQTwJLx5qjnLdysKE0Ww4cVv8VGvDYpu2DCwSPfjlZvz6SdnBs3FXBo/Vi7sJs x5T0Jof4lNF0ulP1mOuNFi6K1VZrr/GbLcBdm2/F5VW5GrLfKcwOnKsuT0FBZ8vgskP1zQ cOisN2bItYxQieGVMOjit8tt7Qo9j84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661222574; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YgbO8iFV6P0Cia6+3yhw+UCHidRLj9zT3dgvk0gufSI=; b=6oPI2qroMfVUx/JdKBpuJDRcsv4Ylwff7uJelZnP8sAu1u9a/QYXdOe3ZeaUf496uu32AX jDWYNPM9UNE0XE53wmRltO9tZ0NRzipiwu+NyX6a7Cxvi9fDoHQJ1T/3uQ5GQZt9EQwUn/ QecRwdT/WWWgtkfHuCLxgSUizLBBnf0= X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=StAsM2OZ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com X-Stat-Signature: 1r8sk4pesmk3nfgatpiajbuk4faowcwg X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5C5FE4000F X-HE-Tag: 1661222574-408286 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/20/22 at 11:57pm, Christoph Hellwig wrote: > On Sat, Aug 20, 2022 at 08:31:17AM +0800, Baoquan He wrote: > > Architectures like xtensa, arc, can be converted to GENERIC_IOREMAP, > > to take standard ioremap_prot() and ioremap_xxx() way. But they have > > ARCH specific handling for ioremap() method, than standard ioremap() > > method. > > Do they? > > For arc, the arc_uncached_addr_space case can be easily handled by > arch_ioremap, and the xtensa case looks very similar to that. I am worried it will impact ioremap_prot(). Arc has selected HAVE_IOREMAP_PROT in Kconfig. Putting arc_uncached_addr_space() calling into arch_ioremap() will change ioremap_prot(), right? And I have the same about xtensa. You can see ioremap() and ioremap_cache() will return different value since they take XCHAL_KIO_BYPASS_VADDR and XCHAL_KIO_CACHED_VADDR differently. I haven't figured out a way to handle them in arch_ioremap() differently. static inline void __iomem *ioremap(unsigned long offset, unsigned long size) { if (offset >= XCHAL_KIO_PADDR && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE) return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); else return xtensa_ioremap_nocache(offset, size); } static inline void __iomem *ioremap_cache(unsigned long offset, unsigned long size) { if (offset >= XCHAL_KIO_PADDR && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE) return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); else return xtensa_ioremap_cache(offset, size); } > > I'd really like to kill off arch definitions of ioremap going > forward, as they should just be a special case of ioremap_prot > by definition.