[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 4/4] hvm/svm: Enable CR events



On Thu, Feb 8, 2018 at 8:25 AM, Alexandru Isaila
<aisaila@xxxxxxxxxxxxxxx> wrote:
> This commit enables controlregister events for svm.

So this patch enables the event to trigger but where is it being
handled and forwarded to the monitor ring?

>
> Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
> ---
>  xen/arch/x86/hvm/svm/svm.c    | 11 +++++++++++
>  xen/include/asm-x86/monitor.h |  6 +++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> index 1eadab4..311902f 100644
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -60,6 +60,7 @@
>  #include <asm/apic.h>
>  #include <asm/debugger.h>
>  #include <asm/hvm/monitor.h>
> +#include <asm/monitor.h>
>  #include <asm/xstate.h>
>
>  void svm_asm_do_resume(void);
> @@ -560,6 +561,16 @@ void svm_update_guest_cr(struct vcpu *v, unsigned int cr)
>                  svm_fpu_enter(v);
>          }
>
> +        if ( paging_mode_hap(v->domain) )
> +        {
> +            uint32_t intercepts = vmcb_get_cr_intercepts(vmcb);
> +
> +            /* Trap CR3 updates if CR3 memory events are enabled. */
> +            if ( v->domain->arch.monitor.write_ctrlreg_enabled &
> +                 monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) )
> +               vmcb_set_cr_intercepts(vmcb, intercepts | 
> CR_INTERCEPT_CR3_WRITE);
> +        }
> +
>          value = v->arch.hvm_vcpu.guest_cr[0] | hw_cr0_mask;
>          if ( !paging_mode_hap(v->domain) )
>              value |= X86_CR0_PG | X86_CR0_WP;
> diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
> index 138c463..b80d217 100644
> --- a/xen/include/asm-x86/monitor.h
> +++ b/xen/include/asm-x86/monitor.h
> @@ -79,8 +79,7 @@ static inline uint32_t arch_monitor_get_capabilities(struct 
> domain *d)
>
>      if( cpu_has_vmx )
>      {
> -        capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) |
> -                       (1U << XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION) |
> +        capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION) |
>                         (1U << XEN_DOMCTL_MONITOR_EVENT_CPUID) |
>                         (1U << XEN_DOMCTL_MONITOR_EVENT_INTERRUPT) |
>                         (1U << XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED);
> @@ -92,7 +91,8 @@ static inline uint32_t arch_monitor_get_capabilities(struct 
> domain *d)
>
>      capabilities |= ((1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST) |
>                      (1U << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) |
> -                    (1U << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR));
> +                    (1U << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) |
> +                    (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG));
>
>      if ( hvm_funcs.set_descriptor_access_exiting )
>          capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS);
> --
> 2.7.4

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.