[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9079202f-2b0d-4bcf-8f61-36c7234245d1@intel.com>
Date: Thu, 27 Feb 2025 11:03:12 +1300
From: "Huang, Kai" <kai.huang@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>, <linux-kernel@...r.kernel.org>,
<kvm@...r.kernel.org>
CC: <seanjc@...gle.com>, Yan Zhao <yan.y.zhao@...el.com>, Rick Edgecombe
<rick.p.edgecombe@...el.com>
Subject: Re: [PATCH 25/33] KVM: x86: expose cpuid_entry2_find for TDX
On 27/02/2025 7:14 am, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
Reviewed-by: Kai Huang <kai.huang@...el.com>
... assuming there will be a changelog, e.g., perhaps something like below:
TDX will need to search a CPUID leaf from a list of per-TD scope CPUID
entries w/o any vCPU context. Abstract the code which does CPUID entry
search from a given list of CPUID entries as kvm_find_cpuid_entry2() and
Export it for TDX to use.
And one nit below ...
> @@ -141,23 +141,26 @@ static struct kvm_cpuid_entry2 *cpuid_entry2_find(struct kvm_vcpu *vcpu,
>
> return NULL;
> }
> +EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry2);
>
> struct kvm_cpuid_entry2 *kvm_find_cpuid_entry_index(struct kvm_vcpu *vcpu,
> u32 function, u32 index)
> {
> - return cpuid_entry2_find(vcpu, function, index);
> + return kvm_find_cpuid_entry2(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent,
> + function, index);
> }
> EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry_index);
>
> struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
> u32 function)
> {
> - return cpuid_entry2_find(vcpu, function, KVM_CPUID_INDEX_NOT_SIGNIFICANT);
> + return kvm_find_cpuid_entry2(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent,
> + function, KVM_CPUID_INDEX_NOT_SIGNIFICANT);
> }
> EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry);
... I think we can change both kvm_find_cpuid_entry_index() and
kvm_find_cpuid_entry() to 'static inline' and place them in the
kvm/cpuid.h to avoid exporting them.
See attached diff. Build test only.
View attachment "tdx_cpuid.diff" of type "text/plain" (2682 bytes)
Powered by blists - more mailing lists