[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f951a29a-edad-89a7-cf04-c87fdfa9ba5e@linux.intel.com>
Date: Wed, 12 Oct 2022 11:11:54 -0700
From: Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
Shuah Khan <shuah@...nel.org>,
Jonathan Corbet <corbet@....net>,
"H . Peter Anvin" <hpa@...or.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
Kai Huang <kai.huang@...el.com>,
Wander Lairson Costa <wander@...hat.com>,
Isaku Yamahata <isaku.yamahata@...il.com>,
marcelo.cerri@...onical.com, tim.gardner@...onical.com,
khalid.elmously@...onical.com, philip.cox@...onical.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in
driver module
On 10/12/22 10:26 AM, Greg Kroah-Hartman wrote:
> On Wed, Oct 12, 2022 at 10:13:50AM -0700, Sathyanarayanan Kuppuswamy wrote:
>> Hi,
>>
>> On 10/12/22 9:23 AM, Greg Kroah-Hartman wrote:
>>> On Wed, Oct 12, 2022 at 08:44:04AM -0700, Sathyanarayanan Kuppuswamy wrote:
>>>>
>>>>
>>>> On 10/12/22 7:27 AM, Borislav Petkov wrote:
>>>>> On Wed, Oct 12, 2022 at 06:35:56AM -0700, Sathyanarayanan Kuppuswamy wrote:
>>>>>> So we should create a new wrapper for this use case or use
>>>>>
>>>>> Yes, you got it - a new wrapper pls.
>>>>
>>>> Ok. I will add a new wrapper to get the TDREPORT.
>>>>
>>>> +/*
>>>>
>>>> + * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest
>>>>
>>>> + * driver module to get the TDREPORT.
>>>>
>>>> + */
>>>>
>>>> +long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)
>>>
>>> Why "long"?
>>
>> We used long because __tdx_module_call() call returns u64 value.
>
> Great, then use u64 please. Or if you are returning negative errors,
> use s64 to be specific.
>
>> Alternatively, we can also check for return value of __tdx_module_call() here
>> and return 0/-EIO as return values. In this case we can change return value
>> to int.
>
> That would make more sense, right?
Yes. I will change it as mentioned above.
>
>>>
>>> Why void *? Don't you have real types for these?
>>
>> We use these buffers as an intermediary to transfer data between userspace and
>> the TDX module. In the kernel we don't consume these datas. So we did not define
>> the type of the data.
>
> Then these are userspace pointers? Why are they not marked as such?
They are not userspace pointers. Since we need to pass physical addresses of reportdata
and tdreport buffers to the TDX Module, we cannot directly use userspace pointers. So
we allocate these intermediary buffers in the TDX guest driver and use it to copy the
data from/to user pointers.
>
> thanks,
>
> greg k-h
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
Powered by blists - more mailing lists