On 5/23/2022 5:01 PM, Gerd Hoffmann wrote:
Hi,
- The supported XCR0 and XSS bits needs to be cap'ed by tdx_caps, because
KVM uses them to setup XFAM of TD.
+ case 0xd:
+ if (index == 0) {
+ if (reg == R_EAX) {
+ *ret &= (uint32_t)tdx_caps->xfam_fixed0 & XCR0_MASK;
+ *ret |= (uint32_t)tdx_caps->xfam_fixed1 & XCR0_MASK;
+ } else if (reg == R_EDX) {
+ *ret &= (tdx_caps->xfam_fixed0 & XCR0_MASK) >> 32;
+ *ret |= (tdx_caps->xfam_fixed1 & XCR0_MASK) >> 32;
+ }
+ } else if (index == 1) {
+ /* TODO: Adjust XSS when it's supported. */
+ }
+ break;
+ default:
+ /* TODO: Use tdx_caps to adjust CPUID leafs. */
+ break;
Hmm, that looks all a bit messy and incomplete, also the commit
message doesn't match the patch (describes XSS which isn't actually
implemented).
For XSS, QEMU recently got XSS MASK defined, I will use it in this patch.
For other CPUID leaves, we have following patches (a series) to enable
fine-grained feature control for TDX guest and CPU model for it. So the
plan is to make it functional with no error in this basic series. Anyway
I will update the commit message to describe clearly.
take care,
Gerd