How can I change Qemu KVM machine architecture from 440fx to q35 with virsh edit or virt-manager

45,779

Solution 1

I just did this today - pretty much as 'Fox' described, except change the pci controller entry instead of deleting it - changing 'pci-root' to 'pcie-root'

Then it will complain about anything with a bus-related parameter - I think you can leave the item but remove the specification. I also had to remove USB-related entries (piix3 integrated controller requires a PCI bus, or something to that effect).

Not sure if you're still trying to do this - but I tought I'd put it out there for anyone else who searches for this.

Solution 2

There is a patch available for the underlying issue (being that QEMU won't allow you to bind to a PCIe root bus, which is needed for Windows guests on Q35):

http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg05385.html

Solution 3

Latest virt-manager (1.1.0) supports setting architecture on VM creation. You can not change it later.

With virsh edit, I am guessing a little, but I would try removing the PCI controller and all bus related parameters (like <address />. And changing

<type arch='i686' machine='pc-i440fx-2.1'>hvm</type>

to

<type arch='i686' machine='pc-q35'>hvm</type>

Normally i'd offer this in a comment, since its more of a guess, but it's too long. I'll remove it if it does not work.

btw. those <qemu:arg /> at the end might be causing trouble as well. If you run into problems, try removing those as well.

Solution 4

Try instead of pc-i440fx-2.1 above

See an example at https://gist.github.com/lyarbean/7036986

I'd run qemu manually with -M q35 or -M ? to check the version you have installed really supports it

hth

Share:
45,779

Related videos on Youtube

htfree
Author by

htfree

Updated on September 18, 2022

Comments

  • htfree
    htfree over 1 year

    Still trying to get GPU passthrough working and decided to change machine type from older 440fx to q35 ie pc-q35 but if I do virsh edit on the config it refuse to save saying "PCI Bridges not supported"... by current qemu binary. What do I need to fix/change in the virtual machine xml file?

    After some research seems q35 only allows PCIexpress PCIe and not PCI but I don't know what to change in my xml file so that virsh stops complaining and accepts change from 440fx to q35.

    This is on Debian Jessie: uname -a Linux vmserver 3.16.0-customvmkernel #1 SMP Sun Sep 28 00:34:42 PDT 2014 x86_64 GNU/Linux

    kvm --version QEMU emulator version 2.1.0 (Debian 2.1+dfsg-4)

    Here is my current virtual machine file with 440fx that I want to change to q35:

    <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
    <name>Win7enterprise32bit</name>
    <uuid>77599af9-35a3-45e1-9fce-74304f7d7a9c</uuid>
    <memory unit='KiB'>1048576</memory>
    <currentMemory unit='KiB'>1048576</currentMemory>
    <vcpu placement='static'>1</vcpu>
    <os>
    <type arch='i686' machine='pc-i440fx-2.1'>hvm</type>
    <boot dev='hd'/>
    </os>
    <features>
    <acpi/>
    <apic/>
    <pae/>
    </features>
    <clock offset='localtime'/>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
    <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='vmdk'/>
      <source file='/mount/ssd/VirtWin7-clone.vmdk'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='bridge'>
      <mac address='52:54:00:9e:f5:11'/>
      <source bridge='br0'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
    </devices>
    <qemu:commandline>
    <qemu:arg value='-nodefaults'/>
    <qemu:arg value='-vga'/>
    <qemu:arg value='none'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,rombar=0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=04:00.1,bus=root.1,addr=00.1'/>
    <qemu:arg value='-bios'/>
    <qemu:arg value='/usr/share/seabios/bios.bin'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host,kvm=off'/>
    </qemu:commandline>
    </domain>
    
  • htfree
    htfree over 9 years
    sorry just noticed reply, if I change to pc-q35 I get "error: unsupported configuration: PCI bridges are not supported by this QEMU binary"
  • htfree
    htfree about 9 years
    Thanks, I got this resolved some time ago, main thing is I think I was missing the dmi-to-pci bridge and I had to change the buses from 0x00 to 0x02 for some devices, I ended up passing through HDMI+Audio of gpu and also extra USB ports so that mouse/keyboard can work on passed through gpu.
  • htfree
    htfree about 9 years
    got this resolved some time ago, change pci to pcie etc and fixed bus addresses...
  • htfree
    htfree about 9 years
    yea, see my comment to Pat, I fixed everything some time ago, with virsh edit ...
  • NoX
    NoX over 5 years
    How do you find how to correct the buses?
  • user643011
    user643011 over 3 years
    qemu-system-x86_64 --machine help worked for me. Thanks!