Skip to content

Commit d8bb23f

Browse files
bjorn-helgaassmb49
authored andcommitted
PCI/sysfs: Find shadow ROM before static attribute initialization
BugLink: https://bugs.launchpad.net/bugs/1964422 commit 66d28b2 upstream. Ville reported that the sysfs "rom" file for VGA devices disappeared after 527139d ("PCI/sysfs: Convert "rom" to static attribute"). Prior to 527139d, FINAL fixups, including pci_fixup_video() where we find shadow ROMs, were run before pci_create_sysfs_dev_files() created the sysfs "rom" file. After 527139d, "rom" is a static attribute and is created before FINAL fixups are run, so we didn't create "rom" files for shadow ROMs: acpi_pci_root_add ... pci_scan_single_device pci_device_add pci_fixup_video # <-- new HEADER fixup device_add ... if (grp->is_visible()) pci_dev_rom_attr_is_visible # after 527139d pci_bus_add_devices pci_bus_add_device pci_fixup_device(pci_fixup_final) pci_fixup_video # <-- previous FINAL fixup pci_create_sysfs_dev_files if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) sysfs_create_bin_file("rom") # before 527139d Change pci_fixup_video() to be a HEADER fixup so it runs before sysfs static attributes are initialized. Rename the Loongson pci_fixup_radeon() to pci_fixup_video() and make its dmesg logging identical to the others since it is doing the same job. Link: https://lore.kernel.org/r/[email protected] Fixes: 527139d ("PCI/sysfs: Convert "rom" to static attribute") Link: https://lore.kernel.org/r/[email protected] Reported-by: Ville Syrjälä <[email protected]> Tested-by: Ville Syrjälä <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Cc: [email protected] # v5.13+ Cc: Huacai Chen <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Krzysztof Wilczyński <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 90b7f02 commit d8bb23f

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

arch/ia64/pci/fixup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ static void pci_fixup_video(struct pci_dev *pdev)
7676
}
7777
}
7878
}
79-
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
80-
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
79+
DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID,
80+
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);

arch/mips/loongson64/vbios_quirk.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <linux/pci.h>
44
#include <loongson.h>
55

6-
static void pci_fixup_radeon(struct pci_dev *pdev)
6+
static void pci_fixup_video(struct pci_dev *pdev)
77
{
88
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
99

@@ -22,8 +22,7 @@ static void pci_fixup_radeon(struct pci_dev *pdev)
2222
res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW |
2323
IORESOURCE_PCI_FIXED;
2424

25-
dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n",
26-
PCI_ROM_RESOURCE, res);
25+
dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", res);
2726
}
28-
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, 0x9615,
29-
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon);
27+
DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, 0x9615,
28+
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);

arch/x86/pci/fixup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ static void pci_fixup_video(struct pci_dev *pdev)
353353
}
354354
}
355355
}
356-
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
357-
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
356+
DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID,
357+
PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
358358

359359

360360
static const struct dmi_system_id msi_k8t_dmi_table[] = {

0 commit comments

Comments
 (0)