[SOLVED] WIndows 7 VM won't boot with more than 1 core

Hi All

Having an issue i’ve been trying to troubleshoot off and on for 2 months now.
I cannot get a windows 7 vm to boot with more than 1 core. 1 Core, and it will boot fine, it even sees the ryzen processor. However, anything more than 1 core, and it freezes on the windows logo and reboots. I have tried both importing my working win7 vm from my previous intel server, as well as creating a new VM. This is meant to be my gaming vm. I have a windows10 gaming vm up and working, so i know at the minimum, qemu/kvm, IOMMU, GPU passthru are working.
Fedora is currently on qemu 3.1, i don’t know if qemu 4.0 would help or not. Nor do i know exactly how to manually update qemu to 4.0 since 4 isn’t available in the repos.

Specs:
Ryzen 3900x
GIgabyte Aorus Master x570 F5 BIOS
2 ADATA SXG8200 pro 512GB nvme drives
Radeon 5670 (host gpu)
Radeon RX 480 (guest GPU)
Host OS: Fedora 30/latest updates

Current boot parameters: iommu=pt amd_iommu=on rd.driver.pre=vfio-pci kvm_amd.npt=1 pcie_aspm=off

and my xml

domain type='kvm'>
  <name>windows7</name>
  <uuid>c2a5a3c4-6833-41c2-b06c-ab067e55292a</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/7"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static' current='1'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-3.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/windows7_VARS.fd</nvram>
    <bootmenu enable='no'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
    <vmport state='off'/>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <cache level='3' mode='emulate'/>
    <feature policy='disable' name='smep'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/xaviergray/Desktop/win7uefi.iso'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/xaviergray/Desktop/virtio-win-0.1.141.iso'/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/xaviergray/mount/win7-test.qcow'/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:a9:59:db'/>
      <source network='default'/>
      <model type='e1000e'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <sound model='ich9'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x04d9'/>
        <product id='0x1605'/>
      </source>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x413c'/>
        <product id='0x301a'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x0e' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x0e' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='4'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='5'/>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </memballoon>
  </devices>
</domain>

One thing i have noticed is that anytime i try to add more cores, virt-manager topology seems to think i have sockets, not cores… adding 4 cores and topolgy seems to think 4 sockets, 1 core each. I know that windows 7 was not designed to work with more than 2 sockets, but even just adding 2 sockets doesn’t work and results in the same boot loop. I have tried manually setting the topology to 1 socket, 4 cores, 1 thread, but still the same behavior.

I would appreciate any help or ideas on how i can fix this, and let me know what other info might be needed.

thanks for looking

Have you tried using Seabios instead of OVMF? I know Win 7 had/has issues with OVMF.

Thanks Cake for the idea.

I spent the last couple of days testing out using seabios instead of OVMF.
Using seabios DOES fix the multi-core issue, but it seems to create other problems.

  1. I couldn’t get a virtio drive to work.
  2. I am having all kinds of problems with video now. I successfully (and finally) got an AMD driver to install (only 18.9.3), current drivers crashed the VM, and required startup repair and manually removing the driver using cmd prompt.
    And for a brief moment, it seemed to work, but as soon as i restarted the VM, i lost video output. Thought maybe it was a reset issue so i tried rebooting the host machine, but that didn’t fix it.
    After reattaching vnc dispaly server to the vm, i was greeted with a odd looking negative, color inverted dispaly of windows 7. There was no radeon graphics listed under device manager, even though the software and drivers were still installed. This was where i ended my troubleshooting yesterday.

f i wasn’t trying to do gpu passthrough, this would work fine i think to fix the multicore problem.

So, still on the hunt for a way to get around the multicore issue.

Sorry, i’m not familiar with either if those. Um, I did see a patch for OVMF that makes it work with windows 7, https://github.com/tholin/OVMF-win7-hyperv

You would have to download the source, apply the patch and compile it yourself.

1 Like

thats interesting, I’m going to have to look into that. LOL, it even says “multicore” issues.

Maybe i’m reading it wrong, but it seems like the 2 fd files are the already patched version, and i just need to add them and change my xml to point to those files instead of the standard fd files?

Also, going to the bug report mentioned on github has some intereting ideas too, such as removing all hperv enlightments. So, i’m going to try that too.

What’s odd is this worked perfectly on a xeon system, but that was running much older versions of fedora and qemu/kvm.

Either way, you’ve given me some hope and some more things to try, and i appreciate that.

1 Like

They are the compiled files you need, just they are compiled for hyperv. They might work with qemu on your distro, they might not. Since the original source code might have been patched to work with hyperv and/or the distro you are using might have patched the original source for their package.

SUCCESS!!!

Adding the patched OMVF .fd files from github plus adding

> <feature policy='disable' name='hypervisor'/>

to my xml worked. I now have a multi-core windows 7 vm again.

Thanks so much for your help

3 Likes