Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-10-12 Thread Shuo A Liu
On Mon 12.Oct'20 at 12:49:16 -0400, Arvind Sankar wrote: On Mon, Oct 12, 2020 at 04:44:31PM +0800, Shuo A Liu wrote: On Wed 30.Sep'20 at 12:14:03 -0700, Nick Desaulniers wrote: >On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: >> >> On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessen

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-10-12 Thread Arvind Sankar
On Mon, Oct 12, 2020 at 04:44:31PM +0800, Shuo A Liu wrote: > On Wed 30.Sep'20 at 12:14:03 -0700, Nick Desaulniers wrote: > >On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > >> > >> On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > >> > >> > Since this variable is a loc

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-10-12 Thread Shuo A Liu
On Wed 30.Sep'20 at 12:54:08 +0200, Borislav Petkov wrote: On Tue, Sep 22, 2020 at 07:42:58PM +0800, shuo.a@intel.com wrote: From: Shuo Liu The Service VM communicates with the hypervisor via conventional hypercalls. VMCALL instruction is used to make the hypercalls. ACRN hypercall ABI:

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-10-12 Thread Shuo A Liu
On Wed 30.Sep'20 at 12:14:03 -0700, Nick Desaulniers wrote: On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > Since this variable is a local register asm, on entry to the asm the > compiler guarantees that the value li

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 07:38:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 06:25:59PM -0500, Segher Boessenkool wrote: > > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > > Do we need register local storage here? > > > > Depends what you want. It looks like you

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 03:59:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra > > wrote: > > > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > > > > > Since thi

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 09:42:40PM +0200, Peter Zijlstra wrote: > > Looks like yes. You can even check different GCC versions via the > > dropdown in the top right. > > That only tells me it compiles it, not if that (IMO) weird construct is > actually guaranteed to work as expected. > > I'd almos

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 06:25:59PM -0500, Segher Boessenkool wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > Do we need register local storage here? > > Depends what you want. It looks like you do: > > > static inline long bar(unsigned long hcall_id) > > { > > lo

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > Do we need register local storage here? Depends what you want. It looks like you do: > static inline long bar(unsigned long hcall_id) > { > long result; > asm volatile("movl %1, %%r8d\n\t" > "vmcall\n\t" > : "=a" (resu

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 03:59:15PM -0400, Arvind Sankar wrote: > On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra > > wrote: > > > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > > > > > Since thi

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Arvind Sankar
On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > > > Since this variable is a local register asm, on entry to the asm the > > > compiler guara

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Peter Zijlstra
On Wed, Sep 30, 2020 at 12:14:03PM -0700, Nick Desaulniers wrote: > On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > > > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > > > Since this variable is a local register asm, on entry to the asm the > > > compiler guara

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Nick Desaulniers
On Wed, Sep 30, 2020 at 10:13 AM Peter Zijlstra wrote: > > On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > > > Since this variable is a local register asm, on entry to the asm the > > compiler guarantees that the value lives in the assigned register (the > > "r8" hardware reg

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Peter Zijlstra
On Wed, Sep 30, 2020 at 11:10:36AM -0500, Segher Boessenkool wrote: > Since this variable is a local register asm, on entry to the asm the > compiler guarantees that the value lives in the assigned register (the > "r8" hardware register in this case). This all works completely fine. > This is the

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Segher Boessenkool
Hi! On Wed, Sep 30, 2020 at 01:16:12PM +0200, Peter Zijlstra wrote: > On Sun, Sep 27, 2020 at 08:38:03AM -0700, Dave Hansen wrote: > > On 9/27/20 3:51 AM, Greg Kroah-Hartman wrote: > > >> +static inline long acrn_hypercall0(unsigned long hcall_id) > > >> +{ > > >> +register long r8 asm("r8

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Peter Zijlstra
On Sun, Sep 27, 2020 at 08:38:03AM -0700, Dave Hansen wrote: > On 9/27/20 3:51 AM, Greg Kroah-Hartman wrote: > >> +static inline long acrn_hypercall0(unsigned long hcall_id) > >> +{ > >> + register long r8 asm("r8"); > >> + long result; > >> + > >> + /* Nothing can come between the r8 assignment

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-30 Thread Borislav Petkov
On Tue, Sep 22, 2020 at 07:42:58PM +0800, shuo.a@intel.com wrote: > From: Shuo Liu > > The Service VM communicates with the hypervisor via conventional > hypercalls. VMCALL instruction is used to make the hypercalls. > > ACRN hypercall ABI: > * Hypercall number is in R8 register. > * Up

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-27 Thread Shuo A Liu
On Sun 27.Sep'20 at 12:53:14 +0200, Greg Kroah-Hartman wrote: On Sun, Sep 27, 2020 at 12:51:52PM +0200, Greg Kroah-Hartman wrote: On Tue, Sep 22, 2020 at 07:42:58PM +0800, shuo.a@intel.com wrote: > From: Shuo Liu > > The Service VM communicates with the hypervisor via conventional > hyperca

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-27 Thread Dave Hansen
On 9/27/20 3:51 AM, Greg Kroah-Hartman wrote: >> +static inline long acrn_hypercall0(unsigned long hcall_id) >> +{ >> +register long r8 asm("r8"); >> +long result; >> + >> +/* Nothing can come between the r8 assignment and the asm: */ >> +r8 = hcall_id; >> +asm volatile("vmcall\

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-27 Thread Greg Kroah-Hartman
On Sun, Sep 27, 2020 at 12:51:52PM +0200, Greg Kroah-Hartman wrote: > On Tue, Sep 22, 2020 at 07:42:58PM +0800, shuo.a@intel.com wrote: > > From: Shuo Liu > > > > The Service VM communicates with the hypervisor via conventional > > hypercalls. VMCALL instruction is used to make the hypercalls

Re: [PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-27 Thread Greg Kroah-Hartman
On Tue, Sep 22, 2020 at 07:42:58PM +0800, shuo.a@intel.com wrote: > From: Shuo Liu > > The Service VM communicates with the hypervisor via conventional > hypercalls. VMCALL instruction is used to make the hypercalls. > > ACRN hypercall ABI: > * Hypercall number is in R8 register. > * Up

[PATCH v4 04/17] x86/acrn: Introduce hypercall interfaces

2020-09-22 Thread shuo . a . liu
From: Shuo Liu The Service VM communicates with the hypervisor via conventional hypercalls. VMCALL instruction is used to make the hypercalls. ACRN hypercall ABI: * Hypercall number is in R8 register. * Up to 2 parameters are in RDI and RSI registers. * Return value is in RAX register. In