提交 934d6086 编写于 作者: C Chris Wilson 提交者: Daniel Vetter

drm/i915: Limit the ioremap of the PCI bar to the registers

In the future we may like to experiment with using a WC map of the GTT
portion. However, that will conflict with i915.ko mapping the entire bar
as UC in order to access the GPU registers. Instead we can shrink the
register ioremap to only map the register block.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Tested-by (IVB): Ben Widawsky <ben@bwidawsk.net>
Acked-by: NBen Widawsky <ben@bwidawsk.net>
[danvet: Squashed-in follow-up fix for gen2/3 registers file size from
Chris Wilson.]
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 ac6ae347
...@@ -1461,7 +1461,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1461,7 +1461,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
{ {
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv;
struct intel_device_info *info; struct intel_device_info *info;
int ret = 0, mmio_bar; int ret = 0, mmio_bar, mmio_size;
uint32_t aperture_size; uint32_t aperture_size;
info = (struct intel_device_info *) flags; info = (struct intel_device_info *) flags;
...@@ -1526,7 +1526,19 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1526,7 +1526,19 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(32)); dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(32));
mmio_bar = IS_GEN2(dev) ? 1 : 0; mmio_bar = IS_GEN2(dev) ? 1 : 0;
dev_priv->regs = pci_iomap(dev->pdev, mmio_bar, 0); /* Before gen4, the registers and the GTT are behind different BARs.
* However, from gen4 onwards, the registers and the GTT are shared
* in the same BAR, so we want to restrict this ioremap from
* clobbering the GTT which we want ioremap_wc instead. Fortunately,
* the register BAR remains the same size for all the earlier
* generations up to Ironlake.
*/
if (info->gen < 5)
mmio_size = 512*1024;
else
mmio_size = 2*1024*1024;
dev_priv->regs = pci_iomap(dev->pdev, mmio_bar, mmio_size);
if (!dev_priv->regs) { if (!dev_priv->regs) {
DRM_ERROR("failed to map registers\n"); DRM_ERROR("failed to map registers\n");
ret = -EIO; ret = -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册