KVM: PPC: Add return value to core_check_requests

Requests may want to tell us that we need to go back into host state,
so add a return value for the checks.

Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Alexander Graf 2012-08-13 12:50:35 +02:00
Родитель 7ee788556b
Коммит 7c973a2ebb
4 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -112,7 +112,7 @@ extern int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn,
ulong val); ulong val);
extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, extern int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn,
ulong *val); ulong *val);
extern void kvmppc_core_check_requests(struct kvm_vcpu *vcpu); extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu);
extern int kvmppc_booke_init(void); extern int kvmppc_booke_init(void);
extern void kvmppc_booke_exit(void); extern void kvmppc_booke_exit(void);

Просмотреть файл

@ -86,12 +86,16 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
kvmppc_giveup_ext(vcpu, MSR_VSX); kvmppc_giveup_ext(vcpu, MSR_VSX);
} }
void kvmppc_core_check_requests(struct kvm_vcpu *vcpu) int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
{ {
int r = 1; /* Indicate we want to get back into the guest */
/* We misuse TLB_FLUSH to indicate that we want to clear /* We misuse TLB_FLUSH to indicate that we want to clear
all shadow cache entries */ all shadow cache entries */
if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
kvmppc_mmu_pte_flush(vcpu, 0, 0); kvmppc_mmu_pte_flush(vcpu, 0, 0);
return r;
} }
/************* MMU Notifiers *************/ /************* MMU Notifiers *************/

Просмотреть файл

@ -455,14 +455,18 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
return r; return r;
} }
void kvmppc_core_check_requests(struct kvm_vcpu *vcpu) int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
{ {
int r = 1; /* Indicate we want to get back into the guest */
if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu))
update_timer_ints(vcpu); update_timer_ints(vcpu);
#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) #if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
kvmppc_core_flush_tlb(vcpu); kvmppc_core_flush_tlb(vcpu);
#endif #endif
return r;
} }
int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)

Просмотреть файл

@ -83,9 +83,11 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
/* Make sure we process requests preemptable */ /* Make sure we process requests preemptable */
local_irq_enable(); local_irq_enable();
trace_kvm_check_requests(vcpu); trace_kvm_check_requests(vcpu);
kvmppc_core_check_requests(vcpu); r = kvmppc_core_check_requests(vcpu);
local_irq_disable(); local_irq_disable();
continue; if (r > 0)
continue;
break;
} }
if (kvmppc_core_prepare_to_enter(vcpu)) { if (kvmppc_core_prepare_to_enter(vcpu)) {