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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B70C433DF for ; Mon, 6 Jul 2020 11:25:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 114D020774 for ; Mon, 6 Jul 2020 11:25:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BpBqopMw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 114D020774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j2tJbGCk7Iqnl+TT2A3G4y1I+0rZoyn/B6g4OXlleMU=; b=BpBqopMwIddfyWhmlpmFyYG91 DNEyhd6ag5PSNAj+4Eri2YF9GUxSEdJsFD7Q76DyOdhEbxPviipItjjQEaBGlXPsb42XCCHbIbjXo uz3CqfdY+9f54190wZc/14D7GkvU9esZoPPh/+nQf9+oBqulc6+FYPu6eQBbPSfp+x9Z9BV7r8Wwd 7hIiSK8d9GHq7vV0DHbGXBP/BsM2RF2LtTsA393H3sb4Suw2/IoQBAsratY7H+5Ym/Hl+JKyJXaCD R6tYO3Q1zrvbpZxCqB0jGzVZKQDXc1aobxSTF+AFowLZSb2FgC+GDe9GddVhgJrGsQOiGfP06wXbQ H1ClowSSw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsPEc-0007L8-Av; Mon, 06 Jul 2020 11:24:30 +0000 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsPEX-0007Iu-8j for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2020 11:24:27 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R641e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e07484; MF=jkchen@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0U1u4RQd_1594034650; Received: from localhost(mailfrom:jkchen@linux.alibaba.com fp:SMTPD_---0U1u4RQd_1594034650) by smtp.aliyun-inc.com(127.0.0.1); Mon, 06 Jul 2020 19:24:11 +0800 From: Jay Chen To: will@kernel.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v1 2/2] perf/smmuv3: To support the dts to get options Date: Mon, 6 Jul 2020 19:22:46 +0800 Message-Id: <20200706112246.92220-3-jkchen@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200706112246.92220-1-jkchen@linux.alibaba.com> References: <20200706112246.92220-1-jkchen@linux.alibaba.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_072425_549377_170BC478 X-CRM114-Status: GOOD ( 13.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jay Chen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For the smmuv3 pmu for support the dts to get the options Signed-off-by: Jay Chen --- drivers/perf/arm_smmuv3_pmu.c | 42 ++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 2d09f3e47d12..44e9f4197444 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -115,6 +115,16 @@ struct smmu_pmu { bool global_filter; }; +struct smmu_pmu_prop { + u32 opt; + const char *prop; +}; + +static struct smmu_pmu_prop smmu_pmu_options[] = { + { SMMU_PMCG_EVCNTR_RDONLY, "hisilicon,smmu-pmcg-evcntr-rdonly"}, + { 0, NULL}, +}; + #define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu)) #define SMMU_PMU_EVENT_ATTR_EXTRACTOR(_name, _config, _start, _end) \ @@ -708,6 +718,7 @@ static void smmu_pmu_reset(struct smmu_pmu *smmu_pmu) smmu_pmu->reloc_base + SMMU_PMCG_OVSCLR0); } +#ifdef CONFIG_ACPI static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu) { u32 model; @@ -723,6 +734,26 @@ static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu) dev_notice(smmu_pmu->dev, "option mask 0x%x\n", smmu_pmu->options); } +#else +static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu) +{ + +} +#endif + +static void smmu_pmu_get_dt_options(struct smmu_pmu *smmu_pmu) +{ + int i = 0; + + do { + if (of_property_read_bool(smmu_pmu->dev->of_node, + smmu_pmu_options[i].prop)) { + smmu_pmu->options |= smmu_pmu_options[i].opt; + dev_notice(smmu_pmu->dev, "option mask 0x%x\n", + smmu_pmu->options); + } + } while (smmu_pmu_options[++i].opt); +} static int smmu_pmu_probe(struct platform_device *pdev) { @@ -801,7 +832,10 @@ static int smmu_pmu_probe(struct platform_device *pdev) return -EINVAL; } - smmu_pmu_get_acpi_options(smmu_pmu); + if (dev->of_node) + smmu_pmu_get_dt_options(smmu_pmu); + else + smmu_pmu_get_acpi_options(smmu_pmu); /* Pick one CPU to be the preferred one to use */ smmu_pmu->on_cpu = raw_smp_processor_id(); @@ -855,9 +889,15 @@ static void smmu_pmu_shutdown(struct platform_device *pdev) smmu_pmu_disable(&smmu_pmu->pmu); } +static const struct of_device_id smmu_pmu_of_match[] = { + { .compatible = "arm-smmu-v3-pmcg", }, + { }, +}; + static struct platform_driver smmu_pmu_driver = { .driver = { .name = "arm-smmu-v3-pmcg", + .of_match_table = smmu_pmu_of_match, }, .probe = smmu_pmu_probe, .remove = smmu_pmu_remove, -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel