#include <linux/kvm_host.h>
#include <linux/perf_event.h>
Go to the source code of this file.
◆ PMEVTYPER_CASES
#define PMEVTYPER_CASES |
( |
|
readwrite | ) |
|
Definition at line 74 of file pmu.c.
◆ PMEVTYPER_READ_CASE
#define PMEVTYPER_READ_CASE |
( |
|
idx | ) |
|
Value: case idx: \
return read_sysreg(pmevtyper##idx##_el0)
Definition at line 65 of file pmu.c.
◆ PMEVTYPER_WRITE_CASE
#define PMEVTYPER_WRITE_CASE |
( |
|
idx | ) |
|
Value: case idx: \
write_sysreg(val, pmevtyper##idx##_el0); \
break
Definition at line 69 of file pmu.c.
◆ DEFINE_PER_CPU()
static DEFINE_PER_CPU |
( |
struct kvm_pmu_events |
, |
|
|
kvm_pmu_events |
|
|
) |
| |
|
static |
◆ kvm_clr_pmu_events()
void kvm_clr_pmu_events |
( |
u32 |
clr | ) |
|
Definition at line 54 of file pmu.c.
61 pmu->events_host &= ~clr;
62 pmu->events_guest &= ~clr;
static bool kvm_arm_support_pmu_v3(void)
struct kvm_pmu_events * kvm_get_pmu_events(void)
◆ kvm_get_pmu_events()
struct kvm_pmu_events* kvm_get_pmu_events |
( |
void |
| ) |
|
Definition at line 29 of file pmu.c.
31 return this_cpu_ptr(&kvm_pmu_events);
◆ kvm_pmu_switch_needed()
static bool kvm_pmu_switch_needed |
( |
struct perf_event_attr * |
attr | ) |
|
|
static |
With VHE the guest kernel runs at EL1 and the host at EL2, where user (EL0) is excluded then we have no reason to switch counters.
Definition at line 15 of file pmu.c.
22 if (has_vhe() && attr->exclude_user)
26 return (attr->exclude_host != attr->exclude_guest);
◆ kvm_set_pmu_events()
void kvm_set_pmu_events |
( |
u32 |
set, |
|
|
struct perf_event_attr * |
attr |
|
) |
| |
Definition at line 38 of file pmu.c.
45 if (!attr->exclude_host)
46 pmu->events_host |= set;
47 if (!attr->exclude_guest)
48 pmu->events_guest |= set;
static bool kvm_pmu_switch_needed(struct perf_event_attr *attr)
◆ kvm_set_pmuserenr()
bool kvm_set_pmuserenr |
( |
u64 |
val | ) |
|
Definition at line 223 of file pmu.c.
225 struct kvm_cpu_context *hctxt;
226 struct kvm_vcpu *vcpu;
232 if (!vcpu || !vcpu_get_flag(vcpu, PMUSERENR_ON_CPU))
235 hctxt = &this_cpu_ptr(&kvm_host_data)->host_ctxt;
236 ctxt_sys_reg(hctxt, PMUSERENR_EL0) = val;
struct kvm_vcpu * kvm_get_running_vcpu(void)
◆ kvm_vcpu_pmu_disable_el0()
static void kvm_vcpu_pmu_disable_el0 |
( |
unsigned long |
events | ) |
|
|
static |
Definition at line 158 of file pmu.c.
163 for_each_set_bit(counter, &events, 32) {
165 typer |= ARMV8_PMU_EXCLUDE_EL0;
static u64 kvm_vcpu_pmu_read_evtype_direct(int idx)
static void kvm_vcpu_pmu_write_evtype_direct(int idx, u32 val)
◆ kvm_vcpu_pmu_enable_el0()
static void kvm_vcpu_pmu_enable_el0 |
( |
unsigned long |
events | ) |
|
|
static |
Definition at line 143 of file pmu.c.
148 for_each_set_bit(counter, &events, 32) {
150 typer &= ~ARMV8_PMU_EXCLUDE_EL0;
◆ kvm_vcpu_pmu_read_evtype_direct()
static u64 kvm_vcpu_pmu_read_evtype_direct |
( |
int |
idx | ) |
|
|
static |
Definition at line 111 of file pmu.c.
116 return read_sysreg(pmccfiltr_el0);
#define ARMV8_PMU_CYCLE_IDX
#define PMEVTYPER_CASES(readwrite)
◆ kvm_vcpu_pmu_restore_guest()
void kvm_vcpu_pmu_restore_guest |
( |
struct kvm_vcpu * |
vcpu | ) |
|
Definition at line 176 of file pmu.c.
178 struct kvm_pmu_events *pmu;
179 u32 events_guest, events_host;
186 events_guest = pmu->events_guest;
187 events_host = pmu->events_host;
static void kvm_vcpu_pmu_enable_el0(unsigned long events)
static void kvm_vcpu_pmu_disable_el0(unsigned long events)
◆ kvm_vcpu_pmu_restore_host()
void kvm_vcpu_pmu_restore_host |
( |
struct kvm_vcpu * |
vcpu | ) |
|
Definition at line 197 of file pmu.c.
199 struct kvm_pmu_events *pmu;
200 u32 events_guest, events_host;
206 events_guest = pmu->events_guest;
207 events_host = pmu->events_host;
◆ kvm_vcpu_pmu_resync_el0()
void kvm_vcpu_pmu_resync_el0 |
( |
void |
| ) |
|
Definition at line 244 of file pmu.c.
246 struct kvm_vcpu *vcpu;
248 if (!has_vhe() || !in_interrupt())
255 kvm_make_request(KVM_REQ_RESYNC_PMU_EL0, vcpu);
◆ kvm_vcpu_pmu_write_evtype_direct()
static void kvm_vcpu_pmu_write_evtype_direct |
( |
int |
idx, |
|
|
u32 |
val |
|
) |
| |
|
static |
Definition at line 128 of file pmu.c.
133 write_sysreg(val, pmccfiltr_el0);