Wait until the end of the init sequence to trigger the unmask event.
Note that it will be unconditionally triggered, but that's harmless if
not unmask actually happened.
While there change the variable type to bool.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
struct hvm_hw_vpic *vpic, uint32_t addr, uint32_t val)
{
int priority, cmd;
- uint8_t mask, unmasked = 0;
+ uint8_t mask;
+ bool unmasked = false;
vpic_lock(vpic);
/* Clear edge-sensing logic. */
vpic->irr &= vpic->elcr;
- unmasked = vpic->imr;
/* No interrupts masked or in service. */
vpic->imr = vpic->isr = 0;
/* ICW3 */
vpic->init_state++;
if ( !(vpic->init_state & 4) )
+ {
vpic->init_state = 0; /* No ICW4: init done */
+ unmasked = true;
+ }
break;
case 3:
/* ICW4 */
vpic->special_fully_nested_mode = (val >> 4) & 1;
vpic->auto_eoi = (val >> 1) & 1;
vpic->init_state = 0;
+ unmasked = true;
break;
}
}