[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b71e8410-c73b-45a3-a1a3-e13911a078dc@redhat.com>
Date: Tue, 10 Sep 2024 19:27:06 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Tony Lindgren <tony.lindgren@...ux.intel.com>,
Tao Su <tao1.su@...ux.intel.com>
Cc: Rick Edgecombe <rick.p.edgecombe@...el.com>, seanjc@...gle.com,
kvm@...r.kernel.org, kai.huang@...el.com, isaku.yamahata@...il.com,
xiaoyao.li@...el.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 21/25] KVM: x86: Introduce KVM_TDX_GET_CPUID
On 9/3/24 08:21, Tony Lindgren wrote:
> On Mon, Aug 19, 2024 at 10:59:49AM +0800, Tao Su wrote:
>> On Mon, Aug 12, 2024 at 03:48:16PM -0700, Rick Edgecombe wrote:
>>> From: Xiaoyao Li <xiaoyao.li@...el.com>
>>> + /*
>>> + * Work around missing support on old TDX modules, fetch
>>> + * guest maxpa from gfn_direct_bits.
>>> + */
>>> + if (output_e->function == 0x80000008) {
>>> + gpa_t gpa_bits = gfn_to_gpa(kvm_gfn_direct_bits(vcpu->kvm));
>>> + unsigned int g_maxpa = __ffs(gpa_bits) + 1;
>>> +
>>> + output_e->eax &= ~0x00ff0000;
>>> + output_e->eax |= g_maxpa << 16;
>>> + }
>>
>> I suggest putting all guest_phys_bits related WA in a WA-only patch, which will
>> be clearer.
>
> The 80000008 workaround needs to be tidied up for sure, it's hard to follow.
I think it's okay if you just add a separate
tdx_get_guest_phys_addr_bits(struct kvm *kvm).
>>> --- a/arch/x86/kvm/vmx/tdx.h
>>> +++ b/arch/x86/kvm/vmx/tdx.h
>>> @@ -25,6 +25,11 @@ struct kvm_tdx {
>>> bool finalized;
>>>
>>> u64 tsc_offset;
>>> +
>>> + /* For KVM_MAP_MEMORY and KVM_TDX_INIT_MEM_REGION. */
>>> + atomic64_t nr_premapped;
>>
>> I don't see it is used in this patch set.
>
> Yes that should have been in a later patch.
Yes, it's used in the MMU prep part 2 series.
Paolo
Powered by blists - more mailing lists