aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam bobroff <sam.bobroff@au1.ibm.com>2015-05-26 19:56:57 -0400
committerAlexander Graf <agraf@suse.de>2015-08-22 05:16:19 -0400
commitc63517c2e3810071359af926f621c1f784388c3f (patch)
tree7687ac199f73c810ffc480b274941b77eff8fab3
parent563a1e93afac4d2c135072461fbab418b9dff43f (diff)
KVM: PPC: Book3S: correct width in XER handling
In 64 bit kernels, the Fixed Point Exception Register (XER) is a 64 bit field (e.g. in kvm_regs and kvm_vcpu_arch) and in most places it is accessed as such. This patch corrects places where it is accessed as a 32 bit field by a 64 bit kernel. In some cases this is via a 32 bit load or store instruction which, depending on endianness, will cause either the lower or upper 32 bits to be missed. In another case it is cast as a u32, causing the upper 32 bits to be cleared. This patch corrects those places by extending the access methods to 64 bits. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h4
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h2
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h4
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S6
-rw-r--r--arch/powerpc/kvm/book3s_segment.S4
5 files changed, 10 insertions, 10 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index e6b2534a2a63..9fac01cb89c1 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -226,12 +226,12 @@ static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
226 return vcpu->arch.cr; 226 return vcpu->arch.cr;
227} 227}
228 228
229static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val) 229static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, ulong val)
230{ 230{
231 vcpu->arch.xer = val; 231 vcpu->arch.xer = val;
232} 232}
233 233
234static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu) 234static inline ulong kvmppc_get_xer(struct kvm_vcpu *vcpu)
235{ 235{
236 return vcpu->arch.xer; 236 return vcpu->arch.xer;
237} 237}
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 57d5dfef48bd..72b6225aca73 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -132,7 +132,7 @@ struct kvmppc_book3s_shadow_vcpu {
132 bool in_use; 132 bool in_use;
133 ulong gpr[14]; 133 ulong gpr[14];
134 u32 cr; 134 u32 cr;
135 u32 xer; 135 ulong xer;
136 ulong ctr; 136 ulong ctr;
137 ulong lr; 137 ulong lr;
138 ulong pc; 138 ulong pc;
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index 3286f0d6a86c..bc6e29e4dfd4 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -54,12 +54,12 @@ static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
54 return vcpu->arch.cr; 54 return vcpu->arch.cr;
55} 55}
56 56
57static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val) 57static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, ulong val)
58{ 58{
59 vcpu->arch.xer = val; 59 vcpu->arch.xer = val;
60} 60}
61 61
62static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu) 62static inline ulong kvmppc_get_xer(struct kvm_vcpu *vcpu)
63{ 63{
64 return vcpu->arch.xer; 64 return vcpu->arch.xer;
65} 65}
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index e3477667d498..472680f47d09 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -944,7 +944,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
944 blt hdec_soon 944 blt hdec_soon
945 945
946 ld r6, VCPU_CTR(r4) 946 ld r6, VCPU_CTR(r4)
947 lwz r7, VCPU_XER(r4) 947 ld r7, VCPU_XER(r4)
948 948
949 mtctr r6 949 mtctr r6
950 mtxer r7 950 mtxer r7
@@ -1181,7 +1181,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
1181 mfctr r3 1181 mfctr r3
1182 mfxer r4 1182 mfxer r4
1183 std r3, VCPU_CTR(r9) 1183 std r3, VCPU_CTR(r9)
1184 stw r4, VCPU_XER(r9) 1184 std r4, VCPU_XER(r9)
1185 1185
1186 /* If this is a page table miss then see if it's theirs or ours */ 1186 /* If this is a page table miss then see if it's theirs or ours */
1187 cmpwi r12, BOOK3S_INTERRUPT_H_DATA_STORAGE 1187 cmpwi r12, BOOK3S_INTERRUPT_H_DATA_STORAGE
@@ -1763,7 +1763,7 @@ kvmppc_hdsi:
1763 bl kvmppc_msr_interrupt 1763 bl kvmppc_msr_interrupt
1764fast_interrupt_c_return: 1764fast_interrupt_c_return:
17656: ld r7, VCPU_CTR(r9) 17656: ld r7, VCPU_CTR(r9)
1766 lwz r8, VCPU_XER(r9) 1766 ld r8, VCPU_XER(r9)
1767 mtctr r7 1767 mtctr r7
1768 mtxer r8 1768 mtxer r8
1769 mr r4, r9 1769 mr r4, r9
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index acee37cde840..ca8f174289bb 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -123,7 +123,7 @@ no_dcbz32_on:
123 PPC_LL r8, SVCPU_CTR(r3) 123 PPC_LL r8, SVCPU_CTR(r3)
124 PPC_LL r9, SVCPU_LR(r3) 124 PPC_LL r9, SVCPU_LR(r3)
125 lwz r10, SVCPU_CR(r3) 125 lwz r10, SVCPU_CR(r3)
126 lwz r11, SVCPU_XER(r3) 126 PPC_LL r11, SVCPU_XER(r3)
127 127
128 mtctr r8 128 mtctr r8
129 mtlr r9 129 mtlr r9
@@ -237,7 +237,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
237 mfctr r8 237 mfctr r8
238 mflr r9 238 mflr r9
239 239
240 stw r5, SVCPU_XER(r13) 240 PPC_STL r5, SVCPU_XER(r13)
241 PPC_STL r6, SVCPU_FAULT_DAR(r13) 241 PPC_STL r6, SVCPU_FAULT_DAR(r13)
242 stw r7, SVCPU_FAULT_DSISR(r13) 242 stw r7, SVCPU_FAULT_DSISR(r13)
243 PPC_STL r8, SVCPU_CTR(r13) 243 PPC_STL r8, SVCPU_CTR(r13)