b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -36,6 +36,13 @@
#define NAPPING_CEDE 1
#define NAPPING_NOVCPU 2
+.macro bswap32 regd, regs
+ srwi \regd,\regs,24
+ rlwimi \regd,\regs,24,16,23
+ rlwimi \regd,\regs,8,8,15
+ rlwimi \regd,\regs,24,0,7
+.endm
+
/*
* Call kvmppc_hv_entry in real mode.
* Must be called with interrupts hard-disabled.
@@ -2325,7 +2332,12 @@ kvmppc_read_intr:
cmpdi r6, 0
beq- 1f
lwzcix r0, r6, r7
- rlwinm. r3, r0, 0, 0xffffff
+#ifdef __LITTLE_ENDIAN__
+ bswap32 r4, r0
+#else
+ mr r4, r0
+#endif
+ rlwinm. r3, r4, 0, 0xffffff
sync
beq 1f /* if nothing pending in the ICP */
@@ -2360,7 +2372,7 @@ kvmppc_read_intr:
42: /* It's not an IPI and it's for the host, stash it in the PACA
* before exit, it will be picked up by the host ICP driver
*/
- stw r0, HSTATE_SAVED_XIRR(r13)
+ stw r4, HSTATE_SAVED_XIRR(r13)
li r3, 1
b 1b