From: Marc Zyngier Date: Mon, 25 Jan 2016 17:31:13 +0000 (+0000) Subject: arm64: perf: Count EL2 events if the kernel is running in HYP X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d98ecdaca296815b3c4d11032b3699af6b49b70b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git arm64: perf: Count EL2 events if the kernel is running in HYP When the kernel is running in HYP (with VHE), it is necessary to include EL2 events if the user requests counting kernel or hypervisor events. Reviewed-by: Christoffer Dall Acked-by: Catalin Marinas Acked-by: Will Deacon Signed-off-by: Marc Zyngier --- diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index f7ab14c4d5df..1b52269ffa87 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -691,9 +692,12 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, if (attr->exclude_idle) return -EPERM; + if (is_kernel_in_hyp_mode() && + attr->exclude_kernel != attr->exclude_hv) + return -EINVAL; if (attr->exclude_user) config_base |= ARMV8_EXCLUDE_EL0; - if (attr->exclude_kernel) + if (!is_kernel_in_hyp_mode() && attr->exclude_kernel) config_base |= ARMV8_EXCLUDE_EL1; if (!attr->exclude_hv) config_base |= ARMV8_INCLUDE_EL2;