1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

hyperv: Fix vmbus after the i386 4/4 split

The vmbus ISR needs to live in a trampoline.  Dynamically allocating a
trampoline at driver initialization time poses some difficulties due to
the fact that the KENTER macro assumes that the offset relative to
tramp_idleptd is fixed at static link time.  Another problem is that
native_lapic_ipi_alloc() uses setidt(), which assumes a fixed trampoline
offset.

Rather than fight this, move the Hyper-V ISR to i386/exception.s.  Add a
new HYPERV kernel option to make this optional, and configure it by
default on i386.  This is sufficient to make use of vmbus(4) after the
4/4 split.  Note that vmbus cannot be loaded dynamically and both the
HYPERV option and device must be configured together.  I think this is
not too onerous a requirement, since vmbus(4) was previously
non-functional.

Reported by:	Harry Schmalzbauer <freebsd@omnilan.de>
Tested by:	Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by:	whu, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30577
This commit is contained in:
Mark Johnston 2021-06-08 09:40:30 -04:00
parent 6181470239
commit 97993d1ebf
6 changed files with 24 additions and 4 deletions

View File

@ -102,7 +102,6 @@ dev/glxiic/glxiic.c optional glxiic
dev/glxsb/glxsb.c optional glxsb
dev/glxsb/glxsb_hash.c optional glxsb
dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv
dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv
dev/le/if_le_isa.c optional le isa
dev/nctgpio/nctgpio.c optional nctgpio
dev/nfe/if_nfe.c optional nfe pci

View File

@ -101,6 +101,9 @@ NPX_DEBUG opt_npx.h
# BPF just-in-time compiler
BPF_JITTER opt_bpf.h
# Hyper-V support
HYPERV opt_hyperv.h
XENHVM opt_global.h
# options for the Intel C600 SAS driver (isci)

View File

@ -35,6 +35,9 @@
/*
* This is the Hyper-V vmbus channel direct callback interrupt.
* Only used when it is running on Hyper-V.
*
* Note that this file is not compiled directly, it is included into
* i386/exception.s.
*/
.text
SUPERALIGN_TEXT
@ -45,6 +48,7 @@ IDTVEC(vmbus_isr)
cld
KENTER
pushl %esp
call vmbus_handle_intr
mov $vmbus_handle_intr, %eax
call *%eax
add $4, %esp
jmp doreti

View File

@ -339,7 +339,9 @@ device virtio_scsi # VirtIO SCSI device
device virtio_balloon # VirtIO Memory Balloon device
# HyperV drivers and enhancement support
device hyperv # HyperV drivers
# NOTE: HYPERV depends on hyperv. They must be added or removed together.
options HYPERV # Kernel support for HyperV drivers
device hyperv # HyperV drivers
# Xen HVM Guest Optimizations
# NOTE: XENHVM depends on xenpci. They must be added or removed together.

View File

@ -39,6 +39,7 @@
#include "opt_apic.h"
#include "opt_atpic.h"
#include "opt_hwpmc_hooks.h"
#include "opt_hyperv.h"
#include "assym.inc"
@ -404,6 +405,14 @@ ENTRY(fork_trampoline)
#ifdef DEV_APIC
#include <i386/i386/apic_vector.s>
#endif
#ifdef HYPERV
.data
.p2align 4
.text
SUPERALIGN_TEXT
#include <dev/hyperv/vmbus/i386/vmbus_vector.S>
#endif
.data

View File

@ -13,8 +13,11 @@ SRCS= hyperv.c \
vmbus_et.c \
vmbus_if.c \
vmbus_res.c \
vmbus_vector.S \
vmbus_xact.c
.if ${MACHINE_CPUARCH} != "i386"
SRCS+= vmbus_vector.S
.endif
SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h
# XXX: for assym.inc