diff options
author | Alexander Graf <agraf@suse.de> | 2010-04-19 20:49:46 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:18:55 -0400 |
commit | af7b4d104b36e782a5a97dd55958c3c63964e088 (patch) | |
tree | 6c727f71eb6c094d289d504a472a4f1a4f49d1bd /arch/powerpc | |
parent | 4f84139037b0c006c906cacbe904b25ccd4dfff9 (diff) |
KVM: PPC: Convert u64 -> ulong
There are some pieces in the code that I overlooked that still use
u64s instead of longs. This slows down 32 bit hosts unnecessarily, so
let's just move them to ulong.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s.h | 4 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 6 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_32_mmu.c | 6 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_32_mmu_host.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu_host.c | 6 |
7 files changed, 19 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index 9517b8deafed..5d3bd0cc4116 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -107,9 +107,9 @@ struct kvmppc_vcpu_book3s { | |||
107 | #define VSID_BAT 0x7fffffffffb00000ULL | 107 | #define VSID_BAT 0x7fffffffffb00000ULL |
108 | #define VSID_PR 0x8000000000000000ULL | 108 | #define VSID_PR 0x8000000000000000ULL |
109 | 109 | ||
110 | extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask); | 110 | extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong ea, ulong ea_mask); |
111 | extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); | 111 | extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask); |
112 | extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end); | 112 | extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end); |
113 | extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); | 113 | extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr); |
114 | extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); | 114 | extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu); |
115 | extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); | 115 | extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); |
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 5a83995105f8..0c9ad869decd 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -124,9 +124,9 @@ struct kvm_arch { | |||
124 | }; | 124 | }; |
125 | 125 | ||
126 | struct kvmppc_pte { | 126 | struct kvmppc_pte { |
127 | u64 eaddr; | 127 | ulong eaddr; |
128 | u64 vpage; | 128 | u64 vpage; |
129 | u64 raddr; | 129 | ulong raddr; |
130 | bool may_read : 1; | 130 | bool may_read : 1; |
131 | bool may_write : 1; | 131 | bool may_write : 1; |
132 | bool may_execute : 1; | 132 | bool may_execute : 1; |
@@ -145,7 +145,7 @@ struct kvmppc_mmu { | |||
145 | int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data); | 145 | int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data); |
146 | void (*reset_msr)(struct kvm_vcpu *vcpu); | 146 | void (*reset_msr)(struct kvm_vcpu *vcpu); |
147 | void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); | 147 | void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); |
148 | int (*esid_to_vsid)(struct kvm_vcpu *vcpu, u64 esid, u64 *vsid); | 148 | int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid); |
149 | u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data); | 149 | u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data); |
150 | bool (*is_dcbz32)(struct kvm_vcpu *vcpu); | 150 | bool (*is_dcbz32)(struct kvm_vcpu *vcpu); |
151 | }; | 151 | }; |
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index ec0a6512ab09..6ee9c5e1ffe2 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -813,12 +813,12 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
813 | * so we can't use the NX bit inside the guest. Let's cross our fingers, | 813 | * so we can't use the NX bit inside the guest. Let's cross our fingers, |
814 | * that no guest that needs the dcbz hack does NX. | 814 | * that no guest that needs the dcbz hack does NX. |
815 | */ | 815 | */ |
816 | kvmppc_mmu_pte_flush(vcpu, kvmppc_get_pc(vcpu), ~0xFFFULL); | 816 | kvmppc_mmu_pte_flush(vcpu, kvmppc_get_pc(vcpu), ~0xFFFUL); |
817 | r = RESUME_GUEST; | 817 | r = RESUME_GUEST; |
818 | } else { | 818 | } else { |
819 | vcpu->arch.msr |= to_svcpu(vcpu)->shadow_srr1 & 0x58000000; | 819 | vcpu->arch.msr |= to_svcpu(vcpu)->shadow_srr1 & 0x58000000; |
820 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); | 820 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); |
821 | kvmppc_mmu_pte_flush(vcpu, kvmppc_get_pc(vcpu), ~0xFFFULL); | 821 | kvmppc_mmu_pte_flush(vcpu, kvmppc_get_pc(vcpu), ~0xFFFUL); |
822 | r = RESUME_GUEST; | 822 | r = RESUME_GUEST; |
823 | } | 823 | } |
824 | break; | 824 | break; |
@@ -844,7 +844,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
844 | vcpu->arch.dear = dar; | 844 | vcpu->arch.dear = dar; |
845 | to_book3s(vcpu)->dsisr = to_svcpu(vcpu)->fault_dsisr; | 845 | to_book3s(vcpu)->dsisr = to_svcpu(vcpu)->fault_dsisr; |
846 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); | 846 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); |
847 | kvmppc_mmu_pte_flush(vcpu, vcpu->arch.dear, ~0xFFFULL); | 847 | kvmppc_mmu_pte_flush(vcpu, vcpu->arch.dear, ~0xFFFUL); |
848 | r = RESUME_GUEST; | 848 | r = RESUME_GUEST; |
849 | } | 849 | } |
850 | break; | 850 | break; |
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c index 48efb37500a1..33186b745c90 100644 --- a/arch/powerpc/kvm/book3s_32_mmu.c +++ b/arch/powerpc/kvm/book3s_32_mmu.c | |||
@@ -60,7 +60,7 @@ static inline bool check_debug_ip(struct kvm_vcpu *vcpu) | |||
60 | 60 | ||
61 | static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr, | 61 | static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr, |
62 | struct kvmppc_pte *pte, bool data); | 62 | struct kvmppc_pte *pte, bool data); |
63 | static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, u64 esid, | 63 | static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, |
64 | u64 *vsid); | 64 | u64 *vsid); |
65 | 65 | ||
66 | static struct kvmppc_sr *find_sr(struct kvmppc_vcpu_book3s *vcpu_book3s, gva_t eaddr) | 66 | static struct kvmppc_sr *find_sr(struct kvmppc_vcpu_book3s *vcpu_book3s, gva_t eaddr) |
@@ -183,7 +183,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, | |||
183 | struct kvmppc_sr *sre; | 183 | struct kvmppc_sr *sre; |
184 | hva_t ptegp; | 184 | hva_t ptegp; |
185 | u32 pteg[16]; | 185 | u32 pteg[16]; |
186 | u64 ptem = 0; | 186 | u32 ptem = 0; |
187 | int i; | 187 | int i; |
188 | int found = 0; | 188 | int found = 0; |
189 | 189 | ||
@@ -327,7 +327,7 @@ static void kvmppc_mmu_book3s_32_tlbie(struct kvm_vcpu *vcpu, ulong ea, bool lar | |||
327 | kvmppc_mmu_pte_flush(vcpu, ea, 0x0FFFF000); | 327 | kvmppc_mmu_pte_flush(vcpu, ea, 0x0FFFF000); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, u64 esid, | 330 | static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, |
331 | u64 *vsid) | 331 | u64 *vsid) |
332 | { | 332 | { |
333 | /* In case we only have one of MSR_IR or MSR_DR set, let's put | 333 | /* In case we only have one of MSR_IR or MSR_DR set, let's put |
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index ce1bfb19c4c1..2bb67e633de2 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c | |||
@@ -77,11 +77,9 @@ static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) | |||
77 | kvm_release_pfn_clean(pte->pfn); | 77 | kvm_release_pfn_clean(pte->pfn); |
78 | } | 78 | } |
79 | 79 | ||
80 | void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 _guest_ea, u64 _ea_mask) | 80 | void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask) |
81 | { | 81 | { |
82 | int i; | 82 | int i; |
83 | u32 guest_ea = _guest_ea; | ||
84 | u32 ea_mask = _ea_mask; | ||
85 | 83 | ||
86 | dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%x & 0x%x\n", | 84 | dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%x & 0x%x\n", |
87 | vcpu->arch.hpte_cache_offset, guest_ea, ea_mask); | 85 | vcpu->arch.hpte_cache_offset, guest_ea, ea_mask); |
@@ -127,7 +125,7 @@ void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask) | |||
127 | } | 125 | } |
128 | } | 126 | } |
129 | 127 | ||
130 | void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end) | 128 | void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end) |
131 | { | 129 | { |
132 | int i; | 130 | int i; |
133 | 131 | ||
@@ -265,7 +263,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) | |||
265 | /* Get host physical address for gpa */ | 263 | /* Get host physical address for gpa */ |
266 | hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); | 264 | hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); |
267 | if (kvm_is_error_hva(hpaddr)) { | 265 | if (kvm_is_error_hva(hpaddr)) { |
268 | printk(KERN_INFO "Couldn't get guest page for gfn %llx!\n", | 266 | printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", |
269 | orig_pte->eaddr); | 267 | orig_pte->eaddr); |
270 | return -EINVAL; | 268 | return -EINVAL; |
271 | } | 269 | } |
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c index 12e4c975a376..a9241e90a68b 100644 --- a/arch/powerpc/kvm/book3s_64_mmu.c +++ b/arch/powerpc/kvm/book3s_64_mmu.c | |||
@@ -232,7 +232,7 @@ do_second: | |||
232 | } | 232 | } |
233 | 233 | ||
234 | dprintk("KVM MMU: Translated 0x%lx [0x%llx] -> 0x%llx " | 234 | dprintk("KVM MMU: Translated 0x%lx [0x%llx] -> 0x%llx " |
235 | "-> 0x%llx\n", | 235 | "-> 0x%lx\n", |
236 | eaddr, avpn, gpte->vpage, gpte->raddr); | 236 | eaddr, avpn, gpte->vpage, gpte->raddr); |
237 | found = true; | 237 | found = true; |
238 | break; | 238 | break; |
@@ -439,7 +439,7 @@ static void kvmppc_mmu_book3s_64_tlbie(struct kvm_vcpu *vcpu, ulong va, | |||
439 | kvmppc_mmu_pte_vflush(vcpu, va >> 12, mask); | 439 | kvmppc_mmu_pte_vflush(vcpu, va >> 12, mask); |
440 | } | 440 | } |
441 | 441 | ||
442 | static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, u64 esid, | 442 | static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, |
443 | u64 *vsid) | 443 | u64 *vsid) |
444 | { | 444 | { |
445 | switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) { | 445 | switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) { |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index b23015438371..41af12fb1260 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c | |||
@@ -62,7 +62,7 @@ static void invalidate_pte(struct hpte_cache *pte) | |||
62 | kvm_release_pfn_clean(pte->pfn); | 62 | kvm_release_pfn_clean(pte->pfn); |
63 | } | 63 | } |
64 | 64 | ||
65 | void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 guest_ea, u64 ea_mask) | 65 | void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask) |
66 | { | 66 | { |
67 | int i; | 67 | int i; |
68 | 68 | ||
@@ -110,7 +110,7 @@ void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask) | |||
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end) | 113 | void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end) |
114 | { | 114 | { |
115 | int i; | 115 | int i; |
116 | 116 | ||
@@ -216,7 +216,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) | |||
216 | /* Get host physical address for gpa */ | 216 | /* Get host physical address for gpa */ |
217 | hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); | 217 | hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT); |
218 | if (kvm_is_error_hva(hpaddr)) { | 218 | if (kvm_is_error_hva(hpaddr)) { |
219 | printk(KERN_INFO "Couldn't get guest page for gfn %llx!\n", orig_pte->eaddr); | 219 | printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", orig_pte->eaddr); |
220 | return -EINVAL; | 220 | return -EINVAL; |
221 | } | 221 | } |
222 | hpaddr <<= PAGE_SHIFT; | 222 | hpaddr <<= PAGE_SHIFT; |