[PATCH 1/2] intelfb: Do not ioremap entire graphics aperture

DORMANTno replies

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2005-08-15 13:38:09
Subsystem: framebuffer layer, the rest · Maintainers: Helge Deller, Linus Torvalds

Reported by: Pavel Kysilka (Bugzilla Bug 4738)

modprobe of intelfb results in the following error message:

prog3:/usr/src/linux-2.6.12-rc6# modprobe intelfb
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.
prog3:/usr/src/linux-2.6.12-rc6#

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.

From: Sylvain Meyer <redacted>
Signed-off-by: Sylvain Meyer <redacted>
Signed-off-by: Antonino Daplas <redacted>
---

intelfbdrv.c |   50 +++++++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -579,23 +579,6 @@ intelfb_pci_register(struct pci_dev *pde
		return -ENODEV;
	}

-	/* Map the fb and MMIO regions */
-	dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
-		(dinfo->aperture.physical, dinfo->aperture.size);
-	if (!dinfo->aperture.virtual) {
-		ERR_MSG("Cannot remap FB region.\n");
-		cleanup(dinfo);
-		return -ENODEV;
-	}
-	dinfo->mmio_base =
-		(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
-					       INTEL_REG_SIZE);
-	if (!dinfo->mmio_base) {
-		ERR_MSG("Cannot remap MMIO region.\n");
-		cleanup(dinfo);
-		return -ENODEV;
-	}
-
	/* Get the chipset info. */
	dinfo->pci_chipset = pdev->device;
@@ -626,9 +609,15 @@ intelfb_pci_register(struct pci_dev *pde
		dinfo->accel = 0;
	}

+	if (MB(voffset) < stolen_size)
+		offset = (stolen_size >> 12);
+	else
+		offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
+
	/* Framebuffer parameters - Use all the stolen memory if >= vram */
-	if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) {
+	if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) +  MB(vram))) {
		dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
+		dinfo->fb.offset = 0;
		dinfo->fbmem_gart = 0;
	} else {
		dinfo->fb.size =  MB(vram);
@@ -659,11 +648,6 @@ intelfb_pci_register(struct pci_dev *pde
		return -ENODEV;
	}

-	if (MB(voffset) < stolen_size)
-		offset = (stolen_size >> 12);
-	else
-		offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
-
	/* set the mem offsets - set them after the already used pages */
	if (dinfo->accel) {
		dinfo->ring.offset = offset + gtt_info.current_memory;
@@ -678,6 +662,26 @@ intelfb_pci_register(struct pci_dev *pde
			+ (dinfo->cursor.size >> 12);
	}

+	/* Map the fb and MMIO regions */
+	/* ioremap only up to the end of used aperture */
+	dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
+		(dinfo->aperture.physical, (dinfo->fb.offset << 12)
+		 + dinfo->fb.size);
+	if (!dinfo->aperture.virtual) {
+		ERR_MSG("Cannot remap FB region.\n");
+		cleanup(dinfo);
+		return -ENODEV;
+	}
+
+	dinfo->mmio_base =
+		(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
+					       INTEL_REG_SIZE);
+	if (!dinfo->mmio_base) {
+		ERR_MSG("Cannot remap MMIO region.\n");
+		cleanup(dinfo);
+		return -ENODEV;
+	}
+
	/* Allocate memories (which aren't stolen) */
	if (dinfo->accel) {
		if (!(dinfo->gtt_ring_mem =








-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help