[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKVwjdspTazTXlam@google.com>
Date: Wed, 19 May 2021 20:09:49 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: "Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Raj Ashok <ashok.raj@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC v2-fix-v1 1/1] x86/tdx: Add __tdx_module_call() and
__tdx_hypercall() helper functions
On Wed, May 19, 2021, Kuppuswamy, Sathyanarayanan wrote:
>
> On 5/19/21 8:31 AM, Dave Hansen wrote:
> > Was this "older compiler" argument really the reason?
>
> It is a speculation. I haven't tried to reproduce it with old compiler. So
> I have removed that point.
It's not "older" compilers. gcc does not support R8-R15 as input/output
constraints, which means inline asm needs to do register shenanigans, and those
are horribly fragile because the compiler does not ensure register variables are
preserved outside of asm blobs. E.g. adding a print like so can corrupt r10,
which makes it an absolute nightmare to debug/trace flows that pass r8-r15 to
asm blobs since looking at the code the wrong way can break things.
register unsigned long r10 asm("r10") = __r10;
pr_info("TDCALL: RAX = %lx, R10 = %lx\n", rax, __r10);
asm volatile("tdcall"
: "=a"(rax) :
: "a"(rax), "r"(r10));
Powered by blists - more mailing lists