[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIEGWoM-kY_6gL8N@google.com>
Date: Wed, 23 Jul 2025 08:57:14 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>, pbonzini@...hat.com, vannapurve@...gle.com,
Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org, H Peter Anvin <hpa@...or.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org, rick.p.edgecombe@...el.com,
kas@...nel.org, kai.huang@...el.com, reinette.chatre@...el.com,
xiaoyao.li@...el.com, tony.lindgren@...ux.intel.com,
binbin.wu@...ux.intel.com, isaku.yamahata@...el.com, yan.y.zhao@...el.com,
chao.gao@...el.com
Subject: Re: [PATCH V4 1/2] x86/tdx: Eliminate duplicate code in tdx_clear_page()
On Wed, Jul 23, 2025, Adrian Hunter 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@...nel.org>
> Reviewed-by: Binbin Wu <binbin.wu@...ux.intel.com>
> Reviewed-by: Xiaoyao Li <xiaoyao.li@...el.com>
> Acked-by: Kai Huang <kai.huang@...el.com>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
...
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index 7ddef3a69866..57b46f05ff97 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -131,6 +131,8 @@ int tdx_guest_keyid_alloc(void);
> u32 tdx_get_nr_guest_keyids(void);
> void tdx_guest_keyid_free(unsigned int keyid);
>
> +void tdx_quirk_reset_page(struct page *page);
Might make sense to have this be a static inline so as to avoid two exports if
KVM ever needs/wants the inner helper, but either way is a-ok by me.
Acked-by: Sean Christopherson <seanjc@...gle.com>
Powered by blists - more mailing lists