From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795617638; b=sDzfqdF9w6StZa3J/goZr5Tm4tXCsC3v3mW0COzOOO1A5NYVQstM7k+u+WeX3vyikvSR 8PToppqUdzgY2Pb3Ss83OyFfanoBqNcTWuGajGqQANLk51dFVV6KVSDj6KL8laW3hwKMx la/vSXFhnr4uZ7WTG477k0sQ71NNWBZYp+cPlrxn1zMYNf62b36scwo8pAan9QQiUeb52 n05pkHo/NbaPy/WR8tpq5C8mIFbECMhQuMnlLYMTrJr4CTxlWEoHrF9l2jqLFuBLVRaPl Beu/dw4qBzIxrzI3GvTtoX8stEprtjnv7bgnrEEye1xyNncdwvII2PP0SdHETbbeJXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617638; h=DMARC-Filter:Received:Received:DKIM-Signature:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer; bh=DmGGCXrHwrir6H693moCu2d3Cr+V43eneVcJDQnJvH8=; b=40j70KLQxdylct1Z55+nL4GYrSpoa0sAY7UXpDcsZgAKissayBb7zuBtzdUMCvXh+XDx yWR7gyT9CsbLLmIZzJwlw2iQ0hBTM91jUiopNJyGIt0EetoGOlBzywxdtn5qB/3JhgFsQ w6onw2GUayiBbqnMiQWjsqpO/6OWyYOgVnMj0lQJ6slhzySTuzzeU44tBM1WyGfq84Y0n /yNfLL32UwLbumfEwBMf7sfga77gIeBOGF7AqCNLgqPCIMaaWp+mE1SikQ6KP6GwgwfBK +HrnXG2XOteEIoRNdLOitsQMpV41jhDbG/1lIFncO2GkD2faJbblotdOT4kIWsI1+7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Yu043oG3; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 576BC606A323 for ; Wed, 25 Nov 2026 14:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 576BC606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Yu043oG3 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E12ED339; Wed, 25 Nov 2026 06:40:34 -0800 (PST) Received: from e133894.arm.com (e133894.arm.com [10.2.80.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 515423F632; Wed, 25 Nov 2026 06:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1795617637; bh=MFpgCQeqmz1UwIUbJxHK1uAxa8C7wNm9mZ+co05gCgc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Yu043oG3c/k2s4TTUGb31dvLPI5ye2VSe6X/G0HfKZ1O+ttI9GAc7dwY1IhwEmPZs J+e2y/MWwjLsvRpcdFYpSruEhDAX3syXHAya5hQtZ2mgctAci/YwOonWIMwGGD1Hwm wXAwL+JwVkQ/nuSvfSk5Hhh5VQHMYaDdqtV5ub3Y= From: Sascha Bischoff Date: Wed, 25 Nov 2026 14:40:23 +0000 Subject: [PATCH v4 01/13] irqchip/gic-v5: Reject SPIs not backed by an IRS X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261125-host_gicv5_fixes-v4-1-0469743c47d8@arm.com> References: <20261125-host_gicv5_fixes-v4-0-0469743c47d8@arm.com> In-Reply-To: <20261125-host_gicv5_fixes-v4-0-0469743c47d8@arm.com> To: Marc Zyngier , Lorenzo Pieralisi , Thomas Gleixner , Radu Rendec , Timothy Hayes , Catalin Marinas , Jonathan Cameron , "Rafael J. Wysocki" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Fuad Tabba , Sascha Bischoff X-Mailer: b4 0.15.2 It is possible to build a multi-IRS GICv5 system where there are gaps in the global SPI range that are not backed by any IRS. In the current incarnation, this results in dereferencing a null pointer. Reject cases where the firmware attempts to use those SPIs during IRQ allocation by catching the case where there is no chip_data associated with the irq (meaning that there is no IRS to back it). Spit out a warning about broken firmware when this is encountered as it shouldn't be using non-existent SPIs in the first place. Fixes: 5cb1b6dab2def ("irqchip/gic-v5: Add GICv5 IRS/SPI support") Signed-off-by: Sascha Bischoff Acked-by: Lorenzo Pieralisi --- drivers/irqchip/irq-gic-v5.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c index 8c0303af71e7..693ce1ee263d 100644 --- a/drivers/irqchip/irq-gic-v5.c +++ b/drivers/irqchip/irq-gic-v5.c @@ -727,6 +727,15 @@ static int gicv5_irq_spi_domain_alloc(struct irq_domain *domain, unsigned int vi irqd = irq_desc_get_irq_data(irq_to_desc(virq)); chip_data = gicv5_irs_lookup_by_spi_id(hwirq); + /* + * The global SPI range may contain IDs not covered by any IRS, i.e., it + * may have gaps, in which case there is no IRS to back the SPI. Catch + * broken firmware trying to use any of those SPIs. + */ + if (!chip_data) { + pr_warn(FW_BUG "Unimplemented SPI (0x%lx)!\n", hwirq); + return -EINVAL; + } irq_domain_set_info(domain, virq, hwirq, &gicv5_spi_irq_chip, chip_data, handle_fasteoi_irq, NULL, NULL); -- 2.34.1