Re: [Bug 211189] New: vgaarb overrides boot device unexpectedly with Intel and discrete AMDGPU

From: Bjorn Helgaas
Date: Thu Jan 14 2021 - 14:21:41 EST


[cc'd efifb and vgaarb maintainers on bugzilla, but not sure whether
people pay attention to that]

On Thu, Jan 14, 2021 at 10:42:53AM +0000, bugzilla-daemon@xxxxxxxxxxxxxxxxxxx wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=211189
>
> Bug ID: 211189
> Summary: vgaarb overrides boot device unexpectedly with Intel
> and discrete AMDGPU
> Product: Drivers
> Version: 2.5
> Kernel Version: 5.10.7-200.fc33.x86_64
> Hardware: x86-64
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: PCI
> Assignee: drivers_pci@xxxxxxxxxxxxxxxxxxxx
> Reporter: dominik@xxxxxxxxxxxxxx
> Regression: No
>
> The system is a MSI Z77A-GD65 mainboard configured to boot in UEFI mode.
> Despite setting integrated GPU (from i5-3570K CPU) as the default in firmware
> setup, the kernel sets the discrete GPU (Radeon HD 7950) as boot_vga. This
> results in wrong order in e.g. switcherooctl:
> $ switcherooctl list
> Device: 0
> Name: Advanced Micro Devices, Inc. [AMD®/ATI] Tahiti PRO [Radeon HD
> 7950/8950 OEM / R9 280]
> Default: yes
> Environment: DRI_PRIME=pci-0000_01_00_0
>
> Device: 1
> Name: Intel® HD Graphics 4000
> Default: no
> Environment: DRI_PRIME=pci-0000_00_02_0
> $ lspci -vnn
> ...
> 00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v2/3rd
> Gen Core processor Graphics Controller [8086:0162] (rev 09) (prog-if 00 [VGA
> controller])
> DeviceName: Onboard IGD
> Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:2111]
> Flags: bus master, fast devsel, latency 0, IRQ 31
> Memory at f7800000 (64-bit, non-prefetchable) [size=4M]
> Memory at d0000000 (64-bit, prefetchable) [size=256M]
> I/O ports at f000 [size=64]
> Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
> Capabilities: [d0] Power Management version 2
> Capabilities: [a4] PCI Advanced Features
> Kernel driver in use: i915
> Kernel modules: i915
> ...
> 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc.
> [AMD/ATI] Tahiti PRO [Radeon HD 7950/8950 OEM / R9 280] [1002:679a] (prog-if 00
> [VGA controller])
> Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:2761]
> Flags: bus master, fast devsel, latency 0, IRQ 32
> Memory at e0000000 (64-bit, prefetchable) [size=256M]
> Memory at f7d00000 (64-bit, non-prefetchable) [size=256K]
> I/O ports at e000 [size=256]
> Expansion ROM at 000c0000 [disabled] [size=128K]
> Capabilities: [48] Vendor Specific Information: Len=08 <?>
> Capabilities: [50] Power Management version 3
> Capabilities: [58] Express Legacy Endpoint, MSI 00
> Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
> Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010
> <?>
> Capabilities: [150] Advanced Error Reporting
> Capabilities: [270] Secondary PCI Express
> Capabilities: [2b0] Address Translation Service (ATS)
> Capabilities: [2c0] Page Request Interface (PRI)
> Capabilities: [2d0] Process Address Space ID (PASID)
> Kernel driver in use: amdgpu
> Kernel modules: radeon, amdgpu
>
> $ for f in /sys/bus/pci/devices/*/boot_vga ; do echo -n "$f:" ; cat $f ; done
> /sys/bus/pci/devices/0000:00:02.0/boot_vga:0
> /sys/bus/pci/devices/0000:01:00.0/boot_vga:1
>
> $ dmesg
> ...
> [ 0.267216] pci 0000:01:00.0: BAR 0: assigned to efifb

This is from drivers/video/fbdev/efifb.c and makes me wonder if this
is a firmware defect. You set 00:02.0 to be the default in firmware
setup, but apparently the EFI FB is using 01:00.0?

> [ 0.268571] pci 0000:00:02.0: vgaarb: setting as boot VGA device
> [ 0.268571] pci 0000:00:02.0: vgaarb: VGA device added:
> decodes=io+mem,owns=io+mem,locks=none
> [ 0.268571] pci 0000:01:00.0: vgaarb: VGA device added:
> decodes=io+mem,owns=io+mem,locks=none
> [ 0.268571] pci 0000:00:02.0: vgaarb: no bridge control possible
> [ 0.268571] pci 0000:01:00.0: vgaarb: bridge control possible
> [ 0.268571] pci 0000:01:00.0: vgaarb: overriding boot device
> [ 0.268571] vgaarb: loaded
> [ 0.754748] efifb: probing for efifb
> [ 0.754766] efifb: No BGRT, not showing boot graphics
> [ 0.754768] efifb: framebuffer at 0xe0000000, using 8100k, total 8100k
> [ 0.754769] efifb: mode is 1920x1080x32, linelength=7680, pages=1
> [ 0.754770] efifb: scrolling: redraw
> [ 0.754772] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
> [ 2.984727] i915 0000:00:02.0: vgaarb: changed VGA decodes:
> olddecodes=io+mem,decodes=none:owns=io+mem
> [ 3.011601] [drm] Initialized i915 1.6.0 20200917 for 0000:00:02.0 on minor
> 0
> [ 3.213870] [drm] amdgpu kernel modesetting enabled.
> [ 3.275739] i915 0000:00:02.0: [drm] fb1: i915drmfb frame buffer device
> [ 3.275972] fb0: switching to amdgpudrmfb from EFI VGA
> [ 3.276112] amdgpu 0000:01:00.0: vgaarb: deactivate vga console
> [ 3.276240] [drm] initializing kernel modesetting (TAHITI 0x1002:0x679A
> 0x1462:0x2761 0x00).
> ...
> [ 4.069577] amdgpu 0000:01:00.0: [drm] fb0: amdgpudrmfb frame buffer device
> [ 4.351324] [drm] Initialized amdgpu 3.40.0 20150101 for 0000:01:00.0 on
> minor 1
>
> --
> You may reply to this email to add a comment.
>
> You are receiving this mail because:
> You are watching the assignee of the bug.