KVM: MIPS: Convert get/set_regs -> vcpu_load/put
Convert the get_regs() and set_regs() callbacks to vcpu_load() and vcpu_put(), which provide a cpu argument and more closely match the kvm_arch_vcpu_load() / kvm_arch_vcpu_put() that they are called by. This is in preparation for moving ASID management into the implementations. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krčmář" <rkrcmar@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org
This commit is contained in:
parent
1534b39649
commit
a60b8438bd
|
@ -539,8 +539,8 @@ struct kvm_mips_callbacks {
|
||||||
const struct kvm_one_reg *reg, s64 *v);
|
const struct kvm_one_reg *reg, s64 *v);
|
||||||
int (*set_one_reg)(struct kvm_vcpu *vcpu,
|
int (*set_one_reg)(struct kvm_vcpu *vcpu,
|
||||||
const struct kvm_one_reg *reg, s64 v);
|
const struct kvm_one_reg *reg, s64 v);
|
||||||
int (*vcpu_get_regs)(struct kvm_vcpu *vcpu);
|
int (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
|
||||||
int (*vcpu_set_regs)(struct kvm_vcpu *vcpu);
|
int (*vcpu_put)(struct kvm_vcpu *vcpu, int cpu);
|
||||||
};
|
};
|
||||||
extern struct kvm_mips_callbacks *kvm_mips_callbacks;
|
extern struct kvm_mips_callbacks *kvm_mips_callbacks;
|
||||||
int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks);
|
int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks);
|
||||||
|
|
|
@ -294,7 +294,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore guest state to registers */
|
/* restore guest state to registers */
|
||||||
kvm_mips_callbacks->vcpu_set_regs(vcpu);
|
kvm_mips_callbacks->vcpu_load(vcpu, cpu);
|
||||||
|
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
|
||||||
vcpu->arch.last_sched_cpu = cpu;
|
vcpu->arch.last_sched_cpu = cpu;
|
||||||
|
|
||||||
/* save guest state in registers */
|
/* save guest state in registers */
|
||||||
kvm_mips_callbacks->vcpu_get_regs(vcpu);
|
kvm_mips_callbacks->vcpu_put(vcpu, cpu);
|
||||||
|
|
||||||
if (((cpu_context(cpu, current->mm) ^ asid_cache(cpu)) &
|
if (((cpu_context(cpu, current->mm) ^ asid_cache(cpu)) &
|
||||||
asid_version_mask(cpu))) {
|
asid_version_mask(cpu))) {
|
||||||
|
|
|
@ -633,15 +633,15 @@ static int kvm_trap_emul_set_one_reg(struct kvm_vcpu *vcpu,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvm_trap_emul_vcpu_get_regs(struct kvm_vcpu *vcpu)
|
static int kvm_trap_emul_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
|
||||||
{
|
{
|
||||||
kvm_lose_fpu(vcpu);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvm_trap_emul_vcpu_set_regs(struct kvm_vcpu *vcpu)
|
static int kvm_trap_emul_vcpu_put(struct kvm_vcpu *vcpu, int cpu)
|
||||||
{
|
{
|
||||||
|
kvm_lose_fpu(vcpu);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,8 +675,8 @@ static struct kvm_mips_callbacks kvm_trap_emul_callbacks = {
|
||||||
.copy_reg_indices = kvm_trap_emul_copy_reg_indices,
|
.copy_reg_indices = kvm_trap_emul_copy_reg_indices,
|
||||||
.get_one_reg = kvm_trap_emul_get_one_reg,
|
.get_one_reg = kvm_trap_emul_get_one_reg,
|
||||||
.set_one_reg = kvm_trap_emul_set_one_reg,
|
.set_one_reg = kvm_trap_emul_set_one_reg,
|
||||||
.vcpu_get_regs = kvm_trap_emul_vcpu_get_regs,
|
.vcpu_load = kvm_trap_emul_vcpu_load,
|
||||||
.vcpu_set_regs = kvm_trap_emul_vcpu_set_regs,
|
.vcpu_put = kvm_trap_emul_vcpu_put,
|
||||||
};
|
};
|
||||||
|
|
||||||
int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks)
|
int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks)
|
||||||
|
|
Loading…
Reference in New Issue