[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f8d0beb-cc02-467d-ae2a-10e22571e5cf@suse.com>
Date: Tue, 7 Jan 2025 14:41:51 +0200
From: Nikolay Borisov <nik.borisov@...e.com>
To: Tony Lindgren <tony.lindgren@...ux.intel.com>,
"Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "pbonzini@...hat.com" <pbonzini@...hat.com>,
"seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai" <kai.huang@...el.com>,
"Li, Xiaoyao" <xiaoyao.li@...el.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Zhao, Yan Y" <yan.y.zhao@...el.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>
Subject: Re: [PATCH v2 00/25] TDX vCPU/VM creation
On 7.01.25 г. 9:37 ч., Tony Lindgren wrote:
> On Sat, Jan 04, 2025 at 01:43:56AM +0000, Edgecombe, Rick P wrote:
>> On Mon, 2024-12-23 at 17:25 +0100, Paolo Bonzini wrote:
>>> 22: missing review comment from v1
>>>
>>>> + /* TDX only supports x2APIC, which requires an in-kernel local APIC. */
>>>> + if (!vcpu->arch.apic)
>>>> + return -EINVAL;
>>>
>>> nit: Use kvm_apic_present()
>>
>> Oops, nice catch.
>
> Sorry this fell through. I made a patch for this earlier but missed it
> while rebasing to a later dev branch and never sent it.
>
> Below is a rebased version against the current KVM CoCo queue to fold
> in if still needed. Sounds like this might be already dealt with in
> Paolo's upcoming CoCo queue branch though.
>
> Regards,
>
> Tony
>
> 8< --------------------
> From aac264e9923c15522baf9ae765b1d58165c24523 Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony.lindgren@...ux.intel.com>
> Date: Mon, 2 Sep 2024 13:52:20 +0300
> Subject: [PATCH 1/1] KVM/TDX: Use kvm_apic_present() in tdx_vcpu_create()
>
> Use kvm_apic_present() in tdx_vcpu_create(). We need to now export
> apic_hw_disabled for kvm-intel to use it.
>
> Suggested-by: Nikolay Borisov <nik.borisov@...e.com>
> Signed-off-by: Tony Lindgren <tony.lindgren@...ux.intel.com>
> ---
> arch/x86/kvm/lapic.c | 2 ++
> arch/x86/kvm/vmx/tdx.c | 3 ++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index fcf3a8907196..2b83092eace2 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -139,6 +139,8 @@ __read_mostly DEFINE_STATIC_KEY_FALSE(kvm_has_noapic_vcpu);
> EXPORT_SYMBOL_GPL(kvm_has_noapic_vcpu);
>
> __read_mostly DEFINE_STATIC_KEY_DEFERRED_FALSE(apic_hw_disabled, HZ);
> +EXPORT_SYMBOL_GPL(apic_hw_disabled);
Is it really required to expose this symbol? apic_hw_disabled is defined
as static inline in the header?
> +> __read_mostly DEFINE_STATIC_KEY_DEFERRED_FALSE(apic_sw_disabled,
HZ);
>
> static inline int apic_enabled(struct kvm_lapic *apic)
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index d0dc3200fa37..6c68567d964d 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -8,6 +8,7 @@
> #include "capabilities.h"
> #include "mmu.h"
> #include "x86_ops.h"
> +#include "lapic.h"
> #include "tdx.h"
> #include "vmx.h"
> #include "mmu/spte.h"
> @@ -674,7 +675,7 @@ int tdx_vcpu_create(struct kvm_vcpu *vcpu)
> return -EIO;
>
> /* TDX only supports x2APIC, which requires an in-kernel local APIC. */
> - if (!vcpu->arch.apic)
> + if (!kvm_apic_present(vcpu))
> return -EINVAL;
>
> fpstate_set_confidential(&vcpu->arch.guest_fpu);
Powered by blists - more mailing lists