| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 3 | | - * it under the terms of the GNU General Public License, version 2, as |
|---|
| 4 | | - * published by the Free Software Foundation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 7 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 8 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 9 | | - * GNU General Public License for more details. |
|---|
| 10 | | - * |
|---|
| 11 | | - * You should have received a copy of the GNU General Public License |
|---|
| 12 | | - * along with this program; if not, write to the Free Software |
|---|
| 13 | | - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 14 | 3 | * |
|---|
| 15 | 4 | * Copyright IBM Corp. 2007 |
|---|
| 16 | 5 | * Copyright 2011 Freescale Semiconductor, Inc. |
|---|
| .. | .. |
|---|
| 61 | 50 | |
|---|
| 62 | 51 | dec_time = vcpu->arch.dec; |
|---|
| 63 | 52 | /* |
|---|
| 64 | | - * Guest timebase ticks at the same frequency as host decrementer. |
|---|
| 65 | | - * So use the host decrementer calculations for decrementer emulation. |
|---|
| 53 | + * Guest timebase ticks at the same frequency as host timebase. |
|---|
| 54 | + * So use the host timebase calculations for decrementer emulation. |
|---|
| 66 | 55 | */ |
|---|
| 67 | | - dec_time = dec_time << decrementer_clockevent.shift; |
|---|
| 68 | | - do_div(dec_time, decrementer_clockevent.mult); |
|---|
| 56 | + dec_time = tb_to_ns(dec_time); |
|---|
| 69 | 57 | dec_nsec = do_div(dec_time, NSEC_PER_SEC); |
|---|
| 70 | 58 | hrtimer_start(&vcpu->arch.dec_timer, |
|---|
| 71 | 59 | ktime_set(dec_time, dec_nsec), HRTIMER_MODE_REL); |
|---|
| .. | .. |
|---|
| 203 | 191 | |
|---|
| 204 | 192 | /* XXX Should probably auto-generate instruction decoding for a particular core |
|---|
| 205 | 193 | * from opcode tables in the future. */ |
|---|
| 206 | | -int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) |
|---|
| 194 | +int kvmppc_emulate_instruction(struct kvm_vcpu *vcpu) |
|---|
| 207 | 195 | { |
|---|
| 208 | 196 | u32 inst; |
|---|
| 209 | 197 | int rs, rt, sprn; |
|---|
| .. | .. |
|---|
| 282 | 270 | * these are illegal instructions. |
|---|
| 283 | 271 | */ |
|---|
| 284 | 272 | if (inst == KVMPPC_INST_SW_BREAKPOINT) { |
|---|
| 285 | | - run->exit_reason = KVM_EXIT_DEBUG; |
|---|
| 286 | | - run->debug.arch.address = kvmppc_get_pc(vcpu); |
|---|
| 273 | + vcpu->run->exit_reason = KVM_EXIT_DEBUG; |
|---|
| 274 | + vcpu->run->debug.arch.status = 0; |
|---|
| 275 | + vcpu->run->debug.arch.address = kvmppc_get_pc(vcpu); |
|---|
| 287 | 276 | emulated = EMULATE_EXIT_USER; |
|---|
| 288 | 277 | advance = 0; |
|---|
| 289 | 278 | } else |
|---|
| .. | .. |
|---|
| 296 | 285 | } |
|---|
| 297 | 286 | |
|---|
| 298 | 287 | if (emulated == EMULATE_FAIL) { |
|---|
| 299 | | - emulated = vcpu->kvm->arch.kvm_ops->emulate_op(run, vcpu, inst, |
|---|
| 288 | + emulated = vcpu->kvm->arch.kvm_ops->emulate_op(vcpu, inst, |
|---|
| 300 | 289 | &advance); |
|---|
| 301 | 290 | if (emulated == EMULATE_AGAIN) { |
|---|
| 302 | 291 | advance = 0; |
|---|