History log of /freebsd-11-stable/sys/dev/hyperv/vmbus/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
332068 05-Apr-2018 emaste

MFC r331757: Correct comment typo in Hyper-V

PR: 226665
Submitted by: Ryo ONODERA

329462 17-Feb-2018 kib

MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,
328166,328177,328199,328202,328205,328468,328470,328624,328625,328627,
328628,329214,329297,329365:

Meltdown mitigation by PTI, PCID optimization of PTI, and kernel use of IBRS
for some mitigations of Spectre.

Tested by: emaste, Arshan Khanifar <arshankhanifar@gmail.com>
Discussed with: jkim
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/sys/amd64/amd64/apic_vector.S
/freebsd-11-stable/sys/amd64/amd64/atpic_vector.S
/freebsd-11-stable/sys/amd64/amd64/cpu_switch.S
/freebsd-11-stable/sys/amd64/amd64/db_trace.c
/freebsd-11-stable/sys/amd64/amd64/exception.S
/freebsd-11-stable/sys/amd64/amd64/genassym.c
/freebsd-11-stable/sys/amd64/amd64/initcpu.c
/freebsd-11-stable/sys/amd64/amd64/machdep.c
/freebsd-11-stable/sys/amd64/amd64/mp_machdep.c
/freebsd-11-stable/sys/amd64/amd64/pmap.c
/freebsd-11-stable/sys/amd64/amd64/support.S
/freebsd-11-stable/sys/amd64/amd64/sys_machdep.c
/freebsd-11-stable/sys/amd64/amd64/trap.c
/freebsd-11-stable/sys/amd64/amd64/vm_machdep.c
/freebsd-11-stable/sys/amd64/ia32/ia32_exception.S
/freebsd-11-stable/sys/amd64/ia32/ia32_syscall.c
/freebsd-11-stable/sys/amd64/include/asmacros.h
/freebsd-11-stable/sys/amd64/include/frame.h
/freebsd-11-stable/sys/amd64/include/intr_machdep.h
/freebsd-11-stable/sys/amd64/include/md_var.h
/freebsd-11-stable/sys/amd64/include/pcb.h
/freebsd-11-stable/sys/amd64/include/pcpu.h
/freebsd-11-stable/sys/amd64/include/pmap.h
/freebsd-11-stable/sys/amd64/include/smp.h
/freebsd-11-stable/sys/amd64/vmm/intel/vmx.c
/freebsd-11-stable/sys/amd64/vmm/vmm.c
/freebsd-11-stable/sys/dev/cpuctl/cpuctl.c
amd64/vmbus_vector.S
i386/vmbus_vector.S
vmbus.c
/freebsd-11-stable/sys/i386/i386/apic_vector.s
/freebsd-11-stable/sys/i386/i386/atpic_vector.s
/freebsd-11-stable/sys/i386/i386/exception.s
/freebsd-11-stable/sys/i386/i386/machdep.c
/freebsd-11-stable/sys/i386/i386/pmap.c
/freebsd-11-stable/sys/i386/i386/support.s
/freebsd-11-stable/sys/i386/i386/vm_machdep.c
/freebsd-11-stable/sys/x86/include/apicvar.h
/freebsd-11-stable/sys/x86/include/specialreg.h
/freebsd-11-stable/sys/x86/include/x86_smp.h
/freebsd-11-stable/sys/x86/include/x86_var.h
/freebsd-11-stable/sys/x86/isa/atpic.c
/freebsd-11-stable/sys/x86/x86/cpu_machdep.c
/freebsd-11-stable/sys/x86/x86/identcpu.c
/freebsd-11-stable/sys/x86/x86/local_apic.c
/freebsd-11-stable/sys/x86/x86/mp_x86.c
/freebsd-11-stable/sys/x86/xen/pv.c
324577 13-Oct-2017 sephe

MFC 324488

hyperv/vmbus: Expose Hyper-V major version.

Sponsored by: Microsoft

324576 13-Oct-2017 sephe

