Where i can find ovmf_code.fd file?

I try to passthrough the Nvidia 1050 mobile gpu in KVM.
But when i try to install Windows OS,i’ve got a message
https://i.imgur.com/F1p0YnK.png

Unable to complete install: 'operation failed: unable to find any master var store for loader: /usr/share/qemu/ovmf-x86_64-smm-ms-code.bin'

As i read, i need to link file ovmf_code.fd from /usr/share/ovmf/ovmf_code.fd to /var/lib/libvirt/qemu/nvram/{NAME_OF_VM}_VARS.fd, but i have no such file(ovmf_code.fd) as /usr/share/ovmf .
Where i can get it?

Hi
I use gpu passthrough with qemu, to start my WinX vm I have the following line;


-drive if=pflash,format=raw,file=/usr/share/qemu/ovmf-x86_64-ms-code.bin

Hi!
Where you placed this line?
I was trying to implement this guide https://forums.opensuse.org/showthread.php/522015-VGA-PCI-Passthrough-guide-on-openSuSE-Leap-42-2 and i’ve got this problem before i start a new VM. So i create VM with GUI.
Did you use cli variant? Could you share full start line as example?

Thanks for helping!!

Hi
My full script is as follows;


#!/bin/bash

#Attach tap0 to bridge???
#ip tuntap add dev tap0 mode tap group root
#ip link set tap0 master br0
#wicked ifup tap0

#Create initial image via qemu-img create -f raw -o preallocation=full Win101909pt.raw  40G

qemu-system-x86_64 \
-m 8G \
-cpu host,kvm=off,hv_vendor_id=whatever \
-smp 4,sockets=1,cores=2,threads=2 \
-rtc clock=host,base=utc \
-serial none \
-parallel none \
-vga none \
-nographic \
-usb \
-device usb-host,vendorid=0x05af,productid=0x0808 \
-device vfio-pci,host=03:00.0 \
-device vfio-pci,host=03:00.1 \
-drive id=disk0,if=virtio,cache=none,format=raw,file=/var/lib/libvirt/images/Win101909pt.raw \
-drive file=/data/repositories/iso_images/Windows/Win10_1909_English_x64.iso,index=1,media=cdrom \
-drive file=/data/repositories/iso_images/Windows/virtio-win-0.1.173.iso,index=2,media=cdrom \
-drive if=pflash,format=raw,file=/usr/share/qemu/ovmf-x86_64-ms-code.bin \
-boot order=dc \
-machine type=pc-q35-4.0,accel=kvm,kernel_irqchip=on \
-nic tap,ifname=tap0,script=no,downscript=no

I use a tap for the network, the above is for initial install, then I remove reference to the install image. Passthrough is a GT710 card, I think you might have issues with a dGPU…

Have you configured iommu, vfio-pci etc?

I recall seeing a recent bug report on this. Apparently, using “virt-manager” from recent Tumbleweed, it does not set up a new virtual machine properly for UEFI.

You probably need to create the virtual machine with “virt-install”, where you can specify a template file for initializing virtual NVRAM.

I’m using Leap 15.1, and it is working well. But I occasionally use “virt-install” if I want to choose an ovmf option that is not provided by virt-manager.

Thanks for sharing your script!! I’ll try to use it

Yeap, i did all previous steps from that guide.
IOMMU output:


IOMMU Group 1:
        00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 07)
        01:00.0 3D controller [0302]: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] [10de:1c8d] (rev a1)

