History log of /freebsd-current/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 6f7b1310 07-Sep-2022 Wei Hu <whu@FreeBSD.org>

Hyper-V: storvsc: relax a couple more kasserts

Seems these kasserts don't work well on ARM64

Fixes: 0af5a0cd2788e
Sponsored by: Microsoft


# 0af5a0cd 07-Sep-2022 Wei Hu <whu@FreeBSD.org>

Hyper-V: storvsc: relax a kassert check

On ARM64 this kassert check could cause unnecessary panic.

Sponsored by: Microsoft


# 795a9974 15-Aug-2022 Wei Hu <whu@FreeBSD.org>

Hyper-V: storvsc: Call bus_dmamap_sync() for dma operations

Call bus_dmamap_sync() for related dma operations. This is required
on ARM64 architecture.

Tested by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
MFC after: 2 weeks
Sponsored by: Microsoft


# 35eb9b10 02-Jun-2022 Mitchell Horne <mhorne@FreeBSD.org>

Use KERNEL_PANICKED() in more places

This is slightly more optimized than checking panicstr directly. For
most of these instances performance doesn't matter, but let's make
KERNEL_PANICKED() the common idiom.

Reviewed by: mjg
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35373


# c1cef544 06-May-2022 John Baldwin <jhb@FreeBSD.org>

hyperv: Remove unused devclass arguments to DRIVER_MODULE.


# b024faff 06-Apr-2022 John Baldwin <jhb@FreeBSD.org>

hyperv storvsc: Remove unused variables.


# 53e938e4 31-Jan-2022 John Baldwin <jhb@FreeBSD.org>

hyperv storvsc: Don't abuse struct sglist to hold virtual addresses.

struct sglist is intended for holding S/G lists of physical address
ranges, not virtual address ranges. GCC 9.x issues several warnings
due to casts between pointers and integers of different sizes as a
result (vm_paddr_t is 64-bits on i386). Instead, add a local 'struct
hv_sglist' which uses an array of 'struct iovec' to hold the S/G list
of virtual address ranges.

Differential Revision: https://reviews.freebsd.org/D31933


# db0ac6de 02-Dec-2021 Cy Schubert <cy@FreeBSD.org>

Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"

This reverts commit 266f97b5e9a7958e365e78288616a459b40d924a, reversing
changes made to a10253cffea84c0c980a36ba6776b00ed96c3e3b.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.


# 8f82dc8d 30-Apr-2021 Don Morris <dgmorris@earthlink.net>

hyperv: Flag hn and storvsc statistics with CTLFLAG_STATS.

Reviewed by: vangyzen, whu, bdrewery
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D30060


# 8afecefd 07-May-2021 Andriy Gapon <avg@FreeBSD.org>

storvsc: fix auto-sense reporting

I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb
even though SRB_STATUS_AUTOSENSE_VALID was not set in the status.
The actual sense data remained all zeros.
The problem seems to be that create_storvsc_request() always sets
hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0
is not enough to determine if any auto-sense data is actually available.

Reviewed by: whu, imp
MFC after: 2 weeks
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D30124


# 2a0ce39d 31-Aug-2020 Wei Hu <whu@FreeBSD.org>

Hyper-V: storvsc: Enhance srb_status code handling.

In hv_storvsc_io_request() when coring, prevent changing of the send channel
from the base channel to another one. storvsc_poll always probes on the base
channel.

Based upon conversations with Microsoft, changed the handling of srb_status
codes. Most we should never get, others yes. All are treated as retry-able
except for two. We should not get these statuses, but if we ever do, the I/O
state is not known.

Submitted by: Alexander Sideropoulos <Alexander.Sideropoulos@netapp.com>
Reviewed by: trasz, allanjude, whu
MFC after: 1 week
Sponsored by: Netapp Inc
Differential Revision: https://reviews.freebsd.org/D25756


# efdba95d 14-Jan-2020 Andriy Gapon <avg@FreeBSD.org>

storvsc: port a Linux patch, properly set residual data length on errors

This change is based on Linux commit 40630f462824ee. csio.resid should
account for transfer_len only for success and SRB_STATUS_DATA_OVERRUN
condition.

I am not sure how exactly this change works, but I have a report from a
user that they see lots of checksum errors when running a pool scrub
concurrently with iozone -l 1 -s 100G. After applying this patch the
problem cannot be reproduced.

Reviewed by: nobody
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D22312


# 97d8f008 19-Nov-2019 Andriy Gapon <avg@FreeBSD.org>

hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb

A SIM-private field is used for that.
The pointer can be useful when examining a state of a queued ccb.
E.g., a ccb on a da_softc.pending_ccbs.

MFC after: 2 weeks


