• Sean Christopherson's avatar
    KVM: x86: Move hardware setup/unsetup to init/exit · b7483387
    Sean Christopherson authored
    Now that kvm_arch_hardware_setup() is called immediately after
    kvm_arch_init(), fold the guts of kvm_arch_hardware_(un)setup() into
    kvm_arch_{init,exit}() as a step towards dropping one of the hooks.
    
    To avoid having to unwind various setup, e.g registration of several
    notifiers, slot in the vendor hardware setup before the registration of
    said notifiers and callbacks.  Introducing a functional change while
    moving code is less than ideal, but the alternative is adding a pile of
    unwinding code, which is much more error prone, e.g. several attempts to
    move the setup code verbatim all introduced bugs.
    
    Add a comment to document that kvm_ops_update() is effectively the point
    of no return, e.g. it sets the kvm_x86_ops.hardware_enable canary and so
    needs to be unwound.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20221130230934.1014142-9-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b7483387
x86.c 358 KB