Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1081309rwd; Wed, 31 May 2023 09:12:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42ahPEqQEIepg+71WSMXA4tLVcc8EYcGpNsdiV29OzdJfRoT3QzRtVgGnFsZglSjHa6+J6 X-Received: by 2002:a17:90a:db02:b0:252:75ed:eff5 with SMTP id g2-20020a17090adb0200b0025275edeff5mr5831702pjv.30.1685549570495; Wed, 31 May 2023 09:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685549570; cv=none; d=google.com; s=arc-20160816; b=SqW2+pMG1+FZAZa4CBuS1lfDK6dzw6GCO0xBKKZ8XnWFVGIsBLSg4WDE1FwFr7kq1t DeytxwSMJIp3eenChOc/RA3BZMImQINvKpSn0cft3qjy5Wujmv5R3qih346eyv8WOi2o US28wdFhlK+m5/MIy460D2Rby5qn+LwyK5BvBuNp+1y0xmmomLQnbDaN1C3TaXNtyH36 CPCOBnhyU8/3w4BeNWPNfbJd344H1KrVhdooNY+H7L0LXbr3J50MKbEwp7hIPjQFqy+F Ys06c0RXehwom0VSnOjZS3YiQvpCqMCHufb+y19mYKUIW1Gs1oVXme84BA7am75jKAYK uxnw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=c9bn5/tuQMVKNkqMqmgA1U9SVrRNf7HzX3IwsbeIcLA=; b=SfTQe9d3YnCKPb2eIagS8Dnnw1TSyAqLA/NvBnhvLGEXwDkP8bwgrVFpDd4gIUpiwx 4UkXVpOjpjlxVOzpq6HVoPuCHxmcbOCVNK2PfbrTTdiPnU4M8nfEtUS9T9kcWX7yQxYP CsvdB03jltT2YCN6LrLYU6s202m/+FGkRTU12InHJamWBBmayS4E+fXg2GxHkoxIXeFM 7gHtb2sggpfc0PG/4NfoQxOZLNYtYyDpS2jZk+CEBQu2tgDjZW4qqJt/ZKy8B1TRzxa2 thBeXW6cF1wc6yCT4hpB/jy81C53x9CgMLJU8UanX/xrD3hrHFC37FFvkRMYi5ZOZj4o WyZg== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe9-20020a17090b4f8900b00256cba1cadesi1216075pjb.50.2023.05.31.09.12.35; Wed, 31 May 2023 09:12:50 -0700 (PDT) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234504AbjEaP7U convert rfc822-to-8bit (ORCPT + 99 others); Wed, 31 May 2023 11:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234479AbjEaP7R (ORCPT ); Wed, 31 May 2023 11:59:17 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7011CB3; Wed, 31 May 2023 08:59:12 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QWYn36pMtz67Gvv; Wed, 31 May 2023 23:57:27 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 31 May 2023 16:59:09 +0100 Date: Wed, 31 May 2023 16:59:08 +0100 From: Jonathan Cameron To: Junhao He CC: , , , , , , , , Subject: Re: [PATCH v2 2/3] drivers/perf: hisi: Add support for HiSilicon UC PMU driver Message-ID: <20230531165908.000022b0@Huawei.com> In-Reply-To: <20230531104625.18296-3-hejunhao3@huawei.com> References: <20230531104625.18296-1-hejunhao3@huawei.com> <20230531104625.18296-3-hejunhao3@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500005.china.huawei.com (7.191.163.240) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Wed, 31 May 2023 18:46:24 +0800 Junhao He wrote: Hi Junhao, A few small comments inline. > On HiSilicon Hip09 platform, there is a UC (unified cache) module > on each chip SCCL (Super CPU Cluster). UC is a cache that provides > coherence between NUMA and UMA domains. It is located between L2 > and Memory System. While PA uncore PMU model is the same as other > Hip09 PMU modules and many PMU events are supported. I don't follow what this sentence means. Normally you'd have While A, B is different.. > Let's support > the PMU driver using the HiSilicon uncore PMU framework. > > * rd_req_en : rd_req_en is the abbreviation of read request tracetag enable > and allows user to count only read operations. > details are listed in the hisi-pmu document. Details are .. Also no need for the ine break and allows user to count only read operations. Details are listed in the hisi-pmu document at .... > > * srcid_en & srcid: allows user to filter statistics that come from Allows for consistency with the uring_channel description that follows. > specific CPU/ICL by configuration source ID. > > * uring_channel: Allows users to filter statistical information based on > the specified tx request uring channel. > uring_channel only supported events: [0x47 ~ 0x59]. > > Signed-off-by: Junhao He > diff --git a/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c > new file mode 100644 > index 000000000000..d27f28584fd7 > --- /dev/null > +++ b/drivers/perf/hisilicon/hisi_uncore_uc_pmu.c > @@ -0,0 +1,577 @@ ... > +static int hisi_uc_pmu_init_data(struct platform_device *pdev, > + struct hisi_pmu *uc_pmu) > +{ > + /* > + * Use SCCL (Super CPU Cluster) ID and CCL (CPU Cluster) ID to > + * identify the topology information of UC PMU devices in the chip. > + */ From patch description, I'd assume there is only one of these per sccl so why do we care about the cluster level or the sub-id? Perhaps that description is missleading? > + if (device_property_read_u32(&pdev->dev, "hisilicon,scl-id", > + &uc_pmu->sccl_id)) { > + dev_err(&pdev->dev, "Can not read uc sccl-id!\n"); > + return -EINVAL; > + } > + > + if (device_property_read_u32(&pdev->dev, "hisilicon,ccl-id", > + &uc_pmu->ccl_id)) { > + dev_err(&pdev->dev, "Can not read uc ccl-id!\n"); > + return -EINVAL; > + } > + > + if (device_property_read_u32(&pdev->dev, "hisilicon,sub-id", > + &uc_pmu->sub_id)) { > + dev_err(&pdev->dev, "Can not read sub-id!\n"); > + return -EINVAL; > + } > + > + uc_pmu->base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(uc_pmu->base)) { > + dev_err(&pdev->dev, "ioremap failed for uc_pmu resource\n"); > + return PTR_ERR(uc_pmu->base); > + } > + > + uc_pmu->identifier = readl(uc_pmu->base + HISI_UC_VERSION_REG); > + > + return 0; > +} > +static struct platform_driver hisi_uc_pmu_driver = { > + .driver = { > + .name = "hisi_uc_pmu", > + .acpi_match_table = hisi_uc_pmu_acpi_match, > + /* > + * We have not worked out a safe bind/unbind process, > + * so this is not supported yet. If you can reference more info on this that would be great. Perhaps a thread talking about why? > + */ > + .suppress_bind_attrs = true, > + }, > + .probe = hisi_uc_pmu_probe, > +};