KVM: Store immutable gfn_to_pfn_cache properties
authorMichal Luczaj <mhal@rbox.co>
Thu, 13 Oct 2022 21:12:24 +0000 (21:12 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 30 Nov 2022 19:25:23 +0000 (19:25 +0000)
commit8c82a0b3ba1a411b84af5d43a4cc5994efa897ec
treeb7305a994d35882a01e9514207160bcd7cd0f408
parent214b0a88c46d5f32d80abe0d1bc2eea1cbd38f11
KVM: Store immutable gfn_to_pfn_cache properties

Move the assignment of immutable properties @kvm, @vcpu, and @usage to
the initializer.  Make _activate() and _deactivate() use stored values.

Note, @len is also effectively immutable for most cases, but not in the
case of the Xen runstate cache, which may be split across two pages and
the length of the first segment will depend on its address.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
[sean: handle @len in a separate patch]
Signed-off-by: Sean Christopherson <seanjc@google.com>
[dwmw2: acknowledge that @len can actually change for some use cases]
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/kvm/x86.c
arch/x86/kvm/xen.c
include/linux/kvm_host.h
include/linux/kvm_types.h
virt/kvm/pfncache.c