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

how to adjust resolution with virtiogpu and windows 11 for aarch64 VM? #969

Open gang929 opened 10 months ago

gang929 commented 10 months ago
  1. qemu-kvm-aarch64 5.2
  2. libvirt xml add virtiogpu <video><model type="virtio"/></video>
  3. guestos : windows 11 arm64 + virtio-win-0.1.229

question:

  1. In windows display settings, It can not be change resolution. The resolution combox option is disable.
  2. In windows device manager, It has two monitor, which one is attach to virtiogpu dod controller, another one is a General Non-Pnp Monitor, which is attach to Basic Display. How to remove it ?
vrozenfe commented 10 months ago

@gang929 Can you please post the qemu command line?

Thanks, Vadim,

gang929 commented 10 months ago

the qemu command line

/usr/libexec/qemu-kvm \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-5-win11testa/master-key.aes \
-blockdev '{"driver":"file","filename":"/usr/share/AAVMF/AAVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/win11testa_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
-machine virt-rhel8.3.0,accel=kvm,usb=off,dump-guest-core=off,gic-version=3,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
-cpu host \
-m 8192 \
-smp 8,sockets=8,cores=1,threads=1 \
-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.4,addr=0x0 \
-device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x0 \
-blockdev '{"driver":"file","filename":"/win11testa/win11testa.vdisk1","node-name":"libvirt-1-storage","cache":{
"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"discard":"unmap","detect-zeroes":"unmap","cache":{"direct"
:true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":null}' \
-device virtio-blk-pci,bus=pci.6,addr=0x0,drive=libvirt-1-format,id=virtio-disk0,bootindex=3,write-cache=on \
-device usb-mouse,id=input0,bus=usb.0,port=13 \
-device usb-kbd,id=input1,bus=usb.0,port=14 \
-device usb-tablet,id=input2,bus=usb.0,port=15 \
-device virtio-gpu-pci,id=video0,max_outputs=1,bus=pci.8,addr=0x0 \
-device ich9-intel-hda,id=sound0,bus=pci.17,addr=0x1 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-vnc :10 \
-drive file=/vsipfsRepo/mirrors/virtio-win-0.1.229.iso,media=cdrom,if=none,id=drivers \
-device usb-storage,drive=drivers 

libvirt xml

<domain type="kvm">
  <name>win11testa</name>
  <qemu:commandline xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
    <qemu:arg value='-vnc'/>
    <qemu:arg value=':10'/>

    <qemu:arg value='-drive'/>
    <qemu:arg value='file=/virtio-win-0.1.229.iso,media=cdrom,if=none,id=drivers'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-storage,drive=drivers'/>

  </qemu:commandline>
  <os>
    <type arch="aarch64">hvm</type>
    <loader type="pflash" readonly="yes">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
    <nvram template='/usr/share/AAVMF/AAVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/win11testa_VARS.fd</nvram>
    <smbios mode="sysinfo"/>
  </os>
  <memory>8388608</memory>
  <currentMemory>8388608</currentMemory>
  <vcpu current="8">8</vcpu>
  <cpu mode="custom">
    <model>host</model>
  </cpu>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <features>
    <pae/>
    <acpi/>
