History log of /freebsd-11.0-release/sys/dev/hyperv/vmbus/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
303975 11-Aug-2016 gjb

Copy stable/11@r303970 to releng/11.0 as part of the 11.0-RELEASE
cycle.

Prune svn:mergeinfo from the new branch, and rename it to RC1.

Update __FreeBSD_version.

Use the quarterly branch for the default FreeBSD.conf pkg(8) repo and
the dvd1.iso packages population.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


301588 08-Jun-2016 sephe

hyperv/vmbus: Change tx_evtflags type to u_long to match vmbus_evtflags

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6745


301583 08-Jun-2016 sephe

hyperv/vmbus: Busdma-fy MNF and event flags.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6744


301488 06-Jun-2016 sephe

hyperv/vmbus: Constify channel message

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6708


301487 06-Jun-2016 sephe

hyperv/vmbus: Factor out channel message processing

This paves the way for further cleanup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6707


301484 06-Jun-2016 sephe

hyperv/vmbus: Define type for channel messages.

And fix message processing; only channel messages are supported.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6706


301483 06-Jun-2016 sephe

hyperv: Move machine dependent bits into machine dependent files.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6701


301113 01-Jun-2016 sephe

hyperv: Rename some cleaned up/almost cleaned up files

MFC after: 1 week
Sponsored by: Microsoft OSTC


301109 01-Jun-2016 sephe

hyperv/channel: Only cpu0 is supported as channel target cpu on WIN7

MFC after: 1 week
Sponsored by: Microsoft OSTC


301106 01-Jun-2016 sephe

hyperv/vmbus: Redefine event flags.

- Nuke unnecessary union.
- Avoid convoluted macro indirection.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6671


301021 31-May-2016 sephe

hyperv: Move guid2str from vmbus file to hyperv file

- Use uint8_t for GUID byte array.
- Define GUID string length.
- Break long lines.
- Nuke unnecessary stack variable.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6640


301020 31-May-2016 sephe

hyperv/vmbus: White space cleanup

No functional changes

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6637


301019 31-May-2016 sephe

hyperv/vmbus: Redefine SynIC message.

- Avoid unnecessary indirection.
- Avoid bit fields.
- Use __packed.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6636


301018 31-May-2016 sephe

hyperv/vmbus: Move global vmbus id array to stack.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6603


301017 31-May-2016 sephe

hyperv/vmbus: Indentation cleanup

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6602


301015 31-May-2016 sephe

hyperv/vmbus: Rename ISR functions

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6601


301009 31-May-2016 sephe

hyperv/vmbus: Process event timer before checking events

And update comment.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6600


300994 30-May-2016 sephe

hyperv/et: Allow Hyper-V event timer be disabled

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6599


300993 30-May-2016 sephe

hyperv/et: Device renaming; consistent w/ other Hyper-V utils

While I'm here, prefix function names w/ vmbus, since unlike Hyper-V
timecounter, Hyper-V event timer will not work w/o vmbus.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6598


300992 30-May-2016 sephe

hyperv: Move timer frequency definition to common place.

And cleanup event timer period settings.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6597


300989 30-May-2016 sephe

hyperv/et: Make sure only one event timer will be registered

This nullifies the need to use softc.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6591


300988 30-May-2016 sephe

hyperv/vmbus: Move SINT settings to vmbus_var.h

While I'm here remove the event timer's dependency on hv_vmbus_priv.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6574


300987 30-May-2016 sephe

hyperv/et: Fix STIMER0 operations.

- Make sure that STIMER0 is disabled before writting to it, since
writing to an enabled STIMER will result in undefined behaviour.
- It is unnecessary to reconfigure STIMER0 upon each et_start().
- Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since
writing 0 to STIMER_COUNT will disable the target STIMER.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6573


300834 27-May-2016 sephe

hyperv: Test features before enabling optional functionalities

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6571


300832 27-May-2016 sephe

hyperv: Clean up Hyper-V timecounter a bit.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6569


300831 27-May-2016 sephe

hyperv: GC unneeded bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6568


300830 27-May-2016 sephe

hyperv/vmbus: Move MSR EOM to hyperv_reg.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6567


300827 27-May-2016 sephe

hyperv: Move timer related MSRs into hyperv_reg.h

And avoid bit fields for event timer.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6566


300825 27-May-2016 sephe

hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6565


300708 26-May-2016 sephe

