From nobody Tue Feb 10 07:57:50 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 D34B636922B for ; Mon, 9 Feb 2026 10:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770633732; cv=none; b=RfroBx05O/G1v4EeeePC7f6naEDPStdLos+eTjvW4rkGNeWb/HKEEMsNsH/JiS/Rggy1UAVVHF8QPGwKEiyHoC6GfflFcAoNl1JWsc4u3njz8CXKshnWxc8dtgCThlazLKkRNVvuoVlU7CeIhmj0moUtQSo59F9jGaesLLYq0v8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770633732; c=relaxed/simple; bh=TqaRlfcksReFLFPjLOJqka0OjTG44POzeHc64dTRc60=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nrZC46DehlnP1RBDtaiX2nSispYhWYeI5OoOVD4RHm2MI+9hZRIASjSEaUd+GQBvuKie3nwkWK3sL5XaeuyxWKQhIBOigvJza/T2WeS4zfBp4veuIM8WOkGlW35zo3d2Yj+d18HXTBUrvNKgEtG4TRtvWEpTggi0M9VC8GebSJc= 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=YMnA1nJy; arc=none smtp.client-ip=209.85.221.43 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="YMnA1nJy" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4376c0bffc1so756931f8f.0 for ; Mon, 09 Feb 2026 02:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770633730; x=1771238530; 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=LinQMk8vpLuA2yrBKVt1Nrvfv80xEiK4QCTzQwij+FQ=; b=YMnA1nJybXmepnBxZsfRtCRu6sevIA+B30zk34LPUAoX8+YmIdeDg2ZHVxJnwnM92A Sl6tr3gcvh3bjbt3q0sJXnnlV5i7R9bmh6o2SzdvmvjFm3Lof6fVsfl64UVYpXOTaGLf IZu+9kU0HeD7jGQMAsYVmTW2hOop0rSmePhl2frQG7XI32qqvLhpjaBpV2Ta8Q4bdCGc WIrCyXIQfcQN/FRgpPzvtKxz7l1WE6xlSyLjj0+XJ9shZpTZeUzygK5DFhmnzSZG3/4U zd32SBYLWSP1OeXV36kxtYNQip/KD5B5VNyVWAxtmlzxUvpnKBxEAeNHETohxW1NcC0w y/Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770633730; x=1771238530; 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=LinQMk8vpLuA2yrBKVt1Nrvfv80xEiK4QCTzQwij+FQ=; b=pz3v6FUIqvCA4Cq5QZIYyT++XfgDTq8Ro4o2hza3rIwX3n9nYzEYfetc/HXH8cIfBT nh01xqDpULE39F2nNc53Pi1ev63kyVEXM8X7kTY7+DkJi0egZLUshdIsG22rGgNOUIJx lliGe/VdIy6YuGw9fcdIjI7f2B9OtTFaVZSk8PHGOSI/JiZJn0spMbi3FNEe5bmmycyg BMJyznrUqYpIH8zdFkL7YysDRg1RSu7aLxvhJJnj3kl45ximXvntXQDP18O4ja4M9JS8 rGEuJrHVrLHw1KvAQPA/G0ZeJ/siwswrDXK6tPfOlDswXpsi8dlAMg1TUs8TSZNu/koA H15g== X-Gm-Message-State: AOJu0YwxCybnfHHrJCh5P7j8haUnvLa+rjdcDjLpksb9ooKs7bpLV2BR jKNmf2IXSjYE3FpMAchxQsqEwsecCuZbNmXgFTRTml6iC1ZIbbjBMk63 X-Gm-Gg: AZuq6aJW1AHWKzwVP5juKTO7SvQu3+kLUBfbZpaEa+WIpCGqHs3hKjM/oHhTMqWYeCv VtwAdYZpNUhJBXJwPxcXtH5IIeeE+6ycocVUkNkZ91KNvW5MoYwnlC14HCu8y5D1Q5OsnE6T0us JwWBK9d6bnytjhU23JyaBnQyP8kryhM3qtfgSzbmgQFxlaKt3dWNnjHiau47O4xBmthx7+Z4h54 iiKGAxPExxXeChbbddbQSEQvMiSR3oxCj10GrIuybPfdTFqFmG7wQr+oGHvJnyyPR6XxBq0uyP1 AQzqLHfiCTduDiayxdmGrgHQUQsRJcrRYIQlhbQZ75+ZE6n1T4wqdP8pD3zc/9KDwnBNXRceRpP UNCuN2dFK9vHP6WyDV7fuHPcVkRuWFey9B7gWpeJlR6reAxaDgvE6FeWIyRusLdHX2DYtPxCPZl q0uQrmlG2+kowoNTu3NOtkhPg+uFoBFyRhwsnIgXJla+pbhPpRAFdlX3vFRDmQ8Txn+JryP6P6M 45lkCy/ivaYFsuTZgeY114A61S2zBL2LjY= X-Received: by 2002:a05:600c:3e0b:b0:47a:810f:1d06 with SMTP id 5b1f17b1804b1-483209291eamr154277925e9.4.1770633729738; Mon, 09 Feb 2026 02:42:09 -0800 (PST) Received: from iku.Home ([2a06:5906:61b:2d00:436e:8b6:a7da:63b7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-436296b20fasm25962211f8f.6.2026.02.09.02.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 02:42:09 -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 v3 4/6] irqchip/renesas-rzv2h: Make IRQ type handling range-aware Date: Mon, 9 Feb 2026 10:41:18 +0000 Message-ID: <20260209104121.26172-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260209104121.26172-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260209104121.26172-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 --- v2->v3: - Updated the check in rzv2h_icu_alloc() to ensure hwirq is within the TINT range when extracting TINT information. v1->v2: - New patch. --- drivers/irqchip/irq-renesas-rzv2h.c | 60 +++++++++++++++++++---------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-rene= sas-rzv2h.c index 4aa772ba1a1f..d4a47df0e26e 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; @@ -508,11 +529,10 @@ static int rzv2h_icu_alloc(struct irq_domain *domain,= unsigned int virq, unsigne * hwirq is embedded in bits 0-15. * TINT is embedded in bits 16-31. */ - 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_START && hwirq <=3D ICU_TINT_LAST)) { hwirq =3D ICU_TINT_EXTRACT_HWIRQ(hwirq); - - if (hwirq < ICU_TINT_START) + if (hwirq < ICU_TINT_START || hwirq > ICU_TINT_LAST) return -EINVAL; } =20 --=20 2.52.0