Date: Wed, 28 Jul 2021 15:28:02 GMT From: =?utf-8?Q?Roger Pau Monn=C3=A9?= <royger@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: ac959cf54421 - main - xen: introduce xen_has_percpu_evtchn() Message-ID: <202107281528.16SFS2wZ088191@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ac959cf54421bc560c93748b227f05f9b6583678 commit ac959cf54421bc560c93748b227f05f9b6583678 Author: Julien Grall <julien@xen.org> AuthorDate: 2015-10-10 19:40:06 +0000 Commit: Roger Pau Monné <royger@FreeBSD.org> CommitDate: 2021-07-28 15:27:05 +0000 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 --- sys/dev/xen/debug/debug.c | 2 +- sys/x86/include/xen/xen-os.h | 7 +++++++ sys/x86/xen/xen_intr.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/xen/debug/debug.c b/sys/dev/xen/debug/debug.c index 269d46d46afa..ec4585e64c62 100644 --- a/sys/dev/xen/debug/debug.c +++ b/sys/dev/xen/debug/debug.c @@ -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) 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 @@ -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) { 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107281528.16SFS2wZ088191>