aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm/trace.h
diff options
context:
space:
mode:
authorChristoffer Dall <c.dall@virtualopensystems.com>2013-01-20 18:28:07 -0500
committerChristoffer Dall <c.dall@virtualopensystems.com>2013-01-23 13:29:11 -0500
commitd5d8184d35c990b1324d9b30bcd0e4e8aa08f56d (patch)
tree7559fbc98d2b347f89f926b39715d3bf3cfbb719 /arch/arm/kvm/trace.h
parent342cd0ab0e6ca3fe7c88a78890352748b8e894a9 (diff)
KVM: ARM: Memory virtualization setup
This commit introduces the framework for guest memory management through the use of 2nd stage translation. Each VM has a pointer to a level-1 table (the pgd field in struct kvm_arch) which is used for the 2nd stage translations. Entries are added when handling guest faults (later patch) and the table itself can be allocated and freed through the following functions implemented in arch/arm/kvm/arm_mmu.c: - kvm_alloc_stage2_pgd(struct kvm *kvm); - kvm_free_stage2_pgd(struct kvm *kvm); Each entry in TLBs and caches are tagged with a VMID identifier in addition to ASIDs. The VMIDs are assigned consecutively to VMs in the order that VMs are executed, and caches and tlbs are invalidated when the VMID space has been used to allow for more than 255 simultaenously running guests. The 2nd stage pgd is allocated in kvm_arch_init_vm(). The table is freed in kvm_arch_destroy_vm(). Both functions are called from the main KVM code. We pre-allocate page table memory to be able to synchronize using a spinlock and be called under rcu_read_lock from the MMU notifiers. We steal the mmu_memory_cache implementation from x86 and adapt for our specific usage. We support MMU notifiers (thanks to Marc Zyngier) through kvm_unmap_hva and kvm_set_spte_hva. Finally, define kvm_phys_addr_ioremap() to map a device at a guest IPA, which is used by VGIC support to map the virtual CPU interface registers to the guest. This support is added by Marc Zyngier. Reviewed-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Diffstat (limited to 'arch/arm/kvm/trace.h')
-rw-r--r--arch/arm/kvm/trace.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h
index f8869c19c0a3..862b2cc12fbe 100644
--- a/arch/arm/kvm/trace.h
+++ b/arch/arm/kvm/trace.h
@@ -39,7 +39,53 @@ TRACE_EVENT(kvm_exit,
39 TP_printk("PC: 0x%08lx", __entry->vcpu_pc) 39 TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
40); 40);
41 41
42TRACE_EVENT(kvm_unmap_hva,
43 TP_PROTO(unsigned long hva),
44 TP_ARGS(hva),
42 45
46 TP_STRUCT__entry(
47 __field( unsigned long, hva )
48 ),
49
50 TP_fast_assign(
51 __entry->hva = hva;
52 ),
53
54 TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
55);
56
57TRACE_EVENT(kvm_unmap_hva_range,
58 TP_PROTO(unsigned long start, unsigned long end),
59 TP_ARGS(start, end),
60
61 TP_STRUCT__entry(
62 __field( unsigned long, start )
63 __field( unsigned long, end )
64 ),
65
66 TP_fast_assign(
67 __entry->start = start;
68 __entry->end = end;
69 ),
70
71 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
72 __entry->start, __entry->end)
73);
74
75TRACE_EVENT(kvm_set_spte_hva,
76 TP_PROTO(unsigned long hva),
77 TP_ARGS(hva),
78
79 TP_STRUCT__entry(
80 __field( unsigned long, hva )
81 ),
82
83 TP_fast_assign(
84 __entry->hva = hva;
85 ),
86
87 TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
88);
43 89
44#endif /* _TRACE_KVM_H */ 90#endif /* _TRACE_KVM_H */
45 91