From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1B15C52D7C for ; Tue, 13 Aug 2024 09:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wi1GRXgv5z0vDrAHCiQRkanFaqv+S5pMhvuF4SeO0EY=; b=dcmmhm8frAD2F8NjySNPRSPcwM 3mGdubIPoBr8kLalCxEp3T8vNUIuZt7Hpc7mtOFlIN+DsnWfsrT969t7zywumFZvBjKRhZTRb7Yda 4g7oSWeZYZWhjDjONjkYRNP3NJz/uDC3SpfSzkp0efcfpMyeuTd/i0zKdylBXK8n/rNtoU0LjNu9M XpLR1f1EriNoH8XSu7wytDtc2rrfsZVLo3HCFSfp8vY5l807SjUbQMFGi8gd2D78WNDEfSvEZzQB9 mOI7t6sTgZ+7T1FrdzPjJYKLeAuKjl3Y5k6E2DmE62SXTwv+nZqJDDN+uUoJWsC9PLOP7dvdQ1D23 qL5LFxsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdnNh-0000000339X-3cuv; Tue, 13 Aug 2024 08:59:53 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdnMV-000000032oZ-2tER for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 08:58:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C0F13CE10AB; Tue, 13 Aug 2024 08:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2049C4AF0B; Tue, 13 Aug 2024 08:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723539516; bh=7NQeNfFpaCXWMDNowtEOSAtlyV+7MKBfKJDqRukDraQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I48YQts0xZw9IRiHpoO1JAdZe2hAgqmfcMiGtJtgHPcpTa/sRWZv6nUwGLOuaf86H 9hax3I+y6A4t1s6q95k6LReGpuH9xsOcSC4WOQ++5TZOVt/1Kry087t9Be/L7GzmVw XncCqH901VOAEo7K0i1tw5WuXzw5vF85kT17X13sIISj22D0R9nOAuQgoagwfvP7Ur yBy5rl282JieOLj854QDNXgl/QSeiErKyF+SfaJZQXijreW1d2FiGqGMchqX/9kVZQ LWfQbyufLv7QU2pq/6wkZiYd5+VMxKrnZX9Yb3u/CYCw47nM77opG5qdX8iRiJbajp UWw5RIzIxt/PQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sdnMQ-003HCh-P8; Tue, 13 Aug 2024 09:58:34 +0100 Date: Tue, 13 Aug 2024 09:58:34 +0100 Message-ID: <86zfpgztmt.wl-maz@kernel.org> From: Marc Zyngier To: Shanker Donthineni Cc: Thomas Gleixner , Catalin Marinas , Will Deacon , Jonathan Corbet , Sudeep Holla , , Subject: Re: [PATCH] irqchip/gic-v3: Allow unused SGIs for drivers/modules In-Reply-To: <20240813033925.925947-1-sdonthineni@nvidia.com> References: <20240813033925.925947-1-sdonthineni@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: sdonthineni@nvidia.com, tglx@linutronix.de, catalin.marinas@arm.com, will@kernel.org, corbet@lwn.net, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_015840_112380_725C529F X-CRM114-Status: GOOD ( 33.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 13 Aug 2024 04:39:25 +0100, Shanker Donthineni wrote: > > The commit 897e9e60c016 ("firmware: arm_ffa: Initial support for scheduler > receiver interrupt") adds support for SGI interrupts in the FFA driver. > However, the validation for SGIs in the GICv3 is too strict, causing the > driver probe to fail. It probably is a good thing that I wasn't on Cc for this patch, because I would have immediately NAK'd it. Sudeep, please consider this a retrospective NAK! > > This patch relaxes the SGI validation check, allowing callers to use SGIs > if the requested SGI number is greater than or equal to MAX_IPI, which > fixes the TFA driver probe failure. > > This issue is observed on NVIDIA server platform with FFA-v1.1. > [ 7.918099] PTP clock support registered > [ 7.922110] EDAC MC: Ver: 3.0.0 > [ 7.945063] ARM FF-A: Driver version 1.1 > [ 7.949068] ARM FF-A: Firmware version 1.1 found > [ 7.977832] GICv3: [Firmware Bug]: Illegal GSI8 translation request > [ 7.984237] ARM FF-A: Failed to create IRQ mapping! > [ 7.989220] ARM FF-A: Notification setup failed -61, not enabled > [ 8.000198] ARM FF-A: Failed to register driver sched callback -95 > [ 8.011322] scmi_core: SCMI protocol bus registered > > Signed-off-by: Shanker Donthineni > --- > arch/arm64/include/asm/arch_gicv3.h | 17 +++++++++++++++++ > arch/arm64/kernel/smp.c | 17 ----------------- > drivers/irqchip/irq-gic-v3.c | 2 +- > 3 files changed, 18 insertions(+), 18 deletions(-) > > diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h > index 9e96f024b2f19..ecf81df2915c7 100644 > --- a/arch/arm64/include/asm/arch_gicv3.h > +++ b/arch/arm64/include/asm/arch_gicv3.h > @@ -188,5 +188,22 @@ static inline bool gic_has_relaxed_pmr_sync(void) > return cpus_have_cap(ARM64_HAS_GIC_PRIO_RELAXED_SYNC); > } > > +enum ipi_msg_type { > + IPI_RESCHEDULE, > + IPI_CALL_FUNC, > + IPI_CPU_STOP, > + IPI_CPU_CRASH_STOP, > + IPI_TIMER, > + IPI_IRQ_WORK, > + NR_IPI, > + /* > + * Any enum >= NR_IPI and < MAX_IPI is special and not tracable > + * with trace_ipi_* > + */ > + IPI_CPU_BACKTRACE = NR_IPI, > + IPI_KGDB_ROUNDUP, > + MAX_IPI > +}; > + > #endif /* __ASSEMBLY__ */ > #endif /* __ASM_ARCH_GICV3_H */ > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > index 5e18fbcee9a20..373cd815d9a43 100644 > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -64,23 +64,6 @@ struct secondary_data secondary_data; > /* Number of CPUs which aren't online, but looping in kernel text. */ > static int cpus_stuck_in_kernel; > > -enum ipi_msg_type { > - IPI_RESCHEDULE, > - IPI_CALL_FUNC, > - IPI_CPU_STOP, > - IPI_CPU_CRASH_STOP, > - IPI_TIMER, > - IPI_IRQ_WORK, > - NR_IPI, > - /* > - * Any enum >= NR_IPI and < MAX_IPI is special and not tracable > - * with trace_ipi_* > - */ > - IPI_CPU_BACKTRACE = NR_IPI, > - IPI_KGDB_ROUNDUP, > - MAX_IPI > -}; > - > static int ipi_irq_base __ro_after_init; > static int nr_ipi __ro_after_init = NR_IPI; > static struct irq_desc *ipi_desc[MAX_IPI] __ro_after_init; > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > index c19083bfb9432..0d2038d8cd311 100644 > --- a/drivers/irqchip/irq-gic-v3.c > +++ b/drivers/irqchip/irq-gic-v3.c > @@ -1655,7 +1655,7 @@ static int gic_irq_domain_translate(struct irq_domain *d, > if(fwspec->param_count != 2) > return -EINVAL; > > - if (fwspec->param[0] < 16) { > + if (fwspec->param[0] < MAX_IPI) { > pr_err(FW_BUG "Illegal GSI%d translation request\n", > fwspec->param[0]); > return -EINVAL; No. This is the wrong approach, and leads to inconsistent behaviour if we ever change this MAX_IPI value. It also breaks 32 bit builds, and makes things completely inconsistent between ACPI and DT. I don't know how the FFA code was tested, because I cannot see how it can work. *IF* we are going to allow random SGIs being requested by random drivers, we need to be able to do it properly. Not as a side hack like this. M. -- Without deviation from the norm, progress is not possible.