diff options
author | José Roberto de Souza <jose.souza@intel.com> | 2022-02-23 22:49:46 +0300 |
---|---|---|
committer | José Roberto de Souza <jose.souza@intel.com> | 2022-02-25 16:24:16 +0300 |
commit | b8986c889e7ac26c57cb548f8f344456fa925a2f (patch) | |
tree | 4cb9220ed8e647b1b26cbc13f8201904ded5e84a /drivers/gpu/drm/i915/intel_memory_region.c | |
parent | bbd57d16d5ddeb9d8995a6ded81a6879be6af928 (diff) | |
download | linux-b8986c889e7ac26c57cb548f8f344456fa925a2f.tar.xz |
drm/i915: Check stolen memory size before calling drm_mm_init
Add check for zero usable stolen memory before calling drm_mm_init
to support configurations where stolen memory exists but is fully
reserved.
Also skip memory test in cases that usable stolen is smaller than
page size(amount mapped and used to test memory).
v2:
- skiping test if available memory is smaller than page size (Lucas)
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Steve Carbonari <steven.carbonari@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220223194946.725328-1-jose.souza@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_memory_region.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_memory_region.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c index c70d7e286a51..16ab62d605b1 100644 --- a/drivers/gpu/drm/i915/intel_memory_region.c +++ b/drivers/gpu/drm/i915/intel_memory_region.c @@ -97,10 +97,14 @@ static int iomemtest(struct intel_memory_region *mem, bool test_all, const void *caller) { - resource_size_t last = resource_size(&mem->region) - PAGE_SIZE; - resource_size_t page; + resource_size_t last, page; int err; + if (resource_size(&mem->region) < PAGE_SIZE) + return 0; + + last = resource_size(&mem->region) - PAGE_SIZE; + /* * Quick test to check read/write access to the iomap (backing store). * |