• Sean Christopherson's avatar
    KVM: Let/force architectures to deal with arch specific memslot data · 537a17b3
    Sean Christopherson authored
    Pass the "old" slot to kvm_arch_prepare_memory_region() and force arch
    code to handle propagating arch specific data from "new" to "old" when
    necessary.  This is a baby step towards dynamically allocating "new" from
    the get go, and is a (very) minor performance boost on x86 due to not
    unnecessarily copying arch data.
    
    For PPC HV, copy the rmap in the !CREATE and !DELETE paths, i.e. for MOVE
    and FLAGS_ONLY.  This is functionally a nop as the previous behavior
    would overwrite the pointer for CREATE, and eventually discard/ignore it
    for DELETE.
    
    For x86, copy the arch data only for FLAGS_ONLY changes.  Unlike PPC HV,
    x86 needs to reallocate arch data in the MOVE case as the size of x86's
    allocations depend on the alignment of the memslot's gfn.
    
    Opportunistically tweak kvm_arch_prepare_memory_region()'s param order to
    match the "commit" prototype.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Reviewed-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
    [mss: add missing RISCV kvm_arch_prepare_memory_region() change]
    Signed-off-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Message-Id: <67dea5f11bbcfd71e3da5986f11e87f5dd4013f9.1638817639.git.maciej.szmigiero@oracle.com>
    537a17b3
booke.c 56.8 KB