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