mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 17:56:45 +07:00
b0e89590f4
Once upon a time, OProfile and Perf fought hard over who could play with the PMU. To stop all hell from breaking loose, pmu.c offered an internal reserve/release API and took care of parsing PMU platform data passed in from board support code. Now that Perf has ingested OProfile, let's move the platform device handling into the Perf driver and out of the PMU locking code. Unfortunately, the lock has to remain to prevent Perf being bitten by out-of-tree modules such as LTTng, which still claim a right to the PMU when Perf isn't looking. Acked-by: Jamie Iles <jamie@jamieiles.com> Reviewed-by: Jean Pihet <j-pihet@ti.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
36 lines
798 B
C
36 lines
798 B
C
/*
|
|
* linux/arch/arm/kernel/pmu.c
|
|
*
|
|
* Copyright (C) 2009 picoChip Designs Ltd, Jamie Iles
|
|
* Copyright (C) 2010 ARM Ltd, Will Deacon
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
*/
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
|
|
#include <asm/pmu.h>
|
|
|
|
/*
|
|
* PMU locking to ensure mutual exclusion between different subsystems.
|
|
*/
|
|
static unsigned long pmu_lock[BITS_TO_LONGS(ARM_NUM_PMU_DEVICES)];
|
|
|
|
int
|
|
reserve_pmu(enum arm_pmu_type type)
|
|
{
|
|
return test_and_set_bit_lock(type, pmu_lock) ? -EBUSY : 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(reserve_pmu);
|
|
|
|
void
|
|
release_pmu(enum arm_pmu_type type)
|
|
{
|
|
clear_bit_unlock(type, pmu_lock);
|
|
}
|