Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1340611rdb; Fri, 1 Dec 2023 13:33:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvYHMhb0kv2s3iDrqm8Ml/a2RQZTuKGNH/+CRCoFxRzax6vxJ/orrNfCs4WrgOoP0IzKYP X-Received: by 2002:a05:6a00:1909:b0:6ce:2731:47b8 with SMTP id y9-20020a056a00190900b006ce273147b8mr160477pfi.24.1701466397430; Fri, 01 Dec 2023 13:33:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701466397; cv=none; d=google.com; s=arc-20160816; b=b1AYZTiMQxzf+U5pey9yw+MLZIsCUv+pIV2dbQjGmmcoD14Dfs67ezM+NX8Yi5Y9cZ pwkIIIHh2Zi/Lc52AepTM6lgTfV4C5VbP6jymWsKgXRuGxyzdfUcr1AmeuHQieCjw/e8 kilquLO9e3OQUZXLlEpk0PIEX583TKOC81uKhx2ArlU6ffCaJI5tg9SvTlCXVJ8VW4Lr J8yDh1D1NVpbekpg2/LpYgWrO43hOqAVY9dZC9grHipFeab2XkY0woofLhNBZ2BEcLIT v3AO5/+i48fmfLKg0kc3Zjo3tbnNMQT7+oVMFoGl94/neQPTmfFnWR+1gIaUZSpuJT0p ClzQ== 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=EJcI3n/uJ+tyVR7t2YzAuKRIYKbllJExxoU8CSyelqs=; fh=jJNHcyh/luO/l9b0Qb1EfMnLcysECFK10xGDf8JFCdo=; b=FsBKzoWiohl8y2zilSnV3BmjzzDR4aB8iWwaqzyg6JEEu8yeSZtR/WGZgO/rMdkggm ZP8V70LcaL9BJpJ2y8m2ryQ8Qil2Zf9HYipgWPEjhwF73vWqE92NnAnpxbPhZGR6AM5N hdUrCN+DFI3t9ykKWIsQXi1SFWhqtcWbdjwmVvmRoyVdJsm4cSICUVpW9xXousbbAdEH 2A7h+bHUNKxYkLluO1gxNOuAQU518nMLYkzbdm0nXRXhxEUylvRRINmP9d2OCLBtzIaO dZnDQ4klmntDniIuo6teY7rPUlSvqq1oRUjoendYtfhGl1ZdLInxkyqbi3lrjywHLxTT U8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=Ha+WtJNw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uaCCuLPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id be26-20020a056a001f1a00b00690f9e835d8si4007040pfb.132.2023.12.01.13.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 13:33:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=Ha+WtJNw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uaCCuLPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 2B3A383A15A7; Fri, 1 Dec 2023 13:33:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379678AbjLAVco (ORCPT + 99 others); Fri, 1 Dec 2023 16:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379670AbjLAVcn (ORCPT ); Fri, 1 Dec 2023 16:32:43 -0500 Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7201910D0 for ; Fri, 1 Dec 2023 13:32:49 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 8F0AC2B003FF; Fri, 1 Dec 2023 16:32:44 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Fri, 01 Dec 2023 16:32:47 -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= 1701466364; x=1701473564; bh=EJcI3n/uJ+tyVR7t2YzAuKRIYKbllJExxoU 8CSyelqs=; b=Ha+WtJNw/9/yBPf+qCDeJsxi4wbEdXtVXTJwPIVr7hphlE1Cseh CxUTAcflSnUBVVQl3GPxui2/JbjbcscQKbVvGpA/snPzqB3KJs/DGG9mMjrBNDpQ QuuJeXKO6vOuDNzYSfoXH8Or7zdaOK1QK2LZMLCZC1yjnXqPe4UJsSvFNeQy/SGI MDWgVQIJtZkcfoE95VHugnfnWawCffXYSUHbDnqoYuKG2USxIuRfekh0lZxcjfWo uttyshfytiOJIFjmTxw5RJDPAjueGBPIG089jGy6W4rnP2vR2rqCEVagYkDNBQ2d t2R1Yy101W8RfGoFOB/1xYs5hYJNriTPCQQ== 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= 1701466364; x=1701473564; bh=EJcI3n/uJ+tyVR7t2YzAuKRIYKbllJExxoU 8CSyelqs=; b=uaCCuLPfAVLn5GQiRkbAngaCzzUFPmJX87puR5QOry5DRRke/CQ gsaZO1F1zRsAZd36tBxh90CZnCoQWqmAtcigmOqjhuTxXqAVD2QH/tPt3rASpIqh eYaDHj9vf1W2cUKkLCJhE0d6nKnJcyMYneRaj2gTr6n4eP425IV/xnS6y1NG8YHM QMVAXjAFKc8wCmvWkfJdI9HH6ff8lSdgq2LbvbHyfoL5VyhzrSCoV7BymzZXzgvD DK5uPrOYWUfGMepESDIS4F/zNdd38tsm02FbzUiIXZ49uydjq9qo2BNejeid6Pwc AsgXFtJEfcSL2xJ9r8X1ojcEGrxpekcJdTA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeiledgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf tehrnhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrf grthhtvghrnhepgeefjeehvdelvdffieejieejiedvvdfhleeivdelveehjeelteegudek tdfgjeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id EC766B60089; Fri, 1 Dec 2023 16:32:42 -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: <330df2f8-3796-4f74-8856-06ae1e46ec9b@app.fastmail.com> In-Reply-To: References: <20231201121622.16343-1-pstanner@redhat.com> <20231201121622.16343-5-pstanner@redhat.com> <619ea619-29e4-42fb-9b27-1d1a32e0ee66@app.fastmail.com> Date: Fri, 01 Dec 2023 22:32:22 +0100 From: "Arnd Bergmann" To: "Philipp Stanner" , "Bjorn Helgaas" , "Andrew Morton" , "Dan Williams" , "Jonathan Cameron" , "Jakub Kicinski" , "Dave Jiang" , "Uladzislau Koshchanka" , "Neil Brown" , "Niklas Schnelle" , "John Sanpe" , "Kent Overstreet" , "Masami Hiramatsu" , "Kees Cook" , "David Gow" , "Yury Norov" , "wuqiang.matt" , "Jason Baron" , "Kefeng Wang" , "Ben Dooks" , "Danilo Krummrich" Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Linux-Arch , "Arnd Bergmann" Subject: Re: [PATCH v2 4/4] lib, pci: unify generic pci_iounmap() Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 13:33:14 -0800 (PST) On Fri, Dec 1, 2023, at 20:37, Philipp Stanner wrote: > On Fri, 2023-12-01 at 16:26 +0100, Arnd Bergmann wrote: >>=20 >> static inline bool struct iomem_is_ioport(void __iomem *p) >> { >> #ifdef CONFIG_HAS_IOPORT >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uintptr_t start =3D (uintp= tr_t) PCI_IOBASE; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uintptr_t addr =3D (uintpt= r_t) p; >>=20 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (addr >=3D start && add= r < start + IO_SPACE_LIMIT) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 return true; >> #endif >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return false; >> } >>=20 >> > +#else /* CONFIG_GENERIC_IOMAP. Version from lib/iomap.c will be >> > used.=20 >> > */ >> > +bool iomem_is_ioport(void __iomem *addr); >> > +#define ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT >>=20 >> I'm not sure what this macro is for, since it appears to >> do the opposite of what its name suggests: rather than >> provide the generic version of iomem_is_ioport(), it >> skips that and provides a custom one to go with lib/iomap.c > > Hmmm well now it's getting tricky. > > This else-branch is the one where CONFIG_GENERIC_IOMAP is actually set. > > I think we're running into the "generic not being generic now that IA64 > has died" problem you were hinting at. > > If we build for x86 and have CONFIG_GENERIC set, only then do we want > iomem_is_ioport() from lib/iomap.c. So the macro serves avoiding a > collision between symbols. Because lib/iomap.c might be compiled even > if someone else already has defined iomem_is_ioport(). > I also don't like it, but it was the least bad solution I could come up > with > Suggestions? The best I can think of is to move the lib/iomap.c version of iomem_is_ioport() to include/asm-generic/iomap.h with an #ifndef iomem_is_ioport / #define iomem_is_ioport check around it. This file is only included on parisc, alpha, sh and when CONFIG_GENERIC_IOMAP is set. The default version in asm-generic/io.h then just needs one more #ifdef iomem_is_ioport check around it. Arnd