Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp71880pxh; Thu, 7 Apr 2022 14:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTU2/sgXp2UAEulHi+b3RYl4ReM9dltF/p0i5lL6sSUUr6l5w6pEuH+G/GnIJFLxhKzR4n X-Received: by 2002:a05:6a00:14c6:b0:4fb:3978:1020 with SMTP id w6-20020a056a0014c600b004fb39781020mr15700670pfu.36.1649366381400; Thu, 07 Apr 2022 14:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649366381; cv=none; d=google.com; s=arc-20160816; b=WGd1HKh+Clo68+mMIXC9gPvwQBLHjFQzmnfOxofxMLwD7+zSQqq2kElk9nFCDtekvV dT53bl4ncbnD3UxNA0XfJarReafOzSATmRNK3EZ0Le/YUyEevPkZHF9Vb/f+yCuwEzjN 5OMvFHmqcBwYv1qdnqdVVFCgJYf1/MEnLpX2m2KW4c13xZCiZd3EEsdRtySZOddmHqci wPJ5xAlQfEUV1NDA+rCki1FvIK6hLKIqCQE6RXW9+/p4ryr88+jxNK+dNdQaJu9Yh4eP VyDRJfzUI65aTyVMSx9MisvRhOMETbFUgTJPJftYpST7pgRPO82pWYjMyj+aMUz3GOFA L7DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HDlmCjGSC7gkYBFI/qglt+5cE7IeYwE0gdpuCfQHmws=; b=VVJm8l7Azcvz1bxKY+iRXtPa5BNJzeYd9WuetQmGMAX3bCiv79T/nL9zkjqJploMJv Rp5JiZ5thgshzntAOCJLXYohtZcGcjOYGmmwE9QlPBCluLVV3FFKPjubfe9rJ+HuNkm4 LCiqgBUZxmkYyo1V0kvu+/8MoI+iRkVRwD7jSkysHoMGdqKbCfNE3L4VEXz3JfO47II9 +/Yjr4NYzlMjdA7KCtdxbmLGSbmAXsSI+2VyZRU2qQbhrGW9gdpDOQtl2yK8Osw31xno vwMMQzWVJwNkFCg9YEw6yLIR4GX7eHQjOwm1oLPQp7a1YeL2fX3finBamByb31FBoAaB 3UVw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w2-20020a636202000000b00398d8b1871bsi18860290pgb.44.2022.04.07.14.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6232A47A011; Thu, 7 Apr 2022 13:11:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245428AbiDGMuC (ORCPT + 99 others); Thu, 7 Apr 2022 08:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242785AbiDGMtz (ORCPT ); Thu, 7 Apr 2022 08:49:55 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA338D5548 for ; Thu, 7 Apr 2022 05:47:51 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KZ1Jp1nkBzBs7t; Thu, 7 Apr 2022 20:43:38 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Apr 2022 20:47:49 +0800 Received: from localhost.localdomain (10.67.164.66) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 7 Apr 2022 20:47:49 +0800 From: Qi Liu To: , , CC: , , , Subject: [PATCH v4 1/2] drivers/perf: hisi: Associate PMUs in SICL with CPUs online Date: Thu, 7 Apr 2022 20:46:16 +0800 Message-ID: <20220407124617.54521-2-liuqi115@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20220407124617.54521-1-liuqi115@huawei.com> References: <20220407124617.54521-1-liuqi115@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.164.66] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 If a PMU is in a SICL (Super IO cluster), it is not appropriate to associate this PMU with a CPU die. So we associate it with all CPUs online. As the firmware of Hip09 platform hasn't been published yet, change of PMU driver will not influence backwards compatibility between driver and firmware. Signed-off-by: Qi Liu --- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 18 +++++++----------- drivers/perf/hisilicon/hisi_uncore_pmu.c | 4 ++++ drivers/perf/hisilicon/hisi_uncore_pmu.h | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c index bad99d149172..a0ee84d97c41 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c @@ -258,13 +258,12 @@ static int hisi_pa_pmu_init_data(struct platform_device *pdev, struct hisi_pmu *pa_pmu) { /* - * Use the SCCL_ID and the index ID to identify the PA PMU, - * while SCCL_ID is the nearst SCCL_ID from this SICL and - * CPU core is chosen from this SCCL to manage this PMU. + * As PA PMU is in a SICL, use the SICL_ID and the index ID + * to identify the PA PMU. */ if (device_property_read_u32(&pdev->dev, "hisilicon,scl-id", - &pa_pmu->sccl_id)) { - dev_err(&pdev->dev, "Cannot read sccl-id!\n"); + &pa_pmu->sicl_id)) { + dev_err(&pdev->dev, "Cannot read sicl-id!\n"); return -EINVAL; } @@ -275,6 +274,7 @@ static int hisi_pa_pmu_init_data(struct platform_device *pdev, } pa_pmu->ccl_id = -1; + pa_pmu->sccl_id = -1; pa_pmu->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pa_pmu->base)) { @@ -399,13 +399,9 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev) ret = hisi_pa_pmu_dev_probe(pdev, pa_pmu); if (ret) return ret; - /* - * PA is attached in SICL and the CPU core is chosen to manage this - * PMU which is the nearest SCCL, while its SCCL_ID is greater than - * one with the SICL_ID. - */ + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "hisi_sicl%u_pa%u", - pa_pmu->sccl_id - 1, pa_pmu->index_id); + pa_pmu->sicl_id, pa_pmu->index_id); if (!name) return -ENOMEM; diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c index a738aeab5c04..463061fa8fc8 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -458,6 +458,10 @@ static bool hisi_pmu_cpu_is_associated_pmu(struct hisi_pmu *hisi_pmu) { int sccl_id, ccl_id; + /* If SCCL_ID is -1, the PMU is in a SICL and has no CPU affinity */ + if (hisi_pmu->sccl_id == -1) + return true; + if (hisi_pmu->ccl_id == -1) { /* If CCL_ID is -1, the PMU only shares the same SCCL */ hisi_read_sccl_and_ccl_id(&sccl_id, NULL); diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisilicon/hisi_uncore_pmu.h index 7f5841d6f592..96eeddad55ff 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.h +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h @@ -81,6 +81,7 @@ struct hisi_pmu { struct device *dev; struct hlist_node node; int sccl_id; + int sicl_id; int ccl_id; void __iomem *base; /* the ID of the PMU modules */ -- 2.24.0