Re: [PATCH V7 1/3] x86/tdx: Eliminate duplicate code in tdx_clear_page()

From: Vishal Annapurve
Date: Tue Aug 19 2025 - 15:52:45 EST


On Tue, Aug 19, 2025 at 8:58 AM Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
>
> tdx_clear_page() and reset_tdx_pages() duplicate the TDX page clearing
> logic. Rename reset_tdx_pages() to tdx_quirk_reset_paddr() and create
> tdx_quirk_reset_page() to call tdx_quirk_reset_paddr() and be used in
> place of tdx_clear_page().
>
> The new name reflects that, in fact, the clearing is necessary only for
> hardware with a certain quirk. That is dealt with in a subsequent patch
> but doing the rename here avoids additional churn.
>
> Note reset_tdx_pages() is slightly different from tdx_clear_page() because,
> more appropriately, it uses mb() in place of __mb(). Except when extra
> debugging is enabled (kcsan at present), mb() just calls __mb().
>
> Reviewed-by: Kirill A. Shutemov <kas@xxxxxxxxxx>
> Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>
> Reviewed-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
> Acked-by: Kai Huang <kai.huang@xxxxxxxxx>
> Acked-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

Acked-by: Vishal Annapurve <vannapurve@xxxxxxxxxx>