[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c4640af2-a791-848a-bacb-071f0bc8f9b1@amd.com>
Date: Mon, 6 May 2024 08:14:34 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, linux-coco@...ts.linux.dev,
svsm-devel@...onut-svsm.dev, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dan Williams <dan.j.williams@...el.com>, Michael Roth
<michael.roth@....com>, Ashish Kalra <ashish.kalra@....com>
Subject: Re: [PATCH v4 05/15] x86/sev: Use kernel provided SVSM Calling Areas
On 5/6/24 05:09, Borislav Petkov wrote:
> Ok,
>
> I think this is very readable and clear what's going on:
I'll test it out.
>
> static __always_inline void issue_svsm_call(struct svsm_call *call, u8 *pending)
> {
> register unsigned long rax asm("rax") = call->rax;
> register unsigned long rcx asm("rcx") = call->rcx;
> register unsigned long rdx asm("rdx") = call->rdx;
> register unsigned long r8 asm("r8") = call->r8;
> register unsigned long r9 asm("r9") = call->r9;
>
> call->caa->call_pending = 1;
>
> asm volatile("rep; vmmcall\n\t"
> : "+r" (rax), "+r" (rcx), "+r" (rdx), "+r" (r8), "+r" (r9));
>
> xchg(pending, 1);
This isn't quite right. The xchg has to occur between pending and
call->caa->call_pending.
Thanks,
Tom
>
> call->rax_out = rax;
> call->rcx_out = rcx;
> call->rdx_out = rdx;
> call->r8_out = r8;
> call->r9_out = r9;
> }
>
> and the asm looks ok but the devil's in the detail.
>
Powered by blists - more mailing lists