xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "tamas@tklengyel.com" <tamas@tklengyel.com>
Cc: "suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>,
	"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v2 4/4] hvm/svm: Enable CR events
Date: Fri, 9 Feb 2018 13:10:06 +0000	[thread overview]
Message-ID: <1518181806.4963.8.camel@bitdefender.com> (raw)
In-Reply-To: <CABfawhkTv3-+61+PTB5msrQDy49wx98SSmcp_zyD7PhNf9GTBg@mail.gmail.com>

On Jo, 2018-02-08 at 11:06 -0700, Tamas K Lengyel wrote:
> On Thu, Feb 8, 2018 at 8:25 AM, Alexandru Isaila
> <aisaila@bitdefender.com> 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?
Hi Tamas,

If I've understand your question right, this is handled, like on the
vmx side, on a special case on CR0. If this is not what you are looking
for can you please clarify the question.

Alex
>
> >
> >
> > Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
> > ---
> >  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

________________________
This email was scanned by Bitdefender
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-02-09 13:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 15:25 [PATCH v2 0/4] hvm/svm: Enable vm events for SVM Alexandru Isaila
2018-02-08 15:25 ` [PATCH v2 1/4] asm-x86/monitor: Enable svm monitor events Alexandru Isaila
2018-02-08 18:00   ` Tamas K Lengyel
2018-02-09 10:28   ` George Dunlap
2018-02-09 10:54     ` George Dunlap
2018-02-09 16:21     ` Tamas K Lengyel
2018-02-21 11:50       ` George Dunlap
2018-02-10 16:30   ` Boris Ostrovsky
2018-02-10 19:51     ` Boris Ostrovsky
2018-02-08 15:25 ` [PATCH v2 2/4] hvm/svm: Enable Breakpoint events Alexandru Isaila
2018-02-08 18:03   ` Tamas K Lengyel
2018-02-09 10:31   ` George Dunlap
2018-02-10 16:31   ` Boris Ostrovsky
2018-02-08 15:25 ` [PATCH v2 3/4] hvm/svm: Enable MSR events Alexandru Isaila
2018-02-08 18:04   ` Tamas K Lengyel
2018-02-09 10:37   ` George Dunlap
2018-02-09 11:03     ` Alexandru Stefan ISAILA
2018-02-10 16:33   ` Boris Ostrovsky
2018-02-10 20:26     ` Boris Ostrovsky
2018-02-08 15:25 ` [PATCH v2 4/4] hvm/svm: Enable CR events Alexandru Isaila
2018-02-08 18:06   ` Tamas K Lengyel
2018-02-09 13:10     ` Alexandru Stefan ISAILA [this message]
2018-02-09 16:24       ` Tamas K Lengyel
2018-02-09 16:41       ` George Dunlap
2018-02-09 16:25   ` Tamas K Lengyel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518181806.4963.8.camel@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tamas@tklengyel.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).