Complete-Single-GPU-Passthrough icon indicating copy to clipboard operation
Complete-Single-GPU-Passthrough copied to clipboard

MSI Bravo 17

Open 512yottabytes opened this issue 2 years ago • 15 comments

Hello, Tryed on my laptop MSI Bravo 17 and got nothing. GUI hanged and nothing else. My lspci -nn:

00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Root Complex [1022:1630]
00:00.2 IOMMU [0806]: Advanced Micro Devices, Inc. [AMD] Renoir IOMMU [1022:1631]
00:01.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:01.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge [1022:1633]
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:02.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge [1022:1634]
00:02.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge [1022:1634]
00:02.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge [1022:1634]
00:08.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:08.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus [1022:1635]
00:08.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus [1022:1635]
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b] (rev 51)
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e] (rev 51)
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0 [1022:1448]
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1 [1022:1449]
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2 [1022:144a]
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3 [1022:144b]
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4 [1022:144c]
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5 [1022:144d]
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6 [1022:144e]
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7 [1022:144f]
01:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev c1)
02:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479]
03:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1002:7340] (rev c1)
03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio [1002:ab38]
04:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6 AX200 [8086:2723] (rev 1a)
05:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
06:00.0 Non-Volatile memory controller [0108]: Sandisk Corp Device [15b7:5009] (rev 01)
07:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [1002:1636] (rev c6)
07:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor [1022:15df]
07:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1 [1022:1639]
07:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1 [1022:1639]
07:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor [1022:15e2] (rev 01)
07:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller [1022:15e3]
08:00.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901] (rev 81)
08:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901] (rev 81)

So I changed

virsh nodedev-detach pci_0000_01_00_0
virsh nodedev-detach pci_0000_01_00_1

to

virsh nodedev-detach pci_0000_07_00_0
virsh nodedev-detach pci_0000_07_00_6

, am I right?

512yottabytes avatar Jul 05 '21 16:07 512yottabytes

You're currently trying to detach integrated GPU. You need to use pci_0000_03_00_0 and pci_0000_03_00_1 instead.

QaidVoid avatar Jul 06 '21 01:07 QaidVoid

Thank you. Now I can see SystemD init process on external display, but only if I add QXL or VGA. When boot process is over and LightDM of the VM started -- external display shows No Signal. Without QXL or VGA I see only No Signal and nothing else.

I've tryed to get ROM, but got I/O error:

echo 1 > /sys/bus/pci/devices/0000:03:00.0/rom
cat /sys/bus/pci/devices/0000:03:00.0/rom > vbios.rom
Input-output error

512yottabytes avatar Jul 06 '21 11:07 512yottabytes

Please provide the log file at: /var/log/libvirt/qemu/your_vm_name.log

QaidVoid avatar Jul 06 '21 11:07 QaidVoid

log.log Here it is.

512yottabytes avatar Jul 06 '21 11:07 512yottabytes

On your CPU section, use -cpu host and remove the explicitly mentioned features. I'm not sure if those are the requirements to get macos running under KVM, so I don't know if that'll work. Did it work without passthrough?

QaidVoid avatar Jul 06 '21 12:07 QaidVoid

Both with macOS an Ubuntu it works without passthrough. Changed to host and it worked with Linux, but it seems something is wrong with my GPU. зображення_viber_2021-07-06_15-16-10 I think it wouldn't be possible to run macOS with cpu=host...

512yottabytes avatar Jul 06 '21 12:07 512yottabytes

Tryed Linux with:

    <qemu:arg value="-cpu"/>
    <qemu:arg value="Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"/>

also worked fine, except the picture on the external display broken as on the photo above.

But I have the same broken picture I have on my host OS, when I switch to 2 displays (I think laptop switches from integrated GPU to discrete one, when I attach 2nd display to the host OS. Am I right?)

MacOS shows nothing on external display, while seems to boot properly (I see it on serial Qemu console). I'll try to boot Windows this way. It's interesting, will broken picture appear in it too?

512yottabytes avatar Jul 06 '21 12:07 512yottabytes

The display issue happens right after connecting external monitor or during passthrough only? I use single monitor on my PC so I don't really have any idea on what might be happening..

Passthrough doesn't work on my system for now.. I'll check if I can get macOS running with passthrough later..

QaidVoid avatar Jul 06 '21 13:07 QaidVoid

The display issue happens right after connecting external monitor, and it doesn't matter if I do passthrough, or if I attach 2nd display to my laptop, as usual 2nd display. The only difference, that if I attach 2nd display to my host OS, the picture on laptop's display becomes broken, but on the external display the picture is fine.

Also tryed with Windows 10 Installer (iso) -- got nothing on the external display. Maybe it would work with preinstalled Windows, with preinstalled Radeon GPU driver... Also I'll try to boot Ubuntu with vesa nomodeset, and maybe the picture will be fine, this time.

UPD: with vesa nomodeset or just with nomodeset nothing works. No Signal.

512yottabytes avatar Jul 06 '21 13:07 512yottabytes

It's working on my system with passthrough. My mouse didn't work under macOS and keyboard stopped working on language selection screen so I wasn't able to install it.. Here's my script:

OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
OVMF=$PWD/firmware
ROMFILE="GP106.rom"
DISK="/home/qaidvoid/vm/macos.img"
USER="qaidvoid"

