Re: [PATCH v3 3/4] tpm: add SNP SVSM vTPM driver

From: Stefano Garzarella
Date: Thu Mar 20 2025 - 07:20:52 EST


On Wed, Mar 19, 2025 at 08:44:22PM -0300, Jason Gunthorpe wrote:
On Tue, Mar 18, 2025 at 05:18:53PM +0100, Stefano Garzarella wrote:

I see, thanks for the clarification!
I saw that with devm_get_free_pages() I can easily allocate a
resource-managed page, so I'll do that in v4.

As a general note you should just use kmalloc these days, even for
PAGE_SIZE. It is efficient and OK.

Thanks for sharing!

I think I'll stay with devm_get_free_pages() just because if it's
page aligned (with kmalloc I'm not sure if I have a way to ensure it), it can be a bitter faster for SVSM to map/unmap it on every command.


Having a struct that is PAGE_SIZE+1 is not efficient and will waste
a page of memory. That should be avoided ..

Got it, I will definitely split the buffer allocation from the priv.

Thanks,
Stefano