Page 1 of 1

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

Posted: Wed Jul 19, 2023 8:40 pm
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.

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

Posted: Wed Jul 19, 2023 8:58 pm
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

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

Posted: Mon Oct 09, 2023 10:29 pm
by ArchiverXP
Hey so I have a question, what do I set for the video in 86box?

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

Posted: Sun Oct 06, 2024 6:48 am
by NT4Boy
I'd really like to try this in W95 with a PCI/PCMCIA cardbus adapter I have managed to get working in Ubuntu.
I have also enabled IOMMU, and can see my card in a suitable group to pass through.

However, I cannot get the richardg867 branch to compile.
I receive a number of errors in the vfio.c.o page, when I run make which is I guess kind of crucial.

Just wondering how you got it to run.

All clues gratefully received.