aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/intel-gtt.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-08-28 05:04:32 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-08 16:20:13 -0400
commite5e408fc94595aab897f613b6f4e2f5b36870a6f (patch)
tree77924470cb3934115db4116e7a4ff5c12da51153 /drivers/char/agp/intel-gtt.c
parentffdd7510b0bd5ec663b6b11b39810574f2ce3111 (diff)
intel-gtt: fix gtt_total_entries detection
In commit f1befe71 Chris Wilson added some code to clear the full gtt on g33/pineview instead of just the mappable part. The code looks like it was copy-pasted from agp/intel-gtt.c, at least an identical piece of code is still there (in intel_i830_init_gtt_entries). This lead to a regression in 2.6.35 which was supposedly fixed in commit e7b96f28 Now this commit makes absolutely no sense to me. It seems to be slightly confused about chipset generations - it references docs for 4th gen but the regression concerns 3rd gen g33. Luckily the the g33 gmch docs are available with the GMCH Graphics Control pci config register definitions. The other (bigger problem) is that the new check in there uses the i830 stolen mem bits (.5M, 1M or 8M of stolen mem). They are different since the i855GM. The most likely case is that it hits the 512M fallback, which was probably the right thing for the boxes this was tested on. So the original approach by Chris Wilson seems to be wrong and the current code is definitely wrong. There is a third approach by Jesse Barnes from his RFC patch "Who wants a bigger GTT mapping range?" where he simply shoves g33 in the same clause like later chipset generations. I've asked him and Jesse confirmed that this should work. So implement it. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16891$ Tested-by: Anisse Astier <anisse@astier.eu> Cc: stable@kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/char/agp/intel-gtt.c')
-rw-r--r--drivers/char/agp/intel-gtt.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 56bcf27bdb77..3b84d8445a43 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -699,71 +699,43 @@ static unsigned int intel_gtt_stolen_entries(void)
699static unsigned int intel_gtt_total_entries(void) 699static unsigned int intel_gtt_total_entries(void)
700{ 700{
701 int size; 701 int size;
702 u16 gmch_ctrl;
703 702
704 if (IS_I965) { 703 if (IS_G33 || IS_I965 || IS_G4X) {
705 u32 pgetbl_ctl; 704 u32 pgetbl_ctl;
706 pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); 705 pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL);
707 706
708 /* The 965 has a field telling us the size of the GTT,
709 * which may be larger than what is necessary to map the
710 * aperture.
711 */
712 switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) { 707 switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) {
713 case I965_PGETBL_SIZE_128KB: 708 case I965_PGETBL_SIZE_128KB:
714 size = 128; 709 size = KB(128);
715 break; 710 break;
716 case I965_PGETBL_SIZE_256KB: 711 case I965_PGETBL_SIZE_256KB:
717 size = 256; 712 size = KB(256);
718 break; 713 break;
719 case I965_PGETBL_SIZE_512KB: 714 case I965_PGETBL_SIZE_512KB:
720 size = 512; 715 size = KB(512);
721 break; 716 break;
722 case I965_PGETBL_SIZE_1MB: 717 case I965_PGETBL_SIZE_1MB:
723 size = 1024; 718 size = KB(1024);
724 break; 719 break;
725 case I965_PGETBL_SIZE_2MB: 720 case I965_PGETBL_SIZE_2MB:
726 size = 2048; 721 size = KB(2048);
727 break; 722 break;
728 case I965_PGETBL_SIZE_1_5MB: 723 case I965_PGETBL_SIZE_1_5MB:
729 size = 1024 + 512; 724 size = KB(1024 + 512);
730 break; 725 break;
731 default: 726 default:
732 dev_info(&intel_private.pcidev->dev, 727 dev_info(&intel_private.pcidev->dev,
733 "unknown page table size, assuming 512KB\n"); 728 "unknown page table size, assuming 512KB\n");
734 size = 512; 729 size = KB(512);
735 }
736 size += 4; /* add in BIOS popup space */
737 } else if (IS_G33 && !IS_PINEVIEW) {
738 /* G33's GTT size defined in gmch_ctrl */
739 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) {
740 case G33_PGETBL_SIZE_1M:
741 size = 1024;
742 break;
743 case G33_PGETBL_SIZE_2M:
744 size = 2048;
745 break;
746 default:
747 dev_info(&intel_private.bridge_dev->dev,
748 "unknown page table size 0x%x, assuming 512KB\n",
749 (gmch_ctrl & G33_PGETBL_SIZE_MASK));
750 size = 512;
751 } 730 }
752 size += 4; 731
753 } else if (IS_G4X || IS_PINEVIEW) { 732 return size/4;
754 /* On 4 series hardware, GTT stolen is separate from graphics
755 * stolen, ignore it in stolen gtt entries counting. However,
756 * 4KB of the stolen memory doesn't get mapped to the GTT.
757 */
758 size = 4;
759 } else { 733 } else {
760 /* On previous hardware, the GTT size was just what was 734 /* On previous hardware, the GTT size was just what was
761 * required to map the aperture. 735 * required to map the aperture.
762 */ 736 */
763 size = agp_bridge->driver->fetch_size() + 4; 737 return intel_private.base.gtt_mappable_entries;
764 } 738 }
765
766 return size/KB(4);
767} 739}
768#endif 740#endif
769 741