From: Ian Campbell Subject: Re: [PATCH v10] xen/arm: trap guest WFI Date: Wed, 8 May 2013 11:31:38 +0100 Message-ID: <1368009098.26321.217.camel@zakaz.uk.xensource.com> References: <1367404379-5308-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1367404379-5308-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Julien Grall , "xen-devel@lists.xensource.com" , "Tim (Xen.org)" List-Id: xen-devel@lists.xenproject.org On Wed, 2013-05-01 at 11:32 +0100, Stefano Stabellini wrote: > Trap guest WFI, block the guest VCPU unless it has pending interrupts > (WFI should return if any interrupts arrive even if interrupts are > disabled). > > Awake the guest vcpu when a new interrupt for it arrives. > > Introduce gic_events_need_delivery: it checks whether the current vcpu > has any interrupts that need to be delivered either on the lrs or in > lr_pending. > > Properly implement local_events_need_delivery: check if the guest > disabled interrupts, if they aren't disabled, return positive if > gic_events_need_delivery returns positive. Otherwise we still need to > check whether evtchn_upcall_pending is set but no > VGIC_IRQ_EVTCHN_CALLBACK irqs are in flight: it could be the race > described by commit db453468d92369e7182663fb13e14d83ec4ce456 "arm: vgic: > fix race between evtchn upcall and evtchnop_send". If that is the case > it means that an event needs to be injected. > If all these tests are negative then no events need to be delivered. > > Implement local_event_delivery_enable by clearing PSR_IRQ_MASK. > > > Changes on v10: > - improve comment in code. > > Changes in v9: > - rename _local_events_need_delivery to > local_events_need_delivery_nomask; > - remove evtchn_upcall_mask checks and comments. > > Changes in v8: > - remove the mask check from _local_events_need_delivery, add an > unconditional mask check in local_events_need_delivery. > > Changes in v7: > - clear PSR_IRQ_MASK in the implementation of > local_event_delivery_enable. > > Signed-off-by: Stefano Stabellini Acked + applied.