Re: [PATCH v5 4/6] virt: tdx-guest: Add a helper for the Quote buffer size

From: Edgecombe, Rick P

Date: Mon Sep 28 2026 - 15:13:32 EST


On Mon, 2026-09-28 at 09:13 -0700, Dave Hansen wrote:
> Please explain the goal of this function. Why is it doing what it is
> doing? This should also explain why it is page-aligning and caching things.

I'm not sure it actually needs to be. It shortens the math in the places where
it needs to calculate the pages. And then in tdx_report_new_locked() it skips
zeroing the whole buffer (not sure why to zero the buffer actually. Seems it
could just zero the struct members, or maybe skip it).

But actually, this series has a little bit of a change there? Because after this
helper is used, the whole page aligned buffer is zeroed regardless of the quote
size being aligned. Today the compile time constant buffer size happens to be
page aligned already though, so actually there is no change.

But still, a more limited change would have get_quote_buf_size() return the un-
aligned size, like how the define is treated. Then leave the align logic alone
in the callers. Another patch (not in this series) could change that and maybe
make the memset() length in tdx_report_new_locked() make more sense. How about
it?

I guess it just seems like this patch preps for the dynamic changes, while only
halfway addressing the align mysteries.