xive: Clear emulation mode queue on reset

Submitted by Benjamin Herrenschmidt on April 13, 2017, 7:43 a.m.

Details

Message ID 20170413074332.12776-1-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt April 13, 2017, 7:43 a.m.
When resetting, we need to clear the emulation mode queue
for each CPU, otherwise it may contain "stale" interrupts
causing the OS to go completely out of sync.

This fixes problems doing kexecs from emulation to native
back to emulation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/xive.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Neuling April 19, 2017, 5:10 a.m.
This is now upstream as f257a053df54e2b05c841ee74a1a553143fb67d7


On Thu, 2017-04-13 at 17:43 +1000, Benjamin Herrenschmidt wrote:
> When resetting, we need to clear the emulation mode queue
> for each CPU, otherwise it may contain "stale" interrupts
> causing the OS to go completely out of sync.
> 
> This fixes problems doing kexecs from emulation to native
> back to emulation.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  hw/xive.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/xive.c b/hw/xive.c
> index d76f4cf..530e0df 100644
> --- a/hw/xive.c
> +++ b/hw/xive.c
> @@ -2873,6 +2873,7 @@ static void xive_init_cpu_emulation(struct
> xive_cpu_state *xs,
>  	xs->eqbuf = xive_get_eq_buf(xs->vp_blk,
>  				    xs->eq_idx + XIVE_EMULATION_PRIO);
>  	assert(xs->eqbuf);
> +	memset(xs->eqbuf, 0, 0x10000);
>  
>  	xs->eqptr = 0;
>  	xs->eqmsk = (0x10000/4) - 1;

Patch hide | download patch | download mbox

diff --git a/hw/xive.c b/hw/xive.c
index d76f4cf..530e0df 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -2873,6 +2873,7 @@  static void xive_init_cpu_emulation(struct xive_cpu_state *xs,
 	xs->eqbuf = xive_get_eq_buf(xs->vp_blk,
 				    xs->eq_idx + XIVE_EMULATION_PRIO);
 	assert(xs->eqbuf);
+	memset(xs->eqbuf, 0, 0x10000);
 
 	xs->eqptr = 0;
 	xs->eqmsk = (0x10000/4) - 1;