From 487e4d78da3cf3debe4bebc1022cda5e5196142d Mon Sep 17 00:00:00 2001 From: Chuck Ebbert Date: Mon, 20 Sep 2010 08:17:37 -0400 Subject: [PATCH] Fix AGP aperture size detection on Intel G33/Q35 chipsets (#629203) --- ...ct-mask-to-detect-i830-aperture-size.patch | 62 +++++++++++++++++++ kernel.spec | 6 ++ 2 files changed, 68 insertions(+) create mode 100644 agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch diff --git a/agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch b/agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch new file mode 100644 index 000000000..0850df6ba --- /dev/null +++ b/agp-intel-use-the-correct-mask-to-detect-i830-aperture-size.patch @@ -0,0 +1,62 @@ +From: Tim Gardner +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 +Tested-by: Kees Cook +Cc: Chris Wilson +Cc: Eric Anholt +Cc: Jesse Barnes +Signed-off-by: Eric Anholt +--- + +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 { diff --git a/kernel.spec b/kernel.spec index 057bb3627..9f52838f3 100644 --- a/kernel.spec +++ b/kernel.spec @@ -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 +- Fix AGP aperture size detection on Intel G33/Q35 chipsets (#629203) + * Tue Sep 14 2010 Chuck Ebbert 2.6.34.7-57 - Fix CVE-2010-3079: ftrace NULL pointer dereference