Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2716932rdb; Mon, 4 Dec 2023 05:51:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFukS6Fi+EuA4YrrY6X4DN3Z4YndI5kbndlFARSj+qS9o1gs4Q8Y6VZVA6tFkVOozB8W/R1 X-Received: by 2002:a05:6358:3a03:b0:170:a67:899c with SMTP id g3-20020a0563583a0300b001700a67899cmr1709806rwe.17.1701697879854; Mon, 04 Dec 2023 05:51:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701697879; cv=none; d=google.com; s=arc-20160816; b=sbcmIptkmGm/lSAw1OiTrLrzhZCvuUmVUfxDLZbdC1f/lU8f8n62luBLbdimZBVqHo M34pTs9bPeXMSShmK7C86+dxLIZvOf9LKnggcOkmmj7wMVCiFw6OJQA3aUvAtTx+V57s 6o0pO8makdAotgY+gKK3azMRkfKot/h4BJiPzr1ch0rATIC6nvUA4IwYzPo5wKU5Copz EkEzXbjz7ljfzWHyec6AJGsySJDR1H8tmnPQfULu62Cmj5CQLdZruKRuVTbmMbMBOU8+ lFZ5UYVmOB3Ya5LQ0iffkO0pEMc1+n7aVZqYyFNfvXbe3lLrUke5UIiSOxPzsLwIiTxX ci1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=jc2DdqDvPB3CHzS9V5UmYYkn+gfSkKSwGuZew0dKJM8=; fh=glSl0KQRcmU0CwmOJcxT3pP2RubBZqUMb4tj5MCTTAg=; b=ohWMmRlrn43nw3gAtjQ/n69UHFRuf06v29IP2mOC6enTpX9wZwpPZ804LoKSGl2QbG y8IdlfrzkLxGGxa5fJhde1Z8KcyqP9K+5PxlHParXUv48bpcsx/Y6/xzVZkldRIgzCb5 Dm4bNkXJDFTaeSJvIMH0Pw57Rqkiyn87Gc22TRrXQEKZqGwYM9X3/+afRUE99zsy6NyD WntjGByCAfQLForafYAyMXkRURD7V8WEjtvJx+Z6k/NSl/DgQ4Qv6Dp5NW0CRZGwqYuj 2Mhh6FH7E1VpVInOAbeW6hCNbbfR6l+Kmh/744SjanPgs1JH+cxXUI7R+NJpIAScAeR0 /TXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=lToYSd2H; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=QZiosFcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i23-20020a632217000000b005b8ee1c0c68si3959606pgi.605.2023.12.04.05.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:51:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=lToYSd2H; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=QZiosFcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9569780941F5; Mon, 4 Dec 2023 05:51:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344551AbjLDNvI (ORCPT + 99 others); Mon, 4 Dec 2023 08:51:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234237AbjLDNvD (ORCPT ); Mon, 4 Dec 2023 08:51:03 -0500 Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66948186; Mon, 4 Dec 2023 05:51:07 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id B0BE558099E; Mon, 4 Dec 2023 08:51:06 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 04 Dec 2023 08:51:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1701697866; x=1701705066; bh=jc2DdqDvPB3CHzS9V5UmYYkn+gfSkKSwGuZ ew0dKJM8=; b=lToYSd2H6fukkizrGV0SCXL4dTZvFLTwbzShvF4LKI/NowJD/l+ VLAIeUncYheum1Ao5C3QBRx468+f4TzCMbDiN2kjNpi4IH1X/EAlO/1jXvJZ+L8C DdM1J0VewK/7+v78NoVJ+uySXkwOOJfIHCBsh9ixJxI1SPhC2AjpD6DXvY8b63H4 9sKozcMJqM8r1+yA1K3UZmEmvuh1ArwKhWAt2RFsgbpsCHQ7oP1ZSduiw0H1TeMk hQtv+c63NSxKuuNyT5UVeyRUd3azM2Xp16U1iqD9A//igQ58Uymemu+RkDiaCHdf meWNNyq0bsLINex4Rg39ORWByJRSokbFY7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1701697866; x=1701705066; bh=jc2DdqDvPB3CHzS9V5UmYYkn+gfSkKSwGuZ ew0dKJM8=; b=QZiosFcsXa1/hwJvlpyk11ghQFkXbXDaGRFnEdRkhwn1wBw0Nrs VEtwy/djz1+grGIjc2nUnfLCe2OVcHYtTWM4sduSGRztbsJYBS0/e7az5COPhXPS +wr9ORxAwob1jlroh0U9Ymp5Yd3BJhmVweZ5oc6fH5BTHbMrS3s+naoAtksWCQDn QxU29VsiBlKUDbSY0ETrPjC6/zRFtiElYp27Mp3Iuhhy9lx72CINCFH37+eh4OkA q5PIVZyp9nIJR7ij7mNpOHZ/9Ccvozb6YpBJAkMsK51YzpZVIFpBsMrmH6tud/H5 BRFO3ELYZ5QMrVprmT5At58xOrTxdd3Ge1w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejiedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeegfeejhedvledvffeijeeijeeivddvhfeliedvleevheejleetgedukedt gfejveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 97FEEB60089; Mon, 4 Dec 2023 08:51:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: <05173886-444c-4bae-b1a5-d2b068e9c4a5@app.fastmail.com> In-Reply-To: <2648aef32cd5a2272cd3ce8cd7ed5b29b2d21cad.camel@redhat.com> References: <20231204123834.29247-1-pstanner@redhat.com> <20231204123834.29247-6-pstanner@redhat.com> <2648aef32cd5a2272cd3ce8cd7ed5b29b2d21cad.camel@redhat.com> Date: Mon, 04 Dec 2023 14:50:45 +0100 From: "Arnd Bergmann" To: "Philipp Stanner" , "Bjorn Helgaas" , "Hanjun Guo" , "Neil Brown" , "Kent Overstreet" , "Jakub Kicinski" , "Niklas Schnelle" , "Uladzislau Koshchanka" , "John Sanpe" , "Dave Jiang" , "Masami Hiramatsu" , "Kees Cook" , "David Gow" , "Herbert Xu" , "Shuah Khan" , "wuqiang.matt" , "Yury Norov" , "Jason Baron" , "Andrew Morton" , "Ben Dooks" , "Danilo Krummrich" Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Linux-Arch , stable@vger.kernel.org, "Arnd Bergmann" Subject: Re: [PATCH v3 5/5] lib, pci: unify generic pci_iounmap() Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:51:18 -0800 (PST) On Mon, Dec 4, 2023, at 14:39, Philipp Stanner wrote: > On Mon, 2023-12-04 at 13:38 +0100, Philipp Stanner wrote: >> + */ >> +#if defined(ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT) >> +bool iomem_is_ioport(void __iomem *addr) >> =C2=A0{ >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0IO_COND(addr, /* nothing *= /, iounmap(addr)); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned long port =3D (un= signed long __force)addr; >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (port > PIO_OFFSET && p= ort < PIO_RESERVED) > > by the way: > Reading that again my instinctive feeling would be that it should be > port >=3D PIO_OFFSET. > > This is, however, the exactly copied logic from the IO_COND macro in > lib/iomap.c. Is it possible that this macro contains a bug here? Right, I think that would make more sense, but there is no practical difference as long as I/O port 0 is always unused, which is at least true on x86 because of PCIBIOS_MIN_IO. Commit bb356ddb78b2 ("RISC-V: PCI: Avoid handing out address 0 to devices") describes how setting PCIBIOS_MIN_IO to 0 caused other problems. I would just leave the logic consistent with IO_COND here, or maybe use IO_COND() directly, like IO_COND(addr, return true, /* nothing */); return false; Arnd