From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"Hansen, Dave" <dave.hansen@intel.com>,
"seanjc@google.com" <seanjc@google.com>,
"Huang, Kai" <kai.huang@intel.com>
Cc: "Li, Xiaoyao" <xiaoyao.li@intel.com>,
"tony.lindgren@linux.intel.com" <tony.lindgren@linux.intel.com>,
"Hunter, Adrian" <adrian.hunter@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"isaku.yamahata@gmail.com" <isaku.yamahata@gmail.com>,
"x86@kernel.org" <x86@kernel.org>,
"Zhao, Yan Y" <yan.y.zhao@intel.com>
Subject: Re: [RFC PATCH v2 0/6] SEAMCALL Wrappers
Date: Wed, 4 Dec 2024 01:57:57 +0000 [thread overview]
Message-ID: <c8d4bae2834555474c4c709642f86d2ec86a276e.camel@intel.com> (raw)
In-Reply-To: <e69033f1a0ec210c87ee596f96c8c1096ef1d59b.camel@intel.com>
On Wed, 2024-12-04 at 01:24 +0000, Huang, Kai wrote:
> Currently the global metadata reading script generates the struct member based
> on the "field name" of the JSON file. The JSON file stores them as "size":
>
> "TDR_BASE_SIZE", "TDCS_BASE_SIZE", "TDVPS_BASE_SIZE"
>
> We will need to tweak the script to map "metadata field name" to "kernel
> structure member name", and more "special handling for specific fields" when
> auto generating the code.
>
> It's feasible but I am not sure whether it's worth to do, since we are basically
> talking about converting size to page count.
Ah, right. So given that this is generated code, we should probably just add the
wrappers like you suggest. In any case, we should remove the counts from the new
arch/x86 structs.
>
> Also, from global metadata's point of view, perhaps it is also good to just
> provide a metadata which is consistent with what module reports. How kernel
> uses the metadata is another layer on top of it.
I'm not sure I buy this one though. The exported arch/x86 interface shouldn't
have to match the HW directly.
>
> Btw, perhaps we don't need to keep 'tdcs_nr_pages' and 'tdcx_nr_pages' in
> 'struct tdx_td', i.e., as per-TD variables. They are constants for all TDX
> guests.
>
> E.g., assuming KVM is still going to use them, it can just access them using the
> metadata structure:
>
> static inline int tdx_tdcs_nr_pages(void)
> {
> return tdx_sysinfo->td_ctrl.tdcx_base_size >> PAGE_SHIFT;
> }
>
> AFAICT they are only used when creating/destroying TD for a couple of times, so
> I assume doing ">> PAGE_SHIFT" a couple of times won't really matter.
None of the users are in fast paths. Using page count directly would be more
about reducing wrapper clutter.
prev parent reply other threads:[~2024-12-04 1:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 1:03 [RFC PATCH v2 0/6] SEAMCALL Wrappers Rick Edgecombe
2024-12-03 1:03 ` [RFC PATCH v2 1/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX KeyID management Rick Edgecombe
2024-12-03 1:03 ` [RFC PATCH v2 2/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX TD creation Rick Edgecombe
2024-12-03 2:20 ` Binbin Wu
2024-12-04 1:58 ` Edgecombe, Rick P
2024-12-04 19:54 ` Dave Hansen
2024-12-05 17:25 ` Edgecombe, Rick P
2024-12-03 1:03 ` [RFC PATCH v2 3/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX vCPU creation Rick Edgecombe
2024-12-03 1:03 ` [RFC PATCH v2 4/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX page cache management Rick Edgecombe
2024-12-03 2:33 ` Binbin Wu
2024-12-04 1:58 ` Edgecombe, Rick P
2024-12-11 1:23 ` Yan Zhao
2024-12-11 1:33 ` Edgecombe, Rick P
2024-12-03 1:03 ` [RFC PATCH v2 5/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX VM/vCPU field access Rick Edgecombe
2024-12-04 19:57 ` Dave Hansen
2024-12-05 17:33 ` Edgecombe, Rick P
2024-12-03 1:03 ` [RFC PATCH v2 6/6] x86/virt/tdx: Add SEAMCALL wrappers for TDX flush operations Rick Edgecombe
2024-12-04 1:24 ` [RFC PATCH v2 0/6] SEAMCALL Wrappers Huang, Kai
2024-12-04 1:57 ` Edgecombe, Rick P [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c8d4bae2834555474c4c709642f86d2ec86a276e.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=adrian.hunter@intel.com \
--cc=dave.hansen@intel.com \
--cc=isaku.yamahata@gmail.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tony.lindgren@linux.intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=yan.y.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox