virtio-win / kvm-guest-drivers-windows

Windows paravirtualized drivers for QEMU\KVM
https://www.linux-kvm.org/page/WindowsGuestDrivers
BSD 3-Clause "New" or "Revised" License
1.92k stars 377 forks source link

Windows Server 2025 drivers #1037

Closed kroese closed 1 month ago

kroese commented 5 months ago

Two days ago, Microsoft released a preview for Windows Server 2025, see https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver

I tried to install it, but it does not accept the Windows Server 2022 drivers for vioscsi, nor the Windows 11 one.

Maybe it just needs a modified .inf file, as I don't assume anything changed in the driver API compared to Win11/Win22?

Anyway, it would be nice to be able install the 2025 version, so my feature request is to include a w2k25 release of the drivers.

kroese commented 5 months ago

I just tried it again using the "Azure Edition" instead of the normal one, and that one accepts the Win22 drivers for some reason.

EDIT: Nevermind, it only accepts it now during the first screen, but a few screens further it cannot locate any disks, and when manually loading the w2k22 driver again it prompts "Cannot load driver".

kostyanf14 commented 5 months ago

Hi @kroese

What build number of Windows Server do you have?

kroese commented 5 months ago

@kostyanf14 Build 26040

kroese commented 5 months ago

Its a bit strange installation. The first step asks for drivers for a device that displays your hardware. I assumed it was asking for the scsi drivers (as every other Windows setup asks this as the first step), so that it doesnt accept the scsi driver here makes sense in hindsight.

But I have no idea what a "device to display your hardware" is. I tried smbus, fwcfg, and lots of others, but none of them were correct.

Server 2025 is based on Win11 LTSC so I also dont understand why it cannot load the Win11 scsi driver at the disk screen later on.

vrozenfe commented 5 months ago

@kroese Did you try a "normal" vNext preview rather than Azure version ? Vadim

kroese commented 5 months ago

I tried all three versions, the "normal", the Azure and the Annual edition. All have the same problem that they dont accept any VirtIO driver.

vrozenfe commented 5 months ago

Tried to install vNext 26040.1000.240122-1157 Standard Server on my F37 laptop [vrozenfe@milly vms]$ uname -r 6.5.12-100.fc37.x86_64 and (qemu) info version 8.2.50v8.2.0-645-g977542ded7 Screenshot from 2024-01-29 23-36-57

seems to work fine with viostor, netkvm and viogpudo drivers build for ws2022 Screenshot from 2024-01-29 23-38-53

my qemu command line:

!/bin/sh

IMG='/home/vrozenfe/work/images/vnext.qcow2' QEMU='/home/vrozenfe/work/upstream/qemu/build/x86_64-softmmu/qemu-system-x86_64' CDROM='/home/vrozenfe/work/isos/26040.1000.240122-1157.rs_prerelease_SERVER_OEMRET_x64FRE_en-us.iso' ISO='/home/vrozenfe/work/isos/virtio-win-0.1.240.iso'

FLAGS=',hv_stimer,hv_synic,hv_vpindex,hv_relaxed,hv_spinlocks=0xfff,hv_vapic,hv_time,hv_frequencies,hv_runtime,hv_tlbflush,hv_reenlightenment,hv_stimer_direct,hv_ipi,+kvm_pv_unhalt'

VGA='-device virtio-vga,edid=on,xres=1280,yres=800' CPU='host' sudo $QEMU -name vNext \ -M q35 -S \ -L /home/vrozenfe/work/upstream/qemu/pc-bios/ \ -cpu $CPU$FLAGS \ -machine hpet=off \ -monitor stdio \ -enable-kvm \ -rtc base=localtime,clock=host,driftfix=slew \ -usb -device usb-tablet,id=input0 \ -global kvm-pit.lost_tick_policy=discard \ -m 4G -smp 4,maxcpus=4,cores=4,threads=1,sockets=1 \

vrozenfe commented 5 months ago
    $VGA \
    -drive file=$IMG,if=none,media=disk,format=qcow2,rerror=stop,werror=stop,cache=none,id=drive-vioscsi0 \
    -device virtio-scsi-pci,id=scsi-vioscsi0 \
    -device scsi-hd,drive=drive-vioscsi0,id=vioscsi0,bus=scsi-vioscsi0.0,lun=0,scsi-id=0,bootindex=1 \
    -device virtio-net-pci,mac=9a:55:56:57:30:25,id=id18Xcuo,vectors=4,netdev=idGRsMas \
    -netdev tap,id=idGRsMas,script=/etc/qemu-ifup \
    -drive id=drive_cd0,if=none,snapshot=off,aio=threads,cache=none,media=cdrom,file=$CDROM \
    -device ide-cd,id=cd0,drive=drive_cd0,bootindex=2,bus=ide.0,unit=0 \
    -drive id=drive_cd1,if=none,snapshot=off,aio=threads,cache=none,media=cdrom,file=$ISO \
    -device ide-cd,id=cd1,drive=drive_cd1,bootindex=-1,bus=ide.1,unit=0 \

