lkml.org 
[lkml]   [2022]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 3/3] x86/tdx: Add Quote generation support
From
Date

> +
> + /* Get order for Quote buffer page allocation */
> + order = get_order(quote_req.len);
> +
> + /*
> + * Allocate buffer to get TD Quote from the VMM.
> + * Size needs to be 4KB aligned (which is already
> + * met in page allocation).
> + */
> + tdquote = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
> + if (!tdquote) {
> + ret = -ENOMEM;
> + goto quote_failed;
> + }

You can use alloc_pages_exact().

> +
> + /*
> + * Since this buffer will be shared with the VMM via GetQuote
> + * hypercall, decrypt it.
> + */
> + ret = set_memory_decrypted((unsigned long)tdquote, 1UL << order);
> + if (ret)
> + goto quote_failed;


Again, Dave and Andi already commented you should use vmap() to avoid breaking
up the direct-mapping. Please use vmap() instead.

https://lore.kernel.org/all/ce0feeec-a949-35f8-3010-b0d69acbbc2e@linux.intel.com/

Will review the rest later.


--
Thanks,
-Kai


\
 
 \ /
  Last update: 2022-05-02 04:41    [W:0.242 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site