lkml.org 
[lkml]   [2022]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [V2 PATCH 8/8] KVM: selftests: x86: xen: Execute cpu specific vmcall instruction
On Wed, Sep 21, 2022 at 2:47 PM David Matlack <dmatlack@google.com> wrote:
>
> On Thu, Sep 15, 2022 at 12:04:48AM +0000, Vishal Annapurve wrote:
> > Update xen specific hypercall invocation to execute cpu specific vmcall
> > instructions.
> >
> > Suggested-by: Sean Christopherson <seanjc@google.com>
> > Signed-off-by: Vishal Annapurve <vannapurve@google.com>
> > ---
> > .../selftests/kvm/x86_64/xen_shinfo_test.c | 64 +++++++------------
> > .../selftests/kvm/x86_64/xen_vmcall_test.c | 14 ++--
> > 2 files changed, 34 insertions(+), 44 deletions(-)
> > ...
> > diff --git a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
> > index 88914d48c65e..e78f1b5d3af8 100644
> > --- a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
> > +++ b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
> > @@ -37,10 +37,16 @@ static void guest_code(void)
> > register unsigned long r9 __asm__("r9") = ARGVALUE(6);
> >
> > /* First a direct invocation of 'vmcall' */
> > - __asm__ __volatile__("vmcall" :
> > - "=a"(rax) :
> > - "a"(rax), "D"(rdi), "S"(rsi), "d"(rdx),
> > - "r"(r10), "r"(r8), "r"(r9));
> > + if (is_amd_cpu())
> > + __asm__ __volatile__("vmmcall" :
> > + "=a"(rax) :
> > + "a"(rax), "D"(rdi), "S"(rsi), "d"(rdx),
> > + "r"(r10), "r"(r8), "r"(r9));
> > + else
> > + __asm__ __volatile__("vmcall" :
> > + "=a"(rax) :
> > + "a"(rax), "D"(rdi), "S"(rsi), "d"(rdx),
> > + "r"(r10), "r"(r8), "r"(r9));
>
> Can we create common helper functions or macros for doing hypercalls to
> reduce the amount of duplicated inline assembly?
>

Ack, will fix this in the next series.

> > GUEST_ASSERT(rax == RETVALUE);
> >
> > /* Fill in the Xen hypercall page */
> > --
> > 2.37.2.789.g6183377224-goog
> >

\
 
 \ /
  Last update: 2022-09-27 01:38    [W:0.085 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site