From nobody Tue Dec 16 21:47:52 2025 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 AAAF93148BB; Mon, 20 Oct 2025 12:30:10 +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=1760963410; cv=none; b=uBpfMF9fKn0tVpAmyrVeEyVG9jDv1KsPi9bRX68Ydv2HE2T+gPN3a7JOgeNQbCTxoiEvf8rVPUGAtHgQiDM3efwLoRFz/zNvIuYL+40L8PNVIbx2bYALCw+XMjYrwZuAZsn4zVyGTemoxHll+Mfuo5+2a8x9SZGR0m1eWfNhCig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760963410; c=relaxed/simple; bh=B+YD3r2Pf9GN3kTdiVu6vqT+UCLV1wIqiygl0YRDNGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hA8ZAR6aTm1KU5BogyAZZsb/iFRHLcoYsTIprAPmcXcK4fNWwDJshKuyauH8wRktWXHZUgBjKVdZ2/+pyXQ4N/UG3Y5pOxBGuWG5eiEtSnVuLBXcSZ+Ni3JwADz3tFlGFgbNxk1CL+w95nqIqYJW0KvYvo6ZhLVuwjwJHFSMwIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GsYxpLjV; 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="GsYxpLjV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8757FC4CEF9; Mon, 20 Oct 2025 12:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760963410; bh=B+YD3r2Pf9GN3kTdiVu6vqT+UCLV1wIqiygl0YRDNGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsYxpLjVSsE8rdKqpFQTaPAES/iHOGiKyLxs0ZbE3juopvfzc5qu5wHxPN3/GY5dO L1xUu1+9g3dGqcnX4v6w7XuTI27k+4d37RT/BiaUZn8pSPb7RPQHgWTmZSutnApEK1 CCi9uH2Exh0gdiXQWgQuMegbW2vwAFASj39skhCHy+uy6U2s01gWo8cqkFDJStOYxo YNwxJQgImX0sZukJLdHOQQNqRPm1se8wy81y1hlksF/+VEs0ZfQ5+EeZZa/Tu3lbL0 xilme9eYq5+QEfhUcFH6/9nb+27/x7i+n9vfuryLJjXlgtphtCESfSrJSbaFT4wpmk b5YsdFypNz2GA== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) 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 1vAp1c-0000000FUu2-2q2N; Mon, 20 Oct 2025 12:30:08 +0000 From: Marc Zyngier To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org 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 , Jonathan Cameron , Jinjie Ruan , Alexandru Elisei Subject: [PATCH v4 05/26] irqchip/gic-v3: Add FW info retrieval support Date: Mon, 20 Oct 2025 13:29:22 +0100 Message-ID: <20251020122944.3074811-6-maz@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251020122944.3074811-1-maz@kernel.org> References: <20251020122944.3074811-1-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: 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, jonathan.cameron@huawei.com, ruanjinjie@huawei.com, alexandru.elisei@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Content-Type: text/plain; charset="utf-8" Plug the new .get_fwspec_info() callback into the GICv3 core driver, using some of the existing PPI affinity handling infrastructure. Tested-by: Will Deacon Signed-off-by: Marc Zyngier Reviewed-by: Jonathan Cameron --- drivers/irqchip/irq-gic-v3.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 3de351e66ee84..cf0ba83c6eda6 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -69,6 +69,8 @@ struct gic_chip_data { bool has_rss; unsigned int ppi_nr; struct partition_desc **ppi_descs; + struct partition_affinity *parts; + unsigned int nr_parts; }; =20 #define T241_CHIPS_MAX 4 @@ -1797,11 +1799,58 @@ static int gic_irq_domain_select(struct irq_domain = *d, return d =3D=3D partition_get_domain(gic_data.ppi_descs[ppi_idx]); } =20 +static int gic_irq_get_fwspec_info(struct irq_fwspec *fwspec, struct irq_f= wspec_info *info) +{ + const struct cpumask *mask =3D NULL; + + info->flags =3D 0; + info->affinity =3D NULL; + + /* ACPI is not capable of describing PPI affinity -- yet */ + if (!is_of_node(fwspec->fwnode)) + return 0; + + /* If the specifier provides an affinity, use it */ + if (fwspec->param_count =3D=3D 4 && fwspec->param[3]) { + struct fwnode_handle *fw; + + switch (fwspec->param[0]) { + case 1: /* PPI */ + case 3: /* EPPI */ + break; + default: + return 0; + } + + fw =3D of_fwnode_handle(of_find_node_by_phandle(fwspec->param[3])); + if (!fw) + return -ENOENT; + + for (int i =3D 0; i < gic_data.nr_parts; i++) { + if (gic_data.parts[i].partition_id =3D=3D fw) { + mask =3D &gic_data.parts[i].mask; + break; + } + } + + if (!mask) + return -ENOENT; + } else { + mask =3D cpu_possible_mask; + } + + info->affinity =3D mask; + info->flags =3D IRQ_FWSPEC_INFO_AFFINITY_VALID; + + return 0; +} + static const struct irq_domain_ops gic_irq_domain_ops =3D { .translate =3D gic_irq_domain_translate, .alloc =3D gic_irq_domain_alloc, .free =3D gic_irq_domain_free, .select =3D gic_irq_domain_select, + .get_fwspec_info =3D gic_irq_get_fwspec_info, }; =20 static int partition_domain_translate(struct irq_domain *d, @@ -1840,6 +1889,7 @@ static int partition_domain_translate(struct irq_doma= in *d, static const struct irq_domain_ops partition_domain_ops =3D { .translate =3D partition_domain_translate, .select =3D gic_irq_domain_select, + .get_fwspec_info =3D gic_irq_get_fwspec_info, }; =20 static bool gic_enable_quirk_msm8996(void *data) @@ -2232,6 +2282,9 @@ static void __init gic_populate_ppi_partitions(struct= device_node *gic_node) part_idx++; } =20 + gic_data.parts =3D parts; + gic_data.nr_parts =3D nr_parts; + for (i =3D 0; i < gic_data.ppi_nr; i++) { unsigned int irq; struct partition_desc *desc; --=20 2.47.3