From patchwork Thu Aug 29 09:03:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13782902 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 035A0C83013 for ; Thu, 29 Aug 2024 09:39:59 +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=egoeKFBc4uhrvcZ8Ktzuy2NXVWTzG66ZP4Z1nx7Pk4U=; b=gaUw5MXffVC+SL1hdCMa/ZsBzQ jgRVYQgNmhrrlaL8onfdFgvqELSZ8euh1E0w8j7+wu74izC5DsMrha7dKwtMtjS7hedPKK645gg7p K5N6WxlR+b0EgbxesrEJj6apKqQi8qcRyC+30awA3gQOCB1lKnE9hYfORmTq5LXeYQMr6LYoBtOKB 1xx1QZfagsqFSKCPmJDWZI+SFSFq5MZGvT1eXws5eSOPxffESmT+u61T3i/MK7+tzMUhVysT1An60 VMwkHY2BlSM8a2loHiWwbSFlWeDUBBhuQa0SopRrN6mmN87eUbXkiDP0UHv9/2xRX/zDqYmq/LXoh PC0sWGWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbcW-00000001OiC-2uEp; Thu, 29 Aug 2024 09:39:12 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbQy-00000001M0N-3X0z for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 09:27:18 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-204eebfaebdso3629605ad.1 for ; Thu, 29 Aug 2024 02:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724923636; x=1725528436; 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=egoeKFBc4uhrvcZ8Ktzuy2NXVWTzG66ZP4Z1nx7Pk4U=; b=R4lPLzvaedAmnEjDWuFKz4dhg0Z7QDS0SvVuq9y7rCFb4vAESr4INfX6Ao1arXfIUD +sPvTftHPXPIisBIxZiRIIr7fp1ZNNYzU6TYkEYxwjoxnqNl7Eh7HdKwspsMN87K3IJ6 KWHCrno/Ym0/zAlEotYDncl1LUuJ+oFz0UWIOMK8lbMXNScp43inDr+TZTe2adcVurbD mQVO5wF6sgC5BjGUWUCfqr2yxAzgiQ6Ma4t7aEV2vxRX36K8yhLekQSlZGfyI8+I0wpa N7OkkjR/LlJ2E/vsLtz2Wl3lrC3lrsMr1Jk9aCCZO/URlCUdblzYMa0M2o9pIww/qeMb sOYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724923636; x=1725528436; 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=egoeKFBc4uhrvcZ8Ktzuy2NXVWTzG66ZP4Z1nx7Pk4U=; b=qOXiDEAHGvXOes31RJ/KCo3Y9ICxl9CTWvqtUeo5g4ydOLBWV+tObe/QG6LWxsYuYJ vkiUcEPPnZsPLiCveeL8ZH6ZptkWzHwH0yyIZ6j4xgqqa8QFjy6R0HaOcQBdmJZ+u/3x S14ksaEk02sANhdCriec9jQ/JSbCNYgy71vc4+9bbR/t4SV/DBsOKaY0AZzilzBJEyYG CrrGVWu8cgZW/9WOuCy+VG8pj4spSemCi+2WImT/UgHP1oZaXZoma1Yza8Bvzg90KLwh l+JkzCQ47wcO3atkUoF7nymffRwL+k6/Ux+xDf7mAgqUjsbKMgUVjG8pJV+3MvangEXr 5msw== X-Forwarded-Encrypted: i=1; AJvYcCUzFEB20OpOU4ggTmU5lKPLeS62E5fhDECbWEAv4HtJef8hL5Xy8rXvcJHumH8cBhsF8ugPpygzZbsLSf+pfjab@lists.infradead.org X-Gm-Message-State: AOJu0YzGKeoMqixZfQsoRCvP1n3DQb2NjbarSIN/Xo64cd+gIO5GVog/ dkiin9xZTNIfutCjup67Ch+SJaVrt5CpQLtyR4ln5ALcmqSuuB8m X-Google-Smtp-Source: AGHT+IE9a3/PA7Hcwin2yUXCWfoh1SSkESId1pC/M9tB8Z80zr6jplNAzD80CEsYGdj0Bz74E/IN/w== X-Received: by 2002:a17:902:e848:b0:203:a20a:a596 with SMTP id d9443c01a7336-2050c21a680mr23635065ad.7.1724923635850; Thu, 29 Aug 2024 02:27:15 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20515552b6dsm7469245ad.249.2024.08.29.02.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 02:27:15 -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 1/3] dt-bindings: apple,aic: Document A7-A11 compatibles Date: Thu, 29 Aug 2024 17:03:11 +0800 Message-ID: <20240829092610.89731-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829092610.89731-1-towinchenmi@gmail.com> References: <20240829092610.89731-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_022716_899758_B2DEC2BD X-CRM114-Status: GOOD ( 11.63 ) 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 Each feature level is an extension of the previous. For example, M1 will also work with the A7 feature level. Signed-off-by: Nick Chan --- .../bindings/interrupt-controller/apple,aic.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml b/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml index 698588e9aa86..28e09b933087 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml @@ -36,9 +36,18 @@ allOf: properties: compatible: - items: - - const: apple,t8103-aic - - const: apple,aic + oneOf: + - const: apple,s5l8960x-aic + - items: + - enum: + - apple,s8000-aic + - apple,t7000-aic + - apple,t8010-aic + - const: apple,s5l8960x-aic + - items: + - const: apple,t8103-aic + - const: apple,t8015-aic + - const: apple,aic interrupt-controller: true From patchwork Thu Aug 29 09:03:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13782904 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 1A3E2C71135 for ; Thu, 29 Aug 2024 09:40:11 +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=hyrJQ6jxvmUut8ngEU6MgVMBew cKjWkjQvQYwK0/y2WDrHIJom+8bCIPOrPMCagE9t5NYulgkshiTrZw6rF0ZERzOXqxTFq4ubvVTCt sqqIDA/Bzh1xDH+pycfFRKCBOE/6dsFXcJ2su8qSkmsp6F9MG75ME2QOkQVW/LdknA5CqVmmlFvza qApwtlBRih8ACCTmyem7e4StcqB8Qt9kl1UOvh5CzSqVNWMB6wB6WcQDlXu0HZRaY9oSq0evde8SJ 76a7h7krZzOgmg3z/XBO527JAGSViLdnG1L74K4/mkWS2lCw4vgwG70noCwouLKTbRxK6fyFx/zrM En4+nWug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbcX-00000001OiJ-12I6; Thu, 29 Aug 2024 09:39:13 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbR3-00000001M1N-1g5f for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 09:27:22 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2020ac89cabso4339085ad.1 for ; Thu, 29 Aug 2024 02:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724923640; x=1725528440; 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=UsQDQNw1G3cURjnwebqgkzkeWXZDQsYIp8spOjYQVeogmtW+nz0/7GQePzzu1MMrDC 6lpK53t/4bnivODWIQ2NC+iu98dwpma02kJjEYwlfjeP7AWlleXE1TJnULWKsd3h90G8 dMBzTJ3t8nWo647iBaPNCGCNwNvdb9d5ZXo9pp49lp58nJIVItzQCJM2Aki9olQxF4Ai KRHK9ZE06v5jVPp9nv2uOfYPZj/N+1Iwf/BSlDqqH4yYw2pWgmXPBHY+lSqTcjK7hZZv 9Px6F4f3/TkxeqCjIS4ad6cjNeojAbojnpSTFxQ4NtrOEgmjoIq+X8ZWVsS3oIW6VzOK ehhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724923640; x=1725528440; 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=nxO2oz/wkXaD26ls4fQAUyGoBVy9iNXWnTWjByiCbzmgZ0/lXertow8bP6vpXmOCQS 44VjhgtPTTAQcj0s71v2ZeCM5V9S/pR4ozhkPavMECjF5YTOOrtIRhQ1rpy1/aKH03M5 A0hAlz5aPqbUCV+FF2HOQChsbKvtjhmuJUXdQMX9OdpdvGKvjWsaFDspuEPei+Oa59hO tD8xXi92tgmjjbaahMhfjxEuJ81h25ar7pk8gHB3mo3uV/elymlF8rkRZ5RA9uyxrojc mugyRDndqRtttKfO9SjIOiF87Tol/BePozJZosk/lIzw+eB2ySAVuu3K8U57tJFfAAGq NtWQ== X-Forwarded-Encrypted: i=1; AJvYcCVnis8O6MZrawt1Ycxjpf/OrTxplMguMlAK16v6Rank2n0ou84wGoMFDiOfItiDFx3NXxHYEbGb9B0KhjDqRzMg@lists.infradead.org X-Gm-Message-State: AOJu0YyU7shrsz9t09I0RHcB7i/ng3+0PbCjhjMgJHYCSbIfwo0jJOl1 xqkggcVdzD+xjlfjxyeKDPf3sHYZPEt099Zq7CXECyh3VXx1ynjP X-Google-Smtp-Source: AGHT+IEKUoxDuqT/4bjh7520aySEhnZ1arjlxKlqJuEFhxlHhQmG4atig6hIsfRUrkQ+FFxR+vzDFQ== X-Received: by 2002:a17:902:ccc7:b0:202:11ab:ccf4 with SMTP id d9443c01a7336-2050c215845mr22583185ad.6.1724923640331; Thu, 29 Aug 2024 02:27:20 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20515552b6dsm7469245ad.249.2024.08.29.02.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 02:27:20 -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 2/3] irqchip/apple-aic: Only access IPI sysregs when use_fast_ipi is true Date: Thu, 29 Aug 2024 17:03:12 +0800 Message-ID: <20240829092610.89731-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829092610.89731-1-towinchenmi@gmail.com> References: <20240829092610.89731-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_022721_467364_5C0A4502 X-CRM114-Status: GOOD ( 16.66 ) 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 09:03:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13782900 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 770DCC71135 for ; Thu, 29 Aug 2024 09:39:47 +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=Ouhe0enBFjJUZqCtUzq8PmMdBjKDokZmZ4h8nJcgYbU=; b=VNZ8MkQSUKO2yulpKErDZlT5i6 a+TKubOR6PQ7cyr5HEZ0aFil6u81L9R6kyJs1ksftj9hma7p6zOCIXP9itm7NQoKW2LcxmTvOe8EI 5MxsJJJMDuzpE4umsMSUDOxj+r4++O+dQYDXj7eBS6B+vM+RFwePj5DSRAQaYvWWn87WUP4dZDeAB beHw/Wmma5ASl0yTjgulKWNsK0DOTm8X6b+asGbPT2sFAtdCcuqsaOSaLO+vZaUcvIpX/rRWUALw9 eKITWDKFVGI7qlWeqAH2z/4dXBoFscgzL0X8rdFLy+ipTvg3AJDccamePirLYXI9yTa6+ceeBWHGu etL/U4bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbcX-00000001OiN-3M3R; Thu, 29 Aug 2024 09:39:13 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjbR7-00000001M2K-1fPo for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 09:27:26 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-20223b5c1c0so4076855ad.2 for ; Thu, 29 Aug 2024 02:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724923644; x=1725528444; 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=Ouhe0enBFjJUZqCtUzq8PmMdBjKDokZmZ4h8nJcgYbU=; b=d102YkT3TLMn6CgdcCV7e4AwmkxKymI2P6+Wu1yWLfjocoTNHoXtYzU0OBPLzCMzDj bEGqDTRbUGSgmgPuV/6hDtxSMhEH4bX6q/Gvwltsy+2TORaiyMdl++M9jhhIAntkXzTD t3mzDUkQ7GK0Z9Z5fTXuHUUY+8j7b6VaZHVLa3B157BfU3XPpTGpKkR2UZou3ynn8nH3 ny06pFPlxKS3AP1r5jivk3qMFdzQ44FfapoyRQFlmIe6r3XYUW9XNwc7PMOC/zHcnty8 WD7BGPEMCJc8nyfNaL6aJ2NU3lltZZjIfP6A+z0ROENsxZxj4A9EnfRMg9z8l6UM7IHK YN8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724923644; x=1725528444; 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=Ouhe0enBFjJUZqCtUzq8PmMdBjKDokZmZ4h8nJcgYbU=; b=FvvVLAgxvT2mdmQbsVOUJEdHrWm7Y1ZDr4y+d9InX62V3fcSeV6TxDDrM/YdkM77Ay xRrVSNHmdLH6X8NAA19tU1wcrSmg5BTD/WPfeBYh1UGAY19Noy0eo24LKJn9I31d5qCT 3VZp1IBg1B8lMY4OAI/iXtLKESap6Th9AfGQ2owP4oFNsQUwPd5GA5Zsoq1cB4GK/lsI BMHYyoceBvYPGkKV7hkR3oiofawdoCzibGCvREMuSpOAtE0Bc0owbk9zXvkwWU4zGFW4 XuB0+rXikfP7DGOCQPwxPiI73T6ojKoJ84EKzv9Mg+Eq7QZt62ImV2od46uKDmMb+EaT w8UA== X-Forwarded-Encrypted: i=1; AJvYcCX1prkeBC4vTI/4K7MjuFYDkl8LcwyVTZuH2y/L3x4v89vWTV5nqIelQWAJ/HmJ/7ahcfesCGr9puVMs4LI/z8u@lists.infradead.org X-Gm-Message-State: AOJu0YxSSe6YQUUSvalLL42F9SswF0zH8lwNoMzDeTzf3Ifi3EHG4iEM n192V1CKg0E8zfVg2ZYYXJzkKWnPjzfo5lNvOeHACdHif4+QOflz X-Google-Smtp-Source: AGHT+IFrjUhQikLTv2qTwmStFWCrqusJSIZnC40sneETVUkJPqzLcvKuQheZLvCXJHwrdHmRDZZe5w== X-Received: by 2002:a17:902:d584:b0:203:a0b4:3e28 with SMTP id d9443c01a7336-2050c377592mr23038675ad.27.1724923644039; Thu, 29 Aug 2024 02:27:24 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20515552b6dsm7469245ad.249.2024.08.29.02.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 02:27:23 -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 3/3] irqchip/apple-aic: Add a new "Global fast IPIs only" feature level Date: Thu, 29 Aug 2024 17:03:13 +0800 Message-ID: <20240829092610.89731-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829092610.89731-1-towinchenmi@gmail.com> References: <20240829092610.89731-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_022725_460529_A3D32D36 X-CRM114-Status: GOOD ( 17.82 ) 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..9248ecff42a3 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),