# 0d880ef4 10-Apr-2018 Dexuan Cui <dexuan@FreeBSD.org>

hyperv/storvsc: storvsc_io_done(): do not use CAM_SEL_TIMEOUT

CAM_SEL_TIMEOUT was introduced in
https://reviews.freebsd.org/D7521 (r304251), which claimed:

"VM shall response to CAM layer with CAM_SEL_TIMEOUT to filter those
invalid LUNs. Never use CAM_DEV_NOT_THERE which will block LUN scan
for LUN number higher than 7."

But it turns out this is not correct:

I think what really filters the invalid LUNs in r304251 is that:
before r304251, we could set the CAM_REQ_CMP without checking
vm_srb->srb_status at all:
ccb->ccb_h.status |= CAM_REQ_CMP.

r304251 checks vm_srb->srb_status and sets ccb->ccb_h.status properly,
so the invalid LUNs are filtered.

I changed my code version to r304251 but replaced the CAM_SEL_TIMEOUT
with CAM_DEV_NOT_THERE, and I confirmed the invalid LUNs can also be
filtered, and I successfully hot-added and hot-removed 8 disks to/from
the VM without any issue.

CAM_SEL_TIMEOUT has an unwanted side effect -- see cam_periph_error():
For a selection timeout, we consider all of the LUNs on
the target to be gone. If the status is CAM_DEV_NOT_THERE,
then we only get rid of the device(s) specified by the
path in the original CCB.

This means: for a VM with a valid LUN on 3:0:0:0, when the VM inquires
3:0:0:1 and the host reports 3:0:0:1 doesn't exist and storvsc returns
CAM_SEL_TIMEOUT to the CAM layer, CAM will detech 3:0:0:0 as well: this
is the bug I reported recently:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226583

PR: 226583
Reviewed by: mav
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D14690


# 762a7f4f 06-Dec-2017 Warner Losh <imp@FreeBSD.org>

Define xpt_path_inq.

This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
calling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13387


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 93b4e111 14-Aug-2017 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv: Update copyright for the files changed in 2017

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11982


# 6478f318 20-Jul-2017 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Force SPC3 for CDROM attached.

This unbreaks the CDROM attaching on GEN2 VMs. On GEN1 VMs, CDROM is
attached to emulated ATA controller.

PR: 220790
Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11634


# eb36b1d0 30-Jun-2017 Jason A. Harmening <jah@FreeBSD.org>

Clean up MD pollution of bus_dma.h:

--Remove special-case handling of sparc64 bus_dmamap* functions.
Replace with a more generic mechanism that allows MD busdma
implementations to generate inline mapping functions by
defining WANT_INLINE_DMAMAP in <machine/bus_dma.h>. This
is currently useful for sparc64, x86, and arm64, which all
implement non-load dmamap operations as simple wrappers
around map objects which may be bus- or device-specific.

--Remove NULL-checked bus_dmamap macros. Implement the
equivalent NULL checks in the inlined x86 implementation.
For non-x86 platforms, these checks are a minor pessimization
as those platforms do not currently allow NULL maps. NULL
maps were originally allowed on arm64, which appears to have
been the motivation behind adding arm[64]-specific barriers
to bus_dma.h, but that support was removed in r299463.

--Simplify the internal interface used by the bus_dmamap_load*
variants and move it to bus_dma_internal.h

--Fix some drivers that directly include sys/bus_dma.h
despite the recommendations of bus_dma(9)

Reviewed by: kib (previous revision), marius
Differential Revision: https://reviews.freebsd.org/D10729


# cdb5402c 21-Jun-2017 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

PR: 219973
Submitted by: Hongjiang Zhang <hongzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11271


# e25942b0 13-Apr-2017 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Use ULL for 64bits value shift.

Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft


# 498ef762 05-Apr-2017 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Fixup SRB status.

This unbreaks GEN2 Hyper-V cd support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: dexuan@
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10212


# 4195c7de 04-Jan-2017 Alan Somers <asomers@FreeBSD.org>

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
Reviewed by: imp, sephe, slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9037
Differential Revision: https://reviews.freebsd.org/D9038


# 39f01823 20-Dec-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

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


# 4b167c2b 08-Dec-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

Reported by: rpokala
MFC after: 1 week
Sponsored by: Microsoft


# 692cb24f 08-Dec-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8724


# 14c85e52 30-Nov-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Don't use timedwait.

The timeout is unnecessary.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8656


# e52a79e5 13-Oct-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Fix off-by-one bug; this brings back TRIM support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reported by: Lili Deng <v-lide microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8238


# cdf2c7a5 28-Sep-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Fix the blkvsc disk attachment issues.

