VFIO, OVMF, GPU, and You The state of GPU assignment in QEMU/KVM - - PowerPoint PPT Presentation

vfio ovmf gpu and you
SMART_READER_LITE
LIVE PREVIEW

VFIO, OVMF, GPU, and You The state of GPU assignment in QEMU/KVM - - PowerPoint PPT Presentation

VFIO, OVMF, GPU, and You The state of GPU assignment in QEMU/KVM Alex Williamson / alex.williamson@redhat.com The current state of VGA assignment VGA assignment defined: Graphics card assigned as primary graphics for the VM Uses VGA BIOS for


slide-1
SLIDE 1

VFIO, OVMF, GPU, and You

The state of GPU assignment in QEMU/KVM

Alex Williamson / alex.williamson@redhat.com

slide-2
SLIDE 2

The current state of VGA assignment

slide-3
SLIDE 3

VGA assignment defined:

Graphics card assigned as primary graphics for the VM Uses VGA BIOS for initialization and runtime services

slide-4
SLIDE 4

Status:

Works for discrete graphics cards AMD Radeon (HD5xxx+) NVIDIA GeForce (8-series+) Requires experimental vfio-pci option x-vga=on Requires working VGA arbitration Still some device specific glitches BSODs with AMD Catalyst + HDMI audio Reset issues on some Radeon cards Code 43 on GeForce

slide-5
SLIDE 5

Issues:

Requires experimental vfio-pci option, x-vga=on Not supported by libvirt because experimental Experimental because... Requires working VGA arbitration Drivers don't participate (vgacon) Drivers lie (i915) Xorg DRI can't handle multiple arbitration participants

slide-6
SLIDE 6

Can't we fix these?

Drivers don't participate Drivers lie Xorg DRI can't handle multiple arbitration participants fixable Once upon a time... i915 hardware allowed control of VGA resources nobody noticed?! i915 continues to opt-out anyway But if we fix that... designers dropped this feature

slide-7
SLIDE 7

Start with fixing Xorg

DRI wants to mmap VGA MMIO space Possible options... Provide a new VGA arbiter interface allowing mmaps Remove the mmap requirement But what about compatibility? “WE DO NOT BREAK USERSPACE!”

  • Linus Torvalds
slide-8
SLIDE 8

VGA assignment status: Stuck

slide-9
SLIDE 9

What else could we do?

slide-10
SLIDE 10

Do we really need VGA?

slide-11
SLIDE 11

Secondary graphics

Emulated VGA for VM primary display Assigned graphics card for secondary Supported by NVIDIA Requires K-series Quadro/GRID/Tesla Supported in RHEL7.0 Some reports of success with Radeon

Depends on guest driver support

slide-12
SLIDE 12

Legacy-free UEFI VM

No VGA required

No VGA arbitration required!

slide-13
SLIDE 13

Problem solved?

VGA Issues:

Requires "experimental" vfio-pci option Not supported by libvirt because experimental Experimental because... Requires working VGA arbitration Drivers don't participate (vgacon) Drivers lie (i915) Xorg DRI cannot handle multiple arbitration participants

slide-14
SLIDE 14

No Blockers

slide-15
SLIDE 15

How do UEFI?

slide-16
SLIDE 16

Step 1: OVMF

Open Virtual Machine Firmware An implementation of UEFI built on the EDK II code base Replaces Seabios

slide-17
SLIDE 17

OVMF Setup

via command line: via libvirt:

/usr/libexec/qemu-kvm ... \

  • drive if=pflash,format=raw,readonly,file=/path/to/OVMF_CODE.fd \
  • drive if=pflash,format=raw,file=/copy/of/OVMF_VARS.fd

<domain type='kvm'> ... <os> <loader readonly='yes' type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd</loader> <nvram template='/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd'/> ... </os> </domain>

slide-18
SLIDE 18

Step 2: EFI graphics card ROM

PCI ROMs can support muliple images Most newer cards already support EFI

slide-19
SLIDE 19

Step 3: UEFI compatible guest

Newer versions of Linux Windows 8, Server 2012

slide-20
SLIDE 20

That's it!

slide-21
SLIDE 21

Other GPU Topics

slide-22
SLIDE 22

440FX vs Q35

Q35 originally recommended for VFIO-VGA Largely FUD Q35 looks more like the host platform Some Linux drivers assume an upstream PCIe port In reality Windows doesn't care Linux is fixable 440FX is likely the easier path for Windows guests

slide-23
SLIDE 23

NVIDIA: Code 43

Driver detects KVM hypervisor, fails to initialize* Nvidia - "Accidental" breakage, won't fix, unsupported We can't solve it, but we can work around it Hide the hypervisor via command line: via libvirt:

*NVIDIA driver version 338.77+

  • cpu [type],kvm=off

<domain type='kvm'> ... <features> <kvm> <hidden state='on'/> </kvm> ... </features> </domain>

slide-24
SLIDE 24

NVIDIA: Code 43 Redux

Driver detects Hyper-V extensions, fails to initialize* Workaround: Disable use of Hyper-V extensions Performance hit for Windows VMs Have we entered an arms race?

*NVIDIA driver version 344.11

slide-25
SLIDE 25

Quirks

GeForce: Radeon: One still required* Not needed!

*QEMU now enables this independent of x-vga (2.2)

slide-26
SLIDE 26

Unresolved Issues

Radeon device resets Sea Island GPUs don't reset correctly SMC firmware issue? Southern Island GPUs indicate PM reset capability doesn't work Radeon BSOD Typically resolved by avoiding audio function Intel Graphics support In progress? KvmGT? Host/Guest suspend And ponies!

slide-27
SLIDE 27

Resources

VFIO tips and tricks blog: This presentation: http://vfio.blogspot.com http://awilliam.github.io/presentations/KVM-Forum-2014

slide-28
SLIDE 28

Thank you

slide-29
SLIDE 29

Alex Williamson / alex.williamson@redhat.com