hyperv: Rework guest id settings according to Hyper-V spec

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6553


300655 25-May-2016 sephe

hyperv: Preserve required bits when disable Hypercall

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6530


300654 25-May-2016 sephe

hyperv/vmbus: Rework SynIC setup and teardown

- Avoid bit fields.
- Fix SINT setup (preserve required bits).

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6529


300653 25-May-2016 sephe

hyperv/vmbus: Nuke unnecessary MSR read

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6528


300652 25-May-2016 sephe

hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6527


300651 25-May-2016 sephe

hyperv/vmbus: Minor style and white space cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6523


300650 25-May-2016 sephe

hyperv/vmbus: Move two global flags into vmbus softc

And pack them into one flag field.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6522


300647 25-May-2016 sephe

hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6521


300646 25-May-2016 sephe

hyperv/vmbus: Move event/message taskqueue/task to vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6520


300645 25-May-2016 sephe

hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready

And release IDT vector before releasing ISR resources on interrupt
teardown path. We still have some work to do on the interrupt tearing
down path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6519


300644 25-May-2016 sephe

hyperv/vmbus: Check hyperv_dmamem_alloc return value

Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
we had better to check its return value; better safe then sorry here.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6518


300576 24-May-2016 sephe

hyperv/vmbus: Free message taskqueue during interrupt teardown

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6506


300574 24-May-2016 sephe

hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown

This paves way for further cleanup and fix.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6505


300573 24-May-2016 sephe

hyperv/vmbus: Git rid of sc version of pcpu data extraction macro

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6503


300572 24-May-2016 sephe

hyperv/vmbus: Use busdma(9) for messages and event flags

And
- Move message and event flags to vmbus_softc per-cpu data.
- Get rid of hv_setup_arg, which serves no purpose now.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6502


300571 24-May-2016 sephe

hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file

Avoid unnecessary exposure.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6501


300570 24-May-2016 sephe

hyperv/vmbus: Rename local variable and break long lines

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6500


300568 24-May-2016 sephe

hyperv/busdma: Take BUS_DMA_ZERO into account

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6499


300567 24-May-2016 sephe

hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6498


300565 24-May-2016 sephe

hyperv/vmbus: Move vmbus interrupt counter into vmbus softc

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6497


300487 23-May-2016 sephe

hyperv/vmbus: Move IDT vector to vmbus_softc

Prepare to get rid of the hv_setup_arg.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6449


300486 23-May-2016 sephe

hyperv/vmbus: Get rid of vmbus_devp

While I'm here, nuke useless print in vmbus_attach().

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6447


300481 23-May-2016 sephe

hyperv/vmbus: Declare Synic message and event w/ proper types

Avoid ugly casts.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6446


300480 23-May-2016 sephe

hyperv: Move Hypercall setup to an early place.

It does not belong to the vmbus.

While I'm here rework the Hypercall setup, e.g. use busdma(9)
and avoid bit fields.

Discussed with: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6445


300478 23-May-2016 sephe

hyperv: Add helpers for busdma(9) operation

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6443


300455 23-May-2016 sephe

hyperv: Move guest id setup to early place

And
- Rework the guest id composition.
- Nuke useless saved guest_id.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6430


300129 18-May-2016 sephe

hyperv/vmbus: Use consistent device description as other devices

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6418


300127 18-May-2016 sephe

hyperv/vmbus: Minor function definition style fixup

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6417


300126 18-May-2016 sephe

hyperv/vmbus: Fix SYSINIT function prototype and usage.

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6416


300124 18-May-2016 sephe

hyperv/vmbus: Reindent and cleanup devmethods.

While I'm here, use DEVMETHOD_END.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6415


300123 18-May-2016 sephe

hyperv/vmbus: Staticize vmbus_devclass

Reviewed by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6414


300122 18-May-2016 sephe

hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V

Reviewed by: kib
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6412


300121 18-May-2016 sephe

hyperv/vmbus: Nuke unnecessary function indirection

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6411


300120 18-May-2016 sephe

hyperv/vmbus: Remove useless modevent handler

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6410


300112 18-May-2016 sephe

hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task

It is not an SWI handler for a long time.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6409


300111 18-May-2016 sephe

hyperv/vmbus: Utilize curcpu

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6408


300108 18-May-2016 sephe

hyperv/vmbus: Minor white space and style cleanup

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6407


