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

Re: [Xen-devel] [PATCH v1 2/2] hvm/svm: Implement CPUID events



On Tue, Feb 20, 2018 at 3:37 AM, Alexandru Stefan ISAILA
<aisaila@xxxxxxxxxxxxxxx> wrote:
> On Lu, 2018-02-19 at 08:25 -0700, Tamas K Lengyel wrote:
>> On Mon, Feb 19, 2018 at 6:07 AM, Alexandru Isaila
>> <aisaila@xxxxxxxxxxxxxxx> wrote:
>> >
>> > At this moment the CPUID events for the AMD architecture are not
>> > forwarded to the monitor layer.
>> >
>> > This patch adds the CPUID event to the common capabilities and then
>> > forwards the event to the monitor layer.
>> >
>> > Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
>> > ---
>> >  xen/arch/x86/hvm/svm/svm.c    | 8 +++++++-
>> >  xen/include/asm-x86/monitor.h | 2 +-
>> >  2 files changed, 8 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/xen/arch/x86/hvm/svm/svm.c
>> > b/xen/arch/x86/hvm/svm/svm.c
>> > index e36ad05..0f1c57d 100644
>> > --- a/xen/arch/x86/hvm/svm/svm.c
>> > +++ b/xen/arch/x86/hvm/svm/svm.c
>> > @@ -1804,6 +1804,7 @@ static void svm_vmexit_do_cpuid(struct
>> > cpu_user_regs *regs)
>> >      struct vcpu *curr = current;
>> >      unsigned int inst_len;
>> >      struct cpuid_leaf res;
>> > +    int rc = 0;
>> >
>> >      if ( (inst_len = __get_instruction_length(curr, INSTR_CPUID))
>> > == 0 )
>> >          return;
>> > @@ -1822,7 +1823,12 @@ static void svm_vmexit_do_cpuid(struct
>> > cpu_user_regs *regs)
>> >      regs->rcx = res.c;
>> >      regs->rdx = res.d;
>> >
>> > -    __update_guest_eip(regs, inst_len);
>> > +    rc = hvm_monitor_cpuid(inst_len, regs->eax, regs->ecx);
>> > +
>> > +    if ( !rc )
>> Missing the rc < 0 case handling.
> Hi Tamas,
>
> I think we can resolve this in 2 ways:
> 1. I do it like on the vmx side and take the __update_guest_eip out of
> the function, return the result from hvm_monitor_cpuid and handle the
> result in the case statement.

+1, I think it helps if the flow is the same across vmx and svm as
much as possible.

Thanks,
Tamas

_______________________________________________
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®.