From: Nirmoy Das Date: Wed, 11 May 2022 15:37:46 +0000 (+0200) Subject: drm/i915: gracefully error out on platform with small-bar X-Git-Tag: v6.1-rc5~176^2~23^2~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e97c46f832d4669b4e52cde5ad0bd43423504eb;p=platform%2Fkernel%2Flinux-starfive.git drm/i915: gracefully error out on platform with small-bar Currently we just fatally crash during module load if we encounter small-BAR configuration on DG2. We have most of the support already, but we lack the final uAPI bits to tie it all together. Signed-off-by: Nirmoy Das Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld [mauld: reword the commit and error message slightly] Link: https://patchwork.freedesktop.org/patch/msgid/20220511153746.14142-3-nirmoy.das@intel.com --- diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c index cd105ec10429..e9c12e0d6f59 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -111,6 +111,12 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) flat_ccs_base = intel_gt_read_register(gt, XEHPSDV_FLAT_CCS_BASE_ADDR); flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT) * SZ_64K; + /* FIXME: Remove this when we have small-bar enabled */ + if (pci_resource_len(pdev, 2) < lmem_size) { + drm_err(&i915->drm, "System requires small-BAR support, which is currently unsupported on this kernel\n"); + return ERR_PTR(-EINVAL); + } + if (GEM_WARN_ON(lmem_size < flat_ccs_base)) return ERR_PTR(-EIO);