Bug 211189 - vgaarb overrides boot device unexpectedly with Intel and discrete AMDGPU
Summary: vgaarb overrides boot device unexpectedly with Intel and discrete AMDGPU
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_video-dri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-14 10:42 UTC by Dominik Mierzejewski
Modified: 2023-01-09 19:24 UTC (History)
5 users (show)

See Also:
Kernel Version: 5.10.7-200.fc33.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg from kernel 5.10.7 (90.96 KB, text/plain)
2021-01-16 13:57 UTC, Dominik Mierzejewski
Details
dmesg from Intel Alder Lake + Radeon RX 580 (93.17 KB, text/plain)
2023-01-09 16:52 UTC, Eduardo Medina
Details

Description Dominik Mierzejewski 2021-01-14 10:42:53 UTC
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
[    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
Comment 1 Bjorn Helgaas 2021-01-14 19:16:37 UTC
Reassigning to video/DRI since I don't think this is a PCI problem.  If the integrated GPU (00:02.0) is set to the default in firmware setup, this:

  pci 0000:01:00.0: BAR 0: assigned to efifb

makes me wonder if this is a firmware issue.
Comment 2 Alex Deucher 2021-01-14 19:35:12 UTC
Please attach your dmesg output.  I agree this looks like an sbios issue since the the efifb is apparently bound to the radeon chip.
Comment 3 Dominik Mierzejewski 2021-01-16 13:57:57 UTC
Created attachment 294673 [details]
dmesg from kernel 5.10.7

Thanks for your analysis. Full dmesg attached.
Comment 4 Eduardo Medina 2023-01-09 16:52:41 UTC
Created attachment 303560 [details]
dmesg from Intel Alder Lake + Radeon RX 580

Hi. Is there any progress? I get this when I run the "switcherooctl list" command on my Intel Alder Lake system with a RX 580 GPU.

Device: 0
  Name:        Advanced Micro Devices, Inc. [AMD®/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (Nitro+ Radeon RX 570/580/590)
  Default:     yes
  Environment: DRI_PRIME=pci-0000_01_00_0

Device: 1
  Name:        Intel Corporation AlderLake-S GT1
  Default:     no
  Environment: DRI_PRIME=pci-0000_00_02_0
Comment 5 Alex Deucher 2023-01-09 17:10:54 UTC
What GPU does the sbios use for boot messages before you boot the OS?
Comment 6 Eduardo Medina 2023-01-09 17:28:48 UTC
How I do to check that? I force the use of the iGPU from the motherboard, but even with that the system identifies the dedicated card as the iGPU and vice versa.
Comment 7 Alex Deucher 2023-01-09 17:53:39 UTC
(In reply to Eduardo Medina from comment #6)
> How I do to check that? I force the use of the iGPU from the motherboard,
> but even with that the system identifies the dedicated card as the iGPU and
> vice versa.

When you boot the system, before the OS loads, what GPU displays the sbios splash screen?  If it's always the dGPU, regardless of what you set in the sbios, it sounds like the sbios is broken and just always sets the dGPU as default.  The Linux kernel looks at what the pre-OS environment left when the kernel loads.
Comment 8 Eduardo Medina 2023-01-09 18:36:41 UTC
Well, I'm a stupid person.

When I boot the computer, the splash screen always looks like if it's broken. But I put the HDMI output on the motherboard and now the cards are well identified.

Now the color looks a ugly, but switcherooctl list shows the GPUs in order.

Sorry to waste your time.
Comment 9 Alex Deucher 2023-01-09 19:03:00 UTC
No worries.  Can you close this ticket?
Comment 10 Eduardo Medina 2023-01-09 19:24:25 UTC
No, I can't. Sorry again.

Note You need to log in before you can comment on or make changes to this bug.