And dmesg iommu:


    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.3.12-2-default root=UUID=f0c760d0-f77f-4fef-9a42-51b6c1fc99ba splash=silent resume=/dev/mapper/cr_swap quiet elevator=kyber intel_iommu=on scsi_mod.use_blk_mq=1 mitigations=auto
    0.009116] ACPI: DMAR 0x0000000079584330 0000A8 (v01 INTEL  EDK2     00000002      01000013)
    0.084697] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.3.12-2-default root=UUID=f0c760d0-f77f-4fef-9a42-51b6c1fc99ba splash=silent resume=/dev/mapper/cr_swap quiet elevator=kyber intel_iommu=on scsi_mod.use_blk_mq=1 mitigations=auto
    0.084763] DMAR: **IOMMU enabled**
    0.109415] DMAR: Host address width 39
    0.109415] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
    0.109419] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 19e2ff0505e
    0.109420] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
    0.109422] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
    0.109422] DMAR: RMRR base: 0x0000007afdc000 end: 0x0000007b225fff
    0.109423] DMAR: RMRR base: 0x0000007d000000 end: 0x0000007f7fffff
    0.109424] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
    0.109425] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
    0.109425] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
    0.112644] DMAR-IR: Enabled IRQ remapping in x2apic mode
    1.198458] DMAR: No ATSR found
    1.198487] DMAR: dmar0: Using Queued invalidation
    1.198489] DMAR: dmar1: Using Queued invalidation
    1.198809] pci 0000:00:00.0: Adding to iommu group 0
    1.198821] pci 0000:00:01.0: Adding to iommu group 1
    1.198828] pci 0000:00:02.0: Adding to iommu group 2
    1.198834] pci 0000:00:04.0: Adding to iommu group 3
    1.198839] pci 0000:00:08.0: Adding to iommu group 4
    1.198847] pci 0000:00:12.0: Adding to iommu group 5
    1.199039] pci 0000:00:14.0: Adding to iommu group 6
    1.199044] pci 0000:00:14.2: Adding to iommu group 6
    1.199225] pci 0000:00:14.3: Adding to iommu group 6
    1.199235] pci 0000:00:15.0: Adding to iommu group 7
    1.199240] pci 0000:00:15.1: Adding to iommu group 7
    1.199248] pci 0000:00:16.0: Adding to iommu group 8
    1.199253] pci 0000:00:17.0: Adding to iommu group 9
    1.199267] pci 0000:00:1d.0: Adding to iommu group 10
    1.199281] pci 0000:00:1f.0: Adding to iommu group 11
    1.199287] pci 0000:00:1f.3: Adding to iommu group 11
    1.199293] pci 0000:00:1f.4: Adding to iommu group 11
    1.199299] pci 0000:00:1f.5: Adding to iommu group 11
    1.199304] pci 0000:01:00.0: Adding to iommu group 1
    1.199307] pci 0000:01:00.1: Adding to iommu group 1
    1.199323] pci 0000:02:00.0: Adding to iommu group 12
    1.199410] DMAR: Intel(R) Virtualization Technology for Directed I/O
   21.086777] pci 0000:01:00.1: Removing from iommu group 1

And vfio-pci is in use:


01:00.0 3D controller [0302]: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] [10de:1c8d] (rev a1)
        Subsystem: Dell Device [1028:086f]
        **Kernel driver in use: vfio-pci**
        Kernel modules: nouveau, nvidia_drm, nvidia

Thanks for sharing command! I’ll try to find more information about this command! Is it cli command, isn’t it?

You’re using an outdated guide. I posted the following a year later which points to “live” documentation which is updated continuously so never goes obsolete.

https://forums.opensuse.org/showthread.php/524942-GPU-passthrough-Various-virtualization-technologies?highlight=gpu+pas

The above link has info for all virtualizzation technologies

TSU

Either original advice was incorrect or you misremeber it. OVMF firmware image may be built as single code+variables file or as two separate files with code and variable store. ovmf_code suggests that this is split variant - in which case you cannot use the same file as variable store too (which is implied by ovmf_vars).

openSUSE ships both combined and split firmware images. As example:

/usr/share/qemu/ovmf-x86_64-ms.bin

combined image

/usr/share/qemu/ovmf-x86_64-ms-code.bin
/usr/share/qemu/ovmf-x86_64-ms-vars.bin

split images. The ovmf-x86_64-ms-code.bin corresponds to ovmf_code.fd, the ovmf-x86_64-ms-vars.bin - to ovmf_vars.fd.

There are multiple variants which mostly differ in certificates that are integrated.

While this works, it means you have no persistent EFI variable store. In general it makes sense to use per-VM variable store - just copy corresponding …-var.bin in private file:

    -drive if=pflash,format=raw,unit=0,file=$HOME/vm/uefi/ovmf-x86_64-ms-4m-code.bin,readonly=on \
    -drive if=pflash,format=raw,unit=1,file=$HOME/vm/uefi/ovmf-x86_64-ms-4m-vars.bin \

Hi
Thanks for the tip :slight_smile: Done and all works as expected…

Thanks, problem with VARS was solved!