MFC 324487

hyperv/vmbus: Add tunable to pin/unpin event tasks.

Event tasks are pinned to their respective CPU by default, in the same
fashion as they were.

Unpin the event tasks by setting hw.vmbus.pin_evttask to 0, if certain
CPUs serve special purpose.

Sponsored by: Microsoft

322612 17-Aug-2017 sephe

MFC 322488
hyperv: Update copyright for the files changed in 2017

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

318392 17-May-2017 sephe

MFC 318136

hyperv/vmbus: Reorganize vmbus device tree

For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the
resources for PCI passthrough and SR-IOV. There is no
acpi_syscontainer0 on GEN1 Hyper-V.

For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which
contains the resources for PCI passthrough and SR-IOV. There is
no pcib0 on GEN2 Hyper-V.

The ACPI VMBUS device now only holds its _CRS, which is empty as
of this commit; its existence is mainly for upward compatibility.

Device tree structure is suggested by jhb@.

Tested-by: dexuan@
Collabrated-wth: dexuan@
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10565

317108 19-Apr-2017 sephe

MFC 317107
hyperv: Use kmem_malloc for hypercall memory due to NX bit change.

Reported by: dexuan@
Sponsored by: Microsoft

314003 21-Feb-2017 sephe

MFC 311743

hyperv: Add method to read 64bit Hyper-V specific time value.

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

311389 05-Jan-2017 sephe

MFC 310651

hyperv/vmbus: Nuke unnecessary critical sections.

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

311376 05-Jan-2017 sephe

MFC 310048,310101,310239

310048
hyperv: Implement "enlightened" time counter, which is rdtsc based.

Reviewed by: kib
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8763

310101
hyperv: Allow userland to ro-mmap reference TSC page

This paves way to implement VDSO for the enlightened time counter.

Reviewed by: kib
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8768

310239
hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC

This 6 times gettimeofday performance, as measured by
tools/tools/syscall_timing

Reviewed by: kib
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8789

311375 05-Jan-2017 sephe

MFC 309874,309875

309874
hyperv/vmbus: Add channel polling support.

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

309875
hyperv/hn: Add polling support

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

311373 05-Jan-2017 sephe

MFC 309705

hyperv/timesync: Support "sent TC" to improve accuracy.

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

311372 05-Jan-2017 sephe

MFC 309704

hyperv/vmbus: Utilize vmbus_chan_run_task()

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

311369 05-Jan-2017 sephe

MFC 309319

hypver/vmbus: Remove extra assertion.

It is asserted by vmbus_chan_gpadl_connect() now.

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

311368 05-Jan-2017 sephe

MFC 309310,309311,309316,309318

309310
hyperv/hn: Nuke the unused TX taskqueue CPU binding tunable.

It was an experimental tunable, and is now deemed to be road blocker
for further changes. Time to retire it.

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

309311
hyperv/hn: Allow multiple TX taskqueues.

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

309316
hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

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

309318
hyperv/hn: Allow TX to share event taskqueues.

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

311367 05-Jan-2017 sephe

MFC 309240,309242,309244,309245,309670

309240
hyperv/vmbus: Add result polling support for xact API.

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

309242
hyperv/vmbus: Add result polling support for message Hypercall API.

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

309244
hyperv/vmbus: Add exec cancel support for message Hypercall API.

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

309245
hyperv/vmbus: Use poll/cancel APIs to wait for the CHOPEN response.

Since hypervisor does not respond CHOPEN to a revoked channel.

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

309670
hyperv/vmbus: Use pause if possible.

This makes booting on Hyper-V w/ small # of vCPUs work properly.

Reported by: Hongxiong Xian <v-hoxian microsoft com>, Hongjiang Zhang <honzhan microsoft com>
Sponsored by: Microsoft

311366 05-Jan-2017 sephe

MFC 309236,309237

309236
hyperv/vmbus: Make sure that the allocated GPADL is not zero.

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

309237
hyperv/vmbus: Stringent GPADL parameter assertion.

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

