From patchwork Mon Sep 30 14:33:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 174759 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7216410ill; Mon, 30 Sep 2019 07:37:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxY/Qn0owIPbGjxJXlu9pDAbjax3+xMNiOSjpOpxoC1bYp6uiIzmIQ6H7dUTs6YvpwuoTY0 X-Received: by 2002:a17:906:1c03:: with SMTP id k3mr19361028ejg.32.1569854230883; Mon, 30 Sep 2019 07:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569854230; cv=none; d=google.com; s=arc-20160816; b=ue6OuHQh2nrezaBswbkHkXCZg7QY+92eYLtNwfRNqpc0BzyaHmpxvrMy+ZAsXA2YE6 bvWOamgGmY9ncdwUHBjI5opKkN6AHEMmXiionvORZVgsuPswVl7gbWGnO3ZCnaB1jjSV f3CwEmEHusdoU8JKdeA33ba0stJ7Y07cSsolwKpo/JL/2klH0eqzhGgwPHDnIz/K5d3T iqFsR6uEBWlxgNO2G/fn+rV5EYJOMnwZYPljFl4fFJfrENolwo5O8lj2ymp5vfWO3KRN 4p89TuGKM3r2Gbqip8yWPGO/AQTqeUZlwzjIZQ5XriyRpBO2TPKJ79LIccACPt1LmMbe 5f4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=xQO5Nj+k3+OiO4b622mOdJQXQPAmlS662N7gim26Q5g=; b=QQc0rgP8EajLr8k9jPCsEhMfpr83Ovg3bDTYSCUbKbr7WKTF+QRJUK/33XktYulThR tUUASemgXgTBUkdwiqqkipboe+9QjyBPegeCAEfZsTdegdzGMbYTHQWndahpzgSWYf83 lfsVfTb0acL8mQbLBlI3ZuvlEi6EcqBizNeeM4XsSs2jzEMvNYH4k6LKQR7+m1tu4CcR d90H2m1CqEIcRMcu/jnhzUc40clRIbtUeJgUQUQLarlFF4qvq8XVt0l2J2BIA4MVCzqz FSwXZ/bC9cOHQgHHZGQGtSWDrKDJCc4nmSVn7Wq/PeiWCBHbnH6bcuGdQecJX7EYHi11 oWaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si6790638eju.147.2019.09.30.07.37.10; Mon, 30 Sep 2019 07:37:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731807AbfI3OhD (ORCPT + 27 others); Mon, 30 Sep 2019 10:37:03 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:58478 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730780AbfI3OhB (ORCPT ); Mon, 30 Sep 2019 10:37:01 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 63F89242D57370195736; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:49 +0800 From: John Garry To: , , , , , CC: , , , , , , , , John Garry Subject: [RFC PATCH 3/6] perf/smmuv3: Retrieve parent SMMUv3 IIDR Date: Mon, 30 Sep 2019 22:33:48 +0800 Message-ID: <1569854031-237636-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To support IMP DEF events per PMCG, retrieve the parent SMMUv3 IIDR. This will be used as a lookup for the IMP DEF events supported, under the assumption that a PMCG implementation has the same uniqueness as the parent SMMUv3. In this, we assume that any PMCG associated with the same SMMUv3 will have the same IMP DEF events - otherwise, some other secondary matching would need to be done. Signed-off-by: John Garry --- drivers/perf/arm_smmuv3_pmu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index da71c741cb46..f702898c695d 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -115,6 +115,7 @@ struct smmu_pmu { bool global_filter; u32 global_filter_span; u32 global_filter_sid; + u32 parent_iidr; }; #define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu)) @@ -551,6 +552,11 @@ static const struct attribute_group *smmu_pmu_attr_grps[] = { NULL }; +static const struct attribute_group **smmu_pmu_lookup_attr_groups(u32 parent_smmu_iidr) +{ + return smmu_pmu_attr_grps; +} + /* * Generic device handlers */ @@ -706,11 +712,21 @@ static int smmu_pmu_probe(struct platform_device *pdev) int irq, err; char *name; struct device *dev = &pdev->dev; + struct device *parent = dev->parent; smmu_pmu = devm_kzalloc(dev, sizeof(*smmu_pmu), GFP_KERNEL); if (!smmu_pmu) return -ENOMEM; + if (parent) { + void *parent_drvdata; + + parent_drvdata = platform_get_drvdata(to_platform_device(parent)); + if (!parent_drvdata) + return -EPROBE_DEFER; + smmu_pmu->parent_iidr = *(u32 *)parent_drvdata; + } + smmu_pmu->dev = dev; platform_set_drvdata(pdev, smmu_pmu); @@ -724,7 +740,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) .start = smmu_pmu_event_start, .stop = smmu_pmu_event_stop, .read = smmu_pmu_event_read, - .attr_groups = smmu_pmu_attr_grps, + .attr_groups = smmu_pmu_lookup_attr_groups(smmu_pmu->parent_iidr), .capabilities = PERF_PMU_CAP_NO_EXCLUDE, };