1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Branch Record Buffer Extension Helpers. 4 * 5 * Copyright (C) 2022-2025 ARM Limited 6 * 7 * Author: Anshuman Khandual <anshuman.khandual@arm.com> 8 */ 9 10 struct arm_pmu; 11 struct perf_branch_stack; 12 struct perf_event; 13 14 #ifdef CONFIG_ARM64_BRBE 15 void brbe_probe(struct arm_pmu *arm_pmu); 16 unsigned int brbe_num_branch_records(const struct arm_pmu *armpmu); 17 void brbe_invalidate(void); 18 19 void brbe_enable(const struct arm_pmu *arm_pmu); 20 void brbe_disable(void); 21 22 bool brbe_branch_attr_valid(struct perf_event *event); 23 void brbe_read_filtered_entries(struct perf_branch_stack *branch_stack, 24 const struct perf_event *event); 25 #else 26 static inline void brbe_probe(struct arm_pmu *arm_pmu) { } 27 static inline unsigned int brbe_num_branch_records(const struct arm_pmu *armpmu) 28 { 29 return 0; 30 } 31 32 static inline void brbe_invalidate(void) { } 33 34 static inline void brbe_enable(const struct arm_pmu *arm_pmu) { }; 35 static inline void brbe_disable(void) { }; 36 37 static inline bool brbe_branch_attr_valid(struct perf_event *event) 38 { 39 WARN_ON_ONCE(!has_branch_stack(event)); 40 return false; 41 } 42 43 static void brbe_read_filtered_entries(struct perf_branch_stack *branch_stack, 44 const struct perf_event *event) 45 { 46 } 47 #endif 48