311364 05-Jan-2017 sephe

MFC 309128,309129,309131-309136,309138-309140,309224,309225

309128
hyperv/vmbus: Commit the GPADL id only after the connection succeeds.

Minor style change.

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

309129
hyperv/vmbus: Minor style changes.

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

309131
hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.

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

309132
hyperv/vmbus: Don't close unopened channels.

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

309133
hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.

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

309134
hyperv/vmbus: No stranded bufring GPADL is allowed.

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

309135
hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.

So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

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

309136
hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.

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

309138
hyperv/vmbus: Always try disconnect/free bufring memory upon channel close

While I'm here, minor wording and style changes.

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

309139
hyperv/vmbus: Propagate close error.

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

309140
hyperv/vmbus: Add a simplified version of channel close.

So that the caller can know the channel close error and react accordingly.

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

309224
hyperv/vmbus: Zero out GPADL if error happens.

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

309225
hyperv/vmbus: Add supportive transaction wait function.

This function supports channel revocation properly.

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

311359 05-Jan-2017 sephe

MFC 309030,309039,309080,309081,309083

309030
hyperv/vmbus: Set a mark on the revoked channel.

This will be used to fix device detach DEVMETHOD for revoked primary
channel.

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

309039
hyperv/vmbus: Merge free/active locks.

These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

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

309080
hyperv/vmbus: Implement orphan support for transaction API

It will be used to fix the primary channel revocation support.

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

309081
hyperv/vmbus: Fix the primary channel revoking on vmbus side.

Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

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

309083
hyperv/vmbus: Fix the multi-channel revoking on vmbus side.

- Reference count the sub-channel when channel offer message is
processed, so that immediate rescind message on the same channel
will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
mimics the hypervisor's reaction when primary channel is closed
on the VM side. No drivers use sub-channel after primary channel
is closed.

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

311356 05-Jan-2017 sephe

MFC 308906

hyperv/vmbus: Support transction result busy-wait.

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

310573 26-Dec-2016 sephe

r310348

hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook

Properly working pause and friends are required.

Sponsored by: Microsoft

309312 30-Nov-2016 dexuan

MFC: 308723-308725,308793-308795,309127

Approved by: sephe (mentor)

r308723
hyperv/vmbus: add a new method to get vcpu_id

vcpu_id is host's representation of guest CPU.
We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus
driver is loaded. Later, when a driver, like the coming pcib driver, talks
to the host and needs to refer to a guest CPU, the driver must use the
vcpu_id.

Reviewed by: jhb, sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8410

r308724
hyperv/vmbus: add new vmbus methods to support PCIe pass-through

The new methods will be used by the coming pcib driver.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8409

r308725
hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)

The feature enables us to pass through physical PCIe devices to FreeBSD VM
running on Hyper-V (Windows Server 2016) to get near-native performance with
low CPU utilization.

The patch implements a PCI bridge driver to support the feature:

1) The pcib driver talks to the host to discover device(s) and presents
the device(s) to FreeBSD's pci driver via PCI configuration space (note:
to access the configuration space, we don't use the standard I/O port
0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V,
which is very similar to the 0xCF8/CFC method).

2) The pcib driver allocates resources for the device(s) and initialize
the related BARs, when the device driver's attach method is invoked;

3) The pcib driver talks to the host to create MSI/MSI-X interrupt
remapping between the guest and the host;

4) The pcib driver supports device hot add/remove.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8332

r308793
hyperv/pcib: Fix the build for some kernel configs

Add the dependency on pci explicitly for the pcib and vmbus drivers.
The related Makefiles are updated accordingly too.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft

r308794
hyperv/vmbus,pcib: Add MODULE_DEPEND on pci

We'd better add this dependency explicitly, though usually the pci
driver is built into the kernel by default.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft

r308795
hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c

This makes the file name and the variable naming in the file consistent.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft

r309127
hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by: sephe
Approved by: sephe (mentor)
Sponsored by: Microsoft