<gic version='3'/>
  </features>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type="scsi" index="0" model="virtio-scsi"/>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port"/>
    <controller type="pci" index="2" model="pcie-root-port"/>
    <controller type="pci" index="3" model="pcie-root-port"/>
    <controller type="pci" index="4" model="pcie-root-port"/>
    <controller type="pci" index="5" model="pcie-root-port"/>
    <controller type="pci" index="6" model="pcie-root-port"/>
    <controller type="pci" index="7" model="pcie-root-port"/>
    <controller type="pci" index="8" model="pcie-root-port"/>
    <controller type="pci" index="9" model="pcie-root-port"/>
    <controller type="pci" index="10" model="pcie-root-port"/>
    <controller type="pci" index="11" model="pcie-root-port"/>
    <controller type="pci" index="12" model="pcie-root-port"/>
    <controller type="pci" index="13" model="pcie-root-port"/>
    <controller type="pci" index="14" model="pcie-root-port"/>
    <controller type="pci" index="15" model="pcie-root-port"/>
    <controller type="usb" index="0" model="qemu-xhci" ports="15"/>
    <disk device="cdrom" type="file">
      <source file="/Win11_22H2_64ARM_22621.ISO"/>
      <target bus="usb" dev="sda"/>
      <boot order="4"/>
      <readonly/>
    </disk>
    <disk device="cdrom" type="file">
      <driver name='qemu' type='raw'/>
      <source file="/virtio-win-0.1.229.iso"/>
      <target bus="usb" dev="sdb"/>
    </disk>
    <disk type="file">
      <driver type="qcow2" discard="unmap" detect_zeroes="unmap" cache="none"/>
      <source file="/win11testa/win11testa.vdisk1"/>
      <target bus="virtio" dev="vda"/>
      <boot order="3"/>
    </disk>
    <interface type="bridge">
      <source bridge="br1"/>
      <mac address="52:54:00:ee:b9:95"/>
      <model type="virtio"/>
      <virtualport type="openvswitch"/>
    </interface>
    <input type="mouse" bus="usb">
      <address type="usb" bus="0" port="13"/>
    </input>
    <input type="keyboard" bus="usb">
      <address type="usb" bus="0" port="14"/>
    </input>
    <input type="tablet" bus="usb">
      <address type="usb" bus="0" port="15"/>
    </input>
    <graphics autoport="yes" listen="::" type="spice" port="-1" tlsPort="-1">
      <channel name="display" mode="insecure"/>
      <channel name="main" mode="insecure"/>
      <channel name="inputs" mode="insecure"/>
      <channel name="cursor" mode="insecure"/>
      <channel name="playback" mode="insecure"/>
      <channel name="record" mode="insecure"/>
      <image compression="auto_glz"/>
      <jpeg compression="auto"/>
      <zlib compression="auto"/>
      <playback compression="off"/>
    </graphics>

    <video>
      <model type="virtio"/>
    </video>
    <sound model='ich9'>
    </sound>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
    </channel>
    <channel type="unix">
      <target type="virtio" name="org.qemu.guest_agent.0"/>
      <source mode="bind"/>
    </channel>
    <serial type="vc"/>
    <memballoon model="virtio">
      <stats period="6"/>
    </memballoon>
  </devices>
</domain>
vrozenfe commented 10 months ago

@gang929

Unfortunately, I don't have experience with arm VM's yet, but normally "-device virtio-gpu-pci" defines non-VGA device. Can you you try something like "-device virtio-vga,edid=on,xres=1024,yres=768" instead ?

Thanks, Vadim.

gang929 commented 10 months ago

qemu kvm arm dont support vga.

vrozenfe commented 10 months ago

maybe information in https://github.com/virtio-win/kvm-guest-drivers-windows/issues/805 can be helpful for you.

gang929 commented 10 months ago

The same. unable to change the resolution

FTR, I'm using -device virtio-gpu-pci on Win 11 for arm64 in QEMU with the current latest virtio-win.iso driver, the only issue is that I'm unable to change the resolution (using the VNC backend). My setup is this: https://gist.github.com/Vogtinator/293c4f90c5e92838f7e72610725905fd

vrozenfe commented 10 months ago

Thanks, Can not promise anything, but I will try my best to check this issue by end of the next week. Don't hesitate to ping me if you see no updates till then.

Vadim.

gang929 commented 10 months ago

It is maybe that when windows 11 is booting, it checked that vm has not vga compatible display adapter, so , it add a Basic Display Adapter and attach a General Non-Pnp Monitor. After the virtiogpu driver started, it can not replace the "Basic Display Adapter and General Non-Pnp Monitor". https://github.com/virtio-win/kvm-guest-drivers-windows/blob/322f1a40a7d100a989d835f98e84d1f032cf91ca/viogpu/viogpudo/viogpudo.cpp#L168

vrozenfe commented 10 months ago

IsVgaDevice() will return FALSE in case of "-device virtio-gpu-pci" It can be not relevant but during the development phase I quite often install viogpudod driver as "devcon update" when I need to install my driver instead on in-box bdd driver.