300107 18-May-2016 sephe

hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6405


300105 18-May-2016 sephe

hyperv/vmbus: Use atomic swap and flsl to process event flags

Greatly reduce the locked instructions and reduce number of inner loops.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6404


300102 18-May-2016 sephe

hyperv/vmbus: Reduce the # of event loops by recording event flag count

Use vmbus softc to save vmbus per-cpu data. More stuffs will be moved
into vmbus softc.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6403


300101 18-May-2016 sephe

hyperv/vmbus: Use unsigned long for event bits.

And move base channel id calculation out of inner loop. This prepares
for more event processing optimization.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6384


299927 16-May-2016 sephe

hyperv/vmbus: Use atomic_testandclear

Prepare to use unsigned long for event channel bit array.

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6382


299892 16-May-2016 sephe

hyperv/vmbus: Fix event processing loop indentation.

No functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6334


299890 16-May-2016 sephe

hyperv/vmbus: Simplify event processing

For channel0, it will never be processed on event handling path,
so there is no need to install it. After skipping in the channel0
installation, we could discard the channel0 check on event
handling hot code path.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6333


299889 16-May-2016 sephe

hyperv/vmbus: Simplify event processing

While I'm here, remove useless comment and unnecessary return.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6332


299746 14-May-2016 jhb

Add an EARLY_AP_STARTUP option to start APs earlier during boot.

Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed). This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP. It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot. Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system. In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU. Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code. This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP). This will allow the option to be turned off
if need be during initial testing. I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0. Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86. Other platform maintainers
are encouraged to port their architectures over as well. The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR: kern/199321
Reviewed by: markj, gnn, kib
Sponsored by: Netflix


298693 27-Apr-2016 sephe

hyperv/vmbus: Mark sysctls MPSAFE

MFC after: 1 week
Sponsored by: Microsoft OSTC


298617 26-Apr-2016 sephe

hyperv/channel: Git rid of the sub-channel creation callback

It is no longer used.

MFC after: 1 week
Sponsored by: Microsoft OSTC


298574 25-Apr-2016 sephe

hyperv/channel: Add functions to synchronize sub-channel offers

MFC after: 1 week
Sponsored by: Microsoft OSTC


298572 25-Apr-2016 sephe

hyperv/channel: Log a warning about duplicated primary channel offer

MFC after: 1 week
Sponsored by: Microsoft OSTC


298571 25-Apr-2016 sephe

hyperv/channel: Remove unapplied comment

MFC after: 1 week
Sponsored by: Microsoft OSTC


298570 25-Apr-2016 sephe

hyperv/channel: Minor style changes; no functional changes.

MFC after: 1 week
Sponsored by: Microsoft OSTC


298569 25-Apr-2016 sephe

hyperv/channel: Remove the unnecessary 'new' flag

MFC after: 1 week
Sponsored by: Microsoft OSTC


298568 25-Apr-2016 sephe

hyperv/et: Strip extra white space in function name

Reported by: Sascha Wildner <saw online de>
MFC after: 1 week
Sponsored by: Microsoft OSTC


298449 22-Apr-2016 sephe

hyperv/et: Make Hyper-V event timer a device.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5957


298446 22-Apr-2016 sephe

hyperv: Update copyright to 2016 for the files Microsoft changed in 2016

Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6039


298260 19-Apr-2016 sephe

hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT

Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC


298259 19-Apr-2016 sephe

hyperv: Remove two assign-only local variables

Submitted by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC


298039 15-Apr-2016 sephe

hyperv/vmbus: Put multi-channel offer logging under bootverbose

Suggested by: Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC


298022 15-Apr-2016 sephe

hyperv: Deprecate HYPERV option by moving Hyper-V IDT vector into vmbus

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: jhb, kib, sephe
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5910


297908 13-Apr-2016 sephe

hyperv/vmbus: Merge duplicated version check for events

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5911


297841 12-Apr-2016 sephe

hyperv: Replace 0 w/ NULL

Submitted by: pfg
MFC after: 1 week
Sponsored by: Microsoft OSTC


297815 11-Apr-2016 sephe

hyperv: Typo

Noticed by: kib
MFC after: 1 week
Sponsored by: Microsoft OSTC


297808 11-Apr-2016 sephe

hyperv: Define macro for Hyper-V interface

Suggested by: rpokala
MFC after: 1 week
Sponsored by: Microsoft OSTC


