Re: [PATCH 11/18] KVM: TDX: Add methods to ignore accesses to CPU state

Binbin Wu
2025-01-15T06:51:20Z

On 12/10/2024 8:49 AM, Binbin Wu wrote:
[...]
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 413359741085..4bf3a6dc66fc 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -733,8 +733,15 @@ int tdx_vcpu_create(struct kvm_vcpu *vcpu)
>
> vcpu->arch.tsc_offset = kvm_tdx->tsc_offset;
> vcpu->arch.l1_tsc_offset = vcpu->arch.tsc_offset;
> - vcpu->arch.guest_state_protected =
> - !(to_kvm_tdx(vcpu->kvm)->attributes & TDX_TD_ATTR_DEBUG);
> + /*
> + * TODO: support off-TD debug. If TD DEBUG is enabled, guest state
> + * can be accessed. guest_state_protected = false. and kvm ioctl to
> + * access CPU states should be usable for user space VMM (e.g. qemu).
> + *
> + * vcpu->arch.guest_state_protected =
> + * !(to_kvm_tdx(vcpu->kvm)->attributes & TDX_TD_ATTR_DEBUG);
> + */
> + vcpu->arch.guest_state_protected = true;
This was mistakenly introduced during re-base and should be discarded.

>
> if ((kvm_tdx->xfam & XFEATURE_MASK_XTILE) == XFEATURE_MASK_XTILE)
> vcpu->arch.xfd_no_write_intercept = true;
> @@ -2134,6 +2141,23 @@ int tdx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
> }
> }
> …