From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Yan Zhao <yan.y.zhao@intel.com>,
dave.hansen@linux.intel.com, pbonzini@redhat.com,
seanjc@google.com
Cc: tglx@kernel.org, mingo@redhat.com, bp@alien8.de, kas@kernel.org,
x86@kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, linux-coco@lists.linux.dev,
kai.huang@intel.com, rick.p.edgecombe@intel.com,
yilun.xu@linux.intel.com, vannapurve@google.com,
ackerleytng@google.com, sagis@google.com,
binbin.wu@linux.intel.com, isaku.yamahata@intel.com
Subject: Re: [PATCH v2 3/4] x86/tdx: Drop exported function tdx_quirk_reset_page()
Date: Thu, 7 May 2026 16:02:54 +0800 [thread overview]
Message-ID: <28c33c92-e411-416a-9c21-21bb9c01434d@intel.com> (raw)
In-Reply-To: <20260430015001.24242-1-yan.y.zhao@intel.com>
On 4/30/2026 9:50 AM, Yan Zhao wrote:
> KVM invokes tdx_quirk_reset_page() to reset TDX control pages (including
> S-EPT pages, TDR page, etc.), as all those pages are allocated by KVM TDX
> and thus always have struct page.
>
> However, it's also reasonable for KVM to reset those TDX control pages via
> tdx_quirk_reset_paddr() directly, eliminating the need to export two
> parallel APIs. Keeping tdx_quirk_reset_page() as a one-line helper in the
> header file is also unnecessary.
>
> No functional change intended.
>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> arch/x86/include/asm/tdx.h | 1 -
> arch/x86/kvm/vmx/tdx.c | 4 ++--
> arch/x86/virt/vmx/tdx/tdx.c | 6 ------
> 3 files changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index 65f7d874fb5a..9c63deaa0e8f 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -153,7 +153,6 @@ 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);
> void tdx_quirk_reset_paddr(unsigned long base, unsigned long size);
>
> struct tdx_td {
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index a2aadc6d0174..9bd4fd748e2a 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -343,7 +343,7 @@ static int tdx_reclaim_page(struct page *page)
>
> r = __tdx_reclaim_page(page);
> if (!r)
> - tdx_quirk_reset_page(page);
> + tdx_quirk_reset_paddr(page_to_phys(page), PAGE_SIZE);
> return r;
> }
>
> @@ -597,7 +597,7 @@ static void tdx_reclaim_td_control_pages(struct kvm *kvm)
> if (TDX_BUG_ON(err, TDH_PHYMEM_PAGE_WBINVD, kvm))
> return;
>
> - tdx_quirk_reset_page(kvm_tdx->td.tdr_page);
> + tdx_quirk_reset_paddr(page_to_phys(kvm_tdx->td.tdr_page), PAGE_SIZE);
>
> __free_page(kvm_tdx->td.tdr_page);
> kvm_tdx->td.tdr_page = NULL;
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index e5a37ea2d4a0..deb67e68f85f 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -731,12 +731,6 @@ void tdx_quirk_reset_paddr(unsigned long base, unsigned long size)
> }
> EXPORT_SYMBOL_FOR_KVM(tdx_quirk_reset_paddr);
>
> -void tdx_quirk_reset_page(struct page *page)
> -{
> - tdx_quirk_reset_paddr(page_to_phys(page), PAGE_SIZE);
> -}
> -EXPORT_SYMBOL_FOR_KVM(tdx_quirk_reset_page);
> -
> static __init void tdmr_quirk_reset_pamt(struct tdmr_info *tdmr)
>
> {
next prev parent reply other threads:[~2026-05-07 8:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260430014852.24183-1-yan.y.zhao@intel.com>
[not found] ` <20260430014929.24210-1-yan.y.zhao@intel.com>
2026-05-07 7:49 ` [PATCH v2 1/4] x86/tdx: Use PFN directly for mapping guest private memory Xiaoyao Li
2026-05-07 8:08 ` Yan Zhao
2026-05-07 18:46 ` Sean Christopherson
[not found] ` <20260430014948.24226-1-yan.y.zhao@intel.com>
2026-05-07 7:54 ` [PATCH v2 2/4] x86/tdx: Use PFN directly for unmapping " Xiaoyao Li
[not found] ` <20260430015001.24242-1-yan.y.zhao@intel.com>
2026-05-07 8:02 ` Xiaoyao Li [this message]
[not found] ` <20260430015014.24261-1-yan.y.zhao@intel.com>
2026-05-07 8:07 ` [PATCH v2 4/4] x86/virt/tdx: Move mk_keyed_paddr() to tdx.c due to no external users Xiaoyao Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28c33c92-e411-416a-9c21-21bb9c01434d@intel.com \
--to=xiaoyao.li@intel.com \
--cc=ackerleytng@google.com \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=isaku.yamahata@intel.com \
--cc=kai.huang@intel.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=sagis@google.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=vannapurve@google.com \
--cc=x86@kernel.org \
--cc=yan.y.zhao@intel.com \
--cc=yilun.xu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox