Lines Matching refs:vpmu

94 #define msr_bitmap_on(vpmu)    do {                                    \  argument
95 (vpmu)->priv_context = (void *)-1L; \
97 #define msr_bitmap_off(vpmu) do { \ argument
98 (vpmu)->priv_context = NULL; \
100 #define is_msr_bitmap_on(vpmu) ((vpmu)->priv_context != NULL) argument
170 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_set_msr_bitmap() local
178 msr_bitmap_on(vpmu); in amd_vpmu_set_msr_bitmap()
184 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_unset_msr_bitmap() local
192 msr_bitmap_off(vpmu); in amd_vpmu_unset_msr_bitmap()
203 struct vpmu_struct *vpmu = vcpu_vpmu(v); in context_load() local
204 struct xen_pmu_amd_ctxt *ctxt = vpmu->context; in context_load()
217 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_load() local
222 vpmu_reset(vpmu, VPMU_FROZEN); in amd_vpmu_load()
224 if ( !from_guest && vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) ) in amd_vpmu_load()
226 ctxt = vpmu->context; in amd_vpmu_load()
238 struct xen_pmu_amd_ctxt *guest_ctxt = &vpmu->xenpmu_data->pmu.c.amd; in amd_vpmu_load()
242 ctxt = vpmu->context; in amd_vpmu_load()
264 vpmu_set(vpmu, VPMU_RUNNING); in amd_vpmu_load()
266 vpmu_reset(vpmu, VPMU_RUNNING); in amd_vpmu_load()
269 vpmu_set(vpmu, VPMU_CONTEXT_LOADED); in amd_vpmu_load()
279 struct vpmu_struct *vpmu = vcpu_vpmu(v); in context_save() local
280 struct xen_pmu_amd_ctxt *ctxt = vpmu->context; in context_save()
290 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_save() local
297 if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_SAVE) ) in amd_vpmu_save()
299 vpmu_set(vpmu, VPMU_FROZEN); in amd_vpmu_save()
303 if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) ) in amd_vpmu_save()
308 if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) && in amd_vpmu_save()
309 is_msr_bitmap_on(vpmu) ) in amd_vpmu_save()
317 ctxt = vpmu->context; in amd_vpmu_save()
318 guest_ctxt = &vpmu->xenpmu_data->pmu.c.amd; in amd_vpmu_save()
329 struct vpmu_struct *vpmu = vcpu_vpmu(v); in context_update() local
330 struct xen_pmu_amd_ctxt *ctxt = vpmu->context; in context_update()
359 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_do_wrmsr() local
378 is_pmu_enabled(msr_content) && !vpmu_is_set(vpmu, VPMU_RUNNING) ) in amd_vpmu_do_wrmsr()
382 vpmu_set(vpmu, VPMU_RUNNING); in amd_vpmu_do_wrmsr()
384 if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) ) in amd_vpmu_do_wrmsr()
390 (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) ) in amd_vpmu_do_wrmsr()
392 vpmu_reset(vpmu, VPMU_RUNNING); in amd_vpmu_do_wrmsr()
393 if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) ) in amd_vpmu_do_wrmsr()
398 if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) in amd_vpmu_do_wrmsr()
399 || vpmu_is_set(vpmu, VPMU_FROZEN) ) in amd_vpmu_do_wrmsr()
402 vpmu_set(vpmu, VPMU_CONTEXT_LOADED); in amd_vpmu_do_wrmsr()
403 vpmu_reset(vpmu, VPMU_FROZEN); in amd_vpmu_do_wrmsr()
417 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_do_rdmsr() local
419 if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) in amd_vpmu_do_rdmsr()
420 || vpmu_is_set(vpmu, VPMU_FROZEN) ) in amd_vpmu_do_rdmsr()
423 vpmu_set(vpmu, VPMU_CONTEXT_LOADED); in amd_vpmu_do_rdmsr()
424 vpmu_reset(vpmu, VPMU_FROZEN); in amd_vpmu_do_rdmsr()
434 struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_destroy() local
436 if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) ) in amd_vpmu_destroy()
439 xfree(vpmu->context); in amd_vpmu_destroy()
440 vpmu->context = NULL; in amd_vpmu_destroy()
441 vpmu->priv_context = NULL; in amd_vpmu_destroy()
443 if ( vpmu_is_set(vpmu, VPMU_RUNNING) ) in amd_vpmu_destroy()
446 vpmu_clear(vpmu); in amd_vpmu_destroy()
452 const struct vpmu_struct *vpmu = vcpu_vpmu(v); in amd_vpmu_dump() local
453 const struct xen_pmu_amd_ctxt *ctxt = vpmu->context; in amd_vpmu_dump()
458 printk(" VPMU state: 0x%x ", vpmu->flags); in amd_vpmu_dump()
459 if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) ) in amd_vpmu_dump()
466 if ( vpmu_is_set(vpmu, VPMU_PASSIVE_DOMAIN_ALLOCATED) ) in amd_vpmu_dump()
468 if ( vpmu_is_set(vpmu, VPMU_FROZEN) ) in amd_vpmu_dump()
470 if ( vpmu_is_set(vpmu, VPMU_CONTEXT_SAVE) ) in amd_vpmu_dump()
472 if ( vpmu_is_set(vpmu, VPMU_RUNNING) ) in amd_vpmu_dump()
474 if ( vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) ) in amd_vpmu_dump()
503 struct vpmu_struct *vpmu = vcpu_vpmu(v); in svm_vpmu_initialise() local
524 vpmu->context = ctxt; in svm_vpmu_initialise()
525 vpmu->priv_context = NULL; in svm_vpmu_initialise()
530 ASSERT(vpmu->xenpmu_data); in svm_vpmu_initialise()
531 memcpy(&vpmu->xenpmu_data->pmu.c.amd, ctxt, in svm_vpmu_initialise()
535 vpmu->arch_vpmu_ops = &amd_vpmu_ops; in svm_vpmu_initialise()
537 vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED); in svm_vpmu_initialise()