[PATCH] intel-agp: Avoid oops for G33 on 1MB stolen case

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Brandon Philips
Date: Tuesday, October 14, 2008 - 3:58 pm

This is similar to f443675affe3f16dd428e46f0f7fd3f4d703eeab which was
reverted because it broke older X.org driver. This patch only fixes
the 1MB stolen case since it causes an oops.

Xorg will not work without the accompanying patch[1] but avoiding an
oops and making it possible to work with patched xorg driver is
reasonable.

[1] http://ifup.org/~philips/review/xf86-video-intel-G33-1mb.patch

Explanation of the oops:

...
...

size = 1028

Then since we have the BIOS setting 1MB for the device in the GMCH
control we get to here:


MB(1) = 1 * 1024 * 1024
KB(1028) = 1028 * 1024

MB(1) - KB(1028) = -4096


We end up with -1 in gtt_entries.

This leads to intel_i915_configure reading/writing to areas outside of
mapped memory and the oops.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=391261

Signed-off-by: Brandon Philips <bphilips@suse.de>

---
 drivers/char/agp/intel-agp.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-2.6/drivers/char/agp/intel-agp.c
===================================================================
--- linux-2.6.orig/drivers/char/agp/intel-agp.c
+++ linux-2.6/drivers/char/agp/intel-agp.c
@@ -559,6 +559,14 @@ static void intel_i830_init_gtt_entries(
 	} else {
 		switch (gmch_ctrl & I855_GMCH_GMS_MASK) {
 		case I855_GMCH_GMS_STOLEN_1M:
+			if (IS_G33) {
+				size = 0;
+				printk(KERN_WARNING PFX
+				       "Warning: G33 chipset with 1MB"
+					" allocated. Older X.org Intel drivers"
+					" will not work.\n");
+				WARN_ON(1);
+			}
 			gtt_entries = MB(1) - KB(size);
 			break;
 		case I855_GMCH_GMS_STOLEN_4M:
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] intel-agp: Avoid oops for G33 on 1MB stolen case, Brandon Philips, (Tue Oct 14, 3:58 pm)
Re: [PATCH] intel-agp: Avoid oops for G33 on 1MB stolen case, Arjan van de Ven, (Mon Oct 20, 2:52 pm)
Re: [PATCH] intel-agp: Avoid oops for G33 on 1MB stolen case, Brandon Philips, (Tue Oct 28, 9:41 pm)
[PATCH v2] intel-agp: Avoid oops for G33 on 1MB stolen case, Brandon Philips, (Tue Oct 28, 10:22 pm)
Re: [PATCH] intel-agp: Avoid oops for G33 on 1MB stolen case, Brandon Philips, (Tue Oct 28, 10:23 pm)