KVM: PPC: Book3S HV: Introduce low level MSR accessor
authorJordan Niethe <jniethe5@gmail.com>
Thu, 14 Sep 2023 03:05:56 +0000 (13:05 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Sep 2023 12:04:24 +0000 (22:04 +1000)
commit6de2e837babb411cfb3cdb570581c3a65576ddaf
treef03f9bc408505793515a111e21dfe91b451ab561
parentebc88ea7a6ad0ea349df9c765357d3aa4e662aa9
KVM: PPC: Book3S HV: Introduce low level MSR accessor

kvmppc_get_msr() and kvmppc_set_msr_fast() serve as accessors for the
MSR. However because the MSR is kept in the shared regs they include a
conditional check for kvmppc_shared_big_endian() and endian conversion.

Within the Book3S HV specific code there are direct reads and writes of
shregs::msr. In preparation for Nested APIv2 these accesses need to be
replaced with accessor functions so it is possible to extend their
behavior. However, using the kvmppc_get_msr() and kvmppc_set_msr_fast()
functions is undesirable because it would introduce a conditional branch
and endian conversion that is not currently present.

kvmppc_set_msr_hv() already exists, it is used for the
kvmppc_ops::set_msr callback.

Introduce a low level accessor __kvmppc_{s,g}et_msr_hv() that simply
gets and sets shregs::msr. This will be extend for Nested APIv2 support.

Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230914030600.16993-8-jniethe5@gmail.com
arch/powerpc/kvm/book3s_64_mmu_hv.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv.h
arch/powerpc/kvm/book3s_hv_builtin.c