Skip to content
Snippets Groups Projects
Commit 78128481 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov
Browse files

KVM: Move coalesced MMIO initialization (back) into kvm_create_vm()

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2119111



commit c2b82397
Author: Sean Christopherson <seanjc@google.com>
Date:   Tue Aug 16 05:39:37 2022 +0000

    KVM: Move coalesced MMIO initialization (back) into kvm_create_vm()

    Invoke kvm_coalesced_mmio_init() from kvm_create_vm() now that allocating
    and initializing coalesced MMIO objects is separate from registering any
    associated devices.  Moving coalesced MMIO cleans up the last oddity
    where KVM does VM creation/initialization after kvm_create_vm(), and more
    importantly after kvm_arch_post_init_vm() is called and the VM is added
    to the global vm_list, i.e. after the VM is fully created as far as KVM
    is concerned.

    Originally, kvm_coalesced_mmio_init() was called by kvm_create_vm(), but
    the original implementation was completely devoid of error handling.
    Commit 6ce5a090 ("KVM: coalesced_mmio: fix kvm_coalesced_mmio_init()'s
    error handling" fixed the various bugs, and in doing so rightly moved the
    call to after kvm_create_vm() because kvm_coalesced_mmio_init() also
    registered the coalesced MMIO device.  Commit 2b3c246a ("KVM: Make
    coalesced mmio use a device per zone") cleaned up that mess by having
    each zone register a separate device, i.e. moved device registration to
    its logical home in kvm_vm_ioctl_register_coalesced_mmio().  As a result,
    kvm_coalesced_mmio_init() is now a "pure" initialization helper and can
    be safely called from kvm_create_vm().

    Opportunstically drop the #ifdef, KVM provides stubs for
    kvm_coalesced_mmio_{init,free}() when CONFIG_KVM_MMIO=n (s390).

Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20220816053937.2477106-4-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>

Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
parent e6a3fa79
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment