From patchwork Sun Sep 1 03:40:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13786247 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 24F98CA101E for ; Sun, 1 Sep 2024 03:46:00 +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=8P/VLH/bkCVi0Kmx8/pRYs60oDjzwE57I92YjRqe88o=; b=eGVQmNc3c786DdPGBuoy0INYqq lPaC//HyqSnO9HU5YDok9egWiyDFGP0mURJjrDiGqXn7nAtfkBq/A+sY6uEzPzrB6j2B1jph/F+V1 lE1cOP5e3L3ofRuaq/wyWzAg64XlwR6Ztr1EdSg0nPFVIY1yYxH64WWYuUhKgZHJK/f6jNwHSEi2s PBjOxtSQu+2tq+ARHDo1E7vGq8uNZ3sXip1nBL+WJUA/Z0TwOOj986RScM7tW4ta/A+/J42LkpvJP JWKwKzOAgBywHGKdF+sUzWRCokbAiNUhavaX1jvg9/zZiiRBKSssOE0TuLr+CbRqwGzFJNB5TuUJT l5tT5L+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1skbXC-0000000AkvT-1wtR; Sun, 01 Sep 2024 03:45:50 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1skbUF-0000000AkPg-3J0y for linux-arm-kernel@lists.infradead.org; Sun, 01 Sep 2024 03:42:49 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-71456acebe8so2480170b3a.3 for ; Sat, 31 Aug 2024 20:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725162167; x=1725766967; 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=8P/VLH/bkCVi0Kmx8/pRYs60oDjzwE57I92YjRqe88o=; b=XYb3nvteMCCfzFL5SFg18+YkYccNEcGfmKyNCF0q2Pdx9AcgWnzFfDVZjQZ1Zz9KU1 wBPQJXvUWXUCjOi4CDL8iwQth0MOLDca2Cko8wmuWPBYp1/oECgnIdtpQuUQdDvzzolb salDbHILFN07cAhgmGt6DQJBggoFJ5oiCMDqYfIHlD3IWiKz4AL4LcfGlxaJm5YRMbto +Z4mhVAU53tayvxB7O6VW/ZGM6s/Rd/YvjNyaC745MhZhYIiIOmirtdPu33JsoBw7tl7 IsjF2JzemVEjLYH7P1SPxDi/jIiRtbHt8UicokLGVElYowVQJdkBWJ+peRw8UQdVVRYV E/Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725162167; x=1725766967; 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=8P/VLH/bkCVi0Kmx8/pRYs60oDjzwE57I92YjRqe88o=; b=Mf9617WqE4VQnh+SG/wldH2S/PQTueNBGIV/jR5q9/zaKUvu6TsUd02d4SNqRFoh+R 9PHuqORwQyed5bzOv5UCuT9emDK0wnfderQfy+u/Cn6Lj0r33NZo/Uxl0bzYWYNYHsrl UIR+2CNeu62IdES+bXORqMDGC8yYREktpLwPrrAtGIvkhDqIrXnR7Z3aQlWi1eVPA0BW UQRN/2VHBPx0HT8ejLJlqFxq9HLQAg5RPZjRzYMSgf7prIGRbnybzYfaXvelOTJqMkua 11PcBpZeJQpB38AyPMZGWkn9YAiW0PBLfY5tI6sgGSVKckq9621PaYQXGtFEO+pdphqk l4Lg== X-Forwarded-Encrypted: i=1; AJvYcCX8kWh9uQA4bjqMU+n99q41+uV/qF5hlgXu5lITFQTR94vxhuvkWe5/yeuUs3J3bJnaA2AcnFWMiaI2qFzNnG7L@lists.infradead.org X-Gm-Message-State: AOJu0YzIesH9P+qt7Ancq3tDZDE/F8Hadhggczarq2vuLKMh56449Cpn 0K7T+yxtIJ24WTdF+6OTZCJjPYWELlaeJQy39sZWDhMQe0jdfT7x X-Google-Smtp-Source: AGHT+IFhht1qKXBiPs9HIAzfuSOxGKr51cNM8GUgWfxyXslOI4NWrGfhD0H/m6YtWxDBqqE9Ki9wQA== X-Received: by 2002:a05:6a00:928d:b0:706:5cd9:655d with SMTP id d2e1a72fcca58-715dfc3a4f1mr12316514b3a.22.1725162167046; Sat, 31 Aug 2024 20:42:47 -0700 (PDT) Received: from localhost.localdomain ([49.130.72.113]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-715e55771ccsm4826767b3a.43.2024.08.31.20.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 20:42:46 -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, konrad.dybcio@somainline.org, Nick Chan Subject: [PATCH v3 3/4] irqchip/apple-aic: Add a new "Global fast IPIs only" feature level Date: Sun, 1 Sep 2024 11:40:06 +0800 Message-ID: <20240901034143.12731-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901034143.12731-1-towinchenmi@gmail.com> References: <20240901034143.12731-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240831_204247_859509_36F55E8D X-CRM114-Status: GOOD ( 17.40 ) 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. Reviewed-by: Sven Peter Signed-off-by: Nick Chan --- drivers/irqchip/irq-apple-aic.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index 8d81d5fb3c50..01a3c79054f5 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -235,6 +235,8 @@ enum fiq_hwirq { }; static DEFINE_STATIC_KEY_TRUE(use_fast_ipi); +/* True if SYS_IMP_APL_IPI_RR_LOCAL_EL1 exists for local fast IPIs (M1+) */ +static DEFINE_STATIC_KEY_TRUE(use_local_fast_ipi); struct aic_info { int version; @@ -252,6 +254,7 @@ struct aic_info { /* Features */ bool fast_ipi; + bool local_fast_ipi; }; static const struct aic_info aic1_info __initconst = { @@ -270,17 +273,32 @@ 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, .irq_cfg = AIC2_IRQ_CFG, .fast_ipi = true, + .local_fast_ipi = true, }; 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, }, { @@ -750,7 +768,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 @@ -990,6 +1009,9 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p if (!irqc->info.fast_ipi) static_branch_disable(&use_fast_ipi); + if (!irqc->info.local_fast_ipi) + 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),