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),