Skip to content

Commit

Permalink
KVM: PPC: Book3S HV: Use accessors for VCPU registers
Browse files Browse the repository at this point in the history
Introduce accessor generator macros for Book3S HV VCPU registers. Use
the accessor functions to replace direct accesses to this registers.

This will be important later for Nested APIv2 support which requires
additional functionality for accessing and modifying VCPU state.

Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230914030600.16993-7-jniethe5@gmail.com
  • Loading branch information
Jordan Niethe authored and Michael Ellerman committed Sep 14, 2023
1 parent c8ae9b3 commit ebc88ea
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 72 deletions.
5 changes: 3 additions & 2 deletions arch/powerpc/kvm/book3s_64_mmu_radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <asm/kvm_ppc.h>
#include <asm/kvm_book3s.h>
#include "book3s_hv.h"
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/pgalloc.h>
Expand Down Expand Up @@ -294,9 +295,9 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
} else {
if (!(pte & _PAGE_PRIVILEGED)) {
/* Check AMR/IAMR to see if strict mode is in force */
if (vcpu->arch.amr & (1ul << 62))
if (kvmppc_get_amr_hv(vcpu) & (1ul << 62))
gpte->may_read = 0;
if (vcpu->arch.amr & (1ul << 63))
if (kvmppc_get_amr_hv(vcpu) & (1ul << 63))
gpte->may_write = 0;
if (vcpu->arch.iamr & (1ul << 62))
gpte->may_execute = 0;
Expand Down
Loading

0 comments on commit ebc88ea

Please sign in to comment.