- The original 'disengage' ATA controller model does not work properly
for all possible disk configurations. Use the newly added ATA disk
veto eventhandler to fit into all possible disk configuration.
- If the 'invalid LUN' happens on blkvsc controllers, return
CAM_DEV_NOT_THERE so that CAM will not destroy attached disks under
the blkvsc controllers.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Discussed with: mav
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7693


# fa8c9813 20-Sep-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Fix SRB length setting.

This fixes disk discovery issue on WS2008R2 Hyper-V, which plagued
us since 10.2-release.

Reported by: many
MFC after: 3 days
Sponsored by: Microsoft


# 9db7c2c6 24-Aug-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7622


# 86afc9b6 16-Aug-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.

SRB status is set to 0x20 by the hypervisor, if the specified LUN is
unaccessible, and even worse the INQUIRY response will not be set by
the hypervisor at all under this situation. Additionally, SRB status
is 0x20 too, for TUR on an unaccessible LUN.

Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
Scott Long, other values seems improper.

This commit fixes the Hyper-V disk hotplug support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7521


# 8d17f170 03-Aug-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP support

The Hyper-V on pre-win10 systems will only report SPC-2 conformance,
but it actually conforms to SPC-3. The INQUIRY response is adjusted
to propagate the SPC-3 version information to CAM.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7405


# 05f7a8a6 31-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Stringent PRP list assertions

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


# 88cb8d78 31-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Set maxio to 128KB.

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


# 9d6016a7 31-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

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


# cf6890fb 29-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.

The UNMAPPED I/O greatly improves userland direct disk I/O performance
by 35% ~ 135%.

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


# 7d8ee480 28-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Inclusion cleanup

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


# 82b8a879 21-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv: hv_vmbus_channel -> vmbus_channel

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


# 62549472 20-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Hide channel struct definition.

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


# ca871fb7 19-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

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


# 9129ad2d 19-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Channel struct field rename

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


# e93854c4 18-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Function rename

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


# 742fb4f6 18-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Cleanup cpu based channel selection.

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

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


# d0856980 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Function rename

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


# a91e5fd5 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Back out r302888 temporarily

Committed by accident w/ duplicated commit log

MFC after: 1 week
Sponsored by: Microsoft OSTC


# 047affd1 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

Nuke unused channel GPADL API.

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


# 7c557248 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Cleanup channel receiving.

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


# 12140675 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Function rename

And reorder the error prone parameters list.

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


# 03055a2c 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

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


# 1680fb30 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

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


# 66e132bd 15-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyeprv/vmbus: Rework prplist sending.

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


# 71ac1309 13-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv: hv_guid -> struct hyperv_guid.

This paves way for the further cleanup/disentangle.

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


# d2c2a2ef 12-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

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


# 884d26c8 12-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

Reduce the exposure of hv_device.

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


# 38d19df6 12-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/vmbus: Rework vmbus version accessing.

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

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


# 9e6efea6 11-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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.

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


# 7a49521a 11-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Save the response status and xfer length properly.

The current command response handling discards status and xfer
length unconditionally, so that all of the commands would be
considered successful, even if errors happened. When errors
really happens, this causes all kinds of wiredness, since the
buffer will not be filled on the host side and sense data will
be ignored.

Most of the time, errors do not happen, however, error does
happen for the request sent immediately after the disk resizing.
Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
data (capacity changes) prevents the disk resizing from working
properly.

This commit saves the response status and xfer length properly
for later use.

Submitted by: Dexuan Cui <decui microsoft com>
Noticed by: sephe
MFC after: 3 days
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D7181


# 2d774f20 10-Jul-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Fix the INQUIRY checks

Don't check the area that the host has not filled.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443
PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425
Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: sephe, Dexuan Cui <decui microsoft com>
MFC after: 3 days
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6955


# cef367e6 16-May-2016 Eitan Adler <eadler@FreeBSD.org>

Don't repeat the the word 'the'

(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)


# 008c25eb 11-May-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Enable INQUIRY result check only on WIN10 like host systems

On WIN8 like host systems, when rescan happens, the already installed
disks seem to return random invalid results for INQUIRY.

More investigation is under way to figure out why random invalid INQUIRY
results are delivered to VM on WIN8 like host systems.

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


# f494006f 26-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Set description properly in probe devmethod

MFC after: 1 week
Sponsored by: Microsoft OSTC


# 99b476b1 25-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Avoid sub-channel creation callback.

Since the sub-channel offers are synchronized, we can do our own
channel setup without using the sub-channel creation callback.

This paves the way to whack the sub-channel creation callback.

MFC after: 1 week
Sponsored by: Microsoft OSTC


# 232ab086 25-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Synchronize sub-channel offers

MFC after: 1 week
Sponsored by: Microsoft OSTC


