Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1840661rdb; Thu, 17 Aug 2023 03:52:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEolLRdtDLLk/GDIV+GQJNtgPeCpxXHuaVv8RqoPou3vXgCHyDy+WHf5EJIeAzxnm6wLTxR X-Received: by 2002:aa7:d1ce:0:b0:523:d1e0:7079 with SMTP id g14-20020aa7d1ce000000b00523d1e07079mr3694175edp.21.1692269557754; Thu, 17 Aug 2023 03:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692269557; cv=none; d=google.com; s=arc-20160816; b=c/ucnRGxbDCK1K22tTATUIxLRgANBFkaDeSnBWrDo17I18oRDFqvCEO88foWOjWTr2 tCC2WGo6EV+eBjHV9PajQbiFurlF5j/9esj26DI79BnnC8DZ4c+eioNo4J+22CtgqV5L 6BHBQKrifI/jdAjTHzvME9Olr4730Nvy+sOSlPaWcskMfYEQSiLdueXgt+xwML58juKj /NfAZsK/X/Rn1lyUFrg09bxhF9y1MozuzqkeZIebp2pqH20zaN7lALhqWJF3u3UZBJC3 skxsE3zu2//0DkuSFA5Yzm4r5aMmf6pe9an7XDx2Xumvb6mLxsdudggqpnnxv6wsXqez tJuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ykzMY+a699yEQpWVMzfhq7zxKSgV+HY1q13/ga9vyWA=; fh=VCSz7ql7/lGyrtPMCIiEfNyNHI4q4EVZv3PxvY3U0p0=; b=YBJpZLcg/kgAhoILA0qRbT+uXmDcZ4sHYrnjXElzbsyRigEdcHqcp6R3+71eRtcO/Z lO1nduYic8ySfhm7CX71ftYHZ9j8pY/unVKTdGBnTXq6MkMOSliv2UY3K6I0KYuRUTDR 3khsIail8OwK5MhHJJEk7b0ECroLtaXlucjffa1UGAe3OYRf+VNO46+K4LINxK04eVZs 1jeP3qc7yDP/TquETQpgNErhSVodM/WhNUc8cCY++GcOA0kJLiI5Am7KPdCmnqSwaEdz 1gaRPTXLn9iPxTwmYw+t9iv/7FLs67WX7NjSEN6cexJEY/ZfBEBYF6JVIvbrmGQtHsdm xZlw== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u22-20020aa7d0d6000000b00523409dcaabsi12920798edo.617.2023.08.17.03.52.10; Thu, 17 Aug 2023 03:52:37 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245743AbjHPOEA (ORCPT + 99 others); Wed, 16 Aug 2023 10:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343500AbjHPODv (ORCPT ); Wed, 16 Aug 2023 10:03:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0681226B2; Wed, 16 Aug 2023 07:03:49 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF7A5D75; Wed, 16 Aug 2023 07:04:30 -0700 (PDT) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 318B43F762; Wed, 16 Aug 2023 07:03:48 -0700 (PDT) Message-ID: Date: Wed, 16 Aug 2023 15:03:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v6 2/4] perf: arm_cspmu: Support implementation specific filters Content-Language: en-US To: Ilkka Koskinen , Will Deacon , Robin Murphy , Besar Wicaksono , Jonathan Cameron , Mark Rutland , Jonathan Corbet Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20230815063526.9022-1-ilkka@os.amperecomputing.com> <20230815063526.9022-3-ilkka@os.amperecomputing.com> From: Suzuki K Poulose In-Reply-To: <20230815063526.9022-3-ilkka@os.amperecomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 15/08/2023 07:35, Ilkka Koskinen wrote: > ARM Coresight PMU architecture specification [1] defines PMEVTYPER and > PMEVFILT* registers as optional in Chapter 2.1. Moreover, implementers may > choose to use PMIMPDEF* registers (offset: 0xD80-> 0xDFF) to filter the > events. Add support for those by adding implementation specific filter > callback function. > > [1] https://developer.arm.com/documentation/ihi0091/latest > > Signed-off-by: Ilkka Koskinen > Reviewed-by: Besar Wicaksono Reviewed-by: Suzuki K Poulose > --- > drivers/perf/arm_cspmu/arm_cspmu.c | 12 ++++++++---- > drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++ > 2 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c > index 6387cbad7a7d..94f6856ec786 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.c > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c > @@ -116,6 +116,9 @@ static unsigned long arm_cspmu_cpuhp_state; > > static DEFINE_MUTEX(arm_cspmu_lock); > > +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, > + struct hw_perf_event *hwc, u32 filter); > + > static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev) > { > return *(struct acpi_apmt_node **)dev_get_platdata(dev); > @@ -450,6 +453,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu) > CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type); > CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter); > CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible); > + CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter); > > return 0; > } > @@ -811,9 +815,9 @@ static inline void arm_cspmu_set_event(struct arm_cspmu *cspmu, > writel(hwc->config, cspmu->base0 + offset); > } > > -static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, > - struct hw_perf_event *hwc, > - u32 filter) > +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, > + struct hw_perf_event *hwc, > + u32 filter) > { > u32 offset = PMEVFILTR + (4 * hwc->idx); > > @@ -845,7 +849,7 @@ static void arm_cspmu_start(struct perf_event *event, int pmu_flags) > arm_cspmu_set_cc_filter(cspmu, filter); > } else { > arm_cspmu_set_event(cspmu, hwc); > - arm_cspmu_set_ev_filter(cspmu, hwc, filter); > + cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter); > } > > hwc->state = 0; > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h > index e5c6dff2ce7f..274ca3d10578 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.h > +++ b/drivers/perf/arm_cspmu/arm_cspmu.h > @@ -104,6 +104,9 @@ struct arm_cspmu_impl_ops { > u32 (*event_type)(const struct perf_event *event); > /* Decode filter value from configs */ > u32 (*event_filter)(const struct perf_event *event); > + /* Set event filter */ > + void (*set_ev_filter)(struct arm_cspmu *cspmu, > + struct hw_perf_event *hwc, u32 filter); > /* Hide/show unsupported events */ > umode_t (*event_attr_is_visible)(struct kobject *kobj, > struct attribute *attr, int unused);