[SDK][VIRTIO][NETKVM] Make VirtIO a separate library (#6280)

* [SDK][VIRTIO][NETKVM] Make VirtIO a separate library

This is to avoid code duplication when more VirtIO drivers are brought in. This will also be used on development of a VirtIO XDDM GPU Driver.

* [VIRTIO] Sync with upstream
This commit is contained in:
Adam Słaboń 2024-01-17 02:55:35 +01:00 committed by GitHub
parent 96d5b6281d
commit 823fdb19d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 35 additions and 8 deletions

View file

@ -1,5 +1,6 @@
include_directories(BEFORE Common virtio)
include_directories(BEFORE Common
${REACTOS_SOURCE_DIR}/sdk/lib/drivers/virtio)
add_definitions(
-DNDIS_MINIPORT_DRIVER
@ -11,16 +12,12 @@ list(APPEND SOURCE
Common/ParaNdis-VirtIO.c
Common/ParaNdis-Debug.c
Common/sw-offload.c
virtio/VirtIOPCICommon.c
virtio/VirtIOPCILegacy.c
virtio/VirtIOPCIModern.c
virtio/VirtIORing.c
virtio/VirtIORing-Packed.c
wxp/ParaNdis5-Driver.c
wxp/ParaNdis5-Impl.c
wxp/ParaNdis5-Oid.c)
add_library(netkvm MODULE ${SOURCE} wxp/parandis.rc)
target_link_libraries(netkvm virtio)
set_module_type(netkvm kernelmodedriver)
add_importlibs(netkvm ndis ntoskrnl hal)
add_cd_file(TARGET netkvm DESTINATION reactos/system32/drivers FOR all)
@ -29,7 +26,6 @@ add_driver_inf(netkvm netkvm.inf)
if(NOT MSVC)
target_compile_options(netkvm PRIVATE
-Wno-unused-function
-Wno-unknown-pragmas
-Wno-pointer-sign
-Wno-pointer-to-int-cast
-Wno-int-to-pointer-cast

View file

@ -74,6 +74,12 @@ Used Version: 20221020
License: GPL-2.0 (https://spdx.org/licenses/GPL-2.0.html)
URL: https://acpica.org/
Title: VirtIO Windows guest driver library
Path: sdk/lib/drivers/virtio
Used Version: git commit 4c4d181
License: BSD-3-Clause (https://spdx.org/licenses/BSD-3-Clause.html)
URL: https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/VirtIO
Title: WinBtrfs
Path: dll/shellext/shellbtrfs
Path: drivers/filesystems/btrfs
@ -115,7 +121,7 @@ Title: VirtIO NetKVM Windows guest driver
Path: drivers/network/dd/netkvm
Used Version: git commit 5e01b36
License: BSD-3-Clause (https://spdx.org/licenses/BSD-3-Clause.html)
URL: https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/NetKVM/NDIS5
URL: https://github.com/virtio-win/kvm-guest-drivers-windows/tree/03ca1696b9474d62b90fda5be06d91c8c34f6413/NetKVM/NDIS5
Title: Microsoft CDROM Storage Class Driver
Path: drivers/storage/class/cdrom

View file

@ -9,4 +9,5 @@ add_subdirectory(rdbsslib)
add_subdirectory(rtlver)
add_subdirectory(rxce)
add_subdirectory(sound)
add_subdirectory(virtio)
add_subdirectory(wdf)

View file

@ -0,0 +1,17 @@
list(APPEND SOURCE
VirtIOPCICommon.c
VirtIOPCILegacy.c
VirtIOPCIModern.c
VirtIORing.c
VirtIORing-Packed.c)
add_library(virtio ${SOURCE})
add_dependencies(virtio xdk)
if(NOT MSVC)
target_compile_options(virtio PRIVATE
-Wno-unused-function
-Wno-unknown-pragmas
-Wno-attributes)
endif()

View file

@ -184,6 +184,11 @@ static void vio_modern_reset(VirtIODevice *vdev)
* including MSI-X interrupts, if any.
*/
while (ioread8(vdev, &vdev->common->device_status)) {
u16 val;
if (pci_read_config_word(vdev, 0, &val) || val == 0xffff) {
DPrintf(0, "PCI config space is not readable, probably the device is removed\n", 0);
break;
}
vdev_sleep(vdev, 1);
}
}

View file

@ -24,8 +24,10 @@
#endif
#ifndef __REACTOS__
#if !defined(ENOSPC)
#define ENOSPC 1
#endif
#endif
#if !defined(__cplusplus) && !defined(bool)
// Important note: in MSFT C++ bool length is 1 bytes