[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9654f59b-9b8b-445c-9447-d86f6cfc9df7@intel.com>
Date: Tue, 7 Jan 2025 14:13:19 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Yan Zhao <yan.y.zhao@...el.com>,
"Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"sean.j.christopherson@...el.com" <sean.j.christopherson@...el.com>,
"Huang, Kai" <kai.huang@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>
Subject: Re: [PATCH 10/13] x86/virt/tdx: Add SEAMCALL wrappers to remove a TD
private page
On 1/6/25 22:43, Yan Zhao wrote:
> +u64 tdh_phymem_page_wbinvd_hkid(struct page *page, u16 hkid)
> +{
> + struct tdx_module_args args = {};
> +
> + args.rcx = page_to_phys(page) | ((hpa_t)hkid << boot_cpu_data.x86_phys_bits);
I've seen this idiom enough times. You need a helper:
u64 mk_keyed_paddr(struct page *page, u64 keyid)
{
u64 ret;
ret = page_to_phys(page);
/* KeyID bits are just above the physical address bits: */
ret |= keyid << boot_cpu_data.x86_phys_bits;
return ret;
}
Although I'm also debating a bit what the typing on 'keyid' should be.
Right now it's quite tied to the physical address width, but that's not
fundamental to TDX. It could absolutely change in the future.
Powered by blists - more mailing lists