RE: [PATCH v1 14/23] KVM: VMX: Dump FRED context in dump_vmcs()

Li, Xin3
2023-11-15T02:41:45Z

> > @@ -6440,6 +6440,8 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
> >
> > vmentry_ctl = vmcs_read32(VM_ENTRY_CONTROLS);
> > vmexit_ctl = vmcs_read32(VM_EXIT_CONTROLS);
> > + secondary_vmexit_ctl = cpu_has_secondary_vmexit_ctrls() ?
> > + vmcs_read64(SECONDARY_VM_EXIT_CONTROLS) : 0;
> > cpu_based_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> > pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL);
> > cr4 = vmcs_readl(GUEST_CR4);
> > @@ -6486,6 +6488,19 @@ void dump_vmcs(struct kvm_vcpu *vcpu)
> > vmx_dump_sel("LDTR:", GUEST_LDTR_SELECTOR);
> > vmx_dump_dtsel("IDTR:", GUEST_IDTR_LIMIT);
> > vmx_dump_sel("TR: ", GUEST_TR_SELECTOR);
> > +#ifdef CONFIG_X86_64
> > + if (cpu_feature_enabled(X86_FEATURE_FRED)) {
>
> Shouldn't this be gated on whether FRED is enabled in kvm aka the CPUID bit is
> enumerated ?

Yeah, that is more accurate.