# f4ffb60d 25-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Remove the useless hs_open_multi_channel

This fixes the sub-channel offer race after Hyper-V device probe/attach
is moved to vmbus SYSINIT/attach.

MFC after: 1 week
Sponsored by: Microsoft OSTC


# 7cd9b96b 21-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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

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


# 5f9b92f8 15-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv: No need to zero out softc

MFC after: 1 week
Sponsored by: Microsoft OSTC


# a014f7e1 15-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Use xpt_done_direct() upon I/O completion

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


# 97c4992c 15-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Temporary disable the wrongly done command timeout.

It will be reenabled once the request processing is corrected.

MFC after: 1 week
Sponsored by: Microsoft OSTC


# 7e98851e 13-Apr-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv: device_get_softc does not return NULL

MFC after: 1 week
Sponsored by: Microsoft OSTC


# b96a7ad1 26-Feb-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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


# a14df6ad 26-Feb-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

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


# 1b3ce7e3 23-Feb-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Fix print format

Detected by: PVS Static Analysis
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5388


# f70c7ffe 04-Feb-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Fix the NULL pointer dereference

Reported by: Netapp
Submitted by: Hongjiang Zhang <honzhan 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/D5097


# 1b44593c 22-Jan-2016 Sepherosa Ziehau <sephe@FreeBSD.org>

hyperv/stor: Verify returned inquiry data before further dispatching

Windows 10 and Window 2016 will return all zero inquiry data for
non-existing slots. If we dispatched them, then a lot of useless
(0 sized) disks would be created. So we verify the returned inquiry
data (valid type, non-empty vendor/product/revision etc.), before
further dispatching.

Minor white space cleanup and wording fix.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: adrian, sephe, Jun Su <junsu microsoft com>
Approved by: adrian (mentor)
Modified by: sephe
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D4928


# fd90e2ed 22-May-2015 Jung-uk Kim <jkim@FreeBSD.org>

CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head. However, it is continuously misused as the mpsafe argument
for callout_init(9). Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision: https://reviews.freebsd.org/D2613
Reviewed by: jhb
MFC after: 2 weeks


# 17b87604 18-May-2015 Wei Hu <whu@FreeBSD.org>

Add support for SCSI disk hot add and remove. Also add padding according to
the requirement of different hypervisor releases.

Submitted by: whu
Reviewed by: royger
Approved by: royger
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D2512


# da2f98a1 29-Apr-2015 Wei Hu <whu@FreeBSD.org>

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


# 85c9dd9d 21-Nov-2014 Steven Hartland <smh@FreeBSD.org>

Prevent overflow issues in timeout processing

Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision: https://reviews.freebsd.org/D1157
Reviewed by: mav, davide
MFC after: 1 month
Sponsored by: Multiplay


# 20e27add 24-Oct-2014 Xin LI <delphij@FreeBSD.org>

Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree
driver. This change was verified by Microsoft.


# c379cfaf 21-Oct-2014 Glen Barber <gjb@FreeBSD.org>

Fix an issue where a FreeBSD virtual machine provisioned in
the Microsoft Azure service does not recognize the second
attached disk on the system.

Submitted by: kyliel@Microsoft
Patched by: weh@Microsoft
PR: 194376
MFC after: 3 days
X-MFC-10.1: yes, ASAP
Sponsored by: The FreeBSD Foundation


# 3e5a6bd1 05-Apr-2014 Warner Losh <imp@FreeBSD.org>

Make some unwise casts. On i386 these casts wind up being safe. Rather
than disturb the API, go with these casts to shut gcc up.


# c70d3b7a 05-Mar-2014 Alexander Motin <mav@FreeBSD.org>

Minor fix to r262789.

MFC after: 6 days


# 54332e06 05-Mar-2014 Alexander Motin <mav@FreeBSD.org>

Remove custom bus scanner code and fix use of CAM's default scanner.

This fixes kernel panic during boot, caused by incompatibility of recent
CAM locking changes and this bus scanner code.

Submitted by: Microsoft
MFC after: 1 week


# 785e09b0 10-Oct-2013 Dimitry Andric <dim@FreeBSD.org>

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


# cc759c19 17-Jul-2013 Peter Grehan <grehan@FreeBSD.org>

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.


# f17922b0 27-Jun-2013 Peter Grehan <grehan@FreeBSD.org>

Import Microsoft HyperV driver update
From https://github.com/FreeBSDonHyper-V/VendorBranchForFreeBSDonHyper-V
rev: 3c707c73520adbd6d1f4ff009826dbbfb0c2dc4d


# e5548b5c 02-May-2013 Peter Grehan <grehan@FreeBSD.org>

Initial import of the Microsoft HyperV 'enlightened' drivers.

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