hw/ppc: clear pending_events on machine reset
The sPAPR machine isn't clearing up the pending events QTAILQ on machine reboot. This allows for unprocessed hotplug/epow events to persist in the queue after reset and, when reasserting the IRQs in check_exception later on, these will be being processed by the OS. This patch implements a new function called 'spapr_clear_pending_events' that clears up the pending_events QTAILQ. This helper is then called inside ppc_spapr_reset to clear up the events queue, preventing old/deprecated events from persisting after a reset. Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
		
							parent
							
								
									c618e300eb
								
							
						
					
					
						commit
						5625817423
					
				@ -1392,6 +1392,7 @@ static void ppc_spapr_reset(void)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_devices_reset();
 | 
					    qemu_devices_reset();
 | 
				
			||||||
 | 
					    spapr_clear_pending_events(spapr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * We place the device tree and RTAS just below either the top of the RMA,
 | 
					     * We place the device tree and RTAS just below either the top of the RMA,
 | 
				
			||||||
 | 
				
			|||||||
@ -700,6 +700,17 @@ static void event_scan(PowerPCCPU *cpu, sPAPRMachineState *spapr,
 | 
				
			|||||||
    rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
 | 
					    rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void spapr_clear_pending_events(sPAPRMachineState *spapr)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    sPAPREventLogEntry *entry = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
 | 
				
			||||||
 | 
					        QTAILQ_REMOVE(&spapr->pending_events, entry, next);
 | 
				
			||||||
 | 
					        g_free(entry->extended_log);
 | 
				
			||||||
 | 
					        g_free(entry);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void spapr_events_init(sPAPRMachineState *spapr)
 | 
					void spapr_events_init(sPAPRMachineState *spapr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QTAILQ_INIT(&spapr->pending_events);
 | 
					    QTAILQ_INIT(&spapr->pending_events);
 | 
				
			||||||
 | 
				
			|||||||
@ -662,6 +662,7 @@ void spapr_cpu_parse_features(sPAPRMachineState *spapr);
 | 
				
			|||||||
int spapr_hpt_shift_for_ramsize(uint64_t ramsize);
 | 
					int spapr_hpt_shift_for_ramsize(uint64_t ramsize);
 | 
				
			||||||
void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,
 | 
					void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,
 | 
				
			||||||
                          Error **errp);
 | 
					                          Error **errp);
 | 
				
			||||||
 | 
					void spapr_clear_pending_events(sPAPRMachineState *spapr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* CPU and LMB DRC release callbacks. */
 | 
					/* CPU and LMB DRC release callbacks. */
 | 
				
			||||||
void spapr_core_release(DeviceState *dev);
 | 
					void spapr_core_release(DeviceState *dev);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user