Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp194471iof; Mon, 6 Jun 2022 01:13:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMFWJyBpgWKCZTt+yZcS1xszbZTvtyHgYh1LxkQh6FYAIPLBzNBhpbCkgae51imyJzwTK+ X-Received: by 2002:a63:1653:0:b0:3fd:cbe2:c031 with SMTP id 19-20020a631653000000b003fdcbe2c031mr2677810pgw.398.1654503204775; Mon, 06 Jun 2022 01:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654503204; cv=none; d=google.com; s=arc-20160816; b=NhUpAbCcoBnTPWsnEmbZ+18Ew9K0w4FdZIsVtEVdUfzyUiCAMN39Z5WjEE6fe4VN2o vdmgEuvfJaba1UfVKMdxsw6iii1PF6qbrl8Jo2a9xlPrFwwrhJHJe6rJDhvdyJQaZ9e8 SmDxfykxgtRqYkd7wecdKzo/DmE0fup7DaFvxBeZzMo1Q5ul5vBUMtzKlgVd+gZUHBV1 R6p3j/s273bdXS0JK7VbsxpbJWkcBrQdaAKXUsfZkKYI0QxwnrZ+siFWmIMa8vTpHioX 6TPlbFwewAaMT1P+Tl6mN8nxMIiBXEgBuUpZgSfYEmtQssgD69WC15j1FsFPq7jFhPHs lG1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lUQxgeaOx1V7BACAiT/2H3YxZOL12gsM6xoyyjRU6Dg=; b=IyC1d1gfazJ2DfRLeIP3A8C6xZ3m/cWhfZAs6T8e/zUMteJOXdIW6EhR7AW3VVKj5d FTxLFkPjlpb3UWJQlZ7h33jR0tHOxZ8KTZ9+q7fV6A/OAAtHaC6YsU1gMGGTYvLdYQqV 9yGupbX9hUXwSCSYMir/+i1ExKriN8zeKpaeNq64lDS8SS2SgFvI7Zwakyw0cCVSofDo rLxpbVTjDh+PliXdEBHXOMdXhHFk1982x6FC5RuKFZz774TYwqJNxFuPabns8GDQndt9 WBvh/SoFQ3LsNjdcs+ewsp/lQMZx1Z/A+3uL5SBjbz9cueNdbcjC3ibYaA3d2/zPd0mP 6JwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=GEjLN8te; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h2-20020a636c02000000b003fdac19f9fbsi3972784pgc.702.2022.06.06.01.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 01:13:24 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=GEjLN8te; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 085FE21E2F; Mon, 6 Jun 2022 00:54:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbiFFHyR (ORCPT + 99 others); Mon, 6 Jun 2022 03:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbiFFHyP (ORCPT ); Mon, 6 Jun 2022 03:54:15 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BFA12D3D for ; Mon, 6 Jun 2022 00:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lUQxgeaOx1V7BACAiT/2H3YxZOL12gsM6xoyyjRU6Dg=; b=GEjLN8te4doRjDnMvvD+Y/go0p UQTGBjb/7Ml2PTLMqaNlV9k9Z5tuMzxnudHCtbs9kPlMOVLUCrl148D9b4PmCVUSffpTNmeu/peek i3Y1Yh/DwCHiiiGfeUSRBxROzCXoe2zXodgJ/MqO4NwuXcSYGRRdvpDTbW+8a9zW8OyuUgMVBfVaB 2cks8R5KY7cjjmAYVVf+5vmGRzn4pdAn/rV5ph23L2jOhkZzZ/PfiucwUEYm00WRQ/Ht+UFAiF5Nl qdQBCjrkb4nVmUygpF9z4YRKsMUW89fbVMwhBLRjY9n5dj0ck+3boQ7w4+V6VHMLndkavXLINEoGf oFJHezHg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny7Yv-0000fB-68; Mon, 06 Jun 2022 07:54:09 +0000 Date: Mon, 6 Jun 2022 00:54:09 -0700 From: Christoph Hellwig To: Kefeng Wang Cc: catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, arnd@arndb.de, anshuman.khandual@arm.com Subject: Re: [PATCH v4 5/6] arm64: mm: Convert to GENERIC_IOREMAP Message-ID: References: <20220606074815.139265-1-wangkefeng.wang@huawei.com> <20220606074815.139265-6-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606074815.139265-6-wangkefeng.wang@huawei.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 > +#define ioremap_wc(addr, size) ioremap_prot((addr), (size), PROT_NORMAL_NC) > +#define ioremap_np(addr, size) ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE) Please avoid the overly long lines here. Independt of that having a non-trivial body on a separate line tends to generlly be a lot more readable anyway. > +#define ioremap_cache(addr, size) ({ \ > + pfn_is_map_memory(__phys_to_pfn(addr)) ? \ > + (void __iomem *)__phys_to_virt(addr) : ioremap_prot(addr, size, PROT_NORMAL); \ > +}) And this really should be an inline function. > +int iounmap_allowed(void __iomem *addr) > { > /* > * We could get an address outside vmalloc range in case > * of ioremap_cache() reusing a RAM mapping. > */ > + return is_vmalloc_addr(addr) ? 0 : -EINVAL; As the generic ioremap only returns vmalloc addresses, this check really should go into common code.