[PATCH] KVM: PPC: Book3S HV: Fix kvm_alloc_linear in case where no linears exist

2012-02-03 Thread Paul Mackerras
In kvm_alloc_linear we were using and deferencing ri after the list_for_each_entry had come to the end of the list. In that situation, ri is not really defined and probably points to the list head. This will happen every time if the free_linears list is empty, for instance. This led to a NULL

[PATCH 1/4] KVM: PPC: Book3S HV: Save and restore CR in __kvmppc_vcore_entry

2012-02-03 Thread Paul Mackerras
The ABI specifies that CR fields CR2--CR4 are nonvolatile across function calls. Currently __kvmppc_vcore_entry doesn't save and restore the CR, leading to CR2--CR4 getting corrupted with guest values, possibly leading to incorrect behaviour in its caller. This adds instructions to save and

[PATCH 2/4] KVM: PPC: Book3S HV: Make secondary threads more robust against stray IPIs

2012-02-03 Thread Paul Mackerras
Currently on POWER7, if we are running the guest on a core and we don't need all the hardware threads, we do nothing to ensure that the unused threads aren't executing in the kernel (other than checking that they are offline). We just assume they're napping and we don't do anything to stop them

[PATCH 3/4] KVM: PPC: Book3S HV: Make virtual processor area registration more robust

2012-02-03 Thread Paul Mackerras
The PAPR API allows three sorts of per-virtual-processor areas to be registered (VPA, SLB shadow buffer, and dispatch trace log), and furthermore, these can be registered and unregistered for another virtual CPU. Currently we just update the vcpu fields pointing to these areas at the time of