diff options
author | Alexander Graf <agraf@suse.de> | 2011-08-08 09:06:55 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-25 12:52:21 -0400 |
commit | 04fcc11bb5653c421f11f109d8b79ea5eb9fedb4 (patch) | |
tree | 6cb53e2890c526bff4b1e53776ce83bce1247038 /arch/powerpc | |
parent | 317a8fa304f8ba3cd8b67b0f5f38e366e8c3cf1d (diff) |
KVM: PPC: Interpret SDR1 as HVA in PAPR mode
When running a PAPR guest, the guest is not allowed to set SDR1 - instead
the HTAB information is held in internal hypervisor structures. But all of
our current code relies on SDR1 and walking the HTAB like on real hardware.
So in order to not be too intrusive, we simply set SDR1 to the HTAB we hold
in host memory. That way we can keep the HTAB in user space, but use it from
kernel space to map the guest.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c index c6d3e194b6b4..b871721c0050 100644 --- a/arch/powerpc/kvm/book3s_64_mmu.c +++ b/arch/powerpc/kvm/book3s_64_mmu.c | |||
@@ -128,7 +128,13 @@ static hva_t kvmppc_mmu_book3s_64_get_pteg( | |||
128 | dprintk("MMU: page=0x%x sdr1=0x%llx pteg=0x%llx vsid=0x%llx\n", | 128 | dprintk("MMU: page=0x%x sdr1=0x%llx pteg=0x%llx vsid=0x%llx\n", |
129 | page, vcpu_book3s->sdr1, pteg, slbe->vsid); | 129 | page, vcpu_book3s->sdr1, pteg, slbe->vsid); |
130 | 130 | ||
131 | r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT); | 131 | /* When running a PAPR guest, SDR1 contains a HVA address instead |
132 | of a GPA */ | ||
133 | if (vcpu_book3s->vcpu.arch.papr_enabled) | ||
134 | r = pteg; | ||
135 | else | ||
136 | r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT); | ||
137 | |||
132 | if (kvm_is_error_hva(r)) | 138 | if (kvm_is_error_hva(r)) |
133 | return r; | 139 | return r; |
134 | return r | (pteg & ~PAGE_MASK); | 140 | return r | (pteg & ~PAGE_MASK); |