xen: introduce xen_has_percpu_evtchn()

xen_vector_callback_enabled is x86 specific and availability of
per-cpu event channel delivery differs on other architectures.

Introduce a new helper to check if there's support for per-cpu event
channel injection.

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D29402
This commit is contained in:
Julien Grall 2015-10-10 20:40:06 +01:00 committed by Roger Pau Monné
parent 46c46edd18
commit ac959cf544
3 changed files with 10 additions and 3 deletions

View File

@ -97,7 +97,7 @@ xendebug_identify(driver_t *driver, device_t parent)
KASSERT(xen_domain(),
("Trying to add Xen debug device to non-xen guest"));
if (xen_hvm_domain() && !xen_vector_callback_enabled)
if (!xen_has_percpu_evtchn())
return;
if (BUS_ADD_CHILD(parent, 0, "debug", 0) == NULL)

View File

@ -49,6 +49,13 @@ extern int xen_disable_pv_disks;
/* tunable for disabling PV nics */
extern int xen_disable_pv_nics;
static inline bool
xen_has_percpu_evtchn(void)
{
return (!xen_hvm_domain() || xen_vector_callback_enabled);
}
static inline bool
xen_pv_shutdown_handler(void)
{

View File

@ -510,7 +510,7 @@ xen_intr_handle_upcall(struct trapframe *trap_frame)
s = HYPERVISOR_shared_info;
v = DPCPU_GET(vcpu_info);
if (xen_hvm_domain() && !xen_vector_callback_enabled) {
if (!xen_has_percpu_evtchn()) {
KASSERT((cpu == 0), ("Fired PCI event callback on wrong CPU"));
}
@ -859,7 +859,7 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id)
u_int to_cpu, vcpu_id;
int error, masked;
if (xen_vector_callback_enabled == 0)
if (!xen_has_percpu_evtchn())
return (EOPNOTSUPP);
to_cpu = apic_cpuid(apic_id);