Re: [PATCH v7 5/5] x86/tdx: Add Quote generation support

From: Sathyanarayanan Kuppuswamy
Date: Fri Jun 03 2022 - 13:15:18 EST




On 5/26/22 8:37 AM, Wander Lairson Costa wrote:
On Mon, May 23, 2022 at 09:05:17PM -0700, Kuppuswamy Sathyanarayanan wrote:
+
+/* Used for buffer allocation in GetQuote request */
+struct quote_buf {
+ /* vmapped address of kernel buffer (size is page aligned) */
+ void *vmaddr;
+ /* Number of pages */
+ int count;
+};
+
+/* List entry of quote_list */
+struct quote_entry {
+ /* Flag to check validity of the GetQuote request */
+ bool valid;
+ /* Kernel buffer to share data with VMM */
+ struct quote_buf *buf;

Instead of a pointer, we can embed the quote_buf object directly into the
quote_entry. alloc_quote_buf would receive a pointer to quote_buf, and would
only allocate vmaddr (may we should change the names from alloc/free to
init/deinit). This way we can save one memory allocation and have a
simpler code. Not to mention is one less pointer to track its lifetime.

Agree. I will change it to embed object.


--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer