[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1jpr7baxGJDj7Ur@yzhao56-desk.sh.intel.com>
Date: Wed, 11 Dec 2024 09:23:59 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
CC: <kvm@...r.kernel.org>, <pbonzini@...hat.com>, <seanjc@...gle.com>,
<dave.hansen@...el.com>, <isaku.yamahata@...il.com>, <kai.huang@...el.com>,
<linux-kernel@...r.kernel.org>, <tony.lindgren@...ux.intel.com>,
<xiaoyao.li@...el.com>, <x86@...nel.org>, <adrian.hunter@...el.com>, "Isaku
Yamahata" <isaku.yamahata@...el.com>, Binbin Wu <binbin.wu@...ux.intel.com>,
Yuan Yao <yuan.yao@...el.com>
Subject: Re: [RFC PATCH v2 4/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX
page cache management
On Mon, Dec 02, 2024 at 05:03:14PM -0800, Rick Edgecombe wrote:
...
> +u64 tdh_phymem_page_wbinvd_tdr(struct tdx_td *td)
> +{
> + struct tdx_module_args args = {};
> +
> + args.rcx = tdx_tdr_pa(td) | ((u64)tdx_global_keyid << boot_cpu_data.x86_phys_bits);
> +
> + return seamcall(TDH_PHYMEM_PAGE_WBINVD, &args);
> +}
> +EXPORT_SYMBOL_GPL(tdh_phymem_page_wbinvd_tdr);
The tdx_global_keyid is of type u16 in TDX spec and TDX module.
As Reinette pointed out, u64 could cause overflow.
Do we need to change all keyids to u16, including those in
tdh.mng.create() in patch 2,
the global_keyid, tdx_guest_keyid_start in arch/x86/virt/vmx/tdx/tdx.c
and kvm_tdx->hkid in arch/x86/kvm/vmx/tdx.c ?
BTW, is it a good idea to move set_hkid_to_hpa() from KVM TDX to x86 common
header?
static __always_inline hpa_t set_hkid_to_hpa(hpa_t pa, u16 hkid)
{
return pa | ((hpa_t)hkid << boot_cpu_data.x86_phys_bits);
}
Powered by blists - more mailing lists