linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Tony Luck <tony.luck@intel.com>,
	Wander Lairson Costa <wander@redhat.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Dionna Amalie Glaze <dionnaglaze@google.com>,
	Qinkun Bao <qinkun@apache.org>,
	Guorui Yu <GuoRui.Yu@linux.alibaba.com>,
	linux-coco@lists.linux.dev, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] virt: tdx-guest: Add Quote generation support using TSM_REPORTS
Date: Wed, 20 Sep 2023 08:27:39 -0700	[thread overview]
Message-ID: <0031e031-10a8-43b1-a29c-8e1cf913eaad@linux.intel.com> (raw)
In-Reply-To: <20230920131633.ig6ldmwavpu7uhss@box.shutemov.name>



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(&quote_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

  parent reply	other threads:[~2023-09-20 15:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  3:13 [PATCH v2] virt: tdx-guest: Add Quote generation support using TSM_REPORTS Kuppuswamy Sathyanarayanan
2023-09-20 13:16 ` Kirill A . Shutemov
2023-09-20 13:45   ` Daniel P. Berrangé
2023-09-20 15:27   ` Kuppuswamy Sathyanarayanan [this message]
2023-09-20 17:52     ` Kirill A . Shutemov
2023-09-20 18:08       ` Kuppuswamy Sathyanarayanan
2023-09-20 18:11         ` Dave Hansen
2023-09-20 21:10 ` Erdem Aktas
2023-09-21 18:23 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0031e031-10a8-43b1-a29c-8e1cf913eaad@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=GuoRui.Yu@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dionnaglaze@google.com \
    --cc=erdemaktas@google.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=qinkun@apache.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=wander@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).