Commit Graph
1937 Commits
Author SHA1 Message Date
Yuri Benditovich dc06366b32 netkvm: move ParaNdis_ReceiveQueueAddBuffer to RX area
The procedure is used only inside RX, making it static inline.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-23 09:57:33 +02:00
Yuri Benditovich fc16d5878e netkvm: move ParaNdis_ResetRxClassification to RX area
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-23 09:57:33 +02:00
Yuri Benditovich 9364ac6f24 netkvm: make ParaNdis_UnbindRxBufferFromPacket static
The procedure is used only inside RX, no reason to publish.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-23 09:57:33 +02:00
Yuri Benditovich 7150e2b380 netkvm: make ParaNdis_BindRxBufferToPacket static
The procedure is used only inside RX, no reason to publish.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-23 09:57:33 +02:00
Yuri Benditovich 465161ca3b netkvm: make ParaNdis_FreeRxBufferDescriptor static
The procedure is used only inside RX, no reason to publish.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-23 09:57:33 +02:00
Yuri Benditovich 88feed6e0d virtio-wdf: check for initialization before free memory blocks
https://bugzilla.redhat.com/show_bug.cgi?id=1783906

VirtIOWdfDeviceFreeDmaMemoryByTag can be called when the device
failed the initialization of Wdf DMA API. Do not do anything
in such case.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-18 23:01:27 +02:00
Yuri Benditovich a7d3985e2f balloon: return immediately if VirtIOWdfInitialize fails
https://bugzilla.redhat.com/show_bug.cgi?id=1783906
In case of error in VirtIOWdfInitialize just return
proper error status.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-18 23:01:27 +02:00
Yuri Benditovich be64d95a1c virtio-wdf: fix KMDF version in library build
https://bugzilla.redhat.com/show_bug.cgi?id=1783953
Wrong KMDF version during library compilation causes
failure in initialization of DMA enabler.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-18 23:01:27 +02:00
Yuri Benditovich ffbec45e78 vioserial: fix mistake in command length
https://bugzilla.redhat.com/show_bug.cgi?id=1783880
Wrong command length causes loss of functionality of x86 driver.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-18 23:01:27 +02:00
Ilya Rudakov 29af66dc9a viosock: include VirtIO logs into driver logs
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-16 13:14:59 +02:00
Ilya Rudakov 7090cf1ea1 viosock: Remove DMA init code. Fix build
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-16 13:14:59 +02:00
Ilya Rudakov 600ad9e3ef viosock: Add test apps to package
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-15 11:25:38 +02:00
Ilya Rudakov a5570c83f3 viosock: Viosocklib-test now can register provider
When driver installed, run viosocklib-test /i to register (install)
viosock protocol dll. Installation code will be moved to coinstaller or
tools installer helper library at the end of viosock development.

Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-15 11:25:38 +02:00
Ilya Rudakov 28c6411f79 viosock: Add Package project
Move packaging setiings to separate project

Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Ilya Rudakov 3de8100061 viosock: fix lib project settings
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Ilya Rudakov b047a83fdf viosock: Add Win10 Debug config for driver
I'd like to build checked driver during development

Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Ilya Rudakov 479816fc27 viosock: Add socket provider test app
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Ilya Rudakov 9d343f91df viosock: Core definitions for virtio VSOCK address family
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Ilya Rudakov 44184ed581 viosock: Add ARM64 Debug config for lib and viosock-test. Fix build.
Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-12 13:43:27 +02:00
Yuri Benditovich 646e0428b0 viorng: remove unused procedure
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 35b3647fca balloon: fix VirtIO printouts
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 13788aef60 vioinput: fix VirtIO printouts
They did not appear with ETW. Fixed.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich acd56daea2 serial: fix VirtIO printouts
VirtIO printouts did not appear when WPP enabled. Fixed.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 064c9b2946 vioser-test: add flexibility to the test
If the port can't be open (probably opened by vdservice), go to
the next one.
Add ability to increase write buffer size and send
entire buffer filled by characters without getting data from the
console.
This helps testing corner cases of vioser.sys, for example:
configure additional test port port with tcp socket backend,
connect to it with 'nc', press ^Z to suspend the 'nc' and send
several large (512K) buffers.
At some point the write does not return immediately and closing
test application causes cancellation flow.
Another scenarion: if 1M buffer sent, the driver fails the operation
due to too large SG table.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 8098cb90a8 virtio-wdf: WDF VirtIO processes VIRTIO_F_IOMMU_PLATFORM
Handle VIRTIO_F_IOMMU_PLATFORM automatically in the library,
if suggested by the device. The drivers do not need to take
care on that in their code.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich e6ca4eb543 wdf drivers: set common features in WDF VirtIO library
Before this commit each WDF driver called VirtIOWdfSetDriverFeatures
from its PrepareHardware WDF callback. Many drivers do not have any
specific needs for features but needed to make this call in order
just to set VIRTIO_F_VERSION_1 and VIRTIO_F_ANY_LAYOUT properly.
So, even when the  call VirtIOWdfSetDriverFeatures is optional in
general, it is mandatory to handle V1 devices.
Current commit moves ack for VIRTIO_F_VERSION_1 and VIRTIO_F_ANY_LAYOUT
features to WDF VirtIO library. If the driver does not call
VirtIOWdfSetDriverFeatures, these features are set properly at time of
queues' initialization. So, drivers need to make this call only if
they need to enable some type-spefific features or if they need to
disable some common features which WDF library handles automatically
(currently VIRTIO_F_VERSION_1, VIRTIO_F_ANY_LAYOUT).

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich c5521dba1a viorng: add test application
Command line application that can call RNG function of viorng
provider (or other provider) with different buffer sizes.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich f10f740e04 vioinput: output also VirtIO logs as ETW events
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 80a41e2665 vioinput: use VirtIO WDF DMA API
Allocate 2 blocks of 4K. One will be sliced for input events
(8 bytes each, i.e. 512 events, when the queue size is usually 64).
Another one for sporadic output of keyboard reports, 16 bytes
allocated for each.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich c03a53859c balloon: debug printouts if EVENT_TRACING suppressed
Do kernel debug printouts if EVENT_TRACING undefined
during development.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich bfaae3146c balloon: include virtio logs into WPP logs
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich a28c98df61 balloon: Use VirtIO WDF DMA API to work with virtio queues
The driver uses 2 blocks of 4K: one for MemStats, one for
sending PFN arrays to the host. Now we allocate both in
PrepareHardware and release them as group in ReleaseHardware.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 271d3d14fc balloon: change WDF device execution level to PASSIVE
This is preparation patch for further patch making the driver
to work with VirtIO WDF DMA API. The driver allocates
all virt queues under WDF device lock (which is by default)
spinlock. The change making this lock to be fast mutex.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 4ec1e07814 viorng: log out also VirtIO debug printouts
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 446a0ee9bf viorng: Use DMA API of VirtIOWdf
The driver uses serialized IO requests (WdfIoQueueDispatchSequential)
so we need just one common buffer for single receive transaction.
We allocate this buffer of D0 entry and free on D0 exit.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 01be658e0f vioserial: Use VirtIO DMA API for control queue
Currently the driver uses memory structure on the stack
as DMA buffer. To be compatible with IOMMU, we change it
to use common DMA buffer. On D0 entry the driver allocates
single 4K block and uses slices from it for control queue
commands. The entry is 8 bytes, so the buffer is enough
for 512 entries. The driver usually uses just one entry
as control commands do not happen often.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich ba0d0a63a8 vioserial: use VirtIO DMA API for Write requests
Processing of Write request to ports uses Virtio DMA API
instead of GetPhysicalAddress.
The DMA transaction is built using a copy of write request
buffer. Unfortunately, we can't use original buffers of the
request to build the DMA transaction, as the cancellation
flow is problematic - we're not able to cancel the DMA
transaction in tx virtq. If we discard the transaction
in request cancellation flow, the device will still copy the
data using provided (invalidated) hardware addresses.
So, we pass the request's buffer to the DMA API and it makes
a copy of the data and provides SG list based on this copy.
In order to avoid very complicated flows we mark the request
as cancellable only after we successfully added the buffers.
If the request was cancelled in this very small window (from
the moment it was create to the moment we make it cancellable),
the driver will complet it immediately but the data will be
transmitted.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 12e5f9e501 vioserial: use VirtIO DMA API for input virt queues
Allocate input buffers (on D0Entry) using DMA API for both
main device and port devices, providing unique tag for group
deallocation of these buffers of D0Exit.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 6eee49260c vioserial: include VirtIO logs into driver logs
Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich ef86e7479f virtio-wdf: internal VirtIO calls use CommonBuffer API
Internally VirtIO-Wdf stops using MmAllocateContiguousMemory
and MmGetPhysical address, so when initializing and using
VirtIO queues, the WDF flawor of VirtIO library uses IOMMU-compatible
way of physical memory allocation and access. All the WDF drivers
still use old methods of obtaining physical addresses of blocks
for transmit and receive (i.e. allocating virtual memory and using
MmGetPhysicalAddress).

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich a9401e8287 virtio-wdf: Added code for IOMMU support (inactive)
Added and implemented APIs for proper DMA operations.
There are 3 mechanisms suitable for different kinds of
DMA operations:
1. Allocation of common buffers suitable for any kind
   of DMA. Intended for allocation of contiguous memory.
   Can be used on PASSIVE only. Good for RX queues with
   large buffers. It is not recommended to use it with
   sizes more than 8K as such blocks might be not available
   during run-time.
