From: Peter Fang <peter.fang@intel.com>
To: Nikolay Borisov <nik.borisov@suse.com>
Cc: "Xiaoyao Li" <xiaoyao.li@intel.com>,
dave.hansen@linux.intel.com, x86@kernel.org,
rick.p.edgecombe@intel.com, seanjc@google.com,
linux-coco@lists.linux.dev, binbin.wu@linux.intel.com,
"Michal Koutný" <mkoutny@suse.com>
Subject: Re: [PATCH] x86/tdx: Harden exports
Date: Wed, 16 Sep 2026 02:13:11 -0700 [thread overview]
Message-ID: <aqpdpxlc54DCskK9@intel.com> (raw)
In-Reply-To: <ac14f791-93aa-4390-a0ed-d27687141b04@suse.com>
On Fri, Sep 11, 2026 at 05:19:36PM +0300, Nikolay Borisov wrote:
>
> > >
> > > diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> > > index f904a636d449..3055a76c0dfd 100644
> > > --- a/arch/x86/coco/tdx/tdx.c
> > > +++ b/arch/x86/coco/tdx/tdx.c
> > > @@ -64,7 +64,7 @@ long tdx_kvm_hypercall(unsigned int nr, unsigned long p1, unsigned long p2,
> > > return __tdx_hypercall(&args);
> > > }
> > > -EXPORT_SYMBOL_GPL(tdx_kvm_hypercall);
> > > +EXPORT_SYMBOL_FOR_KVM(tdx_kvm_hypercall);
> >
> > tdx_kvm_hypecall() is used by kvm_hypercall{0,1,2,3,4}, which are not used by
> > KVM modules, but used by guest kernel code when running as a KVM guest.
> >
> > It seems the reason we need to export is kvm_arch_ptp_init() calls
> > kvm_hypercall2() and kvm_arch_ptp_init() can be called by guest-side PTP module.
>
>
> So what do you suggest the correct export is?
I agree with Xiaoyao here - EXPORT_SYMBOL_FOR_KVM() isn't the right fit.
And the tricky part is that a lot of it is used by arch/x86/kernel/kvm.c
(e.g. kvm_kick_cpu()), which can't be built as a kernel module.
EXPORT_SYMBOL_FOR_MODULES(tdx_kvm_hypercall, "ptp_kvm") probably will
get you to build, but I think this would be going in a wrong direction.
So... Probably leave it as is?
The remaining EXPORT_SYMBOL_FOR_MODULES(..., "tdx-guest") changes look
good to me though.
>
> >
> > > #endif
> > > /*
> > > @@ -139,7 +139,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
> > > return 0;
> > > }
> > > -EXPORT_SYMBOL_GPL(tdx_mcall_get_report0);
> > > +EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_get_report0, "tdx-guest");
> > > /**
> > > * tdx_mcall_extend_rtmr() - Wrapper to extend RTMR registers using
> > > @@ -175,7 +175,7 @@ int tdx_mcall_extend_rtmr(u8 index, u8 *data)
> > > return 0;
> > > }
> > > -EXPORT_SYMBOL_GPL(tdx_mcall_extend_rtmr);
> > > +EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_extend_rtmr, "tdx-guest");
> > > /**
> > > * tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote
> > > @@ -196,7 +196,7 @@ u64 tdx_hcall_get_quote(u8 *buf, size_t size)
> > > /* Since buf is a shared memory, set the shared (decrypted) bits */
> > > return _tdx_hypercall(TDVMCALL_GET_QUOTE, cc_mkdec(virt_to_phys(buf)), size, 0, 0);
> > > }
> > > -EXPORT_SYMBOL_GPL(tdx_hcall_get_quote);
> > > +EXPORT_SYMBOL_FOR_MODULES(tdx_hcall_get_quote, "tdx-guest");
> > > static void __noreturn tdx_panic(const char *msg)
> > > {
> >
>
prev parent reply other threads:[~2026-09-16 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 11:31 [PATCH] x86/tdx: Harden exports Nikolay Borisov
2026-09-11 13:01 ` Xiaoyao Li
2026-09-11 14:19 ` Nikolay Borisov
2026-09-16 9:13 ` Peter Fang [this message]
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=aqpdpxlc54DCskK9@intel.com \
--to=peter.fang@intel.com \
--cc=binbin.wu@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=mkoutny@suse.com \
--cc=nik.borisov@suse.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@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