diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2013-05-08 13:45:13 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-10 15:56:36 -0400 |
commit | c9cddffc669408a361c62353a36dd40b469dd9c2 (patch) | |
tree | b38d20496bdb1e83e676693906c29866f7bf065b /drivers/gpu/drm/i915/i915_gem_stolen.c | |
parent | 615aaa5f96e40971039e01105c09808a3dead7d5 (diff) |
drm/i915: BIOS and power context stolen mem handling for VLV v7
But we need to get the right stolen base and make pre-allocated objects
for BIOS stuff so we don't clobber it. If the BIOS hasn't allocated a
power context, we allocate one here too, from stolen space as required
by the docs.
v2: fix stolen to phys if ladder (Ben)
keep BIOS reserved space out of allocator altogether (Ben)
v3: fix mask of stolen base (Ben)
v4: clean up preallocated object on unload (Ben)
don't zero reg on unload (Jesse)
fix mask harder (Jesse)
v5: use unref for freeing stolen bits (Chris)
move alloc/free to intel_pm.c (Chris)
v6: NULL pctx at disable time so error paths work (Ben)
v7: use correct PCI device for config read (Jesse)
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_stolen.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_stolen.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 67d3510cafed..913994cd0a3a 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -62,7 +62,10 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) | |||
62 | * its value of TOLUD. | 62 | * its value of TOLUD. |
63 | */ | 63 | */ |
64 | base = 0; | 64 | base = 0; |
65 | if (INTEL_INFO(dev)->gen >= 6) { | 65 | if (IS_VALLEYVIEW(dev)) { |
66 | pci_read_config_dword(dev->pdev, 0x5c, &base); | ||
67 | base &= ~((1<<20) - 1); | ||
68 | } else if (INTEL_INFO(dev)->gen >= 6) { | ||
66 | /* Read Base Data of Stolen Memory Register (BDSM) directly. | 69 | /* Read Base Data of Stolen Memory Register (BDSM) directly. |
67 | * Note that there is also a MCHBAR miror at 0x1080c0 or | 70 | * Note that there is also a MCHBAR miror at 0x1080c0 or |
68 | * we could use device 2:0x5c instead. | 71 | * we could use device 2:0x5c instead. |
@@ -183,6 +186,7 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) | |||
183 | int i915_gem_init_stolen(struct drm_device *dev) | 186 | int i915_gem_init_stolen(struct drm_device *dev) |
184 | { | 187 | { |
185 | struct drm_i915_private *dev_priv = dev->dev_private; | 188 | struct drm_i915_private *dev_priv = dev->dev_private; |
189 | int bios_reserved = 0; | ||
186 | 190 | ||
187 | dev_priv->mm.stolen_base = i915_stolen_to_physical(dev); | 191 | dev_priv->mm.stolen_base = i915_stolen_to_physical(dev); |
188 | if (dev_priv->mm.stolen_base == 0) | 192 | if (dev_priv->mm.stolen_base == 0) |
@@ -191,8 +195,12 @@ int i915_gem_init_stolen(struct drm_device *dev) | |||
191 | DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n", | 195 | DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n", |
192 | dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base); | 196 | dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base); |
193 | 197 | ||
198 | if (IS_VALLEYVIEW(dev)) | ||
199 | bios_reserved = 1024*1024; /* top 1M on VLV/BYT */ | ||
200 | |||
194 | /* Basic memrange allocator for stolen space */ | 201 | /* Basic memrange allocator for stolen space */ |
195 | drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size); | 202 | drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size - |
203 | bios_reserved); | ||
196 | 204 | ||
197 | return 0; | 205 | return 0; |
198 | } | 206 | } |