From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E6B31F5437; Mon, 20 Oct 2025 10:44:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760957081; cv=none; b=lltfcdkqcHG0tFfjVEcSK2D3dvlPykm0tAcBXs8G/dGZmOzvQrQiUmlDFWmoNKsIMH30frMyw9e6KypiMIwxuSLi4nrj0AXwJwV5H5czSnFPElmf4pwIFhwNpSLaUdrHDtB+eT6xWae2DFPlVBToF5h8oIz2xsfUkc3tip0pTVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760957081; c=relaxed/simple; bh=F4Dp7ZQIagEZfQkEK+NkPAeOo1rKX2a9BXZpkTkzXrw=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=LlyEQO2fq4jyqk5EWjYkhhWaN4T9uV6fo1/b7kTYA+malQgNqYDLTstQUFMpcRB2nR/jHeX7yLFYI50v/4ZqhuzaK2Hle9i/NhsJbHgaxlWeDExVIs3Y+efp1Cs+z51zvM0+0Z63FhpvCLgh0ff42jKng2RwoLs/zjlZKt2AH7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RTCqGzXr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RTCqGzXr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B50BCC4CEF9; Mon, 20 Oct 2025 10:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760957080; bh=F4Dp7ZQIagEZfQkEK+NkPAeOo1rKX2a9BXZpkTkzXrw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RTCqGzXrb5mTsz3/Zn76S8LARLm9j6Pg/fZkrU34o9O2onyjXZnrSKqJx/mWr2TL6 NE6q1q2dqWH4yJ/r5rpP70fmac6CdlJUr+CtrtGNYgQ37YROh0hPthK98+dmdEOYfs y59tOsZsJ7AXpr5MkumOQN2ofAUHZx/X/t7ZK/XVxrPWejYJCkpE4qnnmcQ/NZi8aM 9FfthxwSbaVrxal4GK6HL5WJuS62WYnkOmEbPd1/7kB/EhypdhHRybsAclTUgMlhg9 QyW465poC92pV9OEep/1bZys6B/OnXElD1hrbJ12JBtupvGnJxOXsWYrZf9xGtagHa UFtR4Ay7fvJEQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vAnNW-0000000FSrX-16MA; Mon, 20 Oct 2025 10:44:38 +0000 Date: Mon, 20 Oct 2025 11:44:37 +0100 Message-ID: <86qzuxx36y.wl-maz@kernel.org> From: Marc Zyngier To: Jonathan Cameron Cc: , , , Thomas Gleixner , "Mark\ Rutland" , Will Deacon , "Rafael J.\ Wysocki" , Rob Herring , "Saravana\ Kannan" , Greg Kroah-Hartman , Sven Peter , Janne Grunau , Suzuki K Poulose , James Clark Subject: Re: [PATCH v3 04/26] platform: Add firmware-agnostic irq and affinity retrieval interface In-Reply-To: <20251009180351.00000d3d@huawei.com> References: <20250922082833.2038905-1-maz@kernel.org> <20250922082833.2038905-5-maz@kernel.org> <20251009180351.00000d3d@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: jonathan.cameron@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, tglx@linutronix.de, mark.rutland@arm.com, will@kernel.org, rafael@kernel.org, robh@kernel.org, saravanak@google.com, gregkh@linuxfoundation.org, sven@kernel.org, j@jannau.net, suzuki.poulose@arm.com, james.clark@linaro.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 09 Oct 2025 18:03:51 +0100, Jonathan Cameron wrote: > > On Mon, 22 Sep 2025 09:28:11 +0100 > Marc Zyngier wrote: > > > Expand platform_get_irq_optional() to also return an affinity if > > available, renaming it to platform_get_irq_affinity() in the > > process. > > > > platform_get_irq_optional() is preserved with its current semantics > > by calling into the new helper with a NULL affinity pointer. > > > > Signed-off-by: Marc Zyngier > > Maybe a breadcrumb of a comment for those of us who can't be bothered > to figure out why this needs the ifndef CONFIG_SPARC? The main issue is that SPARC, despite using OpenFirmware, does not use the OF infrastructure (which is basically DT only). This means that SPARC has its own firmware interface and parses interrupts its own way, storing them as archdata in the device. Sad state of things, unfortunately. > Otherwise a question on whether it's worth spinning a fwnode.h handler > to hide away the fwnode type in get_irq_affinity. > I think not given the complexity already there for the platform device > irq stuff, but thought I'd mention it. I don't think it'd be worth the hassle at this stage. The platform code is already a weird mix of DT and ACPI, without any clear delineation. If we wanted to do something useful, we'd split that into generic code on one side (the actual Linux platform device code), and the firmware specific backend. The main problem is to find a common abstraction, and ISTR that people found that rather hard, hence the current state. > > Reviewed-by: Jonathan Cameron Thanks for that. > > --- > > drivers/base/platform.c | 60 +++++++++++++++++++++++++++------ > > include/linux/platform_device.h | 2 ++ > > 2 files changed, 52 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > > index 09450349cf323..3a058f63ef0d3 100644 > > --- a/drivers/base/platform.c > > +++ b/drivers/base/platform.c > > @@ -150,25 +150,37 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev, > > EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname); > > #endif /* CONFIG_HAS_IOMEM */ > > > > +static const struct cpumask *get_irq_affinity(struct platform_device *dev, > > + unsigned int num) > > +{ > > + const struct cpumask *mask = NULL; > > +#ifndef CONFIG_SPARC > > + struct fwnode_handle *fwnode = dev_fwnode(&dev->dev); > > + > > + if (is_of_node(fwnode)) > > + mask = of_irq_get_affinity(to_of_node(fwnode), num); > > + else if (is_acpi_device_node(fwnode)) > > + mask = acpi_irq_get_affinity(ACPI_HANDLE_FWNODE(fwnode), num); > > Not sure how useful it will be more generally, but maybe use fwnode.h and > appropriate callback rather than opencoding here? > > Mind you the extra handling in existing platform_get_irq_optional() > for corner cases doesn't really fit with that model. Indeed, and I find that fwnode.h is currently completely FW-independent. I'd rather keep it that way and not expose these shenanigans outside of the support code *unless* we have a good reason to do so. Cheers, M. -- Without deviation from the norm, progress is not possible.