VFIO - Virtual Function I/O

Co-Authored-By: richardg867 <540874+richardg867@users.noreply.github.com>
This commit is contained in:
Jasmine Iwanek
2025-09-06 22:39:16 -04:00
parent da7bec3beb
commit f3f2068d1a
6 changed files with 3425 additions and 0 deletions

View File

@@ -185,6 +185,7 @@ cmake_dependent_option(SIO_DETECT "Super I/O Detection Helper"
cmake_dependent_option(WACOM "Wacom Input Devices" ON "DEV_BRANCH" OFF)
cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
cmake_dependent_option(NETSWITCH "Network Switch Support" ON "DEV_BRANCH" OFF)
cmake_dependent_option(VFIO "Virtual Function I/O" ON "DEV_BRANCH" OFF)
# Ditto but for Qt
if(QT)

View File

@@ -107,6 +107,7 @@
#include <86box/apm.h>
#include <86box/acpi.h>
#include <86box/nv/vid_nv_rivatimer.h>
#include <86box/vfio.h>
// Disable c99-designator to avoid the warnings about int ng
#ifdef __clang__
@@ -1646,6 +1647,11 @@ pc_reset_hard_init(void)
the chances of the SCSI controller ending up on the bridge. */
video_voodoo_init();
#if defined(USE_VFIO) && defined(__linux__)
/* Initialize VFIO */
vfio_init();
#endif
/* installs first game port if no device provides one, must be late */
if (joystick_type[0])
gameport_update_joystick_type(0);

View File

@@ -103,6 +103,16 @@ if(VNC)
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(VFIO)
include(CheckIncludeFile)
check_include_file("linux/vfio.h" VFIO_AVAILABLE)
if(VFIO_AVAILABLE)
add_compile_definitions(USE_VFIO)
endif()
endif()
endif()
if(INSTRUMENT)
add_compile_definitions(USE_INSTRUMENT)
endif()

View File

@@ -81,6 +81,17 @@ if(ISAMEM_BRAT)
target_compile_definitions(dev PRIVATE USE_ISAMEM_BRAT)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(VFIO)
include(CheckIncludeFile)
check_include_file("linux/vfio.h" VFIO_AVAILABLE)
if(VFIO_AVAILABLE)
add_compile_definitions(USE_VFIO)
target_sources(dev PRIVATE vfio.c)
endif()
endif()
endif()
if(LASERXT)
target_compile_definitions(dev PRIVATE USE_LASERXT)
endif()

3377
src/device/vfio.c Normal file

File diff suppressed because it is too large Load Diff

20
src/include/86box/vfio.h Normal file
View File

@@ -0,0 +1,20 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Definitions for Virtual Function I/O PCI passthrough.
*
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2021-2025 RichardG.
*/
#if !defined(EMU_VFIO_H) && defined(USE_VFIO)
# define EMU_VFIO_H
extern void vfio_init(void);
#endif