Commit 54b512cd authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Chris Wilson

drm/i915: do not map aperture if it is not available.

Skip both setup and cleanup of the aperture mapping if the HW doesn't
have an aperture bar.
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191029095856.25431-2-matthew.auld@intel.com
parent 773ed805
...@@ -2770,7 +2770,9 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt) ...@@ -2770,7 +2770,9 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)
i915_address_space_fini(&ggtt->vm); i915_address_space_fini(&ggtt->vm);
arch_phys_wc_del(ggtt->mtrr); arch_phys_wc_del(ggtt->mtrr);
io_mapping_fini(&ggtt->iomap);
if (ggtt->iomap.size)
io_mapping_fini(&ggtt->iomap);
} }
/** /**
...@@ -2988,6 +2990,12 @@ static void setup_private_pat(struct intel_uncore *uncore) ...@@ -2988,6 +2990,12 @@ static void setup_private_pat(struct intel_uncore *uncore)
bdw_setup_private_ppat(uncore); bdw_setup_private_ppat(uncore);
} }
static struct resource pci_resource(struct pci_dev *pdev, int bar)
{
return (struct resource)DEFINE_RES_MEM(pci_resource_start(pdev, bar),
pci_resource_len(pdev, bar));
}
static int gen8_gmch_probe(struct i915_ggtt *ggtt) static int gen8_gmch_probe(struct i915_ggtt *ggtt)
{ {
struct drm_i915_private *dev_priv = ggtt->vm.i915; struct drm_i915_private *dev_priv = ggtt->vm.i915;
...@@ -2997,10 +3005,10 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) ...@@ -2997,10 +3005,10 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
int err; int err;
/* TODO: We're not aware of mappable constraints on gen8 yet */ /* TODO: We're not aware of mappable constraints on gen8 yet */
ggtt->gmadr = if (!IS_DGFX(dev_priv)) {
(struct resource) DEFINE_RES_MEM(pci_resource_start(pdev, 2), ggtt->gmadr = pci_resource(pdev, 2);
pci_resource_len(pdev, 2)); ggtt->mappable_end = resource_size(&ggtt->gmadr);
ggtt->mappable_end = resource_size(&ggtt->gmadr); }
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(39)); err = pci_set_dma_mask(pdev, DMA_BIT_MASK(39));
if (!err) if (!err)
...@@ -3223,14 +3231,17 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt) ...@@ -3223,14 +3231,17 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt)
if (!HAS_LLC(i915) && !HAS_PPGTT(i915)) if (!HAS_LLC(i915) && !HAS_PPGTT(i915))
ggtt->vm.mm.color_adjust = i915_ggtt_color_adjust; ggtt->vm.mm.color_adjust = i915_ggtt_color_adjust;
if (!io_mapping_init_wc(&ggtt->iomap, if (ggtt->mappable_end) {
ggtt->gmadr.start, if (!io_mapping_init_wc(&ggtt->iomap,
ggtt->mappable_end)) { ggtt->gmadr.start,
ggtt->vm.cleanup(&ggtt->vm); ggtt->mappable_end)) {
return -EIO; ggtt->vm.cleanup(&ggtt->vm);
} return -EIO;
}
ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start, ggtt->mappable_end); ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start,
ggtt->mappable_end);
}
i915_ggtt_init_fences(ggtt); i915_ggtt_init_fences(ggtt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment