From patchwork Thu Sep 3 12:05:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 11753469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C8BE739 for ; Thu, 3 Sep 2020 12:07:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7117C2072A for ; Thu, 3 Sep 2020 12:07:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lR2ce83w"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QQ94vAR9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7117C2072A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F7Vskb0UzzhGOoAMzZRGPIUT+DOEjppbcCrUYUKaoyk=; b=lR2ce83wq9oR7bGGSnK79hVBoS svHjzZ/chKTERdKxxzqWkXMWbxDO/WGPotMem3LZbGDv7zr4b645CI8fbCsCZjO1AuzEWNXviMwQ9 JXM+BuAp12cNaG9utMPHgbTOTZ5/KPhrwqaIqYvEnjGjShsDJ9mf5FJlQU9JwsCz95pAMjMA5eo3i O/zUrkCyWLcQxFNCEVAVjzxeHQ7TfXK3lFVLUR2v8BV6+2KUrig3GTX3ACi34ahKmVj5ZweoqtQO6 CPmuuViE9pIz6rzh4uzc3er2ozSS8xSm8pEfq1RMIErhf8j3P7m6g+cFGE55FQOaWdqyU3OjZAhPL zo39Lu8w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDo0I-0002FI-9F; Thu, 03 Sep 2020 12:06:10 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDo0E-0002DD-0K for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 12:06:06 +0000 Received: by mail-pg1-x541.google.com with SMTP id d19so1950036pgl.10 for ; Thu, 03 Sep 2020 05:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l42Sw4hGC87WjooQg2VTZSFCehZO9m9AdkULNCdGfhY=; b=QQ94vAR9C6a51GpTGkrB1+xPpXfRafgvPa3tu6a+3G75SJXaTYLuJc+aYbErLcWfPr CucHQhF5l4BWTgM4UZBaXdBwO+8s55QNcM+2DJ92B86SADz7QZakpwkUXnwFHnL04xJR smJhScLAnqI38oNpr05jXEP03UuXB94dw1B1goqFZLPlwmWeZNgTVbv0kittkb9EuS61 9Vu4GMgFj1p3zoMvDwBo1EDUY8JFsb2AScBfwOSCR32qSiq76EQjJYR4WmTCu5a6kdrG qcqRr57lm9R51EqFelU2ta3IbNgwRf2dWKoJDqzGSpKc0QH4zoncfhXeUayjhlOKr2CQ 2Y7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l42Sw4hGC87WjooQg2VTZSFCehZO9m9AdkULNCdGfhY=; b=S3OCWaZGFYfL0TBkyZcw1xnqrQsNkTuR9R6U8UcFqUTwujbxwPSt1Wp6JlFi9ffgmb k94WlJ+8B0d+TUT7owkPqcJkjGHrbTs1GiGOmAMvJK7qsXZ5mPQFhYaeyob0J8REGJhJ kwMQnVPxKwAXrFs8WDjqi+8ms1fFWiP/yHPJbMjtqk/NbQ6TQO1hC8JwZS/Os2bKM55V Xp1ViMu+EsB7kc4s4MPy4Ph9y/5Ss+MEkROJIbprlp9dWEhPlBsygiBwSV8px7CHdVOs akGS4hmoqKgeESuAtNoHl7DnJLPRgZhhLeG49zeHVj5VFXRNIhAGcYvs+DepRMl+grnP IlZQ== X-Gm-Message-State: AOAM530PiLBbM7ghdyPDmUi0MpEjFVCk8VtkMOB1iHEnzCMukDZiIco5 kcYxqS8vapvkzxbNYV6uWUUHxw== X-Google-Smtp-Source: ABdhPJwA8w/V9i9vrKKv3vQBxhzDj1BOn4fq9KGcKRyand8nMjBomLB0bAwwW8ejG7VaZ6lBdtyH9Q== X-Received: by 2002:a63:ce56:: with SMTP id r22mr2749565pgi.141.1599134763468; Thu, 03 Sep 2020 05:06:03 -0700 (PDT) Received: from localhost.localdomain ([117.210.209.248]) by smtp.gmail.com with ESMTPSA id s1sm2922022pgh.47.2020.09.03.05.05.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 05:06:02 -0700 (PDT) From: Sumit Garg To: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org Subject: [PATCH v3 3/4] arm64: smp: Setup IPI_CALL_NMI_FUNC as a pseudo NMI Date: Thu, 3 Sep 2020 17:35:11 +0530 Message-Id: <1599134712-30923-4-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599134712-30923-1-git-send-email-sumit.garg@linaro.org> References: <1599134712-30923-1-git-send-email-sumit.garg@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_080606_088722_CEC1488F X-CRM114-Status: GOOD ( 17.52 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sumit Garg , daniel.thompson@linaro.org, jason@lakedaemon.net, kgdb-bugreport@lists.sourceforge.net, dianders@chromium.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jason.wessel@windriver.com, tglx@linutronix.de, julien.thierry.kdev@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Setup IPI_CALL_NMI_FUNC as a pseudo NMI using generic interrupt framework APIs. In case a plarform doesn't provide support for pseudo NMIs, switch back to IPI_CALL_NMI_FUNC being a normal interrupt. Signed-off-by: Sumit Garg --- arch/arm64/kernel/smp.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 1b4c07c..572f8f5 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -81,6 +81,7 @@ enum ipi_msg_type { static int ipi_irq_base __read_mostly; static int nr_ipi __read_mostly = NR_IPI; static struct irq_desc *ipi_desc[NR_IPI] __read_mostly; +static int ipi_nmi = -1; static void ipi_setup(int cpu); static void ipi_teardown(int cpu); @@ -971,8 +972,14 @@ static void ipi_setup(int cpu) if (WARN_ON_ONCE(!ipi_irq_base)) return; - for (i = 0; i < nr_ipi; i++) - enable_percpu_irq(ipi_irq_base + i, 0); + for (i = 0; i < nr_ipi; i++) { + if (ipi_nmi == ipi_irq_base + i) { + if (!prepare_percpu_nmi(ipi_nmi)) + enable_percpu_nmi(ipi_nmi, 0); + } else { + enable_percpu_irq(ipi_irq_base + i, 0); + } + } } static void ipi_teardown(int cpu) @@ -982,23 +989,34 @@ static void ipi_teardown(int cpu) if (WARN_ON_ONCE(!ipi_irq_base)) return; - for (i = 0; i < nr_ipi; i++) - disable_percpu_irq(ipi_irq_base + i); + for (i = 0; i < nr_ipi; i++) { + if (ipi_nmi == ipi_irq_base + i) { + disable_percpu_nmi(ipi_nmi); + teardown_percpu_nmi(ipi_nmi); + } else { + disable_percpu_irq(ipi_irq_base + i); + } + } } void __init set_smp_ipi_range(int ipi_base, int n) { - int i; + int i, err; WARN_ON(n < NR_IPI); nr_ipi = min(n, NR_IPI); - for (i = 0; i < nr_ipi; i++) { - int err; + err = request_percpu_nmi(ipi_base + IPI_CALL_NMI_FUNC, + ipi_handler, "IPI", &cpu_number); + if (!err) + ipi_nmi = ipi_base + IPI_CALL_NMI_FUNC; - err = request_percpu_irq(ipi_base + i, ipi_handler, - "IPI", &cpu_number); - WARN_ON(err); + for (i = 0; i < nr_ipi; i++) { + if (ipi_base + i != ipi_nmi) { + err = request_percpu_irq(ipi_base + i, ipi_handler, + "IPI", &cpu_number); + WARN_ON(err); + } ipi_desc[i] = irq_to_desc(ipi_base + i); irq_set_status_flags(ipi_base + i, IRQ_HIDDEN);