linux-stable/arch/x86/pci
Bjorn Helgaas 66d28b21fe PCI/sysfs: Find shadow ROM before static attribute initialization
Ville reported that the sysfs "rom" file for VGA devices disappeared after
527139d738 ("PCI/sysfs: Convert "rom" to static attribute").

Prior to 527139d738, 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 527139d738, "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 527139d738
    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 527139d738

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/YbxqIyrkv3GhZVxx@intel.com
Fixes: 527139d738 ("PCI/sysfs: Convert "rom" to static attribute")
Link: https://lore.kernel.org/r/20220126154001.16895-1-helgaas@kernel.org
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org			# v5.13+
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Krzysztof Wilczyński <kw@linux.com>
2022-01-26 10:41:21 -06:00
..
acpi.c x86/PCI: Remove initialization of static variables to false 2022-01-11 11:05:35 -06:00
amd_bus.c x86/msr: Rename MSR_K8_SYSCFG to MSR_AMD64_SYSCFG 2021-05-10 07:51:38 +02:00
broadcom_bus.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
bus_numa.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bus_numa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ce4100.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 334 2019-06-05 17:37:06 +02:00
common.c PCI: Rename pcibios_add_device() to pcibios_device_add() 2021-09-21 15:26:09 -05:00
direct.c x86/pci: Simplify code by using the new dmi_get_bios_year() helper 2018-02-23 08:20:30 +01:00
early.c PCI: Make early dump functionality generic 2018-06-29 20:06:07 -05:00
fixup.c PCI/sysfs: Find shadow ROM before static attribute initialization 2022-01-26 10:41:21 -06:00
i386.c x86/PCI: Make a kernel-doc comment a normal one 2020-11-27 13:43:09 +01:00
init.c x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init() 2021-02-10 22:06:47 +01:00
intel_mid_pci.c x86/PCI: Describe @reg for type1_access_ok() 2021-02-15 20:10:30 +01:00
irq.c x86: Avoid magic number with ELCR register accesses 2021-08-10 23:31:43 +02:00
legacy.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
Makefile x86/PCI: Replace deprecated EXTRA_CFLAGS with ccflags-y 2019-11-21 07:49:27 -06:00
mmconfig-shared.c x86/pci: Return true/false (not 1/0) from bool functions 2021-05-27 18:51:17 -05:00
mmconfig_32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 387 2019-06-05 17:37:11 +02:00
mmconfig_64.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
numachip.c x86/PCI: Add pci_numachip_init() declaration 2021-08-12 14:07:31 -05:00
olpc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pcbios.c maccess: rename probe_kernel_address to get_kernel_nofault 2020-06-18 11:14:40 -07:00
sta2x11-fixup.c x86/PCI: sta2x11: switch from 'pci_' to 'dma_' API 2021-09-02 11:36:56 -05:00
xen.c x86/pci/xen: Use msi_for_each_desc() 2021-12-16 22:22:18 +01:00