Commit d98ecdac authored by Marc Zyngier's avatar Marc Zyngier

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: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 5f05a72a
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#include <asm/virt.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/perf/arm_pmu.h> #include <linux/perf/arm_pmu.h>
...@@ -691,9 +692,12 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, ...@@ -691,9 +692,12 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
if (attr->exclude_idle) if (attr->exclude_idle)
return -EPERM; return -EPERM;
if (is_kernel_in_hyp_mode() &&
attr->exclude_kernel != attr->exclude_hv)
return -EINVAL;
if (attr->exclude_user) if (attr->exclude_user)
config_base |= ARMV8_EXCLUDE_EL0; config_base |= ARMV8_EXCLUDE_EL0;
if (attr->exclude_kernel) if (!is_kernel_in_hyp_mode() && attr->exclude_kernel)
config_base |= ARMV8_EXCLUDE_EL1; config_base |= ARMV8_EXCLUDE_EL1;
if (!attr->exclude_hv) if (!attr->exclude_hv)
config_base |= ARMV8_INCLUDE_EL2; config_base |= ARMV8_INCLUDE_EL2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment