From nobody Fri Oct 3 02:15:18 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 0625B2F1FDB for ; Mon, 8 Sep 2025 08:27:51 +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=1757320072; cv=none; b=R7J9iUkHWvKYSAyzBdqSwZ1puG3r39uQE4dZO5RkQ3U6Fn9PDBJymUVUf4se6l3wFLiuLOdQUnHS3IB0X90Ylwtf5vE7N5uU5y+4WF4FG85iLVP95Ic5U7t1GENfiotTgthIYC0AlJwORyqsTCXq99+b7VR2EwZWDhIccr7TZ8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757320072; c=relaxed/simple; bh=UwIstvxlYtiqE5m/jyDtG8VwOO9aujtFcYAYcLjppC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YElZBK3SM7i543kQodOHv+jh7pRxlFcFuHl/xXLOYSDYrt49W5TqjEpH0itcvh9lw7XalZCzISRMEpOncfrjjMTKL2hTSN6jv/kZXL1NcKhGRUuU/kIlQbGnnkfd81lwLpurKwQp07AkSsCFa0GbwHMgbO9N89HgFDk/wJelKEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SgaBK3gR; 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="SgaBK3gR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE866C4CEF1; Mon, 8 Sep 2025 08:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757320071; bh=UwIstvxlYtiqE5m/jyDtG8VwOO9aujtFcYAYcLjppC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgaBK3gRy2pLYt8ZO3EQDqsT3Gc3hI3gu8GAFXRe+nvpnn3Rz+RfkmwCL1IjO6q3t Fcr9ZwTjB/HapA7mU/JHzk9CiQdif0bai96AKu12fZWwzJE0SSm0TjyAV3qB7ruQfF 8lw/RJ6zxOoD9Ms0VMXbthWyw/aUGw+KRoqXTFhG1OUzGCJE0c/Oc4r5bQ0Ak3nveu v4U0HNYlUYfmZudcY4dzNglU48bGHSaI6X2GtbY64aL0bj5E3XPmK0sxnLMAXwV2au 5FzGMbVKgRlzpmwdBGOWiJSS087v4YawcpCbgEHGuxMKGYxMpd1qnUnH5phdrxPLWD sAl3Bp1H6OjLg== From: Lorenzo Pieralisi To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Dan Carpenter , Zenghui Yu , Thomas Gleixner , Marc Zyngier Subject: [PATCH v2 RESEND 1/3] irqchip/gic-v5: Delete a stray tab Date: Mon, 8 Sep 2025 10:27:43 +0200 Message-ID: <20250908082745.113718-2-lpieralisi@kernel.org> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250908082745.113718-1-lpieralisi@kernel.org> References: <20250908082745.113718-1-lpieralisi@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 Content-Type: text/plain; charset="utf-8" From: Dan Carpenter Delete a stray tab that is indenting the code erroneously. [lpieralisi: reworded log message] Signed-off-by: Dan Carpenter Signed-off-by: Lorenzo Pieralisi Reviewed-by: Zenghui Yu Cc: Thomas Gleixner Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v5-irs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v5-irs.c b/drivers/irqchip/irq-gic-v5-= irs.c index 13c035727e32..ce2732d649a3 100644 --- a/drivers/irqchip/irq-gic-v5-irs.c +++ b/drivers/irqchip/irq-gic-v5-irs.c @@ -571,7 +571,7 @@ static void __init gicv5_irs_init_bases(struct gicv5_ir= s_chip_data *irs_data, FIELD_PREP(GICV5_IRS_CR1_IST_RA, GICV5_NO_READ_ALLOC) | FIELD_PREP(GICV5_IRS_CR1_IC, GICV5_NON_CACHE) | FIELD_PREP(GICV5_IRS_CR1_OC, GICV5_NON_CACHE); - irs_data->flags |=3D IRS_FLAGS_NON_COHERENT; + irs_data->flags |=3D IRS_FLAGS_NON_COHERENT; } else { cr1 =3D FIELD_PREP(GICV5_IRS_CR1_VPED_WA, GICV5_WRITE_ALLOC) | FIELD_PREP(GICV5_IRS_CR1_VPED_RA, GICV5_READ_ALLOC) | --=20 2.48.0 From nobody Fri Oct 3 02:15:18 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 6128B2F3C32 for ; Mon, 8 Sep 2025 08:27:53 +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=1757320074; cv=none; b=GAsKECp4tvWWzSd1qm0Yk9fbD3VUXOApr36g9kfoJpNJkgMmPbBi0GVMKQItKNGACBlWtry2IJPBlNqAkBvSfpi/O5nhmvJLA7vu9fT6zlGCAVFyNpWd6opTEhE82MqycEtxbVOoYwgGWJQsTJZjW3qAWDTX7hNvS4OTKT7lkPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757320074; c=relaxed/simple; bh=P/vlG6t4K0nRMEfMtDS6pVBd3+VY1KFLZviC+h88F5I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lalbn3AWMi0iJkqRwWWTGxt14PNeoU978cnJcaM2OQTYpuEiCkWzgyuKbRSRYlo/TEgkISg2jFP9lazSSGRJQXueaf5EPTq85F3CUwn9x3FcyOgTBoBXPwy/3TQRin92H+yAsTKo45EZPOBeef0Qd2QEhTrGefW2Xhxf3O1P8ig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JUhJopxZ; 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="JUhJopxZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F76C4CEF5; Mon, 8 Sep 2025 08:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757320073; bh=P/vlG6t4K0nRMEfMtDS6pVBd3+VY1KFLZviC+h88F5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUhJopxZVT0XDCNhhdmGwvnjr5AQ++YQD87Z5jb/6SjmVJkLJo37/tKfhl0NOFw0m ikYD4dJRS1uXcK/+coDje9w8jchfyBXBKBdkrkscxIkXknclhJPHHcKZQ9LdCj2n9s wA+CCfn97QsArsl4FtosaA0gwbSJtUN/iYjmneda2ABluTgPS98Q9tLqV019rN1Ua0 vYnk2hOAyrd4lieVwva8//OIZ1CY3xTO0cXGKz7HGQoGnvhngp5rdJosD1pDAVDWKH kVWyq4zPmy5lLhgId+45y4urANQwajoNIB09Z7tgDexSVY3pF7fQjEP/9B3q9JqbTG /ESCYn9Kr5DeQ== From: Lorenzo Pieralisi To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Dan Carpenter , Zenghui Yu , Thomas Gleixner , Marc Zyngier Subject: [PATCH v2 RESEND 2/3] irqchip/gic-v5: Fix loop in gicv5_its_create_itt_two_level() cleanup path Date: Mon, 8 Sep 2025 10:27:44 +0200 Message-ID: <20250908082745.113718-3-lpieralisi@kernel.org> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250908082745.113718-1-lpieralisi@kernel.org> References: <20250908082745.113718-1-lpieralisi@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 Content-Type: text/plain; charset="utf-8" From: Dan Carpenter The "i" variable in gicv5_its_create_itt_two_level() needs to be signed otherwise it would cause a forever loop in the function cleanup path. [lpieralisi: reworded commit log] Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support") Signed-off-by: Dan Carpenter Signed-off-by: Lorenzo Pieralisi Reviewed-by: Zenghui Yu Cc: Thomas Gleixner Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v5-its.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-= its.c index 9290ac741949..4701ef62b8b2 100644 --- a/drivers/irqchip/irq-gic-v5-its.c +++ b/drivers/irqchip/irq-gic-v5-its.c @@ -191,9 +191,9 @@ static int gicv5_its_create_itt_two_level(struct gicv5_= its_chip_data *its, unsigned int num_events) { unsigned int l1_bits, l2_bits, span, events_per_l2_table; - unsigned int i, complete_tables, final_span, num_ents; + unsigned int complete_tables, final_span, num_ents; __le64 *itt_l1, *itt_l2, **l2ptrs; - int ret; + int i, ret; u64 val; =20 ret =3D gicv5_its_l2sz_to_l2_bits(itt_l2sz); --=20 2.48.0 From nobody Fri Oct 3 02:15:18 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 6CBDF2F60D6 for ; Mon, 8 Sep 2025 08:27:56 +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=1757320076; cv=none; b=OBieDMfx/cQvcUK3q8ar5g5usKhQybMBn31BtlS131PsYlF1t78XDH7u9aOujjY9k3maoBbSSGN8Q1LZE7xbm8UHmSRcOCQVxMaY+gX14Z9OOEdwHTW/lzJrbGe2bbm3EvhMIG7RqLRzbPgECNfskQpeRWFPMEnzRsetnx+EWvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757320076; c=relaxed/simple; bh=CFvvTrfa1t92F7NxctUBMm3QJnsOF0WWxyPhVXxwhCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AtV07iXgyqSTyjS5oaM+KsbS0pXCLFhiBgn56c1MFaPxEgcDgiUom2XNLGeP1FlkYvdvxs1UP5hOSjaolf71aSkKY29uRfp/CVI4wtits2ioEAn0iUOdSG1+wt9xsno65xd/R9ZT8nSZcLXtkVB1cK1vXx4esTA34Q/W9TTIlWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LnXTGIP3; 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="LnXTGIP3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D98C4CEF5; Mon, 8 Sep 2025 08:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757320076; bh=CFvvTrfa1t92F7NxctUBMm3QJnsOF0WWxyPhVXxwhCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LnXTGIP3pULjVEAepJ6qCrd3NuT65KHO7JLgPYCK6GiyxGGYrjnWF6Ox2dxar9Lca i4z/sEg/UtTUZoC9gi488+kRJ3j8liXpyILqPJo69l08TFMSlcZFeVAkWB2lvIZkU6 tvLP5ljWIokQmgVfkhfcieOQg0Y0Mc7U/lAgAPOGskryGwdef+naU19kHGFnLf3nFd 9W8SIQ26Fa9FeabH022g5Nyq5oftskXyMo4qzCjMfZ2mBIB4B1pHkcagYiAzZIpee2 T/cG27wqP1z/4003cPjWGsyJ9Baw3KXaKsFLBAgVdChIdU8B3pOpV9LG+fyaEHtrs2 xJe+nThBVRFYg== From: Lorenzo Pieralisi To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Dan Carpenter , Zenghui Yu , Thomas Gleixner , Marc Zyngier Subject: [PATCH v2 RESEND 3/3] irqchip/gic-v5: Fix error handling in gicv5_its_irq_domain_alloc() Date: Mon, 8 Sep 2025 10:27:45 +0200 Message-ID: <20250908082745.113718-4-lpieralisi@kernel.org> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250908082745.113718-1-lpieralisi@kernel.org> References: <20250908082745.113718-1-lpieralisi@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 Content-Type: text/plain; charset="utf-8" From: Dan Carpenter Code in gicv5_its_irq_domain_alloc() has two issues: - it checks the wrong return value/variable when calling gicv5_alloc_lpi() - The cleanup code does not take previous loop iterations into account Fix both issues at once by adding the right gicv5_alloc_lpi() variable check and by reworking the function cleanup code to take into account current and previous iterations. [lpieralisi: reworded commit log] Fixes: 57d72196dfc8 ("irqchip/gic-v5: Add GICv5 ITS support") Signed-off-by: Dan Carpenter Signed-off-by: Lorenzo Pieralisi Reviewed-by: Zenghui Yu Cc: Thomas Gleixner Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v5-its.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-= its.c index 4701ef62b8b2..2fb58d76f521 100644 --- a/drivers/irqchip/irq-gic-v5-its.c +++ b/drivers/irqchip/irq-gic-v5-its.c @@ -949,15 +949,18 @@ static int gicv5_its_irq_domain_alloc(struct irq_doma= in *domain, unsigned int vi device_id =3D its_dev->device_id; =20 for (i =3D 0; i < nr_irqs; i++) { - lpi =3D gicv5_alloc_lpi(); + ret =3D gicv5_alloc_lpi(); if (ret < 0) { pr_debug("Failed to find free LPI!\n"); - goto out_eventid; + goto out_free_irqs; } + lpi =3D ret; =20 ret =3D irq_domain_alloc_irqs_parent(domain, virq + i, 1, &lpi); - if (ret) - goto out_free_lpi; + if (ret) { + gicv5_free_lpi(lpi); + goto out_free_irqs; + } =20 /* * Store eventid and deviceid into the hwirq for later use. @@ -977,8 +980,13 @@ static int gicv5_its_irq_domain_alloc(struct irq_domai= n *domain, unsigned int vi =20 return 0; =20 -out_free_lpi: - gicv5_free_lpi(lpi); +out_free_irqs: + while (--i >=3D 0) { + irqd =3D irq_domain_get_irq_data(domain, virq + i); + gicv5_free_lpi(irqd->parent_data->hwirq); + irq_domain_reset_irq_data(irqd); + irq_domain_free_irqs_parent(domain, virq + i, 1); + } out_eventid: gicv5_its_free_eventid(its_dev, event_id_base, nr_irqs); return ret; --=20 2.48.0