297807 11-Apr-2016 sephe

hyperv: Print more features

And add comment about the MSR features.

MFC after: 1 week
Sponsored by: Microsoft OSTC


297805 11-Apr-2016 sephe

hyperv: Break long line

MFC after: 1 week
Sponsored by: Microsoft OSTC


297804 11-Apr-2016 sephe

hyperv: Declare hyperv_{features,recommends} properly

MFC after: 1 week
Sponsored by: Microsoft OSTC


297803 11-Apr-2016 sephe

hyperv: Resurrect r297481

This time we make sure that the TIME_REF_COUNT MSR exists.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC


297802 11-Apr-2016 sephe

hyperv: Identify Hyper-V features and recommends properly

Features bits will be used to detect devices, e.g. timers, which
do not have corresponding event channels.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
Rearranged by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC


297801 11-Apr-2016 sephe

hyperv/vmbus: Get rid of max_leaf detection; this is actually not used.

It will be replaced by a new one.

MFC after: 1 week
Sponsored by: Microsoft OSTC


297800 11-Apr-2016 sephe

hyperv/vmbus: Nuke unused function

MFC after: 1 week
Sponsored by: Microsoft OSTC


297699 08-Apr-2016 sephe

hyperv: Revert r297481

Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD
is running on Hyper-V or not. What a mess.

Reported by: smokehydration tutanota com
Sponsored by: Microsoft OSTC


297641 07-Apr-2016 sephe

hyperv: Use lapic_{alloc,free}_ipi to allocate private interrupt vector

Suggested by: jhb
Reviewed by: Dexuan Cui <decui microsoft com>, Jun Su <junsu microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5850


297636 07-Apr-2016 sephe

hyperv: Typo in r297634

Noticed by: hiren
MFC after: 1 week
Sponsored by: Microsoft OSTC


297635 07-Apr-2016 sephe

hyperv/vmbus: Use default mtx for channel message queue

First of all sema_post() can't be called w/ spinlock, and the channel
message queue processing is not on hot code path, i.e. spinlock is not
necessary.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5812


297634 07-Apr-2016 sephe

hyperv: Use mb() instead of atomic_thread_fence_seq_cst()

Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel.

Reviewed by: kib, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5852


297481 01-Apr-2016 sephe

hyperv: Register Hyper-V timer early enough for TSC freq calibration

The i8254 simulation in Hyper-V is kinda broken and is not available
in Generation 2 Hyper-V VMs, so Hyper-V timer must be registered early
enough so that it can be used to do the TSC freq calibration.

This fixes the notorious warning like this:
calcru: runtime went backwards from 50 usec to 25 usec for pid 0 (kernel)

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: kib, sephe
Tested by: kib, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5778


297221 24-Mar-2016 sephe

hyperv/vmbus: Create per-cpu fast taskqueue for msg handling

Using one taskqueue does not work, since the EOM MSR must be written
on the msg's owner CPU.

Noticed by: Jun Su <junsu microsoft com>
Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC


297219 24-Mar-2016 sephe

hyperv/vmbus: use a better retry method in hv_vmbus_post_message()

Most often, hv_vmbus_post_message() doesn't fail. However, it fails
intermittently when GPADLs of large shared memory is to be established
with the host, e.g. on the hn(4) attach path: a GPADL of 15MB sendbuf
is created, for which lots of messages will be flooded to the host.
The host side tries to throttle the message rate by returning
HV_STATUS_INSUFFICIENT_BUFFERS.

Before this commit, we do several retries for failed messages, but the
delay between each retry is pretty/too low, which will cause sporadic
message posting failure. We now use large delay (>=1ms) between each
retry to fix the message posting failure.

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5715


297178 22-Mar-2016 sephe

hyperv/vmbus: Remove NULL check for taskqueue_create_fast(M_WAITOK)

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5215


297177 22-Mar-2016 sephe

hyperv/vmbus: Use taskqueue_fast for non-performance critical messages

This gets rid of the per-cpu SWIs.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5215


297176 22-Mar-2016 sephe

hyperv/evttimer: Use an independent message slot so that it can work

