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 142CDC001B0 for ; Mon, 7 Aug 2023 13:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HdkyaELmFF2wEl+0B4igZ6XAWwDdlHfcRdHNvtEgJ7M=; b=VHwB0xUr/+90XV SNLjjQZqN8DEiIE4tEsxeMdr4CvyyryengzPWTyMBE4rqryCt4/ow6F0bykBoQP0lpTm1Rxup5AAl 6LXRDU4ve0HLLL686EWC0b1TbFHjve6lb7OGUBWMTV/4EmJfyrumGrNier2fSmiJgJ2Y3dIqi/s3U vNRfWBYQiuSLfWxAvH80Yq28kDNNSaFdi5FOaq+kNIf3TCgPehnVMZ9FTrPsI/atiOEp87sZo/oMB IlCxfP0OVgx10P6CUfPLuW5xDIBph5tHKTG9BmzlcRghwul6y0qZdOU08V72XPvbMdtJd0asC7LS4 o+l2dqZFDF1/uTd3kvHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qT0Ei-00HNqy-2e; Mon, 07 Aug 2023 13:25:28 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qT0Ee-00HNn6-2c for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 13:25:26 +0000 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 2F3781FB; Mon, 7 Aug 2023 06:26:03 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.32.139]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 777963F64C; Mon, 7 Aug 2023 06:25:17 -0700 (PDT) Date: Mon, 7 Aug 2023 14:25:08 +0100 From: Mark Rutland To: Sumit Garg Cc: Douglas Anderson , Marc Zyngier , Catalin Marinas , Will Deacon , Daniel Thompson , linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Chen-Yu Tsai , Ard Biesheuvel , Stephen Boyd , Peter Zijlstra , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma , "Rafael J . Wysocki" , Lecopzer Chen , Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 1/7] irqchip/gic-v3: Enable support for SGIs to act as NMIs Message-ID: References: <20230601213440.2488667-1-dianders@chromium.org> <20230601143109.v9.1.I1223c11c88937bd0cbd9b086d4ef216985797302@changeid> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230807_062524_948640_4966CF02 X-CRM114-Status: GOOD ( 21.84 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 07, 2023 at 04:52:40PM +0530, Sumit Garg wrote: > On Mon, 7 Aug 2023 at 15:20, Mark Rutland wrote: > > On Thu, Jun 01, 2023 at 02:31:45PM -0700, Douglas Anderson wrote: > > > @@ -542,16 +543,22 @@ static int gic_irq_nmi_setup(struct irq_data *d) > > > return -EINVAL; > > > > > > /* desc lock should already be held */ > > > - if (gic_irq_in_rdist(d)) { > > > - u32 idx = gic_get_ppi_index(d); > > > + switch (get_intid_range(d)) { > > > + case SGI_RANGE: > > > + break; > > > + case PPI_RANGE: > > > + case EPPI_RANGE: > > > + idx = gic_get_ppi_index(d); > > > > > > /* Setting up PPI as NMI, only switch handler for first NMI */ > > > if (!refcount_inc_not_zero(&ppi_nmi_refs[idx])) { > > > refcount_set(&ppi_nmi_refs[idx], 1); > > > desc->handle_irq = handle_percpu_devid_fasteoi_nmi; > > > } > > > - } else { > > > + break; > > > + default: > > > desc->handle_irq = handle_fasteoi_nmi; > > > + break; > > > } > > > > As above, I reckon this isn't right, and we should treat all rdist interrupts > > (which are all percpu) the same. > > > > I reckon what we should be doing here is make ppi_nmi_refs cover all of the > > rdist interrupts (e.g. make that rdist_nmi_refs, add a gic_get_rdist_idx() > > helper), and then here have something like: > > > > if (gic_irq_in_rdist(d)) { > > u32 idx = gic_get_rdist_idx(d); > > > > /* > > * Setting up a percpu interrupt as NMI, only switch handler > > * for first NMI > > */ > > if (!refcount_inc_not_zero(&rdist_nmi_refs[idx])) { > > refcount_set(&ppi_nmi_refs[idx], 1); > > desc->handle_irq = handle_percpu_devid_fasteoi_nmi; > > } > > } > > It looks like you missed the else part here as follows for all other > interrupt types: > > } else { > desc->handle_irq = handle_fasteoi_nmi; > } Yes, sorry; I had meant for that to be included, i.e. if (gic_irq_in_rdist(d)) { u32 idx = gic_get_rdist_idx(d); /* * Setting up a percpu interrupt as NMI, only switch handler * for first NMI */ if (!refcount_inc_not_zero(&rdist_nmi_refs[idx])) { refcount_set(&ppi_nmi_refs[idx], 1); desc->handle_irq = handle_percpu_devid_fasteoi_nmi; } } else { desc->handle_irq = handle_fasteoi_nmi; } > Apart from that, your logic sounds good to me. Great! Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel