[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcaf6c92-2e2b-81d2-4755-c311d800ce2c@intel.com>
Date: Sun, 7 Feb 2021 08:01:50 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>,
Andy Lutomirski <luto@...nel.org>
Cc: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
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>,
Sean Christopherson <seanjc@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v1 09/26] x86/tdx: Handle CPUID via #VE
On 2/7/21 6:13 AM, Kirill A. Shutemov wrote:
>>> + /* Allow to pass R10, R11, R12, R13, R14 and R15 down to the VMM */
>>> + rcx = BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15);
>>> +
>>> + asm volatile(TDCALL
>>> + : "=a"(ret), "=r"(r10), "=r"(r11), "=r"(r12), "=r"(r13),
>>> + "=r"(r14), "=r"(r15)
>>> + : "a"(TDVMCALL), "r"(rcx), "r"(r10), "r"(r11), "r"(r12),
>>> + "r"(r13)
>>> + : );
>> Some "+" constraints would make this simpler. But I think you should
>> factor the TDCALL helper out into its own function.
> Factor out TDCALL into a helper is tricky: different TDCALLs have
> different list of registers passed to VMM.
Couldn't you just have one big helper that takes *all* the registers
that get used in any TDVMCALL and sets all the rcx bits? The users
could just pass 0's for the things they don't use.
Then you've got the ugly inline asm in one place. It also makes it
harder to screw up the 'rcx' mask and end up passing registers you
didn't want into a malicious VMM.
Powered by blists - more mailing lists