aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
Commit message (Collapse)AuthorAgeFilesLines
* MFC 320184Sepherosa Ziehau2017-06-261-10/+21
| | | | | | | | | | | | | | | | | | | hyperv/storvsc: Reduce log verbosity On some windows hosts TEST_UNIT_READY command will return SRB_STATUS_ERROR and sense data "NOT READY asc:3a,1 (Medium not present - tray closed)", this occurs periodically, and not hurt anything else. So, we prefer to ignore this kind of errors. Approved by: re (delphij) PR: 219973 Submitted by: Hongjiang Zhang <hongzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11271 Notes: svn path=/stable/11/; revision=320351
* MFC: 319690Dexuan Cui2017-06-141-0/+2
| | | | | | | | | | | | | | | | | | | Approved by: re (marius) r319690 hyperv/pcib: use the device serial number as PCI domain Currently the PCI domain is initialized with the instance GUID in vmbus_pcib_attach(). It turns out the GUID can change across VM reboot, while some users want a persistent value for PCI domain. The solution is that we can change to use the device serial number, which starts with 1 and is unique within a VM. Obtained from: Haiyang Zhang Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=319943
* MFC 318136Sepherosa Ziehau2017-05-172-42/+158
| | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=318392
* MFC 317821Sepherosa Ziehau2017-05-051-1/+1
| | | | | | | | | hyperv/kbd: Channel read expects non-NULL channel argument. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317822
* hyperv/hn: Enable sorted LRO (direct commit).Sepherosa Ziehau2017-05-021-1/+1
| | | | | | | | | | | This is a direct commit. Sorted LRO is much better than plain (linked list LRO), which hash LRO is not available on this branch. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317664
* MFC 317353Sepherosa Ziehau2017-04-271-11/+91
| | | | | | | | | | | | | | | | | | hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK. Hyper-V hot channel effect: Operation latency on hot channel is only _half_ of the operation latency on cold channels. This commit takes the advantage of the above Hyper-V host channel effect, and can reduce more than 75% latency and more than 50% latency stdev, i.e. lower and more stable/predictable latency, for various types of web server workloads. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317481
* MFC 316813,316815Sepherosa Ziehau2017-04-192-2/+2
| | | | | | | | | | | | | | | | | 316813 hyperv/storvsc: Use ULL for 64bits value shift. Reported by: PVS Sponsored by: Microsoft 316815 hyperv/kvp: Remove always false condition. Reported by: PVS Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317121
* MFC 316515,316812Sepherosa Ziehau2017-04-193-0/+1199
| | | | | | | | | | | | | | | | | | | | 316515 hyperv/kbd: Add support for synthetic keyboard. Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V. Submitted by: Hongjiang Zhang <honzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10196 316812 hyperv/kbd: Remove unnecessary assignment. Reported by: PVS Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317119
* MFC 317107Sepherosa Ziehau2017-04-191-12/+19
| | | | | | | | | | hyperv: Use kmem_malloc for hypercall memory due to NX bit change. Reported by: dexuan@ Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=317108
* MFC 316520Sepherosa Ziehau2017-04-103-31/+103
| | | | | | | | | | | | | | | | | | hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init. Under certain conditions on certain versions of Hyper-V, the RNDIS rxfilter is _not_ zero on the hypervisor side after the successful RNDIS initialization, which breaks the assumption of any following code (well, it breaks the RNDIS API contract actually). Clear the RNDIS rxfilter explicitly, drain packets sneaking through, and drain the interrupt taskqueues scheduled due to the stealth packets. Reported by: dexuan@ Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10230 Notes: svn path=/stable/11/; revision=316674
* MFC 316519Sepherosa Ziehau2017-04-102-8/+8
| | | | | | | | | | | | | | hyperv/storvsc: Fixup SRB status. This unbreaks GEN2 Hyper-V cd support. Submitted by: Hongjiang Zhang <honzhan microsoft com> Reviewed by: dexuan@ Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10212 Notes: svn path=/stable/11/; revision=316673
* MFC r311305 (by asomers):Alexander Motin2017-03-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are fixed-length strings. AFAICT the only place they're read is in sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. However, the kernel doesn't null-terminate them. A bunch of copy-pasted code uses strncpy to write them, and doesn't guarantee null-termination. For at least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually overflows. You can see the result by doing "camcontrol negotiate da0 -v". This change null-terminates those fields everywhere they're set in the kernel. It also shortens a few strings to ensure they'll fit within the 16-character field. PR: 215474 Reported by: Coverity CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 CID: 1010035 1010036 1010042 1010041 1010040 1010039 Notes: svn path=/stable/11/; revision=315812
* MFC: 314382-314485Sepherosa Ziehau2017-03-173-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 314382 hyperv/hn: Simplify RNDIS packet data offset calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9699 314483 hyperv/hn: Simplify RNDIS packet total length calculation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9712 314484 hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9713 314485 hyperv/hn: Misaligned chimney sending buffers should not be used Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9714 Notes: svn path=/stable/11/; revision=315436
* MFC 312689, 312690Dexuan Cui2017-02-221-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312689 hyperv/hn: add a sysctl name for the VF interface This makes it easier for the userland script to find the releated VF interface. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9101 r312690 hyperv/hn: add devctl_notify for VF_UP/DOWN events Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9102 Notes: svn path=/stable/11/; revision=314092
* MFC 312688Dexuan Cui2017-02-225-9/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312688 hyperv/hn: add the support for VF drivers (SR-IOV) Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together (both NICs have the same MAC address), mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). Note: multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface (if the VF is UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP). Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8964 Notes: svn path=/stable/11/; revision=314091
* MFC: 312686Dexuan Cui2017-02-221-9/+1
| | | | | | | | | | | | | | | | | | | | | | | Approved by: sephe (mentor) r312686 hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt() It's unnecessary because the upper nework stack does the same checking. In the case of Hyper-V SR-IOV, we need to remove the checking because 1) multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface; 2) we must inject the packets even if the synthetic NIC is down, or has a different MTU from the VF device. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8962 Notes: svn path=/stable/11/; revision=314084
* MFC: 312685Dexuan Cui2017-02-222-0/+3
| | | | | | | | | | | | | | | | | Approved by: sephe(mentor) r312685 hyperv/hn: remember the channel pointer in struct hn_rx_ring This will be used by the coming NIC SR-IOV patch. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8909 Notes: svn path=/stable/11/; revision=314083
* MFC 311743Sepherosa Ziehau2017-02-215-17/+50
| | | | | | | | | | hyperv: Add method to read 64bit Hyper-V specific time value. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9057 Notes: svn path=/stable/11/; revision=314003
* MFC 310652,310657,310658Sepherosa Ziehau2017-01-051-26/+34
| | | | | | | | | | | | | | | | | | | | | | | 310652 hyperv/hn: Consolidate hn_{suspend,resume} Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8907 310657 hyperv/hn: Function renaming; no functional changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8908 310658 hyperv/hn: Factor out function to set rxfilter. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8928 Notes: svn path=/stable/11/; revision=311391
* MFC 310651Sepherosa Ziehau2017-01-053-14/+12
| | | | | | | | | | hyperv/vmbus: Nuke unnecessary critical sections. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8906 Notes: svn path=/stable/11/; revision=311389
* MFC 310462,310465Sepherosa Ziehau2017-01-052-10/+35
| | | | | | | | | | | | | | | | | | 310462 hyperv/ic: Fix version4 timesync message format. It is not compat w/ the old timesync message format, which the message type stays the same as the old timesync message. Sponsored by: Microsoft 310465 hyperv/ic: Allow applying the samples from hypervisor unconditionally. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=311388
* MFC 310347Sepherosa Ziehau2017-01-051-15/+26
| | | | | | | | | | | | | | hyperv/storvsc: The max channel in PDU actually means the max sub-chans. Use proper name for local variables. PDU fields' name was not changed yet. While I'm here, make # of usable channels tunable. This eases further testing. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8851 Notes: svn path=/stable/11/; revision=311387
* MFC 310324Sepherosa Ziehau2017-01-053-0/+0
| | | | | | | | | | hyperv/ic: Rename cleaned up files. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8850 Notes: svn path=/stable/11/; revision=311386
* MFC 310318Sepherosa Ziehau2017-01-053-66/+78
| | | | | | | | | | hyperv/ic: Cleanup driver glue. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8849 Notes: svn path=/stable/11/; revision=311385
* MFC 310317Sepherosa Ziehau2017-01-051-0/+0
| | | | | | | | | | hyperv/ic: Rname cleaned up file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8848 Notes: svn path=/stable/11/; revision=311383
* MFC 310315Sepherosa Ziehau2017-01-054-15/+2
| | | | | | | | | | hyperv/ic: Inclusion cleanup Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8847 Notes: svn path=/stable/11/; revision=311380
* MFC 310312-310314Sepherosa Ziehau2017-01-057-73/+89
| | | | | | | | | | | | | | | | | | | | | | | 310312 hyperv/ic: Factor out function to send IC response Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8844 310313 hyperv/ic: Cleanup common struct and functions. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8845 310314 hyperv/ic: Rename cleaned up header file. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8846 Notes: svn path=/stable/11/; revision=311379
* MFC 310048,310101,310239Sepherosa Ziehau2017-01-053-5/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311376
* MFC 309874,309875Sepherosa Ziehau2017-01-055-0/+301
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311375
* MFC 309726,309728Sepherosa Ziehau2017-01-051-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | 309726 hyperv/storvsc: Fix the SCSI disk attachment issue. On pre-WS2016 Hyper-V, if the only LUNs > 7 are used, then all disks fails to attach. Mainly because those versions of Hyper-V do not set SRB_STATUS properly and deliver junky INQUERY responses. Submitted by: Hongjiang Zhang <honzhan microsoft com> Reported by: Hongxiong Xian <v-hoxian microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8724 309728 hyperv/storvsc: Minor style changes; no functional changes. Reported by: rpokala Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=311374
* MFC 309705Sepherosa Ziehau2017-01-056-29/+38
| | | | | | | | | | hyperv/timesync: Support "sent TC" to improve accuracy. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8723 Notes: svn path=/stable/11/; revision=311373
* MFC 309704Sepherosa Ziehau2017-01-051-2/+1
| | | | | | | | | | hyperv/vmbus: Utilize vmbus_chan_run_task() Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8686 Notes: svn path=/stable/11/; revision=311372
* MFC 309346,309348,309353Sepherosa Ziehau2017-01-051-14/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | 309346 hyperv/hn: Add HN_DEBUG kernel option. If bufring is used for per-TX ring descs, don't update "available" counter, which is only used to help debugging. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8674 309348 hyperv/hn: Don't hold txdesc, if no BPFs are attached. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8675 309353 hyperv/hn: Add 'options RSS' support. Reviewed by: adrian Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8676 Notes: svn path=/stable/11/; revision=311371
* MFC 309320Sepherosa Ziehau2017-01-051-32/+6
| | | | | | | | | | | | | hyperv/storvsc: Don't use timedwait. The timeout is unnecessary. Reviewed by: jhb Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8656 Notes: svn path=/stable/11/; revision=311370
* MFC 309319Sepherosa Ziehau2017-01-051-2/+0
| | | | | | | | | | | | hypver/vmbus: Remove extra assertion. It is asserted by vmbus_chan_gpadl_connect() now. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8660 Notes: svn path=/stable/11/; revision=311369
* MFC 309310,309311,309316,309318Sepherosa Ziehau2017-01-054-49/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311368
* MFC 309240,309242,309244,309245,309670Sepherosa Ziehau2017-01-055-27/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311367
* MFC 309236,309237Sepherosa Ziehau2017-01-052-6/+10
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311366
* MFC 309226-309231,309235Sepherosa Ziehau2017-01-054-82/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 309226 hyperv/hn: Utilize vmbus_chan_xact_wait Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8612 309227 hyperv/hn: Fix detach error handling. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8613 309228 hyperv/hn: Fix multi-packet RNDIS message aggregation size setting. Just in case that no chimney sending buffer can be used. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8619 309229 hyperv/hn: Fix attach error handling Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8620 309230 hyperv/hn: Enable multi-packet RNDIS message support by default. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8621 309231 hyperv/hn: Fix vmbus_chan_subidx usage. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8629 309235 hyperv/hn: Simplify RSS indirect table fixup API Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8630 Notes: svn path=/stable/11/; revision=311365
* MFC 309128,309129,309131-309136,309138-309140,309224,309225Sepherosa Ziehau2017-01-052-28/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311364
* MFC 309085Sepherosa Ziehau2017-01-052-28/+118
| | | | | | | | | | | | | | | | | | hyperv/hn: Fix primary channel revocation Since hypervisor will not drain the TX bufring, once the channels are revoked: - Setup vmbus orphan handler properly. - Make sure that suspension will not wait the TX bufring draining forever. - GC the pending TX descs on detach path, before freeing the busdma stuffs. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8559 Notes: svn path=/stable/11/; revision=311362
* MFC 309030,309039,309080,309081,309083Sepherosa Ziehau2017-01-055-50/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=311359
* MFC 308908,308909Sepherosa Ziehau2017-01-052-15/+18
| | | | | | | | | | | | | | | | | | | | | | 308908 hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO. They are still disabled by default. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8490 308909 hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse. Just in case, the # of TX/RX rings is changed upon synthetic parts re-attach. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8520 Notes: svn path=/stable/11/; revision=311358
* MFC 308907Sepherosa Ziehau2017-01-054-25/+45
| | | | | | | | | | | | hyperv/hn: Fix WITNESS warnings And re-enable SIOCADDMULTI/SIOCDELMULTI, after WITNESS warning is fixed. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8489 Notes: svn path=/stable/11/; revision=311357
* MFC 308906Sepherosa Ziehau2017-01-052-3/+28
| | | | | | | | | | hyperv/vmbus: Support transction result busy-wait. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8488 Notes: svn path=/stable/11/; revision=311356
* MFC 308905Sepherosa Ziehau2017-01-053-60/+557
| | | | | | | | | | | | | | | | hyperv/hn: Implement RNDIS multi-packet message support. Currently, it is only applied to packet sent through chimney sending buffers. Not enabled by default yet. This one gives 20%~30% performance boost for non-TSO usage in both bit/packet rate tests and nginx performance test. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8560 Notes: svn path=/stable/11/; revision=311355
* MFC 308664,308742,308743Sepherosa Ziehau2017-01-052-0/+1117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 308664 hyperv/vss: Add driver and tools for VSS VSS stands for "Volume Shadow Copy Service". Unlike virtual machine snapshot, it only takes snapshot for the virtual disks, so both filesystem and applications have to aware of it, and cooperate the whole VSS process. This driver exposes two device files to the userland: /dev/hv_fsvss_dev Normally userland programs should _not_ mess with this device file. It is currently used by the hv_vss_daemon(8), which freezes and thaws the filesystem. NOTE: currently only UFS is supported, if the system mounts _any_ other filesystems, the hv_vss_daemon(8) will veto the VSS process. If hv_vss_daemon(8) was disabled, then this device file must be opened, and proper ioctls must be issued to keep the VSS working. /dev/hv_appvss_dev Userland application can opened this device file to receive the VSS freeze notification, hold the VSS for a while (mainly to flush application data to filesystem), release the VSS process, and receive the VSS thaw notification i.e. applications can run again. The VSS will still work, even if this device file is not opened. However, only filesystem consistency is promised, if this device file is not opened or is not operated properly. hv_vss_daemon(8) is started by devd(8) by default. It can be disabled by editting /etc/devd/hyperv.conf. Submitted by: Hongjiang Zhang <honzhan microsoft com> Reviewed by: kib, mckusick Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8224 308742 hyperv/vss: Nuke unused variables. Submitted by: markj Reported by: markj Sponsored by: Microsoft 308743 hyperv/vss: Install the userland daemon to /usr/sbin instead of / Submitted by: markj Reported by: markj Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=311353
* r310348Sepherosa Ziehau2016-12-262-2/+30
| | | | | | | | | | | hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook Properly working pause and friends are required. Sponsored by: Microsoft Notes: svn path=/stable/11/; revision=310573
* MFC: 308723-308725,308793-308795,309127Dexuan Cui2016-11-304-0/+2070
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/stable/11/; revision=309312
* MFC 308201Sepherosa Ziehau2016-11-143-38/+34
| | | | | | | | | | | | | | hyperv/kvp: Don't mix message status codes and function return values. While I'm here, move message status codes to hv_utilreg.h, since they will be used by the upcoming VSS stuffs. Submitted by: Hongjiang Zhang <honzhan microsoft com> Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8391 Notes: svn path=/stable/11/; revision=308635