int vmce_init(struct cpuinfo_x86 *c);
-#define dom0_vmce_enabled() (hardware_domain && hardware_domain->max_vcpus \
- && hardware_domain->vcpu[0] \
- && guest_enabled_event(hardware_domain->vcpu[0], VIRQ_MCA))
+#define dom0_vmce_enabled() \
+ (hardware_domain && \
+ evtchn_virq_enabled(domain_vcpu(hardware_domain, 0), VIRQ_MCA))
int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn);
return ret;
}
-int guest_enabled_event(struct vcpu *v, uint32_t virq)
+bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq)
{
- return ((v != NULL) && (v->virq_to_evtchn[virq] != 0));
+ if ( !v )
+ return false;
+
+ if ( virq_is_global(virq) && v->vcpu_id )
+ v = domain_vcpu(v->domain, 0);
+
+ return v->virq_to_evtchn[virq];
}
void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
xen_event_channel_notification_t notification_fn);
void free_xen_event_channel(struct domain *d, int port);
-/* Query if event channel is in use by the guest */
-int guest_enabled_event(struct vcpu *v, uint32_t virq);
+/* Query whether a vIRQ is in use by the guest. */
+bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq);
/* Notify remote end of a Xen-attached event channel.*/
void notify_via_xen_event_channel(struct domain *ld, int lport);