qemu-system-x86_64 \
    -runas $USER \
    -nodefaults \
    -enable-kvm \
    -machine q35,accel=kvm \
    -cpu Penryn,vendor=GenuineIntel,kvm=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check,+invtsc \
    -m 4G \
    -smp 4,cores=2 \
    -device isa-applesmc,osk="$OSK" \
    -smbios type=2 \
    -drive if=pflash,format=raw,readonly=on,file="$OVMF/OVMF_CODE.fd" \
    -drive if=pflash,format=raw,file="$OVMF/OVMF_VARS-1024x768.fd" \
    -device usb-ehci,id=ehci \
    -device ich9-ahci,id=sata \
    -device ide-hd,bus=sata.2,drive=ESP \
    -device ide-hd,bus=sata.3,drive=InstallMedia \
    -device ide-hd,bus=sata.4,drive=MacOS \
    -drive id=ESP,if=none,format=qcow2,file=ESP.qcow2 \
    -drive id=InstallMedia,format=raw,if=none,file=BaseSystem.img \
    -drive id=MacOS,if=none,file=$DISK,format=raw \
    -serial none \
    -net nic \
    -net user \
    -vga none \
    -nographic \
    -device vfio-pci,host=01:00.0,x-vga=on,multifunction=on,romfile=$ROMFILE \
    -device vfio-pci,host=01:00.1 \
    -object input-linux,id=mouse1,evdev=/dev/input/by-id/usb-PixArt_HP_USB_Optical_Mouse-event-mouse \
    -object input-linux,id=kbd1,evdev=/dev/input/by-id/usb-Chicony_USB_Keyboard-event-kbd,grab_all=on,repeat=on \
    -device virtio-keyboard \
    -device virtio-mouse

QaidVoid avatar Jul 06 '21 15:07 QaidVoid

Great! Maybe I need to dump ROM? But, unfortunately, I can't:

echo 1 > /sys/bus/pci/devices/0000:03:00.0/rom
cat /sys/bus/pci/devices/0000:03:00.0/rom > vbios.rom
Input-output error

Is there any other way to get ROM, or have I done something wrong?

UPD: It was simple:

echo 1 > /sys/bus/pci/devices/0000\:03\:00.0/rom
cat /sys/bus/pci/devices/0000\:03\:00.0/rom > vbios.rom
Input-output error

It worked this way.

512yottabytes avatar Jul 06 '21 16:07 512yottabytes

In my case MacOS didn't work. Maybe, because my ROM isn't PCIR: type 3 (EFI)... Also Qemu reported, that x-vga=on isn't supported. I've enabled serial, to see at least something... I don't think serail will break all, won't it?

Tried to boot Windows with:

qemu-system-x86_64 \
    -enable-kvm \
    -m 4G \
    -machine q35,accel=kvm \
    -smp 4,cores=2 \
    -cpu Penryn,vendor=GenuineIntel,kvm=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc \
    -smbios type=2 \
    -netdev user,id=net0 \
    -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
    -device ich9-ahci,id=sata \
    -drive id=ESP,if=none,format=qcow2,file=/var/lib/libvirt/images/win10-2-clone.qcow2 \
    -device ide-hd,bus=sata.2,drive=ESP \
    -vga none \
    -device pcie-root-port,bus=pcie.0,multifunction=on,port=1,chassis=1,id=port.1 \
    -device vfio-pci,host=03:00.0,bus=port.1,multifunction=on \
    -device vfio-pci,host=03:00.1,bus=port.1 \
    -object input-linux,id=mouse1,evdev=/dev/input/by-id/usb-YSPRINGTECH_USB_OPTICAL_MOUSE-event-mouse \
    -object input-linux,id=kbd1,evdev=/dev/input/by-id/usb-BTC_USB_Keyboard-event-kbd,grab_all=on,repeat=on \
    -device virtio-keyboard \
    -device virtio-mouse
    ```
    and failed. `No Signal`. Maybe I need patched ROM for Windows too. 

512yottabytes avatar Jul 06 '21 17:07 512yottabytes

Found patched ROM for my GPU (https://www.techpowerup.com/vgabios/216922/AMD.RX5500XT.8192.191017.rom). Used your command, that you wrote here in comments. All worked! (Almost, neither mouse nor keyboard works) зображення_viber_2021-07-06_21-57-05

As for Windows (using -cpu host), -- it works disgusting. Drivers autodetection doesn't work. Edge doesn't work. I ought to use IExplorer to download Firefox. Screen resolution -- only 800x600. AMD Automatic driver installer sees no AMD devices. Download something in Firefox -- BSOD. Launch .exe -- BSOD. Download Windows updates -- BSOD.

512yottabytes avatar Jul 06 '21 18:07 512yottabytes

Thank you!!!

512yottabytes avatar Jul 06 '21 19:07 512yottabytes

Using evdev for keyboard/mouse passthrough didn't work.

But using this works:

-usb \
-device usb-host,vendorid=0x1532,productid=0x0101,id=mouse \
-device usb-host,vendorid=0x04f2,productid=0x0833,id=keyboard

You can find vendorid and productid using lsusb.

With this method, you can't switch between host & guest though..

QaidVoid avatar Jul 07 '21 04:07 QaidVoid

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 03 '23 15:09 stale[bot]