KVM: PPC: Convert MSR to shared page
One of the most obvious registers to share with the guest directly is the MSR. The MSR contains the "interrupts enabled" flag which the guest has to toggle in critical sections. So in order to bring the overhead of interrupt en- and disabling down, let's put msr into the shared page. Keep in mind that even though you can fully read its contents, writing to it doesn't always update all state. There are a few safe fields that don't require hypervisor interaction. See the documentation for a list of MSR bits that are safe to be set from inside the guest. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
committed by
Avi Kivity
parent
96bc451a15
commit
666e7252a1
@@ -314,10 +314,10 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
|
||||
| MAS1_TID(get_tlb_tid(gtlbe)) | MAS1_TS | MAS1_VALID;
|
||||
stlbe->mas2 = (gvaddr & MAS2_EPN)
|
||||
| e500_shadow_mas2_attrib(gtlbe->mas2,
|
||||
vcpu_e500->vcpu.arch.msr & MSR_PR);
|
||||
vcpu_e500->vcpu.arch.shared->msr & MSR_PR);
|
||||
stlbe->mas3 = (hpaddr & MAS3_RPN)
|
||||
| e500_shadow_mas3_attrib(gtlbe->mas3,
|
||||
vcpu_e500->vcpu.arch.msr & MSR_PR);
|
||||
vcpu_e500->vcpu.arch.shared->msr & MSR_PR);
|
||||
stlbe->mas7 = (hpaddr >> 32) & MAS7_RPN;
|
||||
|
||||
trace_kvm_stlb_write(index_of(tlbsel, esel), stlbe->mas1, stlbe->mas2,
|
||||
@@ -576,28 +576,28 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
|
||||
|
||||
int kvmppc_mmu_itlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
|
||||
{
|
||||
unsigned int as = !!(vcpu->arch.msr & MSR_IS);
|
||||
unsigned int as = !!(vcpu->arch.shared->msr & MSR_IS);
|
||||
|
||||
return kvmppc_e500_tlb_search(vcpu, eaddr, get_cur_pid(vcpu), as);
|
||||
}
|
||||
|
||||
int kvmppc_mmu_dtlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
|
||||
{
|
||||
unsigned int as = !!(vcpu->arch.msr & MSR_DS);
|
||||
unsigned int as = !!(vcpu->arch.shared->msr & MSR_DS);
|
||||
|
||||
return kvmppc_e500_tlb_search(vcpu, eaddr, get_cur_pid(vcpu), as);
|
||||
}
|
||||
|
||||
void kvmppc_mmu_itlb_miss(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
unsigned int as = !!(vcpu->arch.msr & MSR_IS);
|
||||
unsigned int as = !!(vcpu->arch.shared->msr & MSR_IS);
|
||||
|
||||
kvmppc_e500_deliver_tlb_miss(vcpu, vcpu->arch.pc, as);
|
||||
}
|
||||
|
||||
void kvmppc_mmu_dtlb_miss(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
unsigned int as = !!(vcpu->arch.msr & MSR_DS);
|
||||
unsigned int as = !!(vcpu->arch.shared->msr & MSR_DS);
|
||||
|
||||
kvmppc_e500_deliver_tlb_miss(vcpu, vcpu->arch.fault_dear, as);
|
||||
}
|
||||
|
Reference in New Issue
Block a user