308634 14-Nov-2016 sephe

MFC 308194

hyperv: GC unused functions.

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

308633 14-Nov-2016 sephe

MFC 308168

hyperv/vmbus: Avoid extra header copy.

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

308621 14-Nov-2016 sephe

MFC 307952,307953,308278

307952
hyperv/vmbus: Add missing white space.

Submitted by: QianYue You <t-youqi microsoft com>
Sponsored by: Microsoft

307953
hyperv/vmbus: Implement vmbus_chan_printf.

And use it for vmbus channel logging, which can log the channel
owner's name properly, instead of vmbus0.

Submitted by: QianYue You <t-youqi microsoft com>
Sponsored by: Microsoft

308278
hyperv/vmbus: Reset ch_dev, once the child is deleted.

So it will not be mis-used later on, e.g. in vmbus_chan_printf().

Submitted by: dexuan
Reported by: dexuan
Sponsored by: Microsoft

308517 11-Nov-2016 sephe

MFC 307624

hyperv/vmbus: Expose channel management taskqueue for driver to use.

MFC after: 3 days
Sponsored by: Microsoft

307618 19-Oct-2016 sephe

MFC 307263

hyperv/vmbus: Add __FBSDID

Sponsored by: Microsoft

307614 19-Oct-2016 sephe

MFC 307012,307013,307262

307012
hyperv/vmbus: Allow driver to inject synchronous task into channel taskq.

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

307013
hyperv/hn: Rework link status support.

This is the preamble for network device SR-IOV and
NDIS_STATUS_NETWORK_CHANGE handling.

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

307262
hyperv/hn: Management parts always need suspend and resume.

Sponsored by: Microsoft

307599 19-Oct-2016 sephe

MFC 306360,306387,306389

306360
hyperv/vmbus: Add dynamic device add and remove support

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

306387
hyperv/vmbus: Add functions to test RX/TX bufring emptiness

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

306389
hyperv/vmbus: Add function to drain channel interrupt task.

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

307595 19-Oct-2016 sephe

MFC 306072-306074,306076

306072
hyperv/vmbus: Allow bufrings preallocation.

The assumption that the channel is only opened upon synthetic device
attach time no longer holds, e.g. Hyper-V network device MTU changes.
We have to allow device drivers to preallocate bufrings, e.g. in
attach DEVMETHOD, to prevent bufring allocation failure once the
system memory is fragmented after running for a while.

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

306073
hyperv/hn: Allocate bufrings in attach DEVMETHOD.

So that reinitialization, e.g. MTU change, will not fail when the system
memory is excessively fragmented.

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

306074
hyperv/vmbus: Assert that the bufring address is page aligned.

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

306076
hyperv/hn: Put debug messages under bootverbose

While I'm here, strip blank line.

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

307510 17-Oct-2016 sephe

MFC 305789

hyperv/vmbus: Make sure that the sub-channel count is valid.

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

307498 17-Oct-2016 sephe

MFC 305405,305407,305408,305410,305411,305453

305405
hyperv/vmbus: Stringent header length and total length check.

While I'm here, minor style changes.

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

305407
hyperv/hn: Stringent NVS notification length check.

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

305408
hyperv/hn: Stringent NVS RNDIS packets length checks.

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

305410
net/rndis: Define RNDIS status message, which could be sent by device.

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

305411
hyperv/hn: Stringent RNDIS control message length check.

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

305453
hyperv/hn: Stringent RNDIS packet message length/offset check.

While I'm here, use definition in net/rndis.h

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

307486 17-Oct-2016 sephe

MFC 304790,304791

304790
hyperv/vmbus: Add function to calculate max # of elements in a bufring.

Sponsored by: Microsoft

304791
hyperv/storvsc: Increase queue depth and rework channel selection.

- Increasing queue depth gives ~100% performance improvement for
randwrite fio test in Azure.
- New channel selection, which takes LUN id and the current cpuid
into consideration, gives additional ~20% performance improvement
for ranwrite fio test in Azure.

