Skip to content

Commit 337bf13

Browse files
committed
PCI/VGA: Replace vga_is_firmware_default() with a screen info check
vga_is_firmware_default() checks firmware resources to find the owner framebuffer resources to find the firmware PCI device. This is an open coded implementation of screen_info_pci_dev(). Switch to using screen_info_pci_dev() instead. Acked-by: Bjorn Helgaas <bhelgaas@google.com> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20250811162606.587759-3-superm1@kernel.org Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
1 parent 6e490de commit 337bf13

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

drivers/pci/vgaarb.c

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -556,34 +556,13 @@ EXPORT_SYMBOL(vga_put);
556556

557557
static bool vga_is_firmware_default(struct pci_dev *pdev)
558558
{
559-
#if defined(CONFIG_X86)
560-
u64 base = screen_info.lfb_base;
561-
u64 size = screen_info.lfb_size;
562-
struct resource *r;
563-
u64 limit;
559+
#ifdef CONFIG_SCREEN_INFO
560+
struct screen_info *si = &screen_info;
564561

565-
/* Select the device owning the boot framebuffer if there is one */
566-
567-
if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
568-
base |= (u64)screen_info.ext_lfb_base << 32;
569-
570-
limit = base + size;
571-
572-
/* Does firmware framebuffer belong to us? */
573-
pci_dev_for_each_resource(pdev, r) {
574-
if (resource_type(r) != IORESOURCE_MEM)
575-
continue;
576-
577-
if (!r->start || !r->end)
578-
continue;
579-
580-
if (base < r->start || limit >= r->end)
581-
continue;
582-
583-
return true;
584-
}
585-
#endif
562+
return pdev == screen_info_pci_dev(si);
563+
#else
586564
return false;
565+
#endif
587566
}
588567

589568
static bool vga_arb_integrated_gpu(struct device *dev)

0 commit comments

Comments
 (0)