Fix AGP aperture size detection on Intel G33/Q35 chipsets (#629203)

This commit is contained in:
Chuck Ebbert 2010-09-20 08:17:37 -04:00
parent fac9fd36ec
commit 487e4d78da
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,62 @@
From: Tim Gardner <tim.gardner@canonical.com>
Date: Fri, 9 Jul 2010 20:48:50 +0000 (-0600)
Subject: agp/intel: Use the correct mask to detect i830 aperture size.
X-Git-Tag: v2.6.35~33^2~4
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=e7b96f28c58ca09f15f6c2e8ccbb889a30fab4f7
agp/intel: Use the correct mask to detect i830 aperture size.
BugLink: https://bugs.launchpad.net/bugs/597075
commit f1befe71fa7a79ab733011b045639d8d809924ad introduced a
regression when detecting aperture size of some i915 adapters, e.g.,
those on the Intel Q35 chipset.
The original report: https://bugzilla.kernel.org/show_bug.cgi?id=15733
The regression report: https://bugzilla.kernel.org/show_bug.cgi?id=16294
According to the specification found at
http://intellinuxgraphics.org/VOL_1_graphics_core.pdf, the PCI config
space register I830_GMCH_CTRL is a mirror of GMCH Graphics
Control. The correct macro for isolating the aperture size bits is
therefore I830_GMCH_GMS_MASK along with the attendant changes to the
case statement.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Tested-by: Kees Cook <kees.cook@canonical.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
---
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9344216..a754715 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1216,17 +1216,20 @@ static int intel_i915_get_gtt_size(void)
/* G33's GTT size defined in gmch_ctrl */
pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl);
- switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) {
- case G33_PGETBL_SIZE_1M:
+ switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
+ case I830_GMCH_GMS_STOLEN_512:
+ size = 512;
+ break;
+ case I830_GMCH_GMS_STOLEN_1024:
size = 1024;
break;
- case G33_PGETBL_SIZE_2M:
- size = 2048;
+ case I830_GMCH_GMS_STOLEN_8192:
+ size = 8*1024;
break;
default:
dev_info(&agp_bridge->dev->dev,
"unknown page table size 0x%x, assuming 512KB\n",
- (gmch_ctrl & G33_PGETBL_SIZE_MASK));
+ (gmch_ctrl & I830_GMCH_GMS_MASK));
size = 512;
}
} else {

View File

@ -713,6 +713,7 @@ Patch1826: drm-radeon-resume-fixes.patch
Patch1830: drm-i915-explosion-following-oom-in-do_execbuffer.patch
Patch1900: linux-2.6-intel-iommu-igfx.patch
Patch1901: drm-nouveau-acpi-edid-fix.patch
Patch1902: agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch
# radeon
# linux1394 git patches
@ -1404,6 +1405,8 @@ ApplyPatch drm-intel-big-hammer.patch
ApplyOptionalPatch drm-intel-next.patch
ApplyPatch drm-intel-make-lvds-work.patch
ApplyPatch drm-i915-explosion-following-oom-in-do_execbuffer.patch
# broken in 2.6.35-rc2, fixed in 2.6.35, but our drm-next snapshot has the bug
ApplyPatch agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch
ApplyPatch drm-radeon-resume-fixes.patch
ApplyPatch linux-2.6-intel-iommu-igfx.patch
@ -2146,6 +2149,9 @@ fi
%changelog
* Mon Sep 20 2010 Chuck Ebbert <cebbert@redhat.com>
- Fix AGP aperture size detection on Intel G33/Q35 chipsets (#629203)
* Tue Sep 14 2010 Chuck Ebbert <cebbert@redhat.com> 2.6.34.7-57
- Fix CVE-2010-3079: ftrace NULL pointer dereference