aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
authorJulien Grall <julien@xen.org>2015-10-10 19:40:06 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2021-07-28 15:27:05 +0000
commitac959cf54421bc560c93748b227f05f9b6583678 (patch)
treeaf7182c4032c991d53cb38336f9a475e07ca50f6 /sys/x86
parent46c46edd18894e75a51b004f1abc1894c78864fe (diff)
downloadsrc-ac959cf54421bc560c93748b227f05f9b6583678.tar.gz
src-ac959cf54421bc560c93748b227f05f9b6583678.zip
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
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/include/xen/xen-os.h7
-rw-r--r--sys/x86/xen/xen_intr.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h
index 5b3b912e0891..9d0964c6631d 100644
--- a/sys/x86/include/xen/xen-os.h
+++ b/sys/x86/include/xen/xen-os.h
@@ -50,6 +50,13 @@ extern int xen_disable_pv_disks;
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)
{
diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index bab86ccd295a..a3d84965f0f2 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -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);