diff options
Diffstat (limited to 'arch/mips/kvm')
| -rw-r--r-- | arch/mips/kvm/emulate.c | 2 | ||||
| -rw-r--r-- | arch/mips/kvm/locore.S | 16 | ||||
| -rw-r--r-- | arch/mips/kvm/mips.c | 5 |
3 files changed, 15 insertions, 8 deletions
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index d5fa3eaf39a1..41b1b090f56f 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c | |||
| @@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, | |||
| 1581 | 1581 | ||
| 1582 | base = (inst >> 21) & 0x1f; | 1582 | base = (inst >> 21) & 0x1f; |
| 1583 | op_inst = (inst >> 16) & 0x1f; | 1583 | op_inst = (inst >> 16) & 0x1f; |
| 1584 | offset = inst & 0xffff; | 1584 | offset = (int16_t)inst; |
| 1585 | cache = (inst >> 16) & 0x3; | 1585 | cache = (inst >> 16) & 0x3; |
| 1586 | op = (inst >> 18) & 0x7; | 1586 | op = (inst >> 18) & 0x7; |
| 1587 | 1587 | ||
diff --git a/arch/mips/kvm/locore.S b/arch/mips/kvm/locore.S index 7bab3a4e8f7d..7e2210846b8b 100644 --- a/arch/mips/kvm/locore.S +++ b/arch/mips/kvm/locore.S | |||
| @@ -157,9 +157,11 @@ FEXPORT(__kvm_mips_vcpu_run) | |||
| 157 | 157 | ||
| 158 | FEXPORT(__kvm_mips_load_asid) | 158 | FEXPORT(__kvm_mips_load_asid) |
| 159 | /* Set the ASID for the Guest Kernel */ | 159 | /* Set the ASID for the Guest Kernel */ |
| 160 | INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ | 160 | PTR_L t0, VCPU_COP0(k1) |
| 161 | /* addresses shift to 0x80000000 */ | 161 | LONG_L t0, COP0_STATUS(t0) |
| 162 | bltz t0, 1f /* If kernel */ | 162 | andi t0, KSU_USER | ST0_ERL | ST0_EXL |
| 163 | xori t0, KSU_USER | ||
| 164 | bnez t0, 1f /* If kernel */ | ||
| 163 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ | 165 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
| 164 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ | 166 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
| 165 | 1: | 167 | 1: |
| @@ -474,9 +476,11 @@ __kvm_mips_return_to_guest: | |||
| 474 | mtc0 t0, CP0_EPC | 476 | mtc0 t0, CP0_EPC |
| 475 | 477 | ||
| 476 | /* Set the ASID for the Guest Kernel */ | 478 | /* Set the ASID for the Guest Kernel */ |
| 477 | INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ | 479 | PTR_L t0, VCPU_COP0(k1) |
| 478 | /* addresses shift to 0x80000000 */ | 480 | LONG_L t0, COP0_STATUS(t0) |
| 479 | bltz t0, 1f /* If kernel */ | 481 | andi t0, KSU_USER | ST0_ERL | ST0_EXL |
| 482 | xori t0, KSU_USER | ||
| 483 | bnez t0, 1f /* If kernel */ | ||
| 480 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ | 484 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
| 481 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ | 485 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
| 482 | 1: | 486 | 1: |
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 49ff3bfc007e..b9b803facdbf 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c | |||
| @@ -279,7 +279,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) | |||
| 279 | 279 | ||
| 280 | if (!gebase) { | 280 | if (!gebase) { |
| 281 | err = -ENOMEM; | 281 | err = -ENOMEM; |
| 282 | goto out_free_cpu; | 282 | goto out_uninit_cpu; |
| 283 | } | 283 | } |
| 284 | kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n", | 284 | kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n", |
| 285 | ALIGN(size, PAGE_SIZE), gebase); | 285 | ALIGN(size, PAGE_SIZE), gebase); |
| @@ -343,6 +343,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) | |||
| 343 | out_free_gebase: | 343 | out_free_gebase: |
| 344 | kfree(gebase); | 344 | kfree(gebase); |
| 345 | 345 | ||
| 346 | out_uninit_cpu: | ||
| 347 | kvm_vcpu_uninit(vcpu); | ||
| 348 | |||
| 346 | out_free_cpu: | 349 | out_free_cpu: |
| 347 | kfree(vcpu); | 350 | kfree(vcpu); |
| 348 | 351 | ||
