diff mbox

[11/13] xive: Fix opal_xive_check_pending()

Message ID 20170116043635.25849-11-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Jan. 16, 2017, 4:36 a.m. UTC
We were calculating the mask all wrong... we got lucky in the
normal case though.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/xive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/xive.c b/hw/xive.c
index 86b5917..69f1239 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -2924,7 +2924,7 @@  static uint8_t xive_sanitize_cppr(uint8_t cppr)
 static inline uint8_t opal_xive_check_pending(struct xive_cpu_state *xs,
 					      uint8_t cppr)
 {
-	uint8_t mask = (cppr > 7) ? 0xff : ((1 << cppr) - 1);
+	uint8_t mask = (cppr > 7) ? 0xff : ~((0x100 >> cppr) - 1);
 
 	return xs->pending & mask;
 }
@@ -2934,9 +2934,9 @@  static int64_t opal_xive_eoi(uint32_t xirr)
 	struct cpu_thread *c = this_cpu();
 	struct xive_cpu_state *xs = c->xstate;
 	uint32_t isn = xirr & 0x00ffffff;
-	uint8_t cppr, irqprio;
 	struct xive *src_x;
 	bool special_ipi = false;
+	uint8_t cppr;
 
 	/*
 	 * In exploitation mode, this is supported as a way to perform