From patchwork Tue Feb 14 10:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 56842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2892784wrn; Tue, 14 Feb 2023 02:44:03 -0800 (PST) X-Google-Smtp-Source: AK7set/pgrmchbuyfYw2uv1IpCRcMvJpnVcTsZQPMyhklFTyE2a1iSLMvSaS1PRPOrZ0mB6NHImp X-Received: by 2002:a05:6a20:8413:b0:a2:c3b0:f637 with SMTP id c19-20020a056a20841300b000a2c3b0f637mr2502038pzd.26.1676371443351; Tue, 14 Feb 2023 02:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676371443; cv=none; d=google.com; s=arc-20160816; b=YT2i+/dmjUmZvh/911WmzNEYJkDRQ6u1T6YLhE7G7+aQqLOOx4lacMk5ScZMFYTh9c G7+0CjuMQnHgSZd2oAZRLmJcqKKywRpUjY+c0hS4P5QQc758GSx7/07mzIMuy+giP62n 6krBpH1lK53CSHpujU6NPzr+WwAIIXHExDk6myIpzVYzboL7fGpA0WKM0oHuJ1tMw4fn Cs0argDnUQhMvNdLu8JATlrpCGC0yjlQ+uS0ByzBikEmKWouLnn8pdnc0f79j0q8K3MO IEsGXZji+0hnWBjbI1+RyF+bMqX77aMwO7oNzaevgZUKrqeIW2bp/iAMPU5+vHCRwBM6 YBeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=Kfy/tWmWEHLKKHvLSLPqjNRDFzIp1QYnzLIy+8eglgI=; b=fZsO5G0j5MqysYu0RNY3Ks5SCYVAWIRgwmTjJ5BtFvtWUhdUUw7DwaIQYmIu3/AofO mHBX0JNqiQiKBeC+8fLJAL9PCRs7C7Th+VfUBngMJ98m1SSs1yrCb9dXBxACy9aN2dZi c8DTOpbczOEf9vGVYKG6OGJvQJ4s/YPcm9q/6i0tH7hVMdWFRT2RBakTNTwXiVJXqL6K dT6E/vhxlcSwTzqxSC0kLNJzosWi/S2XqT++xTBr/BR0L8OnvQq+nCIpgKwrQECZ22T+ kdO+ip4ILer7SHz7ISuqEUy6JJ+/LEXgrGx397nSGv/mCaNl0XslbQfCkn6LHR8sqHrV cuCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a637e09000000b004fb12ee7cb9si13921544pgc.354.2023.02.14.02.43.50; Tue, 14 Feb 2023 02:44:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232562AbjBNKiK (ORCPT + 99 others); Tue, 14 Feb 2023 05:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbjBNKiH (ORCPT ); Tue, 14 Feb 2023 05:38:07 -0500 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEE4244B4; Tue, 14 Feb 2023 02:38:06 -0800 (PST) Received: from robin.home.jannau.net (p579ad32f.dip0.t-ipconnect.de [87.154.211.47]) by soltyk.jannau.net (Postfix) with ESMTPSA id 9A0FD26F78E; Tue, 14 Feb 2023 11:38:04 +0100 (CET) From: Janne Grunau Date: Tue, 14 Feb 2023 11:38:01 +0100 Subject: [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores MIME-Version: 1.0 Message-Id: <20230214-apple_m2_pmu-v1-1-9c9213ab9b63@jannau.net> References: <20230214-apple_m2_pmu-v1-0-9c9213ab9b63@jannau.net> In-Reply-To: <20230214-apple_m2_pmu-v1-0-9c9213ab9b63@jannau.net> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1019; i=j@jannau.net; h=from:subject:message-id; bh=EYGIdWeuF83XYijlj0mM1HCyJqYwvwRd2MoetNSkaJo=; b=owGbwMvMwCG2UNrmdq9+ahrjabUkhuTXKd3G5SYdpuH7vhpzqv5Jfuy10FUvlcnS57TMpRVZl h0ZOxd3lLIwiHEwyIopsiRpv+xgWF2jGFP7IAxmDisTyBAGLk4BmMg/Loa/goJbnhl82Ft7dlrx rWdslX9TK27cqrLQfnM4ZJ/f8QuyCgx/JVjn1GUfSZ2SvyX87Cyf6xFX/t85+Hiq+0l+R3tTBvc DzAA= X-Developer-Key: i=j@jannau.net; a=openpgp; fpr=8B336A6BE4E5695E89B8532B81E806F586338419 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757802862462735493?= X-GMAIL-MSGID: =?utf-8?q?1757802862462735493?= The PMUs on the Apple M2 cores avalanche and blizzard CPU are compatible with M1 ones. As on M1 we don't know exactly what the counters count so use a distinct compatible for each micro-architecture. Apple's PMU counter description omits a counter for M2 so there is some variation on the interpretation of the counters. Signed-off-by: Janne Grunau Acked-by: Rob Herring --- Documentation/devicetree/bindings/arm/pmu.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/pmu.yaml b/Documentation/devicetree/bindings/arm/pmu.yaml index dbb6f3dc5ae5..e14358bf0b9c 100644 --- a/Documentation/devicetree/bindings/arm/pmu.yaml +++ b/Documentation/devicetree/bindings/arm/pmu.yaml @@ -20,6 +20,8 @@ properties: items: - enum: - apm,potenza-pmu + - apple,avalanche-pmu + - apple,blizzard-pmu - apple,firestorm-pmu - apple,icestorm-pmu - arm,armv8-pmuv3 # Only for s/w models From patchwork Tue Feb 14 10:38:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 56836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2892448wrn; Tue, 14 Feb 2023 02:43:04 -0800 (PST) X-Google-Smtp-Source: AK7set8zOF5OUErUpL46ueSOP9Xz4qGcdirVq5tzds3bPr78l97OCGxiy3G3mfh6ArJ1BSl8tX+Y X-Received: by 2002:a17:90b:3753:b0:232:ce83:20a with SMTP id ne19-20020a17090b375300b00232ce83020amr1936427pjb.36.1676371383959; Tue, 14 Feb 2023 02:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676371383; cv=none; d=google.com; s=arc-20160816; b=ZhZX+FHn2J2CWoeXPc21+3cnSlgyhl8nauQF1t6TzwfgB0Jn6XIeKUduJQmouLHUL+ AHkrTWimZhlxh4IRm2+bmut4WjGaxgVlbw9KqtP1DG2aTrVSZZZ8UmkvDm9I7ilJaqfV 9cUaCvwlBOIDWcR/7zSvTjK+y/Irq30ROAhciG2qx/Y+sMtGZpY9/oJuhiLyQ04hBKkd Ey3JqisePhKpS5Q8lUHze22MkSnixuePgD+ZwwWBG+p0waSe+msUuU5fZvQrVMiNV5MT L/RtsfzxNqcmsaG7NQBoGgqA30EXL0gQpP50lGvbKrR2JiwXY65gLbqZHfSmO5B8Bt8A ZeIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=yvtGLAqZHsJgnq1aULz5DPF2ouD0kwWlO7OILpykNhk=; b=nrKNa/3Hp/E7Jnb8CG/+wrxw2+/4w1HQXuGgwxBUzclSaDM4Utlq+ByoezqgOqqaze p/2hIUoIfugItDHafVyUo3lu+0Oy+nHZXu2WDdNNYK0FCmtbjAlEvjfwCHmLARrNvqoR RaSwz/iUIm/8Y0aA9i1KiX/vZzT1Xzue+h3GPZqDUpzL/dj45WjKStPswSEdgrUgRh9m WLshrC+9BklYLUkzUAGeLtKV9mEniNAcnHYlEVSEVDTv0UKu9cnhR75Wur/fcKYk1adS te3T48TU8FK3SkyhixJIeVmFm9jDMgIeMJasK4xyOIV7px/0M9aXAMlTpJ8s1FJMZpBB NSsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 22-20020a17090a19d600b00233773a522fsi12270187pjj.141.2023.02.14.02.42.51; Tue, 14 Feb 2023 02:43:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbjBNKiO (ORCPT + 99 others); Tue, 14 Feb 2023 05:38:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232227AbjBNKiH (ORCPT ); Tue, 14 Feb 2023 05:38:07 -0500 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611E7244B5; Tue, 14 Feb 2023 02:38:06 -0800 (PST) Received: from robin.home.jannau.net (p579ad32f.dip0.t-ipconnect.de [87.154.211.47]) by soltyk.jannau.net (Postfix) with ESMTPSA id 0042726F78F; Tue, 14 Feb 2023 11:38:04 +0100 (CET) From: Janne Grunau Date: Tue, 14 Feb 2023 11:38:02 +0100 Subject: [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support MIME-Version: 1.0 Message-Id: <20230214-apple_m2_pmu-v1-2-9c9213ab9b63@jannau.net> References: <20230214-apple_m2_pmu-v1-0-9c9213ab9b63@jannau.net> In-Reply-To: <20230214-apple_m2_pmu-v1-0-9c9213ab9b63@jannau.net> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1281; i=j@jannau.net; h=from:subject:message-id; bh=UMxgpqVWtk29npa6KJJnZpE9eIozX2KpguZSAOm57YE=; b=owGbwMvMwCG2UNrmdq9+ahrjabUkhuTXKd0V6YlpMx5ZS1za/J2TybBv8/IZ/xO8yu+qKthMO 5/z47NzRykLgxgHg6yYIkuS9ssOhtU1ijG1D8Jg5rAygQxh4OIUgImcO87wT1v91wGnWYb/d9X0 qDeWGJ62mNSfZ5hqGqujuqg5/t22Rwz/tL5vz/9UH3tqX/Uv6V1iB3f9e1zmYfH35T2r+mJ+0ba LrAA= X-Developer-Key: i=j@jannau.net; a=openpgp; fpr=8B336A6BE4E5695E89B8532B81E806F586338419 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757802800182995085?= X-GMAIL-MSGID: =?utf-8?q?1757802800182995085?= The PMU itself is compatible with the one found on M1. We still know next to nothing about the counters so keep using CPU uarch specific compatibles/PMU names. Signed-off-by: Janne Grunau Acked-by: Mark Rutland name = "apple_avalanche_pmu"; + return m1_pmu_init(cpu_pmu); +} + +static int m2_pmu_blizzard_init(struct arm_pmu *cpu_pmu) +{ + cpu_pmu->name = "apple_blizzard_pmu"; + return m1_pmu_init(cpu_pmu); +} + static const struct of_device_id m1_pmu_of_device_ids[] = { + { .compatible = "apple,avalanche-pmu", .data = m2_pmu_avalanche_init, }, + { .compatible = "apple,blizzard-pmu", .data = m2_pmu_blizzard_init, }, { .compatible = "apple,icestorm-pmu", .data = m1_pmu_ice_init, }, { .compatible = "apple,firestorm-pmu", .data = m1_pmu_fire_init, }, { },