[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUOUiD0J5Qihao+4@google.com>
Date: Thu, 16 Sep 2021 19:01:28 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Reiji Watanabe <reijiw@...gle.com>
Subject: Re: [PATCH 2/3] KVM: VMX: Move RESET emulation to vmx_vcpu_reset()
On Thu, Sep 16, 2021, Vitaly Kuznetsov wrote:
> Sean Christopherson <seanjc@...gle.com> writes:
> > @@ -10897,6 +10899,9 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
> > kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
> > kvm_rip_write(vcpu, 0xfff0);
> >
> > + vcpu->arch.cr3 = 0;
> > + kvm_register_mark_dirty(vcpu, VCPU_EXREG_CR3);
> > +
> > /*
> > * CR0.CD/NW are set on RESET, preserved on INIT. Note, some versions
> > * of Intel's SDM list CD/NW as being set on INIT, but they contradict
> >
>
> A selftest for vCPU create/reset would be really helpful. I can even
> volunteer to [eventually] write one :-)
Hmm, I wonder if it would be possible to share code/infrastructure with Erdem's
in-progress TDX selftest framework[*]. TDX forces vCPUs to start at the legacy
reset vector with paging disabled, so it needs a lot of the same glue code as a
from-RESET test would need. TDX forces 32-bit PM instead of RM, but it should
be easy enough to allow an optional opening sequence to get into 32-bit PM.
We could also test INIT without much trouble since INIT to the BSP will send it
back to the reset vector, e.g. set a flag somewhere to avoid an infinite loop and
INIT self.
Let me work with Erdem to see if we can concoct something that will work for
both TDX and tests that want to take control at RESET.
[*] https://lkml.kernel.org/r/20210726183816.1343022-3-erdemaktas@google.com
Powered by blists - more mailing lists