2. Allocation of single common buffer with possibility to
   allocate chunks of predefined size from it. The block
   can be allocated only on PASSIVE, but chunks can be
   allocated also on DISPATCH. Good for RX and TX queues
   with very small buffers.
3. Mapping of existing buffer (from WDF request or not).
   Suitable for TX where the source is WDF request, but
   requires effort to integrate as the mapping might be
   synchronous or asynchronous (does not depend on the
   caller) and the callback when SG list is ready is
   called on DISPATCH.

This is preparation patch.
Due to 'bLegacyMode' field and LEGACY_DMA_SUPPORTED define
the VirtIO works exactly the same way as before.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:55:04 +01:00
Yuri Benditovich 29ee1861bf vioinput: some absolute devices do not function at all
https://github.com/virtio-win/kvm-guest-drivers-windows/issues/413

When logical limits of an absolute device are not default (0..0x7fff),
the device, redirected over input-host, does not function at all
in Windows. Addition of physical limits definition makes it function.
Note that this does not solve completely the problem of touchpads
especially ones that report absolute coordinates like mice do:
they require more effort to function correctly.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:30:04 +01:00
Yuri Benditovich 0102e5bf8d vioinput: fix problem with high resolution mouse
https://github.com/virtio-win/kvm-guest-drivers-windows/issues/385