Submitted by: Hongzhang Jiang <honzhan microsoft com>
Modified by: sephe
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7622

307475 17-Oct-2016 sephe

MFC 303945,303947-303949,303989,303992,303998,304001,304002,304109,304111

303945
hyperv/vmbus: Add macro to get channel packet data length.

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

303947
hyperv/vmbus: Add APIs for various types of transactions.

Reviewed by: Jun Su <junsu microsoft com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7456

303948
hyperv/hn: Switch to vmbus xact APIs for NVS initialization

Reviewed by: Jun Su <junsu microsoft com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7457

303949
hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs

Avoid code duplication.

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

303989
hyperv/hn: Simplify NDIS configuration.

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

303992
hyperv/hn: Simplify NDIS initialization.

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

303998
hyperv/hn: Switch to vmbus xact APIs for NVS RXBUF connection.

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

304001
hyperv/hn: Switch to vmbus xact APIs for NVS chimney buffer connection.

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

304002
hyperv/hn: Simplify RXBUF disconnection.

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

304109
hyperv/hn: Simplify chimney sending buffer disconnection.

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

304111
hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.

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

307471 17-Oct-2016 sephe

MFC 303603-303605,303764

303603
hyperv/vmbus: Remove the artificial entry limit of SG and PRP list.

Just make sure that the total channel packet size does not exceed 1/2
data size of the TX bufring.

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

303604
hyperv/storvsc: Set maxio to 128KB.

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

303605
hyperv/storvsc: Stringent PRP list assertions

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

303764
hyperv/vmbus: Only make sure the TX bufring will not be closed.

KVP can write data, whose size is > 1/2 TX bufring size.

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

307466 17-Oct-2016 sephe

MFC 303421,303422,303470-303473

303421
hyperv/vmbus: Avoid unnecessary mb()

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

303422
hyperv/vmbus: Inclusion cleanup

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

303470
hyperv/vmbus: Reindent function declarations.

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

303471
hyperv/vmbus: Forward declare static functions

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

303472
hyperv/vmbus: Move driver glue to the beginning of the files

Just as most of other drivers do. And move sysinit function close
to its SYSINIT.

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

303473
hyperv/vmbus: Revoke unnecessary exposure of vmbus softc

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

307465 17-Oct-2016 sephe

MFC 303379

hyperv/vmbus: Rename cleaned up bufring code

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

307464 17-Oct-2016 sephe

MFC 303284,303329,303361,303362,303366,303368-303370

303284
hyperv/vmbus: Move bufring info definition to vmbus_brvar.h

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

303329
hyperv/vmbus: Nuke unnecessary accessor functions.

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

303361
hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time

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

303362
hyperv/vmbus: Use different struct for RX/TX bufring.

So that they can use suitable MP synchronization mechanism.

While I'm here change the bufring init/read/write function names.

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

303366
hyperv/vmbus: Update comment for bufring

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

303368
hyperv/vmbus: Cleanup TX bufring write process.

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

303369
hyperv/vmbus: Stringent RX bufring data length checks.

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

303370
hyperv/vmbus: Cleanup RX bufring read process.

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

307463 17-Oct-2016 sephe

MFC 303283

hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h

It only contains bufring related bits for a while.

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

307462 17-Oct-2016 sephe

MFC 303178,303180,303182

303178
hyperv/vmbus: Cosmetic bufring cleanup.

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

303180
hyperv/vmbus: Cleanup and augment bufring sysctl tree creation

Binary state node is added, so that userland programs do not have
to parse human readable state string.

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

303182
hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h

And add more comment about its fields.

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

307461 17-Oct-2016 sephe

MFC 303066-303072,303127-303129,303131

303066
hyperv/vmbus: Get rid of unnecessary definition.

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

303067
hyperv/vmbus: Move IC register definition to Hyper-V utilities

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

303068
hyperv/vmbus: Channel struct field rename

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

