[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251016081900.7129-1-tomitamoeko@gmail.com>
Date: Thu, 16 Oct 2025 16:19:00 +0800
From: Tomita Moeko <tomitamoeko@...il.com>
To: Lukas Wunner <lukas@...ner.de>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: Tomita Moeko <tomitamoeko@...il.com>,
linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] x86/pci: Check signature before assigning shadow ROM
Recent IGD platforms without VBIOS or UEFI CSM support do not contain
VGA ROM at 0xC0000. Check whether the VGA ROM region is a valid PCI
option ROM with 0xAA55 signature before assigning the shadow ROM to
the default PCI VGA controller.
Signed-off-by: Tomita Moeko <tomitamoeko@...il.com>
---
Changelog:
v2:
* Use memmap() instead of iomap() as the shadow ROM is copied to RAM by
BIOS
* Only map the first 2 bytes for the signature check.
Link: https://lore.kernel.org/all/20250406090835.7721-1-tomitamoeko@gmail.com/
arch/x86/pci/fixup.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 25076a5acd96..10dce90e0e00 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -357,6 +357,18 @@ static void pci_fixup_video(struct pci_dev *pdev)
struct pci_bus *bus;
u16 config;
struct resource *res;
+ void *rom;
+ u16 sig;
+
+ /* Does VBIOS region contain a valid PCI ROM? */
+ rom = memremap(0xC0000, sizeof(sig), MEMREMAP_WB);
+ if (!rom)
+ return;
+
+ memcpy(&sig, rom, sizeof(sig));
+ memunmap(rom);
+ if (sig != 0xAA55)
+ return;
/* Is VGA routed to us? */
bus = pdev->bus;
--
2.51.0
Powered by blists - more mailing lists