Re: [PATCH v10 2/2] x86/tdx: Support vmalloc() for tdx_enc_status_changed()

From: Huang, Kai
Date: Tue Sep 05 2023 - 21:27:47 EST


On Fri, 2023-08-11 at 14:48 -0700, Dexuan Cui wrote:
> When a TDX guest runs on Hyper-V, the hv_netvsc driver's netvsc_init_buf()
> allocates buffers using vzalloc(), and needs to share the buffers with the
> host OS by calling set_memory_decrypted(), which is not working for
> vmalloc() yet. Add the support by handling the pages one by one.
>
> Co-developed-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
> Signed-off-by: Dexuan Cui <decui@xxxxxxxxxxxxx>

Acked-by: Kai Huang <kai.huang@xxxxxxxxx>

One nit below ...

[...]


>
> - if (!tdx_map_gpa(start, end, enc))
> + if (offset_in_page(start) != 0)
> return false;

... "!= 0" isn't needed.


Or should we even WARN()? IIUC by reaching here the caller should already
verified both address and size are page aligned, but I didn't do full check.