Hi, On 2023/8/18 06:08, Bjorn Helgaas wrote:
I guess the point here is that: - 03:00.0 BAR 0 is [mem 0xe0050000000-0xe005fffffff] - screen_info says the framebuffer is [mem 0xe0050000000-0xe005fffffff] (or part of it) - Therefore, we want 03:00.0 to be the default VGA - PCI core reassigns 03:00.0 BAR 0 to [mem 0xe0030000000-0xe003fffffff] - PCI core assigns a 00:06.1 BAR to contain [mem 0xe0050000000-0xe005fffffff] - vga_is_firmware_default() incorrectly decides 00:06.1 should be the default VGA because it has a BAR that contains the screen_info address range Is that right?
Yes, The 00:06.1 is loongson integrated display controller, integrated in LS7A1000 North bridge. On loongarch, before apply apply any patch, VGAARB always select 00:06.1 as the default boot device. because it is enumerated first. It is always the first VGA compatible device found on our system. Because its PCI domain, bus, function number is smallest. And it own IO and MEM, so the 00:06.1 will always be selected as the default boot device. Even you plug a discrete GPU on the mother board. Therefore we need help the vga_is_firmware_default() to overriding previous. On a multiple GPU co-exist case (on loongson platform), if no "overriding previous" being printed. then there something wrong. On normal case, we need the discrete GPU overriding the integrated one. Because the discrete GPU is more powerful than the platform integrated. But what we want is let the VGAARB determine the primary GPU by referencing the firmware. If firmware put the firmware framebuffer in the VRAM of the integrated display card(00:06.1). then the integrated display card should be the primary GPU. If firmware put the firmware framebuffer in the VRAM of the discrete display card, then the discrete display card should be the primary GPU.