Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1365599rdb; Wed, 16 Aug 2023 09:19:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbdynm+nxWbJLGQBTYCVUDkGXAhZKJF80/qiRkPTmCgJ6A3vCCi6KD1xE+krlfUbU+PavS X-Received: by 2002:a05:6a00:a93:b0:687:570:5021 with SMTP id b19-20020a056a000a9300b0068705705021mr2815395pfl.15.1692202767598; Wed, 16 Aug 2023 09:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692202767; cv=none; d=google.com; s=arc-20160816; b=tdLTQZVoRtrTEJ3fSvRjlhZV1dDc3q0kP3NUUJfW1xoJETcsVFpRGMH71tCJrl1x6w tjnpMYgWaZfJMJZSqHV+lyEJYXc6+Kf3NEu/gUStbCuA0fdcrULcRr10SQeaFD65/bBp 9hKALwEbB6j4dVdZcPZHKmoqY8NoAepWJQ57ZaELWxR2FOSLnA8OJCQC7D5YwXUQLZdQ 8XYy8LniIakMwNdFUDjOzgPLkOg9iGtAjUqN9JmhjVNjpSVTUbq+3N+Um7oswFjcmtU7 IVEUDcmb2iGMEfAg6cvo5cthsWMkhNXfSgKlKUSw6TmY+F2wMDP1vB446/VQEE6FGc1J /i7w== 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=QcK3nQNHoOFWD0ADyMhjGoWjgte2qdMw9ZaOUp+NXPs=; fh=VCSz7ql7/lGyrtPMCIiEfNyNHI4q4EVZv3PxvY3U0p0=; b=GR3hqk6icT4E5HMJmm0V7SGGAkZ/mac3eLFlLdIBCjCiX402FxQOon44R/NDYRsjpd zlw3uAT8dCrei2fCUZuJErpyQOku8FkFIDcJcFIo6x2e6+VLh6r4D8/M8sB5Y/1BoZhG c9kP/EKgsbKb0VBYb3iA17SJDf3pSwbKbcyCr4exGArNXH/gL66jcY56rUM5D8hxDDUQ oEQ8G6W4W5B99et6+f/Y7rLFrkqIeoA/CaxH7uSc4KU7tq8IpelJQRBHXz5uROalcgR7 a3oR0/UHVhdTcihaYFAEXEduIAKsLyk4qt2gs8D74+pHpapZEPw2v6C2uyQxTw2Sn7Hw W45Q== 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 c4-20020a63ea04000000b0056482047ae0si11614949pgi.723.2023.08.16.09.19.13; Wed, 16 Aug 2023 09:19:27 -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 S245756AbjHPOFh (ORCPT + 99 others); Wed, 16 Aug 2023 10:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbjHPOFT (ORCPT ); Wed, 16 Aug 2023 10:05:19 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96E12E48; Wed, 16 Aug 2023 07:05:18 -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 855F5D75; Wed, 16 Aug 2023 07:05:59 -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 ED8653F762; Wed, 16 Aug 2023 07:05:16 -0700 (PDT) Message-ID: <0530f1e5-7716-413d-a7cb-9378aa120c18@arm.com> Date: Wed, 16 Aug 2023 15:05:15 +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 3/4] perf: arm_cspmu: Support implementation specific validation 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-4-ilkka@os.amperecomputing.com> From: Suzuki K Poulose In-Reply-To: <20230815063526.9022-4-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 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: > Some platforms may use e.g. different filtering mechanism and, thus, > may need different way to validate the events and group. > > Signed-off-by: Ilkka Koskinen > Reviewed-by: Jonathan Cameron Reviewed-by: Suzuki K Poulose > --- > drivers/perf/arm_cspmu/arm_cspmu.c | 8 +++++++- > drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c > index 94f6856ec786..585ce96ac03f 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.c > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c > @@ -572,7 +572,7 @@ static void arm_cspmu_disable(struct pmu *pmu) > static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events, > struct perf_event *event) > { > - int idx; > + int idx, ret; > struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu); > > if (supports_cycle_counter(cspmu)) { > @@ -606,6 +606,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events, > if (idx >= cspmu->num_logical_ctrs) > return -EAGAIN; > > + if (cspmu->impl.ops.validate_event) { > + ret = cspmu->impl.ops.validate_event(cspmu, event); > + if (ret) > + return ret; > + } > + > set_bit(idx, hw_events->used_ctrs); > > return idx; > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h > index 274ca3d10578..05577f74b8a0 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.h > +++ b/drivers/perf/arm_cspmu/arm_cspmu.h > @@ -107,6 +107,9 @@ struct arm_cspmu_impl_ops { > /* Set event filter */ > void (*set_ev_filter)(struct arm_cspmu *cspmu, > struct hw_perf_event *hwc, u32 filter); > + /* Implementation specific event validation */ > + int (*validate_event)(struct arm_cspmu *cspmu, > + struct perf_event *event); > /* Hide/show unsupported events */ > umode_t (*event_attr_is_visible)(struct kobject *kobj, > struct attribute *attr, int unused);