[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0031e031-10a8-43b1-a29c-8e1cf913eaad@linux.intel.com>
Date: Wed, 20 Sep 2023 08:27:39 -0700
From: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>
To: "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>,
"H . Peter Anvin" <hpa@...or.com>, Tony Luck <tony.luck@...el.com>,
Wander Lairson Costa <wander@...hat.com>,
Erdem Aktas <erdemaktas@...gle.com>,
Dionna Amalie Glaze <dionnaglaze@...gle.com>,
Qinkun Bao <qinkun@...che.org>,
Guorui Yu <GuoRui.Yu@...ux.alibaba.com>,
linux-coco@...ts.linux.dev, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] virt: tdx-guest: Add Quote generation support using
TSM_REPORTS
On 9/20/2023 6:16 AM, Kirill A . Shutemov wrote:
>> +static u8 *tdx_report_new(const struct tsm_desc *desc, void *data, size_t *outblob_len)
>> +{
>> + struct tdx_quote_buf *quote_buf = quote_data;
>> + int ret;
>> + u8 *buf;
>> + u64 err;
>> +
>> + if (mutex_lock_interruptible("e_lock))
>> + return ERR_PTR(-EINTR);
>> +
>> + /*
>> + * If the previous request is timedout or interrupted, and the
>> + * Quote buf status is still in GET_QUOTE_IN_FLIGHT (owned by
>> + * VMM), don't permit any new request.
>> + */
>> + if (quote_buf->status == GET_QUOTE_IN_FLIGHT) {
>> + ret = -EBUSY;
>> + goto done;
>> + }
>> +
>> + if (desc->inblob_len != TDX_REPORTDATA_LEN) {
>> + ret = -EINVAL;
>> + goto done;
>> + }
>> +
>> + /* TDX attestation only supports default format request */
>> + if (desc->outblob_format != TSM_FORMAT_DEFAULT) {
>> + ret = -EINVAL;
>> + goto done;
>> + }
>> +
>> + u8 *reportdata __free(kfree) = kmalloc(TDX_REPORTDATA_LEN, GFP_KERNEL);
> __free() is new to me. Good to know.
>
> But are we okay now with declaring variables in the middle of the
> function? Any reason we can't do at the top?
Declaring variables at the top is no longer a hard requirement. The main reason
for declaring it here is to use __free cleanup function. If we use top
declaration, then we have free it manually.
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
Powered by blists - more mailing lists