From mboxrd@z Thu Jan 1 00:00:00 1970 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 171EBC83F26 for ; Thu, 29 Aug 2024 14: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: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iK1IVOMJIxyZnFgv4BStIpf1YlI4C67hPRkMhKa7i/g=; b=AhdpnOcDf6zX+G0haeIIG4Ne5C ZzPIYDp8gpt38Ak8skXIdwBJR7CLZy0bggjf1isIUmMYuUrP9kxg69G0y1gjYpdOsa/zQn6/J+VJg kaq6gFxKNQsCWH9x8L9TqKfLoNUpeh/kf6NKjH679j5TVnFs1gRfZx0/EZ5R8rHKReovBDrzCGyvI sirMU8YGoZgFGAV3mktyC5EKWaJGr2wnEd262DJj7TFzfxkMf9IZtxqLGMm5m+aXwS0r0mb9QDhdA gHPWKjnIRa8hHKH/0cjFL//3dUvwKUY5ltpm1t/xoLWOOL9aMnqsuS/7YW90jVmCqSYgO9bOwq89c R9OSlayQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfoa-00000002KKn-2Eii; Thu, 29 Aug 2024 14:07:56 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfni-00000002K6W-0iAJ for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 14:07:04 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-71433cba1b7so500148b3a.0 for ; Thu, 29 Aug 2024 07:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724940421; x=1725545221; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iK1IVOMJIxyZnFgv4BStIpf1YlI4C67hPRkMhKa7i/g=; b=AVmerDqF0tcWU8hPbsS80+aMecs7bQ0lyOqxgieWr1NgYt1qJ0+0qfVHXk76eE/2Df NhR1EYmtYNQi/pMV1VTvMrfyOefRjvjYoyRh4rwltnMWfNxmO6wwmU1/TJxDXchAuFz+ KD96zTVgSXz517FMYvI/kn1AHVxTw1gOTFPZDbcLV5fyI8kiGmXFegDEEwpq+M4oG2vR Ilg3Sw6KPqZkia0q4hx/r/a2rY2ne/bMXIw2/YNCEoBgcwnSiKlVt1HUirqCBH09VoIh qeVaaCsESm5IA4JFonML+Dq4c/TJnYxtD7gJF+tBE81qTzAjUSURTaBkZP9AANLJEFQ0 HEKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724940421; x=1725545221; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iK1IVOMJIxyZnFgv4BStIpf1YlI4C67hPRkMhKa7i/g=; b=Gt3YcnVu8TX43LVTwSdsMgwNHqikHkWULqnYu0+d+aAmCNzxUJ3P/+MSGwGVV3QGyf ob2it/7+N19BwMArrOTRn1BBjaRi45T70mCUs/i7SD0k6xyfh1dl9MCtCqomIF8TBBN+ AWDVRZbicKm3Tv1k7P8TpJO84hBZvUPf1ReuKfcLOYuyu3Y7iNFRfRsn3bnfbV56u73M NwpXz2s/jGWza0RPholJbx3GJ0S6Qf30QN0mun4vXORbMO9kapAiGT5fN57zDIgxHPU1 puqCkZ+GUbL0H8+tQ2WYz1ZaDoNeyB/l8DkeRF85JPT2IGqpZ10gaD60IDlyI49y+Uos 0l7w== X-Forwarded-Encrypted: i=1; AJvYcCU+8ifFDVa0hgNwfNnShZ6BSt7MiS1+YwOnvkDb+qILqW0xsFkaOZLGjrrMrx5LDyBKC6autHrPgQbg2wTEOdlk@lists.infradead.org X-Gm-Message-State: AOJu0Yw6Zm6Ha8as684yytUshuDf7OxdUBYWGbfQTxb9fG4sF2kKhsQV Z7dOeuD+0/i/JfHoddUnTAe8GZOph9Etta71zxRJBqoXcSe3mG8T X-Google-Smtp-Source: AGHT+IG2CyT+7KwKUd+VOi3UxpXYONelmRV4w2rkII4YQ8l9bIrb2V+UgLmErP8YyjI2/5thiSzKwQ== X-Received: by 2002:a05:6a00:1798:b0:70e:91ca:32ab with SMTP id d2e1a72fcca58-715dfaea829mr3436412b3a.6.1724940420644; Thu, 29 Aug 2024 07:07:00 -0700 (PDT) Received: from [192.168.0.122] ([59.188.211.160]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-715e55b9c4esm1192104b3a.92.2024.08.29.07.06.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Aug 2024 07:07:00 -0700 (PDT) Message-ID: Date: Thu, 29 Aug 2024 22:06:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RESEND 3/3] irqchip/apple-aic: Add a new "Global fast IPIs only" feature level Content-Language: en-MW 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 References: <20240829110436.46052-1-towinchenmi@gmail.com> <20240829110436.46052-4-towinchenmi@gmail.com> From: Nick Chan In-Reply-To: <20240829110436.46052-4-towinchenmi@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_070702_251522_0887AE5F X-CRM114-Status: GOOD ( 24.96 ) 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 On 29/8/2024 19:02, Nick Chan wrote: > 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 = { This patch is incorrectly disabling local fast IPI on aic2, it will be corrected in v2. > .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), Nick Chan