Using the same message slot as the other types of the messages has
the side effect that the event timer message could be deferred to
the swi threads to run (lacking of trapframe and the original code
didn't even handle that, so the event timer was actually broken).

As of this commit we use an independent message slot for event timer,
so that we could handle all of event timer messages in the interrupt
handler directly. Note, the message slot for event timer is still
bind to the same interrupt vector as the other types of messages.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: sephe
Discussed with: Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5696


297143 21-Mar-2016 sephe

hyperv/vmbus: Implement bus_child_pnpinfo_str method

Submitted by: Jun Su <junsu microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5669


297142 21-Mar-2016 sephe

hyperv: Factor out snprinf_hv_guid()

Submitted by: Ju Sun <junsu microsoft com>
Reviewed by: Dexuan Cui <decui microsoft com>, sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5651


296379 04-Mar-2016 sephe

hyperv/hn: Add multiple channel support, a.k.a. vRSS

Each channel contains one RX ring and one TX ring. And we
try to distribute the channels to different evenly.

Note: Currently we don't have enough information to extract
the RSS type and RSS hash value from the received packets.

This greatly improves the TX/RX performance for 8 virtual CPU
Hyper-V over 10Ge: it can max out 10Ge for TCP when multiple
RX/TX rings are enabled.

This almost doubles the TX/RX performance for locally connected
Hyper-Vs: was 6Gbps w/ 128 TCP streams, now 11Gbps w/ multiple
RX/TX rings enabled.

It is not enabled by default; it will be switched on after more
tests.

Collaborated with: Hongjiang Zhang <honzhan microsoft com>
MFC after: 2 week
Sponsored by: Microsoft OSTC


296291 02-Mar-2016 sephe

hyperv/chan: Factor out the vcpu setting

And use it for cpu0 assignment; it does not sound right to assume that
cpu0 maps to vcpu0. And this factored out function will be exposed to
drivers, if driver specific CPU binding is needed, e.g. hn(4).

Move default cpu select after saving channel offer message. This makes
sure that all useful information of the channel has been setup.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5504


296290 02-Mar-2016 sephe

hyperv/chan: Function renaming; no functional change

The renamed function create a sysctl tree for channel, and many
non-statistics nodes exists, so don't claim it only adds sysctl
nodes for statistics.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5503


296289 02-Mar-2016 sephe

hyperv/chan: Add sysctl node to check whether monitor is allocated or not

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5502


296272 01-Mar-2016 jhb

Remove taskqueue_enqueue_fast().

taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167. It has been a compat shim ever
since. It's time for the compat shim to go.

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: sephe
Differential Revision: https://reviews.freebsd.org/D5131


296253 01-Mar-2016 sephe

hyperv/channel: Nuke useless stack variable

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5499


296188 29-Feb-2016 sephe

hyperv/channel: Add sysctl node for channel owner cpu

And add sysctl node for sub-channel's channel id.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5489


296181 29-Feb-2016 sephe

hyperv/channel: Add debug sysctl nodes for channel indices

It would serve as a debug tool, if the shared buffer ring's indices
stopped updating.

Submitted by: HongJiang Zhang <honzhan microsoft com>
Reviewed by: sephe, Jun Su <junsu microsoft com>
Modified by: sephe
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5402


296180 29-Feb-2016 sephe

hyperv: Use proper fence function to keep store-load order for msgs

sfence only makes sure about the store-store order, which is not
sufficient here. Use atomic_thread_fence_seq_cst() as suggested
jhb and kib (a locked op in the nutshell, which should have the

Reviewed by: jhb, kib, Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5436


296084 26-Feb-2016 sephe

hyperv: Always set device for channels

And unregister hv_device only for primary channels, who own the hv_device.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5451


296083 26-Feb-2016 sephe

hyperv: Remove useless channel inbound_lock

It serves no purpose.

Reviewed by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5450


296076 26-Feb-2016 sephe

hyperv: Use atomic_fetchadd_int to get GPADL id.

Reviewed by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5439


296028 25-Feb-2016 sephe

hyperv: Wait 5 seconds for hyperv result, instead of 500ms

This addresses various devices (network, stoarge) attach failure.

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5435


295964 24-Feb-2016 sephe

hyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5417


295309 05-Feb-2016 sephe

hyperv: Use malloc for page allocation.

We will eventually convert them to use busdma.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Dexuan Cui <decui microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5087


295308 05-Feb-2016 sephe

hyperv: Use WAITOK in the places where we can wait

And convert rndis non-hot path spinlock to mutex.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5081


295307 05-Feb-2016 sephe

hyperv: Use standard taskqueue instead of hv_work_queue

HyperV code was ported from Linux. There is an implementation of
work queue called hv_work_queue. In FreeBSD, taskqueue could be
used for the same purpose. Convert all the consumer of hv_work_queue
to use taskqueue, and remove work queue implementation.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, Hongjiang Zhang <honzhan microsoft com>
Approved by: adrian (mentor)
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4963


294886 27-Jan-2016 sephe

hyperv/vmbus: Event handling code refactor.

- Use taskqueue instead of swi for event handling.
- Scan the interrupt flags in filter
- Disable ringbuffer interrupt mask in filter to ensure no unnecessary
interrupts.

Submitted by: Jun Su <junsu microsoft com>
Reviewed by: adrian, sephe, Dexuan <decui microsoft com>
Approved by: adrian (mentor)
MFC after: 2 weeks
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4920


294705 25-Jan-2016 sephe

hyperv/vmbus: Avoid extra copy of page information.

The page information array could contain up to 32 elements (i.e. 512B).
And on network side w/ TSO, 11+ (176B+) elements, i.e. ~44K TSO packet,
in the page information array is quite common.

This saves us some cpu cycles.

Reviewed by: adrian, delphij
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4992


294553 22-Jan-2016 sephe

hyperv/vmbus: Lookup channel through id table

Vmbus event handler will need to find the channel by its relative
id, when software interrupt for event happens. The original lookup
searches the channel list, which is not very efficient. We now
create a table indexed by the channel relative id to speed up
the channel lookup.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: delphij, adrain, sephe, Dexuan Cui <decui microsoft com>
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4802


293874 14-Jan-2016 sephe

hyperv: add interrupt counters

Submitted by: Howard Su <howard0su gmail com>
Reviewed by: royger, Dexuan Cui <decui microsoft com>, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4693


293873 14-Jan-2016 sephe

hyperv: implement an event timer

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: delphij, royger, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4676


293870 14-Jan-2016 sephe

hyperv: use x86 generic code to do the hypervisor detection

This is first step to move the generic part of HV code into kernel instead
of module, so that it is possible to use hypercall to implement some other
paravirtualization code in the kernel.

Submitted by: Howard Su <howard0su@gmail.com>
Reviewed by: royger, delphij, adrian
Approved by: adrian (mentor)
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D3072


292861 29-Dec-2015 delphij

hyperv: vmbus: run non-blocking message handlers in vmbus_msg_swintr()

We'll remove the per-channel control_work_queue because it can't properly
do serialization of message handling, e.g., when there are 2 NIC devices,
vmbus_channel_on_offer() -> hv_queue_work_item() has a race condition:
for an SMP VM, vmbus_channel_process_offer() can run concurrently on
different CPUs and if the second NIC's
vmbus_channel_process_offer() -> hv_vmbus_child_device_register() runs
first, the second NIC's name will be hn0 and the first NIC's name will
be hn1!

We can fix the race condition by removing the per-channel control_work_queue
and run all the message handlers in the global
hv_vmbus_g_connection.work_queue -- we'll do this in the next patch.

With the coming next patch, we have to run the non-blocking handlers
directly in the kernel thread vmbus_msg_swintr(), because the special
handling of sub-channel: when a sub-channel (e.g., of the storvsc driver)
is received and being handled in vmbus_channel_on_offer() running on the
global hv_vmbus_g_connection.work_queue, vmbus_channel_process_offer()
invokes channel->sc_creation_callback, i.e., storvsc_handle_sc_creation,
and the callback will invoke hv_vmbus_channel_open() -> hv_vmbus_post_message
and expect a further reply from the host, but the handling of the further
messag can't be done because the current message's handling hasn't finished
yet; as result, hv_vmbus_channel_open() -> sema_timedwait() will time out
and th device can't work.

Also renamed the handler type from hv_pfn_channel_msg_handler to
vmbus_msg_handler: the 'pfn' and 'channel' in the old name make no sense.

Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: royger
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4596


292859 29-Dec-2015 delphij

hyperv: vmbus: remove the per-channel control_work_queue

Now vmbus_channel_on_offer() -> vmbus_channel_process_offer() can
safely run on the global hv_vmbus_g_connection.work_queue now.

We remove the per-channel control_work_queue to achieve the proper
serialization of the message handling.

I removed the bogus TODO in vmbus_channel_on_offer(): a vmbus offer
can only come from the parent partition, i.e., the host.

PR: kern/205156
Submitted by: Dexuan Cui <decui microsoft com>
Reviewed by: Howard Su <howard0su gmail com>, delphij
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4597


292661 23-Dec-2015 ngie

Remove redundant vmbus_select_outgoing_channel declaration already handled
in include/hyperv.h

This unbreaks the gcc 4.2.1 kernel build of hyperv

Differential Revision: https://reviews.freebsd.org/D4684
MFC after: 3 days
Reviewed by: royger
Sponsored by: EMC / Isilon Storage Division


282212 29-Apr-2015 whu

Microsoft vmbus, storage and other related driver enhancements for HyperV.
- Vmbus multi channel support.
- Vector interrupt support.
- Signal optimization.
- Storvsc driver performance improvement.
- Scatter and gather support for storvsc driver.
- Minor bug fix for KVP driver.
Thanks royger, jhb and delphij from FreeBSD community for the reviews
and comments. Also thanks Hovy Xu from NetApp for the contributions to
the storvsc driver.

PR: 195238
Submitted by: whu
Reviewed by: royger, jhb, delphij
Approved by: royger
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Microsoft OSTC


257341 29-Oct-2013 nwhitehorn

More BUS_PROBE_NOWILDCARD sweeping. Some devices here (if_ath_ahb and siba)
resist easy conversion since they implement a great deal of their attach
logic inside probe(). Some of this could be fixed by moving it to attach(),
but some requires something more subtle than BUS_PROBE_NOWILDCARD.


256425 13-Oct-2013 gibbs

Centralize the detection logic for the Hyper-V hypervisor.

Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs, grehan
Approved by: re (gjb)

sys/sys/systm.h:
* Add a new VM_GUEST type, VM_GUEST_HV (HyperV guest).

sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c:
sys/dev/hyperv/vmbus/hv_hv.c:
sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c:
* Set vm_guest to VM_GUEST_HV and use that on other HyperV related
devices instead of cloning the cpuid hypervisor check.
* Cleanup the vmbus_identify function.


256350 11-Oct-2013 grehan

Fix vmbus channel memory leak where incorrect length parameter was
being passed to contigfree().

Submitted by: Microsoft hyperv dev team
Approved by: re@ (glebius)


256276 10-Oct-2013 dim

In sys/dev/hyperv, fix a number of gcc warnings about usage of anonymous
union members in strict C99, by giving them names. While here, add some
FreeBSD keywords where they were missing.

Approved by: re (gjb)
Reviewed by: grehan


256071 05-Oct-2013 gibbs

Correct panic caused by attaching both Xen PV and HyperV virtualization
aware drivers on Xen hypervisors that advertise support for some
HyperV features.

x86/xen/hvm.c:
When running in HVM mode on a Xen hypervisor, set vm_guest
to VM_GUEST_XEN so other virtualization aware components in
the FreeBSD kernel can detect this mode is active.

dev/hyperv/vmbus/hv_hv.c:
Use vm_guest to ignore Xen's HyperV emulation when Xen is
detected and Xen PV drivers are active.

Reported by: Shanker Balan
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs
Approved by: re (Xen blanket)


255524 13-Sep-2013 grehan

Import Hyper-V paravirtualized drivers from projects/hyperv
branch into head.

Approved by: re@ (hrs)
Obtained from: Microsoft, NetApp, and Citrix.


255414 09-Sep-2013 grehan

Latest update from Microsoft.

Obtained from: Microsoft Hyper-v dev team


253411 17-Jul-2013 grehan

Microsoft have changed their policy on how the hyper-v code will
be pulled into FreeBSD. From now, FreeBSD will be considered the
upstream repo.

First step: move the drivers away from the contrib area and into
the base system.

A follow-on commit will include the drivers in the amd64 GENERIC kernel.


252645 03-Jul-2013 grehan

Import driver source from hyperv-20130627 vendor branch.


251775 15-Jun-2013 grehan

Import driver source from hyperv-20130502 vendor branch.


250200 03-May-2013 grehan

Tag hyperv 20130502


250199 03-May-2013 grehan

Initial import of the Microsoft HyperV 'enlightened' drivers.

From https://github.com/FreeBSDonHyper-V/VendorBranchForFreeBSDonHyper-V
rev: 99eaa0ddb0485c9d76046664100f6beb1a0a0c58