aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv/storvsc
Commit message (Collapse)AuthorAgeFilesLines
* hyper-v: Fix a couple of typos in kernel messagesGordon Bergling2025-10-281-1/+1
| | | | | | | | - s/tranparent/transparent/ - s/Unknow/Unknown/ - s/qury/query/ MFC after: 1 week
* hyperv/storvsc: Avoid conditional asserts in storvsc_xferbuf_prepare()Mark Johnston2025-03-311-2/+0
| | | | | | | | | | | | | whu@ cannot reproduce the assertion failure which led to these ifdefs being added in the first place, and since they appear wrong, i.e., the assertions ought to apply to all platforms, let's remove them. This reverts commits 0af5a0cd2788efce9f444f4f781357d317bb0bb1 and 6f7b1310b6fe36f9bb653d3e97bc257adced3a2b. PR: 285681 Tested by: whu MFC after: 2 weeks
* hyperv/storvsc: Fix busdma constraintsMark Johnston2025-03-311-1/+6
| | | | | | | | | | | | | | - The BUS_DMA_KEEP_PG_OFFSET flag is needed, since storvsc_xferbuf_prepare() assumes that only the first segment may have a non-zero offset, and that all following segments are page-sized and -aligned. - storvsc_xferbuf_prepare() handles 64-bit bus addresses, so avoid unneeded bouncing on i386. PR: 285681 Reported by: dim Tested by: dim, whu MFC after: 2 weeks
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+1
| | | | | | | | | | | | | | | | 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
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | 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
* Hyper-V: storvsc: relax a couple more kassertsWei Hu2022-09-081-4/+3
| | | | | | | Seems these kasserts don't work well on ARM64 Fixes: 0af5a0cd2788e Sponsored by: Microsoft
* Hyper-V: storvsc: relax a kassert checkWei Hu2022-09-071-1/+4
| | | | | | On ARM64 this kassert check could cause unnecessary panic. Sponsored by: Microsoft
* Hyper-V: storvsc: Call bus_dmamap_sync() for dma operationsWei Hu2022-08-151-0/+25
| | | | | | | | | 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
* Use KERNEL_PANICKED() in more placesMitchell Horne2022-06-021-1/+1
| | | | | | | | | | 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
* hyperv: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-061-2/+1
|
* hyperv storvsc: Remove unused variables.John Baldwin2022-04-061-4/+3
|
* hyperv storvsc: Don't abuse struct sglist to hold virtual addresses.John Baldwin2022-02-011-33/+31
| | | | | | | | | | | 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
* Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"Cy Schubert2021-12-021-6/+9
| | | | | | | | 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.
* wpa: Import wpa_supplicant/hostapd commit 14ab4a816Cy Schubert2021-12-021-9/+6
| | | | | | This is the November update to vendor/wpa committed upstream 2021-11-26. MFC after: 1 month
* hyperv: Flag hn and storvsc statistics with CTLFLAG_STATS.Don Morris2021-12-021-6/+9
| | | | | | Reviewed by: vangyzen, whu, bdrewery Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D30060
* storvsc: fix auto-sense reportingAndriy Gapon2021-05-071-1/+2
| | | | | | | | | | | | | | 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
* Hyper-V: storvsc: Enhance srb_status code handling.Wei Hu2020-08-312-24/+168
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=364984
* storvsc: port a Linux patch, properly set residual data length on errorsAndriy Gapon2020-01-142-2/+7
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=356730
* hyperv/storvsc: stash a pointer to hv_storvsc_request in ccbAndriy Gapon2019-11-191-0/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=354849
* hyperv/storvsc: storvsc_io_done(): do not use CAM_SEL_TIMEOUTDexuan Cui2018-04-101-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=332385
* Define xpt_path_inq.Warner Losh2017-12-061-4/+1
| | | | | | | | | | | This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13387 Notes: svn path=/head/; revision=326645
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-272-0/+4
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326255
* hyperv: Update copyright for the files changed in 2017Sepherosa Ziehau2017-08-142-2/+2
| | | | | | | | | MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11982 Notes: svn path=/head/; revision=322488
* hyperv/storvsc: Force SPC3 for CDROM attached.Sepherosa Ziehau2017-07-201-1/+18
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=321286
* Clean up MD pollution of bus_dma.h:Jason A. Harmening2017-07-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --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 Notes: svn path=/head/; revision=320528
* hyperv/storvsc: Reduce log verbositySepherosa Ziehau2017-06-211-10/+21
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=320184
* hyperv/storvsc: Use ULL for 64bits value shift.Sepherosa Ziehau2017-04-141-1/+1
| | | | | | | | | Reported by: PVS MFC after: 3 days Sponsored by: Microsoft Notes: svn path=/head/; revision=316813
* hyperv/storvsc: Fixup SRB status.Sepherosa Ziehau2017-04-052-8/+8
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=316519
* Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)Alan Somers2017-01-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=311305
* hyperv/storvsc: The max channel in PDU actually means the max sub-chans.Sepherosa Ziehau2016-12-211-15/+26
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=310347
* hyperv/storvsc: Minor style changes; no functional changes.Sepherosa Ziehau2016-12-091-1/+6
| | | | | | | | | Reported by: rpokala MFC after: 1 week Sponsored by: Microsoft Notes: svn path=/head/; revision=309728
* hyperv/storvsc: Fix the SCSI disk attachment issue.Sepherosa Ziehau2016-12-091-8/+33
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=309726
* hyperv/storvsc: Don't use timedwait.Sepherosa Ziehau2016-11-301-32/+6
| | | | | | | | | | | | The timeout is unnecessary. Reviewed by: jhb MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8656 Notes: svn path=/head/; revision=309320
* hyperv/stor: Fix off-by-one bug; this brings back TRIM support.Sepherosa Ziehau2016-10-141-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=307261
* hyperv/storvsc: Fix the blkvsc disk attachment issues.Sepherosa Ziehau2016-09-291-22/+91
| | | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=306426
* hyperv/storvsc: Fix SRB length setting.Sepherosa Ziehau2016-09-201-1/+2
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=306015
* hyperv/storvsc: Increase queue depth and rework channel selection.Sepherosa Ziehau2016-08-252-40/+130
| | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=304791
* hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.Sepherosa Ziehau2016-08-172-100/+61
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=304251
* hyperv/storvsc: Claim SPC-3 conformance, thus enable UNMAP supportSepherosa Ziehau2016-08-041-2/+21
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=303737
* hyperv/storvsc: Stringent PRP list assertionsSepherosa Ziehau2016-08-011-4/+19
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7361 Notes: svn path=/head/; revision=303605
* hyperv/storvsc: Set maxio to 128KB.Sepherosa Ziehau2016-08-011-2/+18
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7360 Notes: svn path=/head/; revision=303604
* hyperv/vmbus: Remove the artificial entry limit of SG and PRP list.Sepherosa Ziehau2016-08-011-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=303603
* hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.Sepherosa Ziehau2016-07-291-60/+181
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=303474
* hyperv/vmbus: Inclusion cleanupSepherosa Ziehau2016-07-281-0/+1
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7334 Notes: svn path=/head/; revision=303422
* hyperv: hv_vmbus_channel -> vmbus_channelSepherosa Ziehau2016-07-211-7/+7
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7260 Notes: svn path=/head/; revision=303131
* hyperv/vmbus: Hide channel struct definition.Sepherosa Ziehau2016-07-201-1/+1
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7245 Notes: svn path=/head/; revision=303071
* hyperv/vmbus: Pass channel as the first argument for channel callbackSepherosa Ziehau2016-07-201-12/+6
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=303069
* hyperv/vmbus: Channel struct field renameSepherosa Ziehau2016-07-201-4/+4
| | | | | | | | | MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7242 Notes: svn path=/head/; revision=303068