303069
hyperv/vmbus: Pass channel as the first argument for channel callback

The prepares to kill device private fields in channel struct, which
are not flexible and extensible.

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

303070
hyperv/vmbus: Deprecate the device private data in channel struct

They are neither flexible nor extensible.

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

303071
hyperv/vmbus: Hide channel struct definition.

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

303072
hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.

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

303127
hyperv/vmbus: Save event flag location and evet flag mask.

This avoids unnecessary access to the vmbus_softc struct on sending path.

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

303128
hyperv/vmbus: Reorder channel fields.

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

303129
hyperv/vmbus: Shuffle function declaration and macro definition.

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

303131
hyperv: hv_vmbus_channel -> vmbus_channel

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

307460 17-Oct-2016 sephe

MFC 303023

hyperv/vmbus: Rename laundered vmbus channel code

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

307459 17-Oct-2016 sephe

MFC 302888-302892,302986,303020-303022

302888
hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

Nuke unused channel GPADL API.

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

302889
hyperv/vmbus: Back out r302888 temporarily

Committed by accident w/ duplicated commit log

Sponsored by: Microsoft OSTC

302890
hyperv/vmbus: Function rename

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

302891
hyperv/vmbus: Cosmetic vmbus channel close cleanup

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

302892
hyperv/vmbus: Cleanup channel sysctl tree creation

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

302986
hyperv/vmbus: Cosmetic vmbus channel open cleanup

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

303020
hyperv/vmbus: Cleanup cpu based channel selection.

And create cpu to channel map at device attach time for storvsc(4).

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

303021
hyperv/vmbus: Function rename

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

303022
hyperv/vmbus: Temp/internal variable/function rename

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

307458 17-Oct-2016 sephe

MFC 302887

hyperv/hn: Busdma-fy rxbuf and chimney sending buffer

Nuke unused channel GPADL API.

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

307457 17-Oct-2016 sephe

MFC 302885,302886

302885
hyperv/vmbus: Cleanup channel receiving.

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

302886
hyperv/vmbus: Cleanup channel packet receiving.

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

307456 17-Oct-2016 sephe

MFC 302882-302884

302882
hyperv/vmbus: Function rename

And reorder the error prone parameters list.

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

302883
hyperv/vmbus: Field rename

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

302884
hyperv/vmbus: Factor out macros to do channel packet length conversion.

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

307455 17-Oct-2016 sephe

MFC 302875,302876,302878-302881

302875
hyperv/vmbus: Redefine channel packet.

The channel packet header will be shared w/ PRP (physical region page)
list channel packet and SG (scatter gather) list channel packet.

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

302876
hyperv/vmbus: Rework sglist sending.

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

302878
hyeprv/vmbus: Rework prplist sending.

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

302879
hyperv/vmbus: Move channel packet flags definition to vmbus.h

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

302880
hyperv/vmbus: Move channel packet types definition to vmbus.h

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

302881
hyperv/vmbus: Cleanup channel sending

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

307454 17-Oct-2016 sephe

MFC 302873,302874

302873
hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.

Mainly for compatibility. While I'm here, rename cpuid related
fields in hv_vmbus_channel.

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

302874
hyperv/vmbus: Field rename

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

307453 17-Oct-2016 sephe

MFC 302871,302872

302871
hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr

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

302872
hyperv/vmbus: Busdma-fy channel bufring.

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

307452 17-Oct-2016 sephe

MFC 302867-302870

302867
hyperv/vmbus: Remove unused struct

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

302868
hyperv/vmbus: Function rename

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

302869
hyperv/vmbus: Remove unused function definition/declaration.

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

302870
hyperv/vmbus: Use iovec for bufring scatter/gather list.

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

307451 17-Oct-2016 sephe

MFC 302864

hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c

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

307450 17-Oct-2016 sephe

MFC 302816-302818

302816
hyperv/vmbus: Release vmbus channel lock before detach devices

Device detach method may sleep.

While I'm here, rename the function, fix indentation and function
comment.

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

