Subject: [PATCH 3/9] arm/arm64: KVM: vgic: Factor out level irq processing on guest exit

From: [email-masked] (Marc Zyngier)
Date: Thu, 03 Sep 2015 16:01:24 +0100

On 30/08/15 14:54, Christoffer Dall wrote:
> Currently vgic_process_maintenance() processes dealing with a completed
> level-triggered interrupt directly, but we are soon going to reuse this
> logic for level-triggered mapped interrupts with the HW bit set, so
> move this logic into a separate static function.
> 
> Probably the most scary part of this commit is convincing yourself that
> the current flow is safe compared to the old one.  In the following I
> try to list the changes and why they are harmless:
> 
>   Move vgic_irq_clear_queued after kvm_notify_acked_irq:
>     Harmless because the effect of clearing the queued flag wrt.
>     kvm_set_irq is only that vgic_update_irq_pending does not set the
>     pending bit on the emulated CPU interface or in the pending_on_cpu
>     bitmask, but we set this in __kvm_vgic_sync_hwstate later on if the
>     level is stil high.
> 
>   Move vgic_set_lr before kvm_notify_acked_irq:
>     Also, harmless because the LR are cpu-local operations and
>     kvm_notify_acked only affects the dist
> 
>   Move vgic_dist_irq_clear_soft_pend after kvm_notify_acked_irq:
>     Also harmless because it's just a bit which is cleared and altering
>     the line state does not affect this bit.
> 
> Signed-off-by: Christoffer Dall <[email-masked]>

This one has wrecked my brain, but I can't fault it so far.

Reviewed-by: Marc Zyngier <[email-masked]>

	M.
-- 
Jazz is not dead. It just smells funny...