Thanks all for your posts here and elsewhere.
I am this guy:
https://heiko-sieger.info/running-windo ... comment-27
After struggling with this for a while there seem to be 4 main ways to get this going (paraphrasing / winging it)
1) Traditional Desktop - passthrough the GPU card, the bios is in a predictable place, windows is happy - works with most desktops and some high end laptops
2) Misairu_G laptop - as for #1 but you need to do some voodoo to make sure the GPU is powered when you boot qemu - works with some laptops
3) jscinoz - as for #2 but you also need to figure out your laptops acpi table so that the guest OS can find the video bios - has only worked for a hacked linux guest
4) bash64 - let the laptop's bios initialize the cards and if you set up linux so it doesn't touch them before you run qemu it should all be good - most promising for me
@bash64 I'm after some more details on your setup to see if it's similar to mine
Questions:
- how do I tell if my GPU is powered on?
- what are the next things I should try?
- is there some difference between your working setup and mine which might be important?
- any linux commandline args I should get rid of / add / try?
I've installed windows 10 successfully using approach #2 but I get Code 43. Similarly I can boot a linux ISO within the same KVM setups.
cheers,
Woody
My setup now...
Running Ubuntu 18.04, not mint:
Code: Select all
Linux curtis 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
P950ER Clevo / Metabox
2 VGA cards in PCI; seems that the Nvidia is connected to the 3 external ports (going by windows nvidia control panel), Intel to the LCD (muxless)
When I boot up (windows or linux) the external monitors do not show anything until the OS is booted (e.g. windows 10 login)
This is in contrast to my old laptop P650 Clevo which has the Nvidia card listed as a "3D" device not a VGA, and the grub menu shows in whatever monitors I have connected. It seems to be Muxed, nvidia seems to connect to all monitors as needed.
Code: Select all
woody@curtis:~$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 3e9b
01:00.0 VGA compatible controller: NVIDIA Corporation GP104M [GeForce GTX 1070 Mobile] (rev a1)
woody@curtis:~$
Kernel Commandline and IOMMU:
Code: Select all
woody@curtis:~$ dmesg | grep -i iommu
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-29-generic root=UUID=69e42b1f-6eb0-11e8-a77a-80fa5b5a9d89 ro blacklist=nouveau modprobe.blacklist=nouveau nouveau.blacklist=1 elevator=deadline drm.debug=0xe intel_iommu=on kvm.ignore_msrs=1 acpi_osi=! acpi_osi=Linux "acpi_osi=Windows 2009" default_hugepagesz=1G hugepagesz=1G hugepages=12 transparent_hugepage=never rd.driver.pre=vfio-pci systemd.log_level=debug systemd.journald.forward_to_console=2 console=tty1 nomodeset
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-29-generic root=UUID=69e42b1f-6eb0-11e8-a77a-80fa5b5a9d89 ro blacklist=nouveau modprobe.blacklist=nouveau nouveau.blacklist=1 elevator=deadline drm.debug=0xe intel_iommu=on kvm.ignore_msrs=1 acpi_osi=! acpi_osi=Linux "acpi_osi=Windows 2009" default_hugepagesz=1G hugepagesz=1G hugepages=12 transparent_hugepage=never rd.driver.pre=vfio-pci systemd.log_level=debug systemd.journald.forward_to_console=2 console=tty1 nomodeset
[ 0.000000] DMAR: IOMMU enabled
[ 0.004000] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 2.234880] iommu: Adding device 0000:00:00.0 to group 0
[ 2.234894] iommu: Adding device 0000:00:01.0 to group 1
[ 2.234903] iommu: Adding device 0000:00:02.0 to group 2
[ 2.234913] iommu: Adding device 0000:00:08.0 to group 3
[ 2.234925] iommu: Adding device 0000:00:12.0 to group 4
[ 2.234951] iommu: Adding device 0000:00:14.0 to group 5
[ 2.234959] iommu: Adding device 0000:00:14.2 to group 5
[ 2.234976] iommu: Adding device 0000:00:14.3 to group 5
[ 2.234987] iommu: Adding device 0000:00:16.0 to group 6
[ 2.234997] iommu: Adding device 0000:00:17.0 to group 7
[ 2.235018] iommu: Adding device 0000:00:1d.0 to group 8
[ 2.235034] iommu: Adding device 0000:00:1d.6 to group 9
[ 2.235046] iommu: Adding device 0000:00:1d.7 to group 10
[ 2.235066] iommu: Adding device 0000:00:1f.0 to group 11
[ 2.235076] iommu: Adding device 0000:00:1f.3 to group 11
[ 2.235085] iommu: Adding device 0000:00:1f.4 to group 11
[ 2.235097] iommu: Adding device 0000:00:1f.5 to group 11
[ 2.235103] iommu: Adding device 0000:01:00.0 to group 1
[ 2.235118] iommu: Adding device 0000:03:00.0 to group 12
[ 2.235137] iommu: Adding device 0000:04:00.0 to group 13
woody@curtis:~$
So group 1 is the card + the bridge, but I'm only binding vfio-pci to the card and passing that to qemu:
Code: Select all
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
01:00.0 VGA compatible controller: NVIDIA Corporation GP104M [GeForce GTX 1070 Mobile] (rev a1)
Binding the card to vfio-pci seems to be working
Code: Select all
woody@curtis:~$ lspci -nnk -s 01:00.0
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104M [GeForce GTX 1070 Mobile] [10de:1ba1] (rev a1)
Kernel driver in use: vfio-pci
Kernel modules: nvidiafb, nouveau
woody@curtis:~$
Booting up with nomodeset seems to work fine in linux
Code: Select all
woody@curtis:~$ inxi -Gx
Graphics: Card-1: Intel Device 3e9b bus-ID: 00:02.0
Card-2: NVIDIA GP104M [GeForce GTX 1070 Mobile] bus-ID: 01:00.0
Display Server: x11 (X.Org 1.19.6 ) drivers: fbdev (unloaded: modesetting,vesa)
Resolution: 3840x2160@88.00hz
OpenGL: renderer: llvmpipe (LLVM 6.0, 256 bits) version: 3.3 Mesa 18.0.5 Direct Render: Yes
woody@curtis:~$
Running my script: bash64 with a bit of acpi power on:
Code: Select all
#!/bin/bash
#lookingglass...
#cd /media/dad/QEMU-SSD/qemu-wd
#comment out nbd section. may not work with windows 10...
<<NBDSECTION
echo 'Creating nbd device nodes...'
sudo modprobe nbd max_part=63
sleep 2
echo 'Attach hardfile to device node nbd0...'
qemu-nbd -f raw -c /dev/nbd0 windows7.img
echo 'Create folder to mount hardfile to...'
mkdir -p /media/w7
echo 'Mount nbd0p1 to the folder...'
mount /dev/nbd0p1 /media/w7
echo 'Display the contents of the mounted folder...'
ls /media/w7/Boot/
echo 'Replace BOOTSTAT.DAT with backup copy...'
cp BOOTSTAT.DAT /media/w7/Boot/
cp BCD.LOG /media/w7/Boot/
cp BCD.LOG1 /media/w7/Boot/
cp BCD.LOG2 /media/w7/Boot/
echo 'Wait 5 seconds...'
sleep 5
echo 'Unmount and remove folder...'
umount /media/w7
echo 'Disconnect nbd device node...'
qemu-nbd -d /dev/nbd0
NBDSECTION
configfile=/media/dad/QEMU-SSD/qemu-wd/vfio-pci1.cfg
#vfiobind function....
#vfiobind() {
# dev="$1"
# vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
# device=$(cat /sys/bus/pci/devices/$dev/device)
# echo $dev $vendor $device
# if [ -e /sys/bus/pci/devices/$dev/driver ]; then
# echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
# fi
# echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
#}
#modprobe vfio-pci
#cat $configfile | while read line;do
# echo $line | grep ^# >/dev/null 2>&1 && continue
# vfiobind $line
#done
# use pulseaudio
# use pulseaudio
export QEMU_AUDIO_DRV=pa
#export QEMU_PA_SAMPLES=8192
export QEMU_AUDIO_TIMER_PERIOD=99
export QEMU_PA_SERVER=/run/user/1000/pulse/native
#export QEMU_PA_BUFFER_SIZE_OUT=5000
#export QEMU_PA_BUFFER_SIZE_IN=5000
#export QEMU_PA_TLENGTH=5000
#export QEMU_PA_FRAGSIZE=5000
#use ALSA
#export QEMU_ALSA_DAC_BUFFER_SIZE=512
#export QEMU_ALSA_DAC_PERIOD_SIZE=170
#export QEMU_AUDIO_DRV=alsa
# display current time and expected boot time for Windows...
boottime1=$(date -d "$starttime today + 0 minutes" +'%I:%M:%S')
boottime2=$(date -d "$starttime today + 1 minutes + 13 seconds" +'%I:%M:%S')
echo "Windows expected to reach desktop at $boottime2..."
echo turn on nvidia card
modprobe -v acpi_call
echo '\_SB_.PCI0.PEG0.PEGP._ON' > /proc/acpi/call
echo sleep 2...
sleep 2;
echo slept;
# bind it to vfio-pci
#modprobe vfio-pci
#echo "10de 1ba1" > /sys/bus/pci/drivers/vfio-pci/new_id
#launch windows 7 64bit using SEABIOS (non-uefi bios)....
#/home/dad/qemu/build/x86_64-softmmu/
#-chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios \
#-bios /media/dad/QEMU-SSD/qemu-wd/bios.bin-1.8.0 \
qemu-system-x86_64 \
-machine type=q35,accel=kvm \
-chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios \
-bios /usr/share/seabios/bios.bin \
-cpu host,kvm=off \
-smp 1,sockets=1,cores=1,threads=1 \
-m 12G \
-mem-path /dev/hugepages \
-nodefaults \
-soundhw hda \
-mem-prealloc \
-rtc clock=host,base=localtime \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0 \
-boot menu=on \
-boot order=dc \
-drive id=disk0,if=virtio,cache=none,format=raw,file=/home/woody/win.img \
-drive file=/home/woody/Downloads/virtio-win-0.1.141.iso,index=2,media=cdrom \
-spice port=5900,addr=127.0.0.1,disable-ticketing \
#-device vfio-pci,host=01:00.1 \
#-device virtio-scsi-pci,id=scsi \
#-drive id=disk0,if=virtio,cache=none,format=raw,file=/media/dad/QEMU-SSD/qemu-wd/windows10.img \
#-drive file=/media/dad/QEMU-SSD/qemu-wd/virtio-win-0.1.126.iso,id=isocd,format=raw,if=none -device scsi-cd,drive=isocd \
#-netdev type=tap,id=net0,ifname=tap0 \
#-device virtio-net-pci,netdev=net0,mac=00:16:3e:00:01:01 \
#-usb -device usb-host,vendorid=0x276d,productid=0x1119 \
# unbind + unload vfio-pci
#echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/0000:01:00.0/driver/unbind
#modprobe -r vfio-pci
# turn off nvidia card
#echo '\_SB_.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call
#modprobe -r acpi_call
exit 0
#lookingglass entries
#-object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=32M \
#-device ivshmem-plain,memdev=ivshmem \
#-spice port=5900,addr=127.0.0.1,disable-ticketing \
It looks OK but still hangs at "Running option rom at c000:0003"
Code: Select all
woody@curtis:~$ sudo ./bash64_mod.sh
[sudo] password for woody:
Windows expected to reach desktop at 12:16:28...
turn on nvidia card
sleep 2...
slept
SeaBIOS (version 1.10.2-1ubuntu1)
BUILD: gcc: (Ubuntu 6.3.0-16ubuntu6) 6.3.0 20170506 binutils: (GNU Binutils for Ubuntu) 2.28
Running on QEMU (q35)
RamSize: 0x80000000 [cmos]
Relocating init from 0x000e3160 to 0x7ffb1d20 (size 57920)
Found QEMU fw_cfg
QEMU fw_cfg DMA interface supported
RamBlock: addr 0x0000000000000000 len 0x0000000080000000 [e820]
RamBlock: addr 0x0000000100000000 len 0x0000000280000000 [e820]
Moving pm_base to 0x600
=== PCI bus & bridge init ===
PCI: pci_bios_init_bus_rec bus = 0x0
PCI: pci_bios_init_bus_rec bdf = 0xe0
PCI: primary bus = 0x0
PCI: secondary bus = 0xff -> 0x1
PCI: pci_bios_init_bus_rec bus = 0x1
PCI: subordinate bus = 0x0 -> 0x1
=== PCI device probing ===
Found 8 PCI devices (max PCI bus is 01)
=== PCI new allocation pass #1 ===
PCI: check devices
PCI: secondary bus 1 size 00001000 type io
PCI: secondary bus 1 size 02000000 type mem
PCI: secondary bus 1 size 20000000 type prefmem
=== PCI new allocation pass #2 ===
PCI: IO: c000 - d09f
PCI: 32: 00000000c0000000 - 00000000fec00000
PCI: map device bdf=00:02.0 bar 0, addr 0000d000, size 00000040 [io]
PCI: map device bdf=00:1f.3 bar 4, addr 0000d040, size 00000040 [io]
PCI: map device bdf=00:1f.2 bar 4, addr 0000d080, size 00000020 [io]
PCI: map device bdf=00:01.0 bar 0, addr fe000000, size 00004000 [mem]
PCI: map device bdf=00:02.0 bar 1, addr fe004000, size 00001000 [mem]
PCI: map device bdf=00:1f.2 bar 5, addr fe005000, size 00001000 [mem]
PCI: map device bdf=00:02.0 bar 4, addr f0000000, size 00004000 [prefmem]
PCI: map device bdf=01:00.0 bar 5, addr 0000c000, size 00000080 [io]
PCI: map device bdf=01:00.0 bar 0, addr fc000000, size 01000000 [mem]
PCI: map device bdf=01:00.0 bar 6, addr fd000000, size 00080000 [mem]
PCI: map device bdf=01:00.0 bar 1, addr d0000000, size 10000000 [prefmem]
PCI: map device bdf=01:00.0 bar 3, addr e0000000, size 02000000 [prefmem]
PCI: init bdf=00:00.0 id=8086:29c0
PCI: init bdf=00:01.0 id=8086:2668
PCI: init bdf=00:02.0 id=1af4:1001
PCI: init bdf=00:1c.0 id=8086:3420
PCI: init bdf=00:1f.0 id=8086:2918
Q35 LPC init: elcr=00 0c
Using pmtimer, ioport 0x608
PCI: init bdf=00:1f.2 id=8086:2922
PCI: init bdf=00:1f.3 id=8086:2930
PCI: init bdf=01:00.0 id=10de:1ba1
PCI: Enabling 01:00.0 for primary VGA
PCI: Setting VGA enable on bridge 00:1c.0
Found 1 cpu(s) max supported 1 cpu(s)
Copying PIR from 0x7ffbfca0 to 0x000f1320
Copying MPTABLE from 0x00006e90/7ffa8930 to 0x000f1230
Copying SMBIOS entry point from 0x00006e90 to 0x000f1070
Scan for VGA option rom
Running option rom at c000:0003