From nobody Wed Feb 11 01:36:16 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B119324B33 for ; Tue, 3 Feb 2026 23:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770160715; cv=none; b=YNKKC2vKLsIt0rxtE4ydUdCozDetf9517x7RShPG+IrW0RJxCtPNEBSPehkr5Id+Y9T8+IdhXYj8sdrNTfbpON6bMNY6Arzu1HkqmRrOil6lu8cDpktVe2jLk6dwht4QqQdhrosRvrtWJuCmq51ZmC9wTrg84OkCpTI62WyeiCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770160715; c=relaxed/simple; bh=M74STgH1ns3cnMiq1Iga99YIhx0rQEIYF7y5xQ9Bxsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AAsfopM/JHoEwKP66ji6S/c508itTiDgXFzm61vH4t9Z0Ke3CaijCMJCqD20ptukeRyl+Tehx+xWFXiDLmCRUBwWt7qmFDHbKn+Y1vXmnUobccchNXMxs7r1ky2cQ6VdTv1Pg9vCLmOAa2z80QA5dm+mwQUEttdbmiyz1y6UpQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jOTgVOak; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jOTgVOak" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42fb4eeb482so4230520f8f.0 for ; Tue, 03 Feb 2026 15:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770160712; x=1770765512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+qamj1ZCcGSJBUDcRzNR59i6EIMleinLWFPtTQZPwfs=; b=jOTgVOakGHhYWNs+4rZRq/uTJXWm6tbH0roPC9o8LXZdmsohKQ3S3qN8ZEvRh+x8o8 kHNGeruCGUTKn0eJ6/MfS/kHcS3kPSOu8UmaGU+DPthB68+IyXCDHnBCzmZHv6CICIot deJPyGWQBsTZ9l8SWBjDrXbUzJxdpp2EMovCMqr5eKvnwbwZkb6mHzZIlj4PRXAg5iNc JXrv67b0yhaE2srCppwi6PMpbBIcl8XTW/CaGNMdG++z4OZtwc3nh9SNKOPqZ5CMEhOj DKmzbhwX0QqFpd38OW6GFGYxbVuc0Dk8iKhnLu/Llx7CzViviP95u75aPn5DKO2X9wjj UTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770160712; x=1770765512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+qamj1ZCcGSJBUDcRzNR59i6EIMleinLWFPtTQZPwfs=; b=ZDENbzuauhfl0LNZNpGBaJNTnXfiWQIhf7h00N5OKZCmDCwev06oYcuVZm33pIFION 2ncWk4SE9F6P7SniCPWo6yjniIpsjHOEEFOvTij0A7Yq67XzR4gH9lOqQonZ/gcj2qfz DlXlbAj2fZ3dVCGii7xP63nQCtIE7TzwZ1peRLqhqv3tV6o4CR7PeVhuphJuBUHu3KhZ 06cLcNRDMbv6LbDnmXz4Q8/JvhEfdXCEZeiIrtO1OFXKXnCgEeDtaq7Yrb/MQ3mXagOY IvKGuLK8ZEw1H2nyWNskHkv57OSeODAd5XjoEl4QcnEMStdEB0P9GS2S08lAQBrEY6qk 43UQ== X-Gm-Message-State: AOJu0YyPX8dc6P0yH4DOPhzV4otqYm22RFQRCkhg1GsqgXs84BaOLkO9 YT/NpK310GoHM7mdDW15aggw15mJWNi53FWMHOwMpAPlCmZ/KEyVY/8O X-Gm-Gg: AZuq6aJAWypwc5C5Yiu7ti34ABfJRE1ws5TJaIJTJEXHvm5ZbjE2GB387uPNxWteQCA uRZq8QmvjEAhqMjyXUuYy5ZOLEjDGIsC+o30nLZvwH6xxqXTOG1wghrNSCWT8Aehp/SUHYriheJ b/tf5Z3ikqvclUE1JNCiKL8UhVeDj0rprRmD5WZ+rr7fLSK5y7XuTdNhmJIWgPGuTE53Qw0fAlT sAivYRDDdDv+qf42JT4HWBfQa8rmhJMjJ8A6SSfY7B92yLh76SwgnS0GsBBbfNdP0AmFz+S61d1 VRKYnUSs6XBTIP52rbeuxHb0W3a5KHf5PK3nw43/k1ei3BNLrXzF4WC0ombjGJE9QXolBrGYn7j 0rgGaG6hullyfCHghl60rgTZ5coImOmceQ8u05ZLqPitQAikP/8t0LKlDpXOtDpFzQWDeAcTRyl A9NeZnX574D9WkOv/iYuE9a5SBryQkDBwXiOzeHl6NVIjZrD7CEB0X8Aj/Gz9WE91qSLG6pIpJv kQte6Xet66rTJhMF2q7Tv2E X-Received: by 2002:a05:6000:40c9:b0:435:a8e7:62de with SMTP id ffacd0b85a97d-436180628f8mr1401844f8f.58.1770160711522; Tue, 03 Feb 2026 15:18:31 -0800 (PST) Received: from iku.Home ([2a06:5906:61b:2d00:2e50:5c7f:afca:5f9f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-436180647aasm1739832f8f.41.2026.02.03.15.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 15:18:30 -0800 (PST) From: Prabhakar X-Google-Original-From: Prabhakar To: Thomas Gleixner , Philipp Zabel , Geert Uytterhoeven , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 4/6] irqchip/renesas-rzv2h: Make IRQ type handling range-aware Date: Tue, 3 Feb 2026 23:18:21 +0000 Message-ID: <20260203231823.208661-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260203231823.208661-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260203231823.208661-1-prabhakar.mahadev-lad.rj@bp.renesas.com> 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 Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Refine IRQ type handling to explicitly bound IRQ and TINT ranges and dispatch based on the hardware IRQ number. This restructures the logic to clearly separate NMI, IRQ, and TINT handling and ensures out-of-range interrupts are ignored safely. The change prepares the driver for adding CA55 interrupts into the IRQ hierarchy domain by making the interrupt classification explicit and extensible. Signed-off-by: Lad Prabhakar --- v1->v2: - New patch. --- drivers/irqchip/irq-renesas-rzv2h.c | 59 +++++++++++++++++++---------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-rene= sas-rzv2h.c index 4aa772ba1a1f..6c7bbb04c6e4 100644 --- a/drivers/irqchip/irq-renesas-rzv2h.c +++ b/drivers/irqchip/irq-renesas-rzv2h.c @@ -25,9 +25,11 @@ /* DT "interrupts" indexes */ #define ICU_IRQ_START 1 #define ICU_IRQ_COUNT 16 -#define ICU_TINT_START (ICU_IRQ_START + ICU_IRQ_COUNT) +#define ICU_IRQ_LAST (ICU_IRQ_START + ICU_IRQ_COUNT - 1) +#define ICU_TINT_START (ICU_IRQ_LAST + 1) #define ICU_TINT_COUNT 32 -#define ICU_NUM_IRQ (ICU_TINT_START + ICU_TINT_COUNT) +#define ICU_TINT_LAST (ICU_TINT_START + ICU_TINT_COUNT - 1) +#define ICU_NUM_IRQ (ICU_TINT_LAST + 1) =20 /* Registers */ #define ICU_NSCNT 0x00 @@ -175,18 +177,27 @@ static void rzv2h_icu_eoi(struct irq_data *d) u32 bit; =20 scoped_guard(raw_spinlock, &priv->lock) { - if (hw_irq >=3D ICU_TINT_START) { - tintirq_nr =3D hw_irq - ICU_TINT_START; - bit =3D BIT(tintirq_nr); - if (!irqd_is_level_type(d)) - writel_relaxed(bit, priv->base + priv->info->t_offs + ICU_TSCLR); - } else if (hw_irq >=3D ICU_IRQ_START) { + switch (hw_irq) { + case 0: + /* Clear NMI */ + writel_relaxed(ICU_NSCLR_NCLR, priv->base + ICU_NSCLR); + break; + case ICU_IRQ_START ... ICU_IRQ_LAST: + /* Clear IRQ */ tintirq_nr =3D hw_irq - ICU_IRQ_START; bit =3D BIT(tintirq_nr); if (!irqd_is_level_type(d)) writel_relaxed(bit, priv->base + ICU_ISCLR); - } else { - writel_relaxed(ICU_NSCLR_NCLR, priv->base + ICU_NSCLR); + break; + case ICU_TINT_START ... ICU_TINT_LAST: + /* Clear TINT */ + tintirq_nr =3D hw_irq - ICU_TINT_START; + bit =3D BIT(tintirq_nr); + if (!irqd_is_level_type(d)) + writel_relaxed(bit, priv->base + priv->info->t_offs + ICU_TSCLR); + break; + default: + break; } } =20 @@ -200,7 +211,7 @@ static void rzv2h_tint_irq_endisable(struct irq_data *d= , bool enable) u32 tint_nr, tssel_n, k, tssr; u8 nr_tint; =20 - if (hw_irq < ICU_TINT_START) + if (hw_irq < ICU_TINT_START || hw_irq > ICU_TINT_LAST) return; =20 tint_nr =3D hw_irq - ICU_TINT_START; @@ -421,12 +432,22 @@ static int rzv2h_icu_set_type(struct irq_data *d, uns= igned int type) unsigned int hw_irq =3D irqd_to_hwirq(d); int ret; =20 - if (hw_irq >=3D ICU_TINT_START) - ret =3D rzv2h_tint_set_type(d, type); - else if (hw_irq >=3D ICU_IRQ_START) - ret =3D rzv2h_irq_set_type(d, type); - else + switch (hw_irq) { + case 0: + /* NMI */ ret =3D rzv2h_nmi_set_type(d, type); + break; + case ICU_IRQ_START ... ICU_IRQ_LAST: + /* IRQ */ + ret =3D rzv2h_irq_set_type(d, type); + break; + case ICU_TINT_START ... ICU_TINT_LAST: + /* TINT */ + ret =3D rzv2h_tint_set_type(d, type); + break; + default: + ret =3D -EINVAL; + } =20 if (ret) return ret; @@ -507,11 +528,11 @@ static int rzv2h_icu_alloc(struct irq_domain *domain,= unsigned int virq, unsigne * fwspec->param[0]. * hwirq is embedded in bits 0-15. * TINT is embedded in bits 16-31. + * Check if bits 16-31 are set to identify TINT interrupts. */ - if (hwirq >=3D ICU_TINT_START) { - tint =3D ICU_TINT_EXTRACT_GPIOINT(hwirq); + tint =3D ICU_TINT_EXTRACT_GPIOINT(hwirq); + if (tint) { hwirq =3D ICU_TINT_EXTRACT_HWIRQ(hwirq); - if (hwirq < ICU_TINT_START) return -EINVAL; } --=20 2.52.0