Skip to content

Commit 6bd4934

Browse files
Sylvain MeyerLinus Torvalds
authored andcommitted
[PATCH] intelfb: Do not ioremap entire graphics aperture
Reported by: Pavel Kysilka (Bugzilla Bug 4738) modprobe of intelfb results in the following error message: intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G chi intelfb: Version 0.9.2 ACPI: PCI Interrupt 0000:00:02.0[A] -> GSI 16 (level, low) -> IRQ 16 allocation failed: out of vmalloc space - use vmalloc=<size> to increase siz intelfb: Cannot remap FB region. This will fail if the graphics aperture size is greater than 128 MB. Fix is to ioremap only from the beginning of graphics aperture to the end of the used framebuffer memory. Signed-off-by: Sylvain Meyer <sylvain.meyer@worldonline.fr> Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 89204c4 commit 6bd4934

1 file changed

Lines changed: 27 additions & 23 deletions

File tree

‎drivers/video/intelfb/intelfbdrv.c‎

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -583,23 +583,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
583583
return -ENODEV;
584584
}
585585

586-
/* Map the fb and MMIO regions */
587-
dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
588-
(dinfo->aperture.physical, dinfo->aperture.size);
589-
if (!dinfo->aperture.virtual) {
590-
ERR_MSG("Cannot remap FB region.\n");
591-
cleanup(dinfo);
592-
return -ENODEV;
593-
}
594-
dinfo->mmio_base =
595-
(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
596-
INTEL_REG_SIZE);
597-
if (!dinfo->mmio_base) {
598-
ERR_MSG("Cannot remap MMIO region.\n");
599-
cleanup(dinfo);
600-
return -ENODEV;
601-
}
602-
603586
/* Get the chipset info. */
604587
dinfo->pci_chipset = pdev->device;
605588

@@ -630,9 +613,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
630613
dinfo->accel = 0;
631614
}
632615

616+
if (MB(voffset) < stolen_size)
617+
offset = (stolen_size >> 12);
618+
else
619+
offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
620+
633621
/* Framebuffer parameters - Use all the stolen memory if >= vram */
634-
if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) {
622+
if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) {
635623
dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
624+
dinfo->fb.offset = 0;
636625
dinfo->fbmem_gart = 0;
637626
} else {
638627
dinfo->fb.size = MB(vram);
@@ -663,11 +652,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
663652
return -ENODEV;
664653
}
665654

666-
if (MB(voffset) < stolen_size)
667-
offset = (stolen_size >> 12);
668-
else
669-
offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
670-
671655
/* set the mem offsets - set them after the already used pages */
672656
if (dinfo->accel) {
673657
dinfo->ring.offset = offset + gtt_info.current_memory;
@@ -682,6 +666,26 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
682666
+ (dinfo->cursor.size >> 12);
683667
}
684668

669+
/* Map the fb and MMIO regions */
670+
/* ioremap only up to the end of used aperture */
671+
dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
672+
(dinfo->aperture.physical, (dinfo->fb.offset << 12)
673+
+ dinfo->fb.size);
674+
if (!dinfo->aperture.virtual) {
675+
ERR_MSG("Cannot remap FB region.\n");
676+
cleanup(dinfo);
677+
return -ENODEV;
678+
}
679+
680+
dinfo->mmio_base =
681+
(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
682+
INTEL_REG_SIZE);
683+
if (!dinfo->mmio_base) {
684+
ERR_MSG("Cannot remap MMIO region.\n");
685+
cleanup(dinfo);
686+
return -ENODEV;
687+
}
688+
685689
/* Allocate memories (which aren't stolen) */
686690
if (dinfo->accel) {
687691
if (!(dinfo->gtt_ring_mem =

0 commit comments

Comments
 (0)