Skip to content

Commit 8be86a5

Browse files
author
Marc Zyngier
committed
KVM: arm64: Document PMU filtering API
Add a small blurb describing how the event filtering API gets used. Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 88865be commit 8be86a5

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎Documentation/virt/kvm/devices/vcpu.rst‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,52 @@ Request the initialization of the PMUv3. If using the PMUv3 with an in-kernel
5555
virtual GIC implementation, this must be done after initializing the in-kernel
5656
irqchip.
5757

58+
1.3 ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_FILTER
59+
-----------------------------------------
60+
61+
:Parameters: in kvm_device_attr.addr the address for a PMU event filter is a
62+
pointer to a struct kvm_pmu_event_filter
63+
64+
:Returns:
65+
66+
======= ======================================================
67+
-ENODEV: PMUv3 not supported or GIC not initialized
68+
-ENXIO: PMUv3 not properly configured or in-kernel irqchip not
69+
configured as required prior to calling this attribute
70+
-EBUSY: PMUv3 already initialized
71+
-EINVAL: Invalid filter range
72+
======= ======================================================
73+
74+
Request the installation of a PMU event filter described as follows:
75+
76+
struct kvm_pmu_event_filter {
77+
__u16 base_event;
78+
__u16 nevents;
79+
80+
#define KVM_PMU_EVENT_ALLOW 0
81+
#define KVM_PMU_EVENT_DENY 1
82+
83+
__u8 action;
84+
__u8 pad[3];
85+
};
86+
87+
A filter range is defined as the range [@base_event, @base_event + @nevents),
88+
together with an @action (KVM_PMU_EVENT_ALLOW or KVM_PMU_EVENT_DENY). The
89+
first registered range defines the global policy (global ALLOW if the first
90+
@action is DENY, global DENY if the first @action is ALLOW). Multiple ranges
91+
can be programmed, and must fit within the event space defined by the PMU
92+
architecture (10 bits on ARMv8.0, 16 bits from ARMv8.1 onwards).
93+
94+
Note: "Cancelling" a filter by registering the opposite action for the same
95+
range doesn't change the default action. For example, installing an ALLOW
96+
filter for event range [0:10) as the first filter and then applying a DENY
97+
action for the same range will leave the whole range as disabled.
98+
99+
Restrictions: Event 0 (SW_INCR) is never filtered, as it doesn't count a
100+
hardware event. Filtering event 0x1E (CHAIN) has no effect either, as it
101+
isn't strictly speaking an event. Filtering the cycle counter is possible
102+
using event 0x11 (CPU_CYCLES).
103+
58104

59105
2. GROUP: KVM_ARM_VCPU_TIMER_CTRL
60106
=================================

0 commit comments

Comments
 (0)