How I set up Windows 9x/XP GPU Passthrough with 86box

Creating ultra fast virtual machines of old operating systems for fun and profit
Post Reply
foxlet
Posts: 6
Joined: Wed Jul 19, 2023 7:34 pm

How I set up Windows 9x/XP GPU Passthrough with 86box

Post by foxlet »

Here's a fun fact: QEMU is not the only virtualizer that supports Linux's VFIO API... a few people in the 86box dev community have been working on special branch that allows PCI and PCIe devices to be passed over to an existing 86box config! It's pretty much untested, but so far Windows 98, 2000, and XP have been known to work across a number of GPUs running directly off PCIe, or through a PCIe to PCI bridge riser.

The Problem

QEMU already works fairly well for NT-based operating systems from the XP era onward (makes sense given the more mature nature of the kernel by that point), but there continue to be bugs and device driver issues with Win2K and earlier. That's where 86box can help mend those issues, as it emulates more era-specifc hardware that usually have built-in drivers baked into these old OSes.

A Few Quirks

VFIO has limitations, in particular it can only really handle PCI-based (and newer) hardware. Recently there was a project that allowed attaching ISA devices to the LPC bus (dISAppointment) using the TPM header on more modern boards, but actually enabling this in Linux would require kernel intervention that is not currently in place yet.

Obviously AGP video cards will also poise a problem, although for some specific models (3dfx Voodoo) there do exist some AGP -> PCI bridge designs that could be useful to some extent. Good luck getting a hold of one of those though lol (check out https://www.vogons.org/viewtopic.php?p=896097#p896097 for more)

What worked (for me)

The source code for the vfio branch is hosted at https://github.com/richardg867/86Box, and that's what I've been using for 9x and XP. If your system is already configured for VFIO with QEMU, it should more or less work, but if you're never done it before here's a rundown...
  1. Enable iommu in your device's firmware settings
    > Some vendors enable the iommu automatically, check your motherboard manual
  2. Check for your iommu groupings/devices
    > If you do not see any groups, the iommu on your system is not enabled, or your PC does not support it
  3. Re-bind the PCI device (using vfio-pci) that you want to make available to 86box (similar to QEMU)
  4. Add the following to your 86box config, where `devices` is the ID of the re-bound device

    Code: Select all

    [VFIO]
    devices = 07:00.4
    
  5. Run 86box with the edited config
Tips
  • It's recommended to run 86box as a regular user (rather than root); on some distros you may have to edit `/etc/security/limits.conf` and add the following to extend resource limits (vfio may fail to work otherwise):

    Code: Select all

    myusername soft memlock 1024000
    myusername hard memlock 1024000
    
  • You can pass through non-video devices to 86box as well, such as USB XHCI controllers (to use with XP for example). You can then use lower-latency input devices like controllers and mice for a better game experience.
Last edited by foxlet on Wed Aug 16, 2023 4:51 am, edited 5 times in total.
foxlet
Posts: 6
Joined: Wed Jul 19, 2023 7:34 pm

Re: How I set up Windows 9x/XP GPU Passthrough with 86box (lol)

Post by foxlet »

Some examples of working setups...

Windows 98 (Ryzen 5, Quadro FX 3500, Void Linux)
windows98.png
BIOS text-mode rendering (yep, that works!)
bios-fs8.png
ArchiverXP
Posts: 2
Joined: Mon Oct 09, 2023 10:28 pm

Re: How I set up Windows 9x/XP GPU Passthrough with 86box

Post by ArchiverXP »

Hey so I have a question, what do I set for the video in 86box?
Post Reply