lkml.org 
[lkml]   [2023]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH v13 004/113] KVM: TDX: Initialize logical processor when onlined
    Date
    On Sun, 2023-03-12 at 10:55 -0700, isaku.yamahata@intel.com wrote:
    > From: Isaku Yamahata <isaku.yamahata@intel.com>
    >
    > TDX requires to call a TDX initialization function per logical processor
    > (LP) before the LP uses TDX. When CPU is onlined, call the TDX LP
    > initialization API when cpu is onlined.  
    >

    Double "when CPU is onlined".

    > If it failed refuse onlininig of
    > the cpu for simplicity instead of TDX avoiding the LP.

    Sorry cannot understand this sentence, particularly, the "instead ..." part.

    >
    > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
    > ---
    > arch/x86/kvm/vmx/main.c | 15 ++++++++++++++-
    > arch/x86/kvm/vmx/tdx.c | 5 +++++
    > arch/x86/kvm/vmx/x86_ops.h | 2 ++
    > 3 files changed, 21 insertions(+), 1 deletion(-)
    >
    > diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
    > index 5c9f5e00b3c4..d1c9c7f55050 100644
    > --- a/arch/x86/kvm/vmx/main.c
    > +++ b/arch/x86/kvm/vmx/main.c
    > @@ -9,6 +9,19 @@
    > static bool enable_tdx __ro_after_init;
    > module_param_named(tdx, enable_tdx, bool, 0444);
    >
    > +static int vt_hardware_enable(void)
    > +{
    > + int ret;
    > +
    > + ret = vmx_hardware_enable();
    > + if (!ret && enable_tdx) {
    > + ret = tdx_hardware_enable();
    > + if (ret)
    > + vmx_hardware_disable();
    > + }
    > + return ret;
    > +}
    > +
    > static __init int vt_hardware_setup(void)
    > {
    > int ret;
    > @@ -40,7 +53,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = {
    >
    > .hardware_unsetup = vmx_hardware_unsetup,
    >
    > - .hardware_enable = vmx_hardware_enable,
    > + .hardware_enable = vt_hardware_enable,
    > .hardware_disable = vmx_hardware_disable,
    > .has_emulated_msr = vmx_has_emulated_msr,
    >
    > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
    > index f3eb0138b60b..e51314bbb439 100644
    > --- a/arch/x86/kvm/vmx/tdx.c
    > +++ b/arch/x86/kvm/vmx/tdx.c
    > @@ -10,6 +10,11 @@
    > #undef pr_fmt
    > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    >
    > +int tdx_hardware_enable(void)
    > +{
    > + return tdx_cpu_enable();
    > +}
    > +
    > static int __init tdx_module_setup(void)
    > {
    > int ret;
    > diff --git a/arch/x86/kvm/vmx/x86_ops.h b/arch/x86/kvm/vmx/x86_ops.h
    > index 0f200aead411..010d02c86ba4 100644
    > --- a/arch/x86/kvm/vmx/x86_ops.h
    > +++ b/arch/x86/kvm/vmx/x86_ops.h
    > @@ -139,8 +139,10 @@ void vmx_setup_mce(struct kvm_vcpu *vcpu);
    >
    > #ifdef CONFIG_INTEL_TDX_HOST
    > int __init tdx_hardware_setup(struct kvm_x86_ops *x86_ops);
    > +int tdx_hardware_enable(void);
    > #else
    > static inline int tdx_hardware_setup(struct kvm_x86_ops *x86_ops) { return -ENOSYS; }
    > +static inline int tdx_hardware_enable(void) { return -EOPNOTSUPP; }
    > #endif
    >
    > #endif /* __KVM_X86_VMX_X86_OPS_H */

    \
     
     \ /
      Last update: 2023-03-27 01:01    [W:6.549 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site