freebsd-dev/sys/x86
Elliott Mitchell af610cabf1 xen/intr: adjust xen_intr_handle_upcall() to match driver filter
xen_intr_handle_upcall() has two interfaces.  It needs to be called by
the x86 assembly code invoked by the APIC.  Second, it needs to be called
as a driver_filter_t for the XenPCI code and for architectures besides
x86.

Unfortunately the driver_filter_t interface was implemented as a wrapper
around the x86-APIC interface.  Now create a simple wrapper for the
x86-APIC code, which calls an architecture-independent
xen_intr_handle_upcall().

When called via intr_event_handle(), driver_filter_t functions expect
preemption to be disabled.  This removes the need for
critical_enter()/critical_exit() when called this way.

The lapic_eoi() call is only needed on x86 in some cases when invoked
directly as an APIC vector handler.

Additionally driver_filter_t functions have no need to handle interrupt
counters.  The intrcnt_add() calling function was reworked to match the
current situation.  intrcnt_add() is now only called via one path.

The increment/decrement of curthread->td_intr_nesting_level had
previously been left out.  Appears this was mostly harmless, but this
was noticed during implementation and has been added.

CONFIG_X86 is a leftover from use with Linux.  While the barrier isn't
needed for FreeBSD on x86, it will be needed for FreeBSD on other
architectures.

Copyright note.  xen_intr_intrcnt_add() was introduced at 76acc41fb7
by Justin T. Gibbs.  xen_intrcnt_init() was introduced at fd036deac1
by John Baldwin.

sys/x86/xen/xen_arch_intr.c was originally created by Julien Grall in
2015 for the purpose of holding the x86 interrupt interface.  Later it
was found xen_intr_handle_upcall() was better earlier, and the x86
interrupt interface better later.  As such the filename and header list
belong to Julien Grall, but what those were created for is later.

Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D30006
2023-04-14 15:58:52 +02:00
..
acpica amd64/efi: Stop falling back to hints for RSDP 2022-07-02 08:02:12 -06:00
bios x86: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
conf Complete retire cp(4) 2022-12-14 11:38:55 +08:00
cpufreq cpufreq: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:39:29 -07:00
include xen: introduce XEN_CPUID_TO_VCPUID()/XEN_VCPUID() 2023-04-14 15:58:46 +02:00
iommu kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers. 2022-09-22 15:09:19 -07:00
isa atrtc: expose power loss as sysctl 2023-02-02 08:25:08 +01:00
linux linux(4): Cleanup includes under x86/linux 2023-02-14 17:46:33 +03:00
pci pci: expose intel_graphics_stolen as sysctl 2023-03-27 11:40:49 +02:00
x86 x86: nexus code tidy-up 2023-03-20 17:35:47 -03:00
xen xen/intr: adjust xen_intr_handle_upcall() to match driver filter 2023-04-14 15:58:52 +02:00