booke.c (0fdc50dfab47d525b71a9f0d8310746cdc0c09c5) booke.c (cb953129bfe5c0f2da835a0469930873fb7e71df)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *
4 * Copyright IBM Corp. 2007
5 * Copyright 2010-2011 Freescale Semiconductor, Inc.
6 *
7 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
8 * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

--- 21 unchanged lines hidden (view full) ---

30#include "timing.h"
31#include "booke.h"
32
33#define CREATE_TRACE_POINTS
34#include "trace_booke.h"
35
36unsigned long kvmppc_booke_handlers;
37
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *
4 * Copyright IBM Corp. 2007
5 * Copyright 2010-2011 Freescale Semiconductor, Inc.
6 *
7 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
8 * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

--- 21 unchanged lines hidden (view full) ---

30#include "timing.h"
31#include "booke.h"
32
33#define CREATE_TRACE_POINTS
34#include "trace_booke.h"
35
36unsigned long kvmppc_booke_handlers;
37
38#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
39#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
40
41struct kvm_stats_debugfs_item debugfs_entries[] = {
38struct kvm_stats_debugfs_item debugfs_entries[] = {
42 { "mmio", VCPU_STAT(mmio_exits) },
43 { "sig", VCPU_STAT(signal_exits) },
44 { "itlb_r", VCPU_STAT(itlb_real_miss_exits) },
45 { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) },
46 { "dtlb_r", VCPU_STAT(dtlb_real_miss_exits) },
47 { "dtlb_v", VCPU_STAT(dtlb_virt_miss_exits) },
48 { "sysc", VCPU_STAT(syscall_exits) },
49 { "isi", VCPU_STAT(isi_exits) },
50 { "dsi", VCPU_STAT(dsi_exits) },
51 { "inst_emu", VCPU_STAT(emulated_inst_exits) },
52 { "dec", VCPU_STAT(dec_exits) },
53 { "ext_intr", VCPU_STAT(ext_intr_exits) },
54 { "halt_successful_poll", VCPU_STAT(halt_successful_poll) },
55 { "halt_attempted_poll", VCPU_STAT(halt_attempted_poll) },
56 { "halt_poll_invalid", VCPU_STAT(halt_poll_invalid) },
57 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
58 { "doorbell", VCPU_STAT(dbell_exits) },
59 { "guest doorbell", VCPU_STAT(gdbell_exits) },
60 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
39 VCPU_STAT("mmio", mmio_exits),
40 VCPU_STAT("sig", signal_exits),
41 VCPU_STAT("itlb_r", itlb_real_miss_exits),
42 VCPU_STAT("itlb_v", itlb_virt_miss_exits),
43 VCPU_STAT("dtlb_r", dtlb_real_miss_exits),
44 VCPU_STAT("dtlb_v", dtlb_virt_miss_exits),
45 VCPU_STAT("sysc", syscall_exits),
46 VCPU_STAT("isi", isi_exits),
47 VCPU_STAT("dsi", dsi_exits),
48 VCPU_STAT("inst_emu", emulated_inst_exits),
49 VCPU_STAT("dec", dec_exits),
50 VCPU_STAT("ext_intr", ext_intr_exits),
51 VCPU_STAT("halt_successful_poll", halt_successful_poll),
52 VCPU_STAT("halt_attempted_poll", halt_attempted_poll),
53 VCPU_STAT("halt_poll_invalid", halt_poll_invalid),
54 VCPU_STAT("halt_wakeup", halt_wakeup),
55 VCPU_STAT("doorbell", dbell_exits),
56 VCPU_STAT("guest doorbell", gdbell_exits),
57 VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns),
58 VCPU_STAT("halt_poll_fail_ns", halt_poll_fail_ns),
59 VM_STAT("remote_tlb_flush", remote_tlb_flush),
61 { NULL }
62};
63
64/* TODO: use vcpu_printf() */
65void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
66{
67 int i;
68

--- 347 unchanged lines hidden (view full) ---

416 if ((priority == BOOKE_IRQPRIO_EXTERNAL) && vcpu->arch.epr_flags)
417 update_epr = true;
418
419 switch (priority) {
420 case BOOKE_IRQPRIO_DTLB_MISS:
421 case BOOKE_IRQPRIO_DATA_STORAGE:
422 case BOOKE_IRQPRIO_ALIGNMENT:
423 update_dear = true;
60 { NULL }
61};
62
63/* TODO: use vcpu_printf() */
64void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
65{
66 int i;
67

--- 347 unchanged lines hidden (view full) ---

415 if ((priority == BOOKE_IRQPRIO_EXTERNAL) && vcpu->arch.epr_flags)
416 update_epr = true;
417
418 switch (priority) {
419 case BOOKE_IRQPRIO_DTLB_MISS:
420 case BOOKE_IRQPRIO_DATA_STORAGE:
421 case BOOKE_IRQPRIO_ALIGNMENT:
422 update_dear = true;
424 /* fall through */
423 fallthrough;
425 case BOOKE_IRQPRIO_INST_STORAGE:
426 case BOOKE_IRQPRIO_PROGRAM:
427 update_esr = true;
424 case BOOKE_IRQPRIO_INST_STORAGE:
425 case BOOKE_IRQPRIO_PROGRAM:
426 update_esr = true;
428 /* fall through */
427 fallthrough;
429 case BOOKE_IRQPRIO_ITLB_MISS:
430 case BOOKE_IRQPRIO_SYSCALL:
431 case BOOKE_IRQPRIO_FP_UNAVAIL:
432#ifdef CONFIG_SPE_POSSIBLE
433 case BOOKE_IRQPRIO_SPE_UNAVAIL:
434 case BOOKE_IRQPRIO_SPE_FP_DATA:
435 case BOOKE_IRQPRIO_SPE_FP_ROUND:
436#endif

--- 17 unchanged lines hidden (view full) ---

454 case BOOKE_IRQPRIO_MACHINE_CHECK:
455 allowed = vcpu->arch.shared->msr & MSR_ME;
456 allowed = allowed && !crit;
457 int_class = INT_CLASS_MC;
458 break;
459 case BOOKE_IRQPRIO_DECREMENTER:
460 case BOOKE_IRQPRIO_FIT:
461 keep_irq = true;
428 case BOOKE_IRQPRIO_ITLB_MISS:
429 case BOOKE_IRQPRIO_SYSCALL:
430 case BOOKE_IRQPRIO_FP_UNAVAIL:
431#ifdef CONFIG_SPE_POSSIBLE
432 case BOOKE_IRQPRIO_SPE_UNAVAIL:
433 case BOOKE_IRQPRIO_SPE_FP_DATA:
434 case BOOKE_IRQPRIO_SPE_FP_ROUND:
435#endif

--- 17 unchanged lines hidden (view full) ---

453 case BOOKE_IRQPRIO_MACHINE_CHECK:
454 allowed = vcpu->arch.shared->msr & MSR_ME;
455 allowed = allowed && !crit;
456 int_class = INT_CLASS_MC;
457 break;
458 case BOOKE_IRQPRIO_DECREMENTER:
459 case BOOKE_IRQPRIO_FIT:
460 keep_irq = true;
462 /* fall through */
461 fallthrough;
463 case BOOKE_IRQPRIO_EXTERNAL:
464 case BOOKE_IRQPRIO_DBELL:
465 allowed = vcpu->arch.shared->msr & MSR_EE;
466 allowed = allowed && !crit;
467 msr_mask = MSR_CE | MSR_ME | MSR_DE;
468 int_class = INT_CLASS_NONCRIT;
469 break;
470 case BOOKE_IRQPRIO_DEBUG:

--- 1290 unchanged lines hidden (view full) ---

1761 int r;
1762
1763 vcpu_load(vcpu);
1764 r = kvmppc_core_vcpu_translate(vcpu, tr);
1765 vcpu_put(vcpu);
1766 return r;
1767}
1768
462 case BOOKE_IRQPRIO_EXTERNAL:
463 case BOOKE_IRQPRIO_DBELL:
464 allowed = vcpu->arch.shared->msr & MSR_EE;
465 allowed = allowed && !crit;
466 msr_mask = MSR_CE | MSR_ME | MSR_DE;
467 int_class = INT_CLASS_NONCRIT;
468 break;
469 case BOOKE_IRQPRIO_DEBUG:

--- 1290 unchanged lines hidden (view full) ---

1760 int r;
1761
1762 vcpu_load(vcpu);
1763 r = kvmppc_core_vcpu_translate(vcpu, tr);
1764 vcpu_put(vcpu);
1765 return r;
1766}
1767
1769int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1768void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
1770{
1769{
1771 return -ENOTSUPP;
1770
1772}
1773
1771}
1772
1774void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1775 struct kvm_memory_slot *dont)
1773int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1776{
1774{
1775 return -ENOTSUPP;
1777}
1778
1776}
1777
1779int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1780 unsigned long npages)
1778void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot)
1781{
1779{
1782 return 0;
1783}
1784
1785int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1786 struct kvm_memory_slot *memslot,
1780}
1781
1782int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1783 struct kvm_memory_slot *memslot,
1787 const struct kvm_userspace_memory_region *mem)
1784 const struct kvm_userspace_memory_region *mem,
1785 enum kvm_mr_change change)
1788{
1789 return 0;
1790}
1791
1792void kvmppc_core_commit_memory_region(struct kvm *kvm,
1793 const struct kvm_userspace_memory_region *mem,
1794 const struct kvm_memory_slot *old,
1795 const struct kvm_memory_slot *new,

--- 273 unchanged lines hidden (view full) ---

2069{
2070 current->thread.kvm_vcpu = NULL;
2071 vcpu->cpu = -1;
2072
2073 /* Clear pending debug event in DBSR */
2074 kvmppc_clear_dbsr();
2075}
2076
1786{
1787 return 0;
1788}
1789
1790void kvmppc_core_commit_memory_region(struct kvm *kvm,
1791 const struct kvm_userspace_memory_region *mem,
1792 const struct kvm_memory_slot *old,
1793 const struct kvm_memory_slot *new,

--- 273 unchanged lines hidden (view full) ---

2067{
2068 current->thread.kvm_vcpu = NULL;
2069 vcpu->cpu = -1;
2070
2071 /* Clear pending debug event in DBSR */
2072 kvmppc_clear_dbsr();
2073}
2074
2077void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
2078{
2079 vcpu->kvm->arch.kvm_ops->mmu_destroy(vcpu);
2080}
2081
2082int kvmppc_core_init_vm(struct kvm *kvm)
2083{
2084 return kvm->arch.kvm_ops->init_vm(kvm);
2085}
2086
2087int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu)
2088{
2089 int i;

--- 111 unchanged lines hidden ---
2075int kvmppc_core_init_vm(struct kvm *kvm)
2076{
2077 return kvm->arch.kvm_ops->init_vm(kvm);
2078}
2079
2080int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu)
2081{
2082 int i;

--- 111 unchanged lines hidden ---