$SER \

kroese commented 5 months ago

Interesting... We have almost an identical QEMU commandline, and the same version of the VirtIO drivers, so I am a bit puzzled...

Did you get the screen 'Select a device to display hardware' in the first step of the installation? Did you use the win22 'viostor.inf' or the 'vioscsi.inf'?

kostyanf14 commented 5 months ago

I try both viostor and vioscsi (with corresponding device), and both work fine

kostyanf14 commented 5 months ago

@kroese

Do you run Windows with OVMF (secure-boot or no) or SeaBIOS? Do you run QEMU directly or via libvirt?

kroese commented 5 months ago

I discovered that this command causes the error with loading the drivers:

qemu-system-x86_64 
-nodefaults 
-cpu host,kvm=on,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_passthrough 
-smp 2,sockets=1,dies=1,cores=2,threads=1 
-m 4G 
-machine type=q35,smm=on,graphics=off,vmport=off,dump-guest-core=off,hpet=off,accel=kvm 
-enable-kvm 
-display vnc=:0,websocket=5700 
-vga virtio 
-monitor telnet:localhost:7100,server,nowait,nodelay 
-daemonize 
-D /run/shm/qemu.log 
-pidfile /run/shm/qemu.pid 
-serial pty 
-netdev tap,ifname=qemu,script=no,downscript=no,id=hostnet0 
-device virtio-net-pci,romfile=,netdev=hostnet0,mac=82:cf:d0:5e:57:66,id=net0 
-object iothread,id=io2 
-device virtio-scsi-pci,id=scsi0,iothread=io2,addr=0x5 
-device scsi-cd,bus=scsi0.0,drive=cdrom0,bootindex=10 
-drive id=cdrom0,if=none,format=raw,readonly=on,file=/storage/custom.iso 
-drive id=cdrom1,if=none,format=raw,readonly=on,file=/run/drivers.iso 
-device ide-cd,drive=cdrom1 
-drive file=/storage/data.img,if=none,id=drive-userdata,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on 
-device virtio-blk-pci,scsi=off,bus=pcie.0,addr=0xa,drive=drive-userdata,id=userdata,iothread=io2,bootindex=3 
-global driver=cfi.pflash01,property=secure,value=on
-drive file=/storage/windows.rom,if=pflash,unit=0,format=raw,readonly=on 
-drive file=/storage/windows.vars,if=pflash,unit=1,format=raw 
-global kvm-pit.lost_tick_policy=discard -global ICH9-LPC.disable_s3=1 
-chardev socket,id=chrtpm,path=/run/swtpm-sock 
-tpmdev emulator,id=tpm0,chardev=chrtpm 
-device tpm-tis,tpmdev=tpm0 
-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4 
-object rng-random,id=objrng0,filename=/dev/urandom 
-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c 
-device qemu-xhci 
-device usb-tablet 

And this command causes NO error in loading the drivers:

qemu-system-x86_64 
-nodefaults 
-cpu host,kvm=on,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_passthrough 
-smp 1,sockets=1,dies=1,cores=1,threads=1 
-m 1G 
-machine type=q35,smm=on,graphics=off,vmport=off,dump-guest-core=off,hpet=off,accel=kvm 
-enable-kvm 
-display vnc=:0,websocket=5700 
-vga virtio 
-monitor telnet:localhost:7100,server,nowait,nodelay 
-serial mon:stdio 
-netdev tap,ifname=qemu,script=no,downscript=no,id=hostnet0 
-device virtio-net-pci,romfile=,netdev=hostnet0,mac=82:cf:d0:5e:57:66,id=net0 
-object iothread,id=io2 
-device virtio-scsi-pci,id=scsi0,iothread=io2,addr=0x5 
-device scsi-cd,bus=scsi0.0,drive=cdrom0,bootindex=10 
-drive id=cdrom0,if=none,format=raw,readonly=on,file=/storage/boot.iso 
-drive id=cdrom1,if=none,format=raw,readonly=on,file=/storage/drivers.iso 
-device ide-cd,drive=cdrom1 
-device virtio-scsi-pci,id=hw-userdata,iothread=io2,bus=pcie.0,addr=0xa 
-drive file=/storage/data.img,if=none,id=drive-userdata,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on 
-device scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata,rotation_rate=1,bootindex=3 
-global driver=cfi.pflash01,property=secure,value=on
-drive file=/storage/windows.rom,if=pflash,unit=0,format=raw,readonly=on 
-drive file=/storage/windows.vars,if=pflash,unit=1,format=raw 
-global kvm-pit.lost_tick_policy=discard 
-global ICH9-LPC.disable_s3=1 
-chardev socket,id=chrtpm,path=/run/swtpm-sock 
-tpmdev emulator,id=tpm0,chardev=chrtpm 
-device tpm-tis,tpmdev=tpm0 
-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4 
-object rng-random,id=objrng0,filename=/dev/urandom 
-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c 
-device qemu-xhci 
-device usb-tablet

