From patchwork Thu Aug 29 11:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13783029 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 E9525C8303F for ; Thu, 29 Aug 2024 11:08:57 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ianpNl3jL8Gv0lHeq+hByhZnx3GF6W02IwZ9uRWxMpQ=; b=YmEdB+RWEuHMYZ7VMDUyly882L 3cjZocRDhDKOsgVo+oorcshKSs4ii3ja0WRpVjl0xYR+svuIrtdUT1iQ2g7l6Ol8X3fUMMIZgHTvO rQftYOuo7jQHsuP+tK8+/OBgVsmtkpal0kPNnkafazUX/vu/8kT4H8oukhZ7wBGvNFaXQcFpm0IPb wm7JczItkoeDwwuSWsBsJHf5R3bm1FaJyzF8nJhGZFhCn0ZQMEKjiyTjBilHPc2CbzC1SmphXaRtI Ry/pb0jOPG3z6Oa2V2vtwfbRJHkD+wCqf+pWGlqZzRlawWDjiOGaUZaKLOj/mp6Lqge1kbTSmaubZ DE5ctVgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjd1E-00000001hc1-30Pe; Thu, 29 Aug 2024 11:08:48 +0000 Received: from mail-ua1-x92b.google.com ([2607:f8b0:4864:20::92b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjcyC-00000001ghJ-0E9F for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 11:05:41 +0000 Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-84686812614so943197241.0 for ; Thu, 29 Aug 2024 04:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724929538; x=1725534338; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ianpNl3jL8Gv0lHeq+hByhZnx3GF6W02IwZ9uRWxMpQ=; b=ISd/fBWTcNFk7AvbI7ccGzL6O98bfe/Hf7LtkoYko1RAN2xWQyCsOJ0vyStOjQP8qM Y9l13Qk14GHORFdzo9WCW9TuzmExH7H6BGx6qBINcH+Vf8AOohqrM/8RvFd0be+xYUcP 3mUe/yF/W58Qhdpr5h6wX2fxTWf79YTySdHNreZVGTI6rBmChE/35zSYJiIrpqPerTSZ urPSu4as5sfzdV+srjSDisLJEhfii3zUgZjASq5LoO3zxO2iVp1z4fO9/ul0MqsX4kkx oStYS2G8MLWTOLfAAHd26JGdZz74JhQQS+TC5zsZ8lKCvE28bEdtNEV0r/LB2xEHdxSB PE2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724929538; x=1725534338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ianpNl3jL8Gv0lHeq+hByhZnx3GF6W02IwZ9uRWxMpQ=; b=MZ6iXLG2KInzgHcD2WdtiTbwe/eOaoZenFKjY6GWujkCW149NoV9RncMaZfcrvKYPW y1AmMiFVptMe3xTLhaYe8+pRUDEvKWRdd4rvC9spR06G6LlQCayq3egSN0+5Y9TXP6CW 5ESxvMzhJc8jaNCYREhHSqUSgCi/uCdbf7TAstOEgi1KAEL3CYUpyOnPboAGFaeFTCXV BaJ9bGDr0/FTcOOtq+PUeBNkEtzH5txfEYkEk7i+MyW/BeQ+Atd9oELhbz2vaejsNVod qe9XNBQ2jOiqJRL+YxXHmbVxKNlhyXGiJiDy0yTaJaXYtBe+WDG46+Y2zrSjZ6ZHQs0+ 2++A== X-Forwarded-Encrypted: i=1; AJvYcCV6XrJ3UZ5Y2NF57gBXnZ4fHsXY98YIJuh7l0ma3Nu2cVd0zzsHbYj4Kuv07uUD3+F/cMNlT1NgXoFaqY1lnoRD@lists.infradead.org X-Gm-Message-State: AOJu0YxBV/RrXF5nN6eAtx+l084iclQLuYofRdMUmAJhTmSsFbZZYzxw 8G2TgGDdkuPevlAn4P7M9Dp6DbHgkrhHNFW3vHBlJEaGCUg6VbJ0JzGyuIikqxc= X-Google-Smtp-Source: AGHT+IF6yBcBMzp8rTNq8i+IQc91e14+ebz9MBYVssN2nRk8uZQahgLcP+UIaAxH9XbozPbSUz9pQw== X-Received: by 2002:a05:6a00:a1e:b0:707:fa61:1c6a with SMTP id d2e1a72fcca58-715e78ce1b3mr2227273b3a.10.1724929527263; Thu, 29 Aug 2024 04:05:27 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-715e5576cc7sm906671b3a.32.2024.08.29.04.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 04:05:26 -0700 (PDT) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Nick Chan Subject: [PATCH RESEND 1/3] dt-bindings: apple,aic: Document A7-A11 compatibles Date: Thu, 29 Aug 2024 19:02:15 +0800 Message-ID: <20240829110436.46052-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829110436.46052-1-towinchenmi@gmail.com> References: <20240829110436.46052-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_040540_116842_3212E3B9 X-CRM114-Status: GOOD ( 11.06 ) 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 Document the compatibles for Apple A7-A11 SoCs. There are three feature levels: - A7-A10: No fast IPI - A11: fast IPI, global only - M1: fast IPI with local and global support Signed-off-by: Nick Chan --- .../bindings/interrupt-controller/apple,aic.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml b/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml index 698588e9aa86..2e38b585a722 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml @@ -37,7 +37,13 @@ allOf: properties: compatible: items: - - const: apple,t8103-aic + - enum: + - apple,s5l8960x-aic + - apple,s8000-aic + - apple,t7000-aic + - apple,t8010-aic + - apple,t8015-aic + - apple,t8103-aic - const: apple,aic interrupt-controller: true From patchwork Thu Aug 29 11:02:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13783026 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 A341CC8303F for ; Thu, 29 Aug 2024 11:07:15 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/eGSx27JcX0pDUTDyQY+9iXqRUjb43ZGaILimNXE8xk=; b=ImiyBkVR8W+XA/9Vpsu9j/ruUq PZVGM7hqXtfN6m8x2lwQpdsESfalB2zloErLZERWyrAL1Z03Dh0PlOFfCMsuTV1ew22WTsvTfawo1 0U6n8KTtHGnF+x9KfAhwflMDW58/iAQZKTCObAt7yvG5y7uA7wYVf4GSxsyWp4tmoxKiF+plb5pDH OrXj6uQLyCFKFPR3s8FsCzvg7nZsMJcXj7BilU5zZgfJ39oMTvtgXLLkHtaVsGXziBBz7ezAVYE1V 5uRkW5UEHfXIoZrgWF2nJBpGdOMmFW+9ptIEUlIm2aqmlkKLMdOJdeBe7Ggwr1fyfb4f8Z4vKrIPW kGRkvmeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjczb-00000001h6r-09FW; Thu, 29 Aug 2024 11:07:07 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjcy4-00000001ged-2OVN for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 11:05:34 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-71423273c62so431033b3a.0 for ; Thu, 29 Aug 2024 04:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724929531; x=1725534331; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/eGSx27JcX0pDUTDyQY+9iXqRUjb43ZGaILimNXE8xk=; b=mzLyg+ahZ4m8QkW3DxRCFCQFFkjYuR+ts25i6OaBhd/3Bvho1DxPhNAt4WrTbyzwrE CgTQIke9764t49fYRJobtk4dGnhijnzp81lAIOQN8A7XxFzXs0OVEktDdZvDblKQjhGr 3jITpjIaWsAz7WBlbzKF4HFfRkriu2BRk3AtFYvOkLp5qUOKJXkJ/Dhx0KXN0N3PdrfE jzmTKv+ZT5a8myYRGs9Ob76a2psX3Aw3kb3ama+wD/R3vKwkDyVqsxKK8Mukd9MxpfCf Fc5nkFOc4pUuAUQgheWb5ydldyAJnapsU2Wc41O9juOUnvIW7HRlyLh0P1lPVwUazkc3 wTSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724929531; x=1725534331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/eGSx27JcX0pDUTDyQY+9iXqRUjb43ZGaILimNXE8xk=; b=KZuvQEpgPGxRnI+Tvyw9r9kvlYkMNPGZQsJ1XLCnsn1W2wNqw+mw9JXbtF9e1DJSxn kPbJq+dZp/0binQpYPKk09jD6ipO/65A7njr66Sh6V1Y+/laJQCnAayvYQ7czslZ9Sq7 qDpmQ271Q5I2+lgvf/GkAVqwn4vBHBH1qOcmbNJWmb0qBCJX2ltLL3zrN1ZC/WL+t2SN 22uJ/PFioVhyk+A8KksjNhmg0CFKfBsFMcFtN22EcgZdp/pOJXtBPnjlIXx97iHlRNc/ GEdE2C/7awDKqZ4biP1qTn/DHWv57xHcpp2Z+1re9LGZbt0pZ2DQfk8V6okA5+1r2s+h MPQA== X-Forwarded-Encrypted: i=1; AJvYcCVDGUnBzxoMxyZ1VhAk+dcrXiV35thCpbUylJZ7zCAYDpU7QVsjECxWmudiWQuZl1kI+HNfcknc5LYV/ws+Ulpo@lists.infradead.org X-Gm-Message-State: AOJu0YzlklyrAdv33GoBOweQ/DPHMTlLU0HI9KXh3hmKhRn1+5c9F4n3 1I3rbuITCUc3WLH8++b1D8cLSIw977+j8uTJpfNtuB3KBTi3r9Ts X-Google-Smtp-Source: AGHT+IGpRch0t0zQ2dsUBSE7fPI0Pg93inIyw/ybrn3xmOWgd/6H5CjnHko+G2tx5xUtsaBGE5M2bQ== X-Received: by 2002:a05:6a00:23d6:b0:706:b10c:548a with SMTP id d2e1a72fcca58-715dfc8b955mr2267911b3a.22.1724929530925; Thu, 29 Aug 2024 04:05:30 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-715e5576cc7sm906671b3a.32.2024.08.29.04.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 04:05:30 -0700 (PDT) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Nick Chan , Konrad Dybcio Subject: [PATCH RESEND 2/3] irqchip/apple-aic: Only access IPI sysregs when use_fast_ipi is true Date: Thu, 29 Aug 2024 19:02:16 +0800 Message-ID: <20240829110436.46052-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829110436.46052-1-towinchenmi@gmail.com> References: <20240829110436.46052-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_040532_648676_3734FE70 X-CRM114-Status: GOOD ( 16.56 ) 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 Starting from the A11 (T8015) SoC, Apple introuced system registers for fast IPI and UNCORE PMC control. These sysregs do not exist on earlier A7-A10 SoCs and trying to access them results in an instant crash. Restrict sysreg access within the AIC driver to configurations where use_fast_ipi is true to allow AIC to function properly on A7-A10 SoCs. While at it, remove the IPI-always-ack path on aic_handle_fiq. If we are able to reach there, we are on an IPI-capable system and should be using one of the IPI-capable compatibles, anyway. Signed-off-by: Konrad Dybcio Signed-off-by: Nick Chan --- drivers/irqchip/irq-apple-aic.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index 5c534d9fd2b0..626aaeafa96c 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -234,6 +234,7 @@ enum fiq_hwirq { AIC_NR_FIQ }; +/* True if UNCORE/UNCORE2 and Sn_... IPI registers are present and used (A11+) */ static DEFINE_STATIC_KEY_TRUE(use_fast_ipi); struct aic_info { @@ -532,13 +533,9 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs) * we check for everything here, even things we don't support yet. */ - if (read_sysreg_s(SYS_IMP_APL_IPI_SR_EL1) & IPI_SR_PENDING) { - if (static_branch_likely(&use_fast_ipi)) { - aic_handle_ipi(regs); - } else { - pr_err_ratelimited("Fast IPI fired. Acking.\n"); - write_sysreg_s(IPI_SR_PENDING, SYS_IMP_APL_IPI_SR_EL1); - } + if (static_branch_likely(&use_fast_ipi) && + (read_sysreg_s(SYS_IMP_APL_IPI_SR_EL1) & IPI_SR_PENDING)) { + aic_handle_ipi(regs); } if (TIMER_FIRING(read_sysreg(cntp_ctl_el0))) @@ -574,8 +571,9 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs) AIC_FIQ_HWIRQ(irq)); } - if (FIELD_GET(UPMCR0_IMODE, read_sysreg_s(SYS_IMP_APL_UPMCR0_EL1)) == UPMCR0_IMODE_FIQ && - (read_sysreg_s(SYS_IMP_APL_UPMSR_EL1) & UPMSR_IACT)) { + if (static_branch_likely(&use_fast_ipi) && + (FIELD_GET(UPMCR0_IMODE, read_sysreg_s(SYS_IMP_APL_UPMCR0_EL1)) == UPMCR0_IMODE_FIQ) && + (read_sysreg_s(SYS_IMP_APL_UPMSR_EL1) & UPMSR_IACT)) { /* Same story with uncore PMCs */ pr_err_ratelimited("Uncore PMC FIQ fired. Masking.\n"); sysreg_clear_set_s(SYS_IMP_APL_UPMCR0_EL1, UPMCR0_IMODE, @@ -811,7 +809,8 @@ static int aic_init_cpu(unsigned int cpu) /* Mask all hard-wired per-CPU IRQ/FIQ sources */ /* Pending Fast IPI FIQs */ - write_sysreg_s(IPI_SR_PENDING, SYS_IMP_APL_IPI_SR_EL1); + if (static_branch_likely(&use_fast_ipi)) + write_sysreg_s(IPI_SR_PENDING, SYS_IMP_APL_IPI_SR_EL1); /* Timer FIQs */ sysreg_clear_set(cntp_ctl_el0, 0, ARCH_TIMER_CTRL_IT_MASK); @@ -832,8 +831,9 @@ static int aic_init_cpu(unsigned int cpu) FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_OFF)); /* Uncore PMC FIQ */ - sysreg_clear_set_s(SYS_IMP_APL_UPMCR0_EL1, UPMCR0_IMODE, - FIELD_PREP(UPMCR0_IMODE, UPMCR0_IMODE_OFF)); + if (static_branch_likely(&use_fast_ipi)) + sysreg_clear_set_s(SYS_IMP_APL_UPMCR0_EL1, UPMCR0_IMODE, + FIELD_PREP(UPMCR0_IMODE, UPMCR0_IMODE_OFF)); /* Commit all of the above */ isb(); From patchwork Thu Aug 29 11:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13783028 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 90388C8303F for ; Thu, 29 Aug 2024 11:08:08 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7IMpDPXDzGDzNLDUQoG0T+dbS2HtKvxhLaW4H3a0SWA=; b=WFjVYiBGjlnxc+nJbe0pAaVIOh 56bxnGGy+jfEOoJB/wPzN//uoFgaaACJ+AklluId4g+8BRVsR/UfybRS+zwbuqw1QnTA5ON482Lwr DtrRbMP74gSp5DwKiydGoko3njC6/BuZm23u9jC6gIvZx9e/3J+khX8DyQKE/OmE54COzTxPksxKc ATZ/kITboptCc4vd0qEhchr0niSMo11dQU2+i2wcyLyLGS6Q68/EXj8MF6DNvTXNJWKprMzML2uHQ tzJ3dYuxIZRisFRsix9CyRdmnJ/5tfgymcZsYisc4UXUgPqSR6m5kLr9YCI1lxN1/7ZkRAM11WGM0 w2dKYWjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjd0P-00000001hNW-2cB8; Thu, 29 Aug 2024 11:07:57 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjcy8-00000001ggP-0te1 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 11:05:37 +0000 Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-39d3b31e577so1622885ab.1 for ; Thu, 29 Aug 2024 04:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724929534; x=1725534334; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7IMpDPXDzGDzNLDUQoG0T+dbS2HtKvxhLaW4H3a0SWA=; b=naoZxQqusbaAgKfRSQ1HFJlBC9qFZbGnBMKYRLBZwkSQP6hlp7fnmoC00moSBPN0Rx pQ0OdITPJJqpkjw7HZ6ah2+r0g7fdeGk1CPu3b4KEPdDXm5HiHjovDNvsr6ZXh9ua6fo ehAj8NR+hVddWvalv5gX0MaeXXIrtbOVRZYk2s6IIF3psvG/ERPiFVisLcxfzu4dfxEs DumkHw2zp/f/nTQM8n2CU9UEvYSokDD52hJxNwETmfUbVD3UFklOLy5XNqIHbihsA8ca H/Duzo8sFnM360OQS74fwLS2m9QVU5c+iN/NSWEwjMRSISim78MhcqOu0SSqoVGjiQu5 XoJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724929534; x=1725534334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7IMpDPXDzGDzNLDUQoG0T+dbS2HtKvxhLaW4H3a0SWA=; b=LhrW5a5JEo7O54oyysCsmRCcjSX9s5A9Aw+0iCEVkt7qyMwLISyeWXLmif4cbxlrCn QA8sXIjUoMakDlrPB9P17pwpUo774WthQMkyTZRWv1w7ONVAfyPfxDXJMoZ2pxKqC+YD EjLDzQEhc6NKmbK5UG9jVHKE+6zzAwVhAi+l9gyZMs7C6hswo/6VdRhsxjSwJgSdr5mO R4uUiVFpHGv/BXHJlswHVBgoauItQGQCw1HijLGKVmZMNBQ3luiDqgaD/2+Tpw04Yd3/ waxQMkidQlm5AwiFLx0ALr6IXbyPYX+H/oLmSzVcCJyyL00539JeudhYCSgBEZzARsGz BSRA== X-Forwarded-Encrypted: i=1; AJvYcCV7JlfMRMjGqNXafmp9ci1cYzBa+8ip3T0wjbHj/mCiKneTGwDZNMI0KihEGLhOoqGHlrqi7P6ULRMquPEYLhJK@lists.infradead.org X-Gm-Message-State: AOJu0YxqlwiEJUZAusYjU9ia+tV9gq3M13oARRy3BC+sMqSys+0XgVEa 3M8eD/QRCPvf8Hk5AIgF1mN4n2MDrzjp1E0/K6IWG/sNq1WYf7KV X-Google-Smtp-Source: AGHT+IFYAL99M0w1KDBpEHhep4dtC4BZqLVTkjCxoeojjokRbvlVxXXPnm1VO8JCrwFH6dbpOIGYzQ== X-Received: by 2002:a05:6e02:4b2:b0:39d:4c8a:370d with SMTP id e9e14a558f8ab-39f37837f5fmr24973345ab.18.1724929534467; Thu, 29 Aug 2024 04:05:34 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-715e5576cc7sm906671b3a.32.2024.08.29.04.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 04:05:34 -0700 (PDT) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Nick Chan Subject: [PATCH RESEND 3/3] irqchip/apple-aic: Add a new "Global fast IPIs only" feature level Date: Thu, 29 Aug 2024 19:02:17 +0800 Message-ID: <20240829110436.46052-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829110436.46052-1-towinchenmi@gmail.com> References: <20240829110436.46052-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_040536_286982_E36CC290 X-CRM114-Status: GOOD ( 17.80 ) 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 Starting with the A11 (T8015) SoC, Apple began using arm64 sysregs for fast IPIs. However, on A11, there is no such things as "Local" fast IPIs, as the SYS_IMP_APL_IPI_RR_LOCAL_EL1 register does not seem to exist. Add a new feature level, used by the compatible "apple,t8015-aic", controlled by a static branch key named use_local_fast_ipi. When use_fast_ipi is true and use_local_fast_ipi is false, fast IPIs are used but all IPIs goes through the register SYS_IMP_APL_IPI_RR_GLOBAL_EL1, as "global" IPIs. Signed-off-by: Nick Chan --- drivers/irqchip/irq-apple-aic.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index 626aaeafa96c..1640074af2e1 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -236,6 +236,8 @@ enum fiq_hwirq { /* True if UNCORE/UNCORE2 and Sn_... IPI registers are present and used (A11+) */ static DEFINE_STATIC_KEY_TRUE(use_fast_ipi); +/* True if SYS_IMP_APL_IPI_RR_LOCAL_EL1 exists (M1+) */ +static DEFINE_STATIC_KEY_TRUE(use_local_fast_ipi); struct aic_info { int version; @@ -253,6 +255,7 @@ struct aic_info { /* Features */ bool fast_ipi; + bool local_fast_ipi; }; static const struct aic_info aic1_info __initconst = { @@ -271,6 +274,16 @@ static const struct aic_info aic1_fipi_info __initconst = { .fast_ipi = true, }; +static const struct aic_info aic1_local_fipi_info __initconst = { + .version = 1, + + .event = AIC_EVENT, + .target_cpu = AIC_TARGET_CPU, + + .fast_ipi = true, + .local_fast_ipi = true, +}; + static const struct aic_info aic2_info __initconst = { .version = 2, @@ -282,6 +295,10 @@ static const struct aic_info aic2_info __initconst = { static const struct of_device_id aic_info_match[] = { { .compatible = "apple,t8103-aic", + .data = &aic1_local_fipi_info, + }, + { + .compatible = "apple,t8015-aic", .data = &aic1_fipi_info, }, { @@ -748,7 +765,8 @@ static void aic_ipi_send_fast(int cpu) u64 cluster = MPIDR_CLUSTER(mpidr); u64 idx = MPIDR_CPU(mpidr); - if (MPIDR_CLUSTER(my_mpidr) == cluster) + if (static_branch_likely(&use_local_fast_ipi) && + MPIDR_CLUSTER(my_mpidr) == cluster) write_sysreg_s(FIELD_PREP(IPI_RR_CPU, idx), SYS_IMP_APL_IPI_RR_LOCAL_EL1); else @@ -992,6 +1010,11 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p else static_branch_disable(&use_fast_ipi); + if (irqc->info.local_fast_ipi) + static_branch_enable(&use_local_fast_ipi); + else + static_branch_disable(&use_local_fast_ipi); + irqc->info.die_stride = off - start_off; irqc->hw_domain = irq_domain_create_tree(of_node_to_fwnode(node),