From patchwork Thu Dec 8 08:43:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 31215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp77672wrr; Thu, 8 Dec 2022 00:45:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+baQsrPfPC8OMLLMFL26GUN/gdcIkXDdufKzPxA6U5+iMyXAUc5AkOVFa55L/1gOauu/X X-Received: by 2002:a17:902:f2ca:b0:189:ec2b:7ea4 with SMTP id h10-20020a170902f2ca00b00189ec2b7ea4mr9771272plc.170.1670489152474; Thu, 08 Dec 2022 00:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670489152; cv=none; d=google.com; s=arc-20160816; b=wj6Dwt5jzre92OGvrTofSBeUnTfIbS5UpnOBI/MkBCshPk4yKzTc/zP8OIUlNxZpWg hFmZsWx8yVWnOKa1qBlKvOwvjHA/Fpp7y0AXuGQTHZmdxN2eMlZnP6y7Z/meO+01kyQA mUSamEvapm/6Cx/HeuK/8ozRrMZyl0pophMoXWr9HXd/E/cVd69VVES59U2GzA8m7QWN CFsUeQMWiQ0WU+41UbXLMowQEMBL0KRXpZhYMSoMreBvEjV5/8VqoOfa50mt9H4j5wzP lfQI7s6EK4mp9Tdqehw3zgZyTWmpyodxqi7cI60ypk+/PwmH9pWmTkp/czJ0OJYenMdT xZyQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2E33+lKO4UoTZx+pZq7tIPPg4p65BWgW5X5iLw5LaqQ=; b=NxGP+vlVG/Hph+iG0K8luibC/RPst5GWrdmJvrURFZuIOuKl+AmopfgUxkHDSZHsZP wNWuGgxWzfaTiZ1CXaWYUfkVuoWoIUNfzQswuibJ/gbYUs/DHTJ0mpgRZj8QBw9Pz3le NYG+Q0V+JXRuIoJzrRVKKtm3gNhNHQUKucElr24cWQKYZLJX08nnIjrbSsPBzNMFTHlE /IMuEZTlKC8AVom/wB5F0pg9pJzB4z6QiOdMcj5qgU/fU1eT4Wjj+ji2f0e6J6HrA667 BxZjMDumJRkZ5Hin/bQ3EfAykdFOnqHbi4aECyqKWFBsreF3s/F6YjtW7ITHrFzE1F9E NcDA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020aa79401000000b0057723dd7a4bsi8405283pfo.38.2022.12.08.00.45.38; Thu, 08 Dec 2022 00:45:52 -0800 (PST) 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 S230110AbiLHIpM (ORCPT + 99 others); Thu, 8 Dec 2022 03:45:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbiLHIoo (ORCPT ); Thu, 8 Dec 2022 03:44:44 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 996A0E0FE; Thu, 8 Dec 2022 00:44:43 -0800 (PST) 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 1297123A; Thu, 8 Dec 2022 00:44:50 -0800 (PST) Received: from a077893.blr.arm.com (unknown [10.162.40.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 49CD83F73D; Thu, 8 Dec 2022 00:44:38 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Brown , James Clark , Rob Herring , Marc Zyngier , Suzuki Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: [PATCH V6 3/7] arm64/perf: Add branch stack support in struct arm_pmu Date: Thu, 8 Dec 2022 14:13:58 +0530 Message-Id: <20221208084402.863310-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221208084402.863310-1-anshuman.khandual@arm.com> References: <20221208084402.863310-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751634833434132310?= X-GMAIL-MSGID: =?utf-8?q?1751634833434132310?= This updates 'struct arm_pmu' for branch stack sampling support later. This adds a new 'features' element in the structure to track supported features, and another 'hw_attr' element to encapsulate implementation attributes on a given 'struct arm_pmu'. These updates here will help in tracking any branch stack sampling support, which is being added later. This also adds a helper arm_pmu_branch_stack_supported(). Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- include/linux/perf/arm_pmu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 60d4e4c9b3ea..8c4f42189904 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -80,11 +80,14 @@ enum armpmu_attr_groups { ARMPMU_NR_ATTR_GROUPS }; +#define ARM_PMU_BRANCH_STACK BIT(0) + struct arm_pmu { struct pmu pmu; cpumask_t supported_cpus; char *name; int pmuver; + int features; irqreturn_t (*handle_irq)(struct arm_pmu *pmu); void (*enable)(struct perf_event *event); void (*disable)(struct perf_event *event); @@ -119,8 +122,14 @@ struct arm_pmu { /* Only to be used by ACPI probing code */ unsigned long acpi_cpuid; + void *hw_attr; }; +static inline bool arm_pmu_branch_stack_supported(struct arm_pmu *armpmu) +{ + return armpmu->features & ARM_PMU_BRANCH_STACK; +} + #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) u64 armpmu_event_update(struct perf_event *event);