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
45static unsigned long i915_stolen_to_physical(struct drm_device *dev)45static unsigned long i915_stolen_to_physical(struct drm_device *dev)
46{46{
47 struct drm_i915_private *dev_priv = dev->dev_private;47 struct drm_i915_private *dev_priv = dev->dev_private;
48 struct pci_dev *pdev = dev_priv->bridge_dev;
49 struct resource *r;48 struct resource *r;
50 u32 base;49 u32 base;
51 50
52 /* On the machines I have tested the Graphics Base of Stolen Memory51 /* Almost universally we can find the Graphics Base of Stolen Memory
53 * is unreliable, so on those compute the base by subtracting the52 * at offset 0x5c in the igfx configuration space. On a few (desktop)
54 * stolen memory from the Top of Low Usable DRAM which is where the53 * machines this is also mirrored in the bridge device at different
55 * BIOS places the graphics stolen memory.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.
56 *59 *
57 * On gen2, the layout is slightly different with the Graphics Segment60 * XXX However gen2 requires an unavailable symbol.
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.
64 */61 */
65 base = 0;62 base = 0;
66 if (IS_VALLEYVIEW(dev)) {63 if (INTEL_INFO(dev)->gen >= 3) {
64 /* Read Graphics Base of Stolen Memory directly */
67 pci_read_config_dword(dev->pdev, 0x5c, &base);65 pci_read_config_dword(dev->pdev, 0x5c, &base);
68 base &= ~((1<<20) - 1);66 base &= ~((1<<20) - 1);
69 } else if (INTEL_INFO(dev)->gen >= 6) {67 } else { /* GEN2 */
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);
79#if 068#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 {
87 /* Stolen is immediately above Top of Memory */69 /* Stolen is immediately above Top of Memory */
88 base = max_low_pfn_mapped << PAGE_SHIFT;70 base = max_low_pfn_mapped << PAGE_SHIFT;
89#endif71#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