.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
1 | 2 | /* |
---|
2 | | - * This program is free software; you can redistribute it and/or modify |
---|
3 | | - * it under the terms of the GNU General Public License as published by |
---|
4 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
5 | | - * (at your option) any later version. |
---|
6 | | - * |
---|
7 | | - * This program is distributed in the hope that it will be useful, |
---|
8 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | | - * GNU General Public License for more details. |
---|
11 | | - * |
---|
12 | | - * You should have received a copy of the GNU General Public License |
---|
13 | | - * along with this program; if not, write to the Free Software |
---|
14 | | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
15 | | - * |
---|
16 | 3 | * Copyright (C) 2007 Alan Stern |
---|
17 | 4 | * Copyright (C) IBM Corporation, 2009 |
---|
18 | 5 | * Copyright (C) 2009, Frederic Weisbecker <fweisbec@gmail.com> |
---|
.. | .. |
---|
226 | 213 | list_del(&bp->hw.bp_list); |
---|
227 | 214 | } |
---|
228 | 215 | |
---|
| 216 | +__weak int arch_reserve_bp_slot(struct perf_event *bp) |
---|
| 217 | +{ |
---|
| 218 | + return 0; |
---|
| 219 | +} |
---|
| 220 | + |
---|
| 221 | +__weak void arch_release_bp_slot(struct perf_event *bp) |
---|
| 222 | +{ |
---|
| 223 | +} |
---|
| 224 | + |
---|
229 | 225 | /* |
---|
230 | 226 | * Function to perform processor-specific cleanup during unregistration |
---|
231 | 227 | */ |
---|
.. | .. |
---|
238 | 234 | } |
---|
239 | 235 | |
---|
240 | 236 | /* |
---|
241 | | - * Contraints to check before allowing this new breakpoint counter: |
---|
| 237 | + * Constraints to check before allowing this new breakpoint counter: |
---|
242 | 238 | * |
---|
243 | 239 | * == Non-pinned counter == (Considered as pinned for now) |
---|
244 | 240 | * |
---|
.. | .. |
---|
283 | 279 | struct bp_busy_slots slots = {0}; |
---|
284 | 280 | enum bp_type_idx type; |
---|
285 | 281 | int weight; |
---|
| 282 | + int ret; |
---|
286 | 283 | |
---|
287 | 284 | /* We couldn't initialize breakpoint constraints on boot */ |
---|
288 | 285 | if (!constraints_initialized) |
---|
.. | .. |
---|
307 | 304 | if (slots.pinned + (!!slots.flexible) > nr_slots[type]) |
---|
308 | 305 | return -ENOSPC; |
---|
309 | 306 | |
---|
| 307 | + ret = arch_reserve_bp_slot(bp); |
---|
| 308 | + if (ret) |
---|
| 309 | + return ret; |
---|
| 310 | + |
---|
310 | 311 | toggle_bp_slot(bp, true, type, weight); |
---|
311 | 312 | |
---|
312 | 313 | return 0; |
---|
.. | .. |
---|
330 | 331 | enum bp_type_idx type; |
---|
331 | 332 | int weight; |
---|
332 | 333 | |
---|
| 334 | + arch_release_bp_slot(bp); |
---|
| 335 | + |
---|
333 | 336 | type = find_slot_idx(bp_type); |
---|
334 | 337 | weight = hw_breakpoint_weight(bp); |
---|
335 | 338 | toggle_bp_slot(bp, false, type, weight); |
---|