From owner-dev-commits-src-all@freebsd.org Wed Jun 9 10:36:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D33B64B35B; Wed, 9 Jun 2021 10:36:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G0Nnv35hyz3s2c; Wed, 9 Jun 2021 10:36:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x130.google.com with SMTP id r198so33917263lff.11; Wed, 09 Jun 2021 03:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YoJ0Ee7506uVcXCsJjQy4zLgFV81bGIrjGXT42uh2ZE=; b=rtLTzbwitocVXByYkfazIJue+BjPgbqOi11ssGkZHrM2yP3Fyh2U9FPwvyQfXr4d+V CTUyka30QosApjWK98I2be70Z1DvZczKo9JF98j5KrJF3XQhAqOCFeHkje43aCBE/cub m51zeT1u7zeID2le8E5qGTjlTQ+NaVRVwpfHkGNOZ0beomdSdTnsMkC6PQY3LKGgfX9C Aieiz0K48RqVmWeEaWt1I3/BgEewsCar0r0WFTdcpIbThuNusVKShghpZe4Ha6sOP06g zRVS9y6VDgThPtvWsTcviBuWKueUTmJoY04wiceY4bLSwen373ee+afyPmBVcW30IMHI +CYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YoJ0Ee7506uVcXCsJjQy4zLgFV81bGIrjGXT42uh2ZE=; b=DHCQWA6tBz1hLGqMQtHZ6/VLlLcLj85tm+Nm+5xYRGcbAcLw5A4icEmlsS9RTRFEnt Pfq2Ce85EManFB3e8HnArQzg+baKW9wQdMYLIegD4WcZaVl0EpkhVZ6iTGwMaNHlBPYY CjmtKBkOAqSrFpIcoZcYYTh2l86n1b7/7URujKd/h3NMsHk+iR+J7diW1nzbHCTds1oi QQlpdaPlWlLUjw9qZ4kwp4a4dAYo5E5RVmC5uE7yQ20ol0qoHRsRqLLeXvqjljb59AkV Cq/HOTQFq5ekHjOwQGkIEdUtfm7ROCUmgKp7Hgxo5eAHaqkR4wQqXt34zx8I9T6R4FuK 5UZg== X-Gm-Message-State: AOAM531K2g29Q5QxOI41sevYsAR/oLjF6U9YyCJUA50Z7wzgqwm7nhsC InP1gkOe0g3rYgHCHekkwKhwUFRLlaL5ImqRcSNPy8py X-Google-Smtp-Source: ABdhPJzFCscB4qJvLS/Hi4tV7RoKJbErQF00n6zpuGLDvG55VznskVn34B6UTL7D0DzK+PUrLMO7p+vx7bvvkmjljuE= X-Received: by 2002:a05:6512:b0f:: with SMTP id w15mr18605416lfu.118.1623235009753; Wed, 09 Jun 2021 03:36:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:2006:0:0:0:0 with HTTP; Wed, 9 Jun 2021 03:36:49 -0700 (PDT) In-Reply-To: <202106081350.158DoTmi096312@gitrepo.freebsd.org> References: <202106081350.158DoTmi096312@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 9 Jun 2021 12:36:49 +0200 Message-ID: Subject: Re: git: 97993d1ebf59 - main - hyperv: Fix vmbus after the i386 4/4 split To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4G0Nnv35hyz3s2c X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 10:36:51 -0000 This breaks i386 LINT kernels: ld: error: undefined symbol: Xvmbus_isr >>> referenced by vmbus.c >>> vmbus.o:(vmbus_intrhook) ld: error: undefined symbol: Xvmbus_isr_pti >>> referenced by vmbus.c >>> vmbus.o:(vmbus_intrhook) On 6/8/21, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=97993d1ebf592ac6689a498d5d0d2afb46758680 > > commit 97993d1ebf592ac6689a498d5d0d2afb46758680 > Author: Mark Johnston > AuthorDate: 2021-06-08 13:40:30 +0000 > Commit: Mark Johnston > CommitDate: 2021-06-08 13:40:30 +0000 > > 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 > Tested by: Harry Schmalzbauer > Reviewed by: whu, kib > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D30577 > --- > sys/conf/files.i386 | 1 - > sys/conf/options.i386 | 3 +++ > sys/dev/hyperv/vmbus/i386/vmbus_vector.S | 6 +++++- > sys/i386/conf/GENERIC | 4 +++- > sys/i386/i386/exception.s | 9 +++++++++ > sys/modules/hyperv/vmbus/Makefile | 5 ++++- > 6 files changed, 24 insertions(+), 4 deletions(-) > > diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 > index 331ad5fec79a..10e286dae271 100644 > --- a/sys/conf/files.i386 > +++ b/sys/conf/files.i386 > @@ -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 > diff --git a/sys/conf/options.i386 b/sys/conf/options.i386 > index 4249fa1dfd0a..5e7ea446089b 100644 > --- a/sys/conf/options.i386 > +++ b/sys/conf/options.i386 > @@ -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) > diff --git a/sys/dev/hyperv/vmbus/i386/vmbus_vector.S > b/sys/dev/hyperv/vmbus/i386/vmbus_vector.S > index 0570c6b49e1c..d119cfdc5b12 100644 > --- a/sys/dev/hyperv/vmbus/i386/vmbus_vector.S > +++ b/sys/dev/hyperv/vmbus/i386/vmbus_vector.S > @@ -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 > diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC > index 1b4d853fe1d4..288968d84af1 100644 > --- a/sys/i386/conf/GENERIC > +++ b/sys/i386/conf/GENERIC > @@ -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. > diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s > index 6989d3e2828a..f47ab92f1987 100644 > --- a/sys/i386/i386/exception.s > +++ b/sys/i386/i386/exception.s > @@ -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 > +#endif > + > +#ifdef HYPERV > + .data > + .p2align 4 > + .text > + SUPERALIGN_TEXT > +#include > #endif > > .data > diff --git a/sys/modules/hyperv/vmbus/Makefile > b/sys/modules/hyperv/vmbus/Makefile > index 435106c7e9bd..47a83e76204a 100644 > --- a/sys/modules/hyperv/vmbus/Makefile > +++ b/sys/modules/hyperv/vmbus/Makefile > @@ -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 > -- Mateusz Guzik