I really would like to know why. Because both commands are almost identical.

The only obvious difference is the device virtio-blk-pci vs the device scsi-hd.

So it seems by using virtio-blk it causes Win2025 to fail to load any driver. Maybe it is just the viostor driver that is incompatible, as the vioscsi one seems to work fine.

fkonradmain commented 3 months ago

So, I got almost all of the drivers to work, by hard code activating directly via powershell. I just wanted to share it with you, because it seems to be a certificate issue as well.

My environment:

About the installation: I had no issues here, as disk driver I selected the directory amd64\2k22and then picked the driver.

I wrote a script, that

  1. runs the main installer on the root path of the virtio disk
  2. installs the certificates to the Windows Certificate Store
  3. installs all drivers, one after another
  4. installs the qemu guest agent
# Define the paths to the MSI files
$virtioWinMSI = "D:\virtio-win-gt-x64.msi"
$guestAgentMSI = "D:\guest-agent\qemu-ga-x86_64.msi"

# Install Virtio-Win MSI
Start-Process msiexec.exe -ArgumentList "/i `"$virtioWinMSI`" /qn" -Wait

# Add the Root CA for the drivers to the TrustedPublisher and the Root CA store
Import-Certificate -FilePath "D:\cert\Virtio_Win_Red_Hat_CA.cer" -CertStoreLocation "Cert:\LocalMachine\TrustedPublisher"
Import-Certificate -FilePath "D:\cert\Virtio_Win_Red_Hat_CA.cer" -CertStoreLocation "Cert:\LocalMachine\Root"

# Install Virtio drivers
pnputil -i -a "D:\amd64\2k22\vioscsi.inf"
pnputil -i -a "D:\amd64\2k22\viostor.inf"
pnputil -i -a "D:\Balloon\2k22\amd64\balloon.inf"
pnputil -i -a "D:\NetKVM\2k22\amd64\netkvm.inf"
pnputil -i -a "D:\fwcfg\2k22\amd64\fwcfg.inf"
pnputil -i -a "D:\pvpanic\2k22\amd64\pvpanic.inf"
pnputil -i -a "D:\pvpanic\2k22\amd64\pvpanic-pci.inf"
pnputil -i -a "D:\qemufwcfg\2k22\amd64\qemufwcfg.inf"
pnputil -i -a "D:\qemupciserial\2k22\amd64\qemupciserial.inf"
pnputil -i -a "D:\smbus\2k22\amd64\smbus.inf"
pnputil -i -a "D:\sriov\2k22\amd64\vioprot.inf"
pnputil -i -a "D:\viofs\2k22\amd64\viofs.inf"
pnputil -i -a "D:\viogpudo\2k22\amd64\viogpudo.inf"
pnputil -i -a "D:\vioinput\2k22\amd64\vioinput.inf"
pnputil -i -a "D:\viorng\2k22\amd64\viorng.inf"
pnputil -i -a "D:\vioscsi\2k22\amd64\vioscsi.inf"
pnputil -i -a "D:\vioserial\2k22\amd64\vioser.inf"
pnputil -i -a "D:\viostor\2k22\amd64\viostor.inf"

# Install QEMU Guest Agent MSI
Start-Process msiexec.exe -ArgumentList "/i `"$guestAgentMSI`" /qn" -Wait

At the end, only one device is not recognized (no idea, which it actually is, though): image

vrozenfe commented 3 months ago

@fkonradmain It will be better to use Win11 drivers for WS2025 Vadim.

kroese commented 1 month ago

Solution provided in #1100 1100