History

drm/i915: Use Graphics Base of Stolen Memory on all gen3+

So I made the mistake of missing that the desktop and mobile chipsets have different layouts in their PCI configurations, and we were incorrectly setting the wrong physical address for stolen memory on mobile chipsets. Since all gen3+ are actually consistent in the location of the GBSM register in the PCI configuration space on device 2 (the GPU), use it.

Chris Wilson committed 13 years ago

Commit 17fec8a1 parent f63a4841 file · +12 −30Browse files

Unified · Split

drivers/gpu/drm/i915/i915_gem_stolen.c+12−30
@@ -45,45 +45,27 @@ · 44 unmodified lines
4545 static unsigned long i915_stolen_to_physical(struct drm_device *dev)
4646 {
4747 struct drm_i915_private *dev_priv = dev->dev_private;
48− struct pci_dev *pdev = dev_priv->bridge_dev;
4948 struct resource *r;
5049 u32 base;
5150
52− /* On the machines I have tested the Graphics Base of Stolen Memory
53− * is unreliable, so on those compute the base by subtracting the
54− * stolen memory from the Top of Low Usable DRAM which is where the
55− * BIOS places the graphics stolen memory.
51+ /* Almost universally we can find the Graphics Base of Stolen Memory
52+ * at offset 0x5c in the igfx configuration space. On a few (desktop)
53+ * machines this is also mirrored in the bridge device at different
54+ * locations, or in the MCHBAR. On gen2, the layout is again slightly
55+ * different with the Graphics Segment immediately following Top of
56+ * Memory (or Top of Usable DRAM). Note it appears that TOUD is only
57+ * reported by 865g, so we just use the top of memory as determined
58+ * by the e820 probe.
5659 *
57− * On gen2, the layout is slightly different with the Graphics Segment
58− * immediately following Top of Memory (or Top of Usable DRAM). Note
59− * it appears that TOUD is only reported by 865g, so we just use the
60− * top of memory as determined by the e820 probe.
61− *
62− * XXX gen2 requires an unavailable symbol and 945gm fails with
63− * its value of TOLUD.
60+ * XXX However gen2 requires an unavailable symbol.
6461 */
6562 base = 0;
66− if (IS_VALLEYVIEW(dev)) {
63+ if (INTEL_INFO(dev)->gen >= 3) {
64+ /* Read Graphics Base of Stolen Memory directly */
6765 pci_read_config_dword(dev->pdev, 0x5c, &base);
6866 base &= ~((1<<20) - 1);
69− } else if (INTEL_INFO(dev)->gen >= 6) {
70− /* Read Base Data of Stolen Memory Register (BDSM) directly.
71− * Note that there is also a MCHBAR miror at 0x1080c0 or
72− * we could use device 2:0x5c instead.
73− */
74− pci_read_config_dword(pdev, 0xB0, &base);
75− base &= ~4095; /* lower bits used for locking register */
76− } else if (INTEL_INFO(dev)->gen > 3 || IS_G33(dev)) {
77− /* Read Graphics Base of Stolen Memory directly */
78− pci_read_config_dword(pdev, 0xA4, &base);
67+ } else { /* GEN2 */
7968 #if 0
80− } else if (IS_GEN3(dev)) {
81− u8 val;
82− /* Stolen is immediately below Top of Low Usable DRAM */
83− pci_read_config_byte(pdev, 0x9c, &val);
84− base = val >> 3 << 27;
85− base -= dev_priv->mm.gtt->stolen_size;
86− } else {
8769 /* Stolen is immediately above Top of Memory */
8870 base = max_low_pfn_mapped << PAGE_SHIFT;
8971 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t