aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-05-11 19:08:32 -0400
committerAlexander Graf <agraf@suse.de>2014-05-30 08:26:24 -0400
commitf3383cf80e417e86fcc84a2eb4c96bc52842d8d9 (patch)
tree69cde42c1f516992ef2e6db665d1098ee0eac951 /arch/powerpc/kvm/powerpc.c
parent1f365bb0de12da4a9ef8e56ffba2218d9a026011 (diff)
KVM: PPC: Disable NX for old magic page using guests
Old guests try to use the magic page, but map their trampoline code inside of an NX region. Since we can't fix those old kernels, try to detect whether the guest is sane or not. If not, just disable NX functionality in KVM so that old guests at least work at all. For newer guests, add a bit that we can set to keep NX functionality available. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index b4e15bf3ff88..154f352c39ae 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -177,8 +177,18 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
177 vcpu->arch.shared_big_endian = shared_big_endian; 177 vcpu->arch.shared_big_endian = shared_big_endian;
178#endif 178#endif
179 179
180 vcpu->arch.magic_page_pa = param1; 180 if (!(param2 & MAGIC_PAGE_FLAG_NOT_MAPPED_NX)) {
181 vcpu->arch.magic_page_ea = param2; 181 /*
182 * Older versions of the Linux magic page code had
183 * a bug where they would map their trampoline code
184 * NX. If that's the case, remove !PR NX capability.
185 */
186 vcpu->arch.disable_kernel_nx = true;
187 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
188 }
189
190 vcpu->arch.magic_page_pa = param1 & ~0xfffULL;
191 vcpu->arch.magic_page_ea = param2 & ~0xfffULL;
182 192
183 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7; 193 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
184 194