302817
hyperv/vmbus: Field renaming to reflect reality

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

302818
hyperv/vmbus: Fix the racy channel close.

It is not safe to iterate the sub-channel list w/o lock on the
close path, while it's even more difficult to hold the lock
and iterate the sub-channel list. We leverage the
vmbua_{get,rel}_subchan() functions to solve this dilemma.

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

307449 17-Oct-2016 sephe

MFC 302808-302815

302808
hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free.

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

302809
hyperv/vmbus: Move device register and channel free to the caller.

This paves the way for more cleanup/disentangle.

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

302810
hyperv/vmbus: Move new channel scan notification to device register

And nuke now unnecessary function indirection.

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

302811
hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer

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

302812
hyperv/vmbus: Nuke the channel open state.

Channel is either opened or not-opened.

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

302813
hyperv/vmbus: Cleanup vmbus_chan_add()

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

302814
hyperv/vmbus: Use sub-channel index to detect primary channel

In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of
channel setup.

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

302815
hyperv/vmbus: Only add primary channels to vmbus channel list

- Make the vmbus_chan_add more straightforward.
- Partially fix the hv_vmbus_release_unattached_channels().

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

307448 17-Oct-2016 sephe

MFC 302733,302737,302801-302806

302733
hyperv/vmbus: Remove unused code

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

302737
hyperv/vmbus: Cleanup channel rescind

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

302801
hyperv/vmbus: Remove unused bits

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

302802
hyperv: hv_guid -> struct hyperv_guid.

This paves way for the further cleanup/disentangle.

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

302803
hyperv/vmbus: Move channel offer message definition to vmbus_reg.h

- Avoid bit fields.
- Avoid unnecessary indirection.

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

302804
hyperv/vmbus: Switch to vmbus channel message macros

Prepare for more cleanup.

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

302805
hyperv/vmbus: Remove unused bits

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

302806
hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.

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

307310 14-Oct-2016 sephe

MFC 302723,302726,302731

302723
hyperv: All Hypercall parameters have same alignment requirement.

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

302726
hyperv: Signal event input parameter is shared w/ MNF

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

302731
hyperv/vmbus: Reorganize MNF event sending.

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

307309 14-Oct-2016 sephe

MFC 302710,302713

302710
hyperv/vmbus: Remove unnecessary callback check.

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

302713
hyperv/vmbus: Install different task function for batch/non-batch channels

This avoids bunch of unnecessary checks on hot path and simplifies the
channel processing.

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

307308 14-Oct-2016 sephe

MFC 302707-302709

302707
hyperv/vmbus: Nuke unused field from hv_vmbus_channel.

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

302708
hyperv/bufring: Remove unused fields

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

302709
hyperv/vmbus: Pack bool field into flags field

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

307307 14-Oct-2016 sephe

MFC 302698-302704,302706

302698
hyperv/vmbus: Add vmbus method for GUID base device probing.

Reduce the exposure of hv_device.

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

302699
hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar

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

302700
hyperv/vmbus: Add channel ivar accessor.

This makes life easier during the transition period to nuke the hv_device.

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

302701
hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

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

302702
hyperv/util: Avoid the hv_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

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

302703
hyperv/vmbus: Deprecate the usage of hv_device.

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

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

302704
hyperv/hn: Avoid the hv_device

This paves way to nuke the hv_device, which is actually an unncessary
indirection.

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

302706
hyperv: Get rid of hv_device, which is unnecessary indirection.

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

307306 14-Oct-2016 sephe

MFC 302693-302697

302693
hyperv/vmbus: Make channel id a field of hv_vmbus_channel.

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

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

302694
hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

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

302695
hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

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

302696
hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel

This prepares to remove the unnecessary offer message embedding in
hv_vmbus_channel.

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

302697
hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel

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

307305 14-Oct-2016 sephe

MFC 302692

hyperv/vmbus: Merge hv_connection.c into hv_channel.c

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

307304 14-Oct-2016 sephe

