linux/include/drm
Ville Syrjälä a4dff76924 x86/gpu: Add Intel graphics stolen memory quirk for gen2 platforms
There isn't an explicit stolen memory base register on gen2.
Some old comment in the i915 code suggests we should get it via
max_low_pfn_mapped, but that's clearly a bad idea on my MGM.

The e820 map in said machine looks like this:

	BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable
	BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
	BIOS-e820: [mem 0x00000000000ce000-0x00000000000cffff] reserved
	BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved
	BIOS-e820: [mem 0x0000000000100000-0x000000001f6effff] usable
	BIOS-e820: [mem 0x000000001f6f0000-0x000000001f6f7fff] ACPI data
	BIOS-e820: [mem 0x000000001f6f8000-0x000000001f6fffff] ACPI NVS
	BIOS-e820: [mem 0x000000001f700000-0x000000001fffffff] reserved
	BIOS-e820: [mem 0x00000000fec10000-0x00000000fec1ffff] reserved
	BIOS-e820: [mem 0x00000000ffb00000-0x00000000ffbfffff] reserved
	BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved

That makes max_low_pfn_mapped = 1f6f0000, so assuming our stolen
memory would start there would place it on top of some ACPI
memory regions. So not a good idea as already stated.

The 9MB region after the ACPI regions at 0x1f700000 however
looks promising given that the macine reports the stolen memory
size to be 8MB. Looking at the PGTBL_CTL register, the GTT
entries are at offset 0x1fee00000, and given that the GTT
entries occupy 128KB, it looks like the stolen memory could
start at 0x1f700000 and the GTT entries would occupy the last
128KB of the stolen memory.

After some more digging through chipset documentation, I've
determined the BIOS first allocates space for something called
TSEG (something to do with SMM) from the top of memory, and then
it allocates the graphics stolen memory below that. Accordind to
the chipset documentation TSEG has a fixed size of 1MB on 855.
So that explains the top 1MB in the e820 region. And it also
confirms that the GTT entries are in fact at the end of the the
stolen memory region.

Derive the stolen memory base address on gen2 the same as the
BIOS does (TOM-TSEG_SIZE-stolen_size). There are a few
differences between the registers on various gen2 chipsets, so a
few different codepaths are required.

865G is again bit more special since it seems to support enough
memory to hit 4GB address space issues. This means the PCI
allocations will also affect the location of the stolen memory.
Fortunately there appears to be the TOUD register which may give
us the correct answer directly. But the chipset docs are a bit
unclear, so I'm not 100% sure that the graphics stolen memory is
always the last thing the BIOS steals. Someone would need to
verify it on a real system.

I tested this on the my 830 and 855 machines, and so far
everything looks peachy.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Link: http://lkml.kernel.org/r/1391628540-23072-3-git-send-email-ville.syrjala@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-02-09 15:11:30 +01:00
..
i2c
ttm Merge tag 'vmwgfx-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux into drm-next 2014-01-14 10:55:36 +10:00
drm_agpsupport.h drm: rip out DRM_AGP_MEM and DRM_AGP_KERN 2013-12-18 11:32:55 +10:00
drm_buffer.h
drm_cache.h
drm_core.h
drm_crtc_helper.h drm: Make the connector mode_valid() vfunc return a drm_mode_status enum 2014-01-20 17:43:53 +01:00
drm_crtc.h drm/tegra: Changes for v3.14-rc1 (update) 2014-01-29 12:03:56 +10:00
drm_dp_helper.h drm/dp: Clarify automated test constant and add constant for FAUX test pattern 2013-12-18 11:47:43 +10:00
drm_edid.h
drm_encoder_slave.h
drm_fb_cma_helper.h
drm_fb_helper.h
drm_fixed.h
drm_flip_work.h
drm_gem_cma_helper.h
drm_global.h
drm_hashtab.h
drm_mem_util.h
drm_memory.h
drm_mipi_dsi.h drm: Add MIPI DSI bus support 2013-12-17 18:09:43 +01:00
drm_mm.h
drm_os_linux.h drm: Kill DRM_SUSER 2013-12-18 11:35:45 +10:00
drm_panel.h drm: Add panel support 2013-12-17 18:09:46 +01:00
drm_pciids.h drm/radeon: 0x9649 is SUMO2 not SUMO 2013-12-23 10:03:41 -05:00
drm_rect.h
drm_sysfs.h
drm_usb.h
drm_vma_manager.h
drmP.h drm: Pass 'flags' from the caller to .get_scanout_position() 2014-01-20 12:21:35 +02:00
exynos_drm.h
gma_drm.h
i915_drm.h x86/gpu: Add Intel graphics stolen memory quirk for gen2 platforms 2014-02-09 15:11:30 +01:00
i915_pciids.h
i915_powerwell.h
intel-gtt.h