Skip to content

Commit 9c494ca

Browse files
lucasdemarchibjorn-helgaas
authored andcommitted
x86/gpu: Reserve stolen memory for first integrated Intel GPU
"Stolen memory" is memory set aside for use by an Intel integrated GPU. The intel_graphics_quirks() early quirk reserves this memory when it is called for a GPU that appears in the intel_early_ids[] table of integrated GPUs. Previously intel_graphics_quirks() was marked as QFLAG_APPLY_ONCE, so it was called only for the first Intel GPU found. If a discrete GPU happened to be enumerated first, intel_graphics_quirks() was called for it but not for any integrated GPU found later. Therefore, stolen memory for such an integrated GPU was never reserved. For example, this problem occurs in this Alderlake-P (integrated) + DG2 (discrete) topology where the DG2 is found first, but stolen memory is associated with the integrated GPU: - 00:01.0 Bridge `- 03:00.0 DG2 discrete GPU - 00:02.0 Integrated GPU (with stolen memory) Remove the QFLAG_APPLY_ONCE flag and call intel_graphics_quirks() for every Intel GPU. Reserve stolen memory for the first GPU that appears in intel_early_ids[]. [bhelgaas: commit log, add code comment, squash in https://lore.kernel.org/r/20220118190558.2ququ4vdfjuahicm@ldmartin-desk2] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lucas De Marchi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Cc: [email protected]
1 parent fa55b7d commit 9c494ca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arch/x86/kernel/early-quirks.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ static const struct intel_early_ops gen11_early_ops __initconst = {
515515
.stolen_size = gen9_stolen_size,
516516
};
517517

518+
/* Intel integrated GPUs for which we need to reserve "stolen memory" */
518519
static const struct pci_device_id intel_early_ids[] __initconst = {
519520
INTEL_I830_IDS(&i830_early_ops),
520521
INTEL_I845G_IDS(&i845_early_ops),
@@ -591,6 +592,13 @@ static void __init intel_graphics_quirks(int num, int slot, int func)
591592
u16 device;
592593
int i;
593594

595+
/*
596+
* Reserve "stolen memory" for an integrated GPU. If we've already
597+
* found one, there's nothing to do for other (discrete) GPUs.
598+
*/
599+
if (resource_size(&intel_graphics_stolen_res))
600+
return;
601+
594602
device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID);
595603

596604
for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) {
@@ -703,7 +711,7 @@ static struct chipset early_qrk[] __initdata = {
703711
{ PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST,
704712
PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
705713
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID,
706-
QFLAG_APPLY_ONCE, intel_graphics_quirks },
714+
0, intel_graphics_quirks },
707715
/*
708716
* HPET on the current version of the Baytrail platform has accuracy
709717
* problems: it will halt in deep idle state - so we disable it.

0 commit comments

Comments
 (0)