MFC 302636-302638

302636
hyperv/vmbus: Move channel map to vmbus_softc

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

302637
hyperv/vmbus: Remove needed bits

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

302638
hyperv/vmbus: Destroy channel list lock upon attach failure and detach.

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

307303 14-Oct-2016 sephe

MFC 302632-302634

302632
hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer}

Reviewed by: Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6976

302633
hyperv/vmbus: Free sysctl properly upon channel close.

Prepare for sub-channel re-open.

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

302634
hyperv/vmbus: Fix sub-channel re-open support.

For multi-channel devices, once the primary channel is closed,
a set of 'rescind' messages for sub-channels will be delivered
by Hypervisor. Sub-channel MUST be freed according to these
'rescind' messages; directly re-openning sub-channels in the
same fashion as the primary channel's re-opening does NOT work
at all.

After the primary channel is re-opened, requested # of sub-
channels will be delivered though 'channel offer' messages, and
this set of newly offered channels can be opened along side with
the primary channel.

This unbreaks the MTU setting for hn(4), which requires re-
openning all existsing channels upon MTU change.

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

307302 14-Oct-2016 sephe

MFC 302617-302621,302623,302629-302631

302617
hyperv/vmbus: Flatten channel message response processing.

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

302618
hyperv/vmbus: Avoid tx_evtflags setting code duplication.

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

302619
hyperv/vmbus: Busdma-fy Hypercall signal event input parameter.

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

302620
hyperv: Nuke unused stuffs

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

302621
hyperv/vmbus: Don't be oversmart in default cpu selection.

Pin the channel to cpu0 by default. Drivers having special channel-cpu
mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves.

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

302623
hyperv/vmbus: Minor renaming

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

302629
hyperv/vmbus: Rework vmbus version accessing.

Instead of global variable, vmbus version is accessed through
a vmbus DEVMETHOD now.

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

302630
hyperv/vmbus: Move GPADL index into vmbus_softc

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

302631
hyperv/vmbus: Move channel list to vmbus_softc

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

307301 14-Oct-2016 sephe

MFC 302607-302612

302607
hyperv/vmbus: Use post message Hypercall APIs for channel open

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

302608
hyperv/vmbus: Remove unnecessary check and unapplied comment

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

302609
hyperv/vmbus: Use post message Hypercall APIs for GPADL connect.

This also fixes memory leakge if sub-connect messages are needed.

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

302610
hyperv/vmbus: Use post message Hypercall APIs for channel close

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

302611
hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect

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

302612
hyperv: Nuke unused stuffs

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

307291 14-Oct-2016 sephe

MFC 302543-302545,302547,302549,302554,302556,302557,302559,302606

302543
hyperv/vmbus: Use post message Hypercall APIs for channel request

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

302544
hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf()

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

302545
hyperv/vmbus: Function renaming.

And pass vmbus_softc to vmbus_doattach()

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

302547
hyperv/vmbus: Explicitly assign channel message process array.

While I'm here, remove the useless message type from message process
array, which is not used and serves no purposes at all.

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

302549
hyperv/vmbus: Add sysctl to expose vmbus version.

Requested by: Hongxiong Xian <v-hoxian microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6860

302554
hyperv/vmbus: Use post message Hypercall APIs for unload

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

302556
hyperv/vmbus: Create channel synchronously.

The device probe/attach has been move to a different thread, so the
reasons to create the channel asynchronously are no longer valid.

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

302557
hyperv/vmbus: Save vmbus softc to channels.

So that we don't need to access the global vmbus softc.

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

302559
hyperv/vmbus: Embed channel detach task in channel itself.

GC work queue stuffs.

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

302606
hyperv/vmbus: Reorganize vmbus scan process.

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

307278 14-Oct-2016 sephe

MFC 302540

hyperv/vmbus: Implement a new set of APIs for post message Hypercall

And use this new APIs for Initial Contact post message Hypercall.
More post message Hypercalls will be converted.

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

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


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
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