[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88ea52ea-df9f-45d6-9022-db4313c324e2@linux.intel.com>
Date: Thu, 31 Oct 2024 17:09:17 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>, pbonzini@...hat.com,
seanjc@...gle.com
Cc: yan.y.zhao@...el.com, isaku.yamahata@...il.com, kai.huang@...el.com,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
tony.lindgren@...ux.intel.com, xiaoyao.li@...el.com,
reinette.chatre@...el.com, Isaku Yamahata <isaku.yamahata@...el.com>
Subject: Re: [PATCH v2 16/25] KVM: TDX: Get system-wide info about TDX module
on initialization
On 10/31/2024 3:00 AM, Rick Edgecombe wrote:
[...]
> +static u32 tdx_set_guest_phys_addr_bits(const u32 eax, int addr_bits)
> +{
> + return (eax & ~GENMASK(23, 16)) | (addr_bits & 0xff) << 16;
> +}
> +
> +#define KVM_TDX_CPUID_NO_SUBLEAF ((__u32)-1)
> +
> +static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char idx)
> +{
> + const struct tdx_sys_info_td_conf *td_conf = &tdx_sysinfo->td_conf;
> +
> + entry->function = (u32)td_conf->cpuid_config_leaves[idx];
> + entry->index = td_conf->cpuid_config_leaves[idx] >> 32;
> + entry->eax = (u32)td_conf->cpuid_config_values[idx][0];
> + entry->ebx = td_conf->cpuid_config_values[idx][0] >> 32;
> + entry->ecx = (u32)td_conf->cpuid_config_values[idx][1];
> + entry->edx = td_conf->cpuid_config_values[idx][1] >> 32;
> +
> + if (entry->index == KVM_TDX_CPUID_NO_SUBLEAF)
> + entry->index = 0;
> +
> + /* Work around missing support on old TDX modules */
> + if (entry->function == 0x80000008)
> + entry->eax = tdx_set_guest_phys_addr_bits(entry->eax, 0xff);
Is it necessary to set bit 16~23 to 0xff?
It seems that when userspace wants to retrieve the value, the GPAW will
be set in tdx_read_cpuid() anyway.
> +}
> +
>
[...]
Powered by blists - more mailing lists