gic_remove_from_lr_pending(v, p);
}
-int gic_events_need_delivery(void)
+/**
+ * vgic_vcpu_pending_irq() - determine if interrupts need to be injected
+ * @vcpu: The vCPU on which to check for interrupts.
+ *
+ * Checks whether there is an interrupt on the given VCPU which needs
+ * handling in the guest. This requires at least one IRQ to be pending
+ * and enabled.
+ *
+ * Returns: 1 if the guest should run to handle interrupts, 0 otherwise.
+ */
+int vgic_vcpu_pending_irq(struct vcpu *v)
{
- struct vcpu *v = current;
struct pending_irq *p;
unsigned long flags;
const unsigned long apr = gic_hw_ops->read_apr(0);
int active_priority;
int rc = 0;
+ /* We rely on reading the VMCR, which is only accessible locally. */
+ ASSERT(v == current);
+
mask_priority = gic_hw_ops->read_vmcr_priority();
active_priority = find_next_bit(&apr, 32, 0);
* interrupts disabled so this shouldn't be a problem in the general
* case.
*/
- if ( gic_events_need_delivery() )
+ if ( vgic_vcpu_pending_irq(current) )
return 1;
if ( !vcpu_info(current, evtchn_upcall_pending) )
extern void vgic_sync_to_lrs(void);
extern void gic_clear_pending_irqs(struct vcpu *v);
-extern int gic_events_need_delivery(void);
+extern int vgic_vcpu_pending_irq(struct vcpu *v);
extern void init_maintenance_interrupt(void);
extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,