High resultion mouse often provides values out of range (-127,+127).
Unfortunately the interface of vioinput does not provide any
information about logical limits of relative pointer.
So, let's keep the value inside the range.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-12-11 13:30:04 +01:00
Ilya Rudakov 638ba85503 Virtio vsock support for Windows guests, initial commit.
Just a stub for further development. Build is ok, but without packaging
yet, a project set is defined (device driver, Windows Sockets service
provider interface (SPI) client for user mode apps, driver test app).
Device initialization is partially implemented, virtqueues are not
ready, you can only get the CID. The socket service provider client
implemented as a dll, it will handle requests from Windows Socket
subsystem, at the moment this is just a stub for building. Common
read/write requests will be used to communicate with the driver,
connection parameters will be defined with extended file attributes on
open.

Signed-off-by: Ilya Rudakov <[email protected]>
2019-12-02 09:47:16 +02:00
Yan Vugenfirer 757e5e45ac We are no longer using appveyor for CI 2019-12-02 09:06:04 +02:00
Yuri Benditovich c46f38f624 netkvm: avoid rebuilding the driver each time
Do not update netkvmmof.h without need, check whether
generated header file is different from existing one,
only then update it.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-11-26 11:46:42 +02:00
Yuri Benditovich 3177419a99 netkvm: change default speed to 10 Gbps
https://bugzilla.redhat.com/show_bug.cgi?id=1711743
Default speed of 100 Gbps and 40 Gbps causes degradation
in preformance tests, so changing it to 10 Gbps. Still
can be configured by QEMU command line.

Signed-off-by: Yuri Benditovich <[email protected]>
2019-11-26 11:46:42 +02:00
Ilya Rudakov 0aac288e28 viorng: fix vendor info substitution
Signed-off-by: Ilya Rudakov <[email protected]>
2019-10-31 14:50:46 +01:00
Michał Janiszewski c758405c0e netkvm: Plug memory leak on exception
Signed-off-by: Michał Janiszewski <[email protected]>
2019-10-24 10:17:31 +03:00
Michał Janiszewski b0c891c562 netkvm: Use free to deallocate memory allocated with malloc
_tcsdup is a macro that eventually evaluates to _strdup or a similar
call, which uses malloc() to allocate the required memory. Such pointer
should be released using a call to free(), not operator delete.

Signed-off-by: Michał Janiszewski <[email protected]>
2019-10-24 10:17:12 +03:00