aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-02-10 23:04:05 -0500
committerDave Airlie <airlied@redhat.com>2019-02-10 23:04:20 -0500
commitf4bc54b532a62d8bee421ca06adb6d1b3e7ffaa9 (patch)
tree3b835f9bed6bd236fa1a6d5d0add836f25ca8262 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parent5ea3998d56346975c2701df18fb5b6e3ab5c8d9e (diff)
parent0461221316ec21e0a535a35fba3feb6ba75706e6 (diff)
Merge branch 'drm-next-5.1' of git://people.freedesktop.org/~agd5f/linux into drm-next
Updates for 5.1: - GDS fixes - Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES interface - GPUVM fixes - PCIE DPM switching fixes for vega20 - Vega10 uclk DPM regression fix - DC Freesync fixes - DC ABM fixes - Various DC cleanups Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190208210214.27666-1-alexander.deucher@amd.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 728e15e5d68a..fd9c4beeaaa4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -426,12 +426,20 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
426 size_t acc_size; 426 size_t acc_size;
427 int r; 427 int r;
428 428
429 page_align = roundup(bp->byte_align, PAGE_SIZE) >> PAGE_SHIFT; 429 /* Note that GDS/GWS/OA allocates 1 page per byte/resource. */
430 if (bp->domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | 430 if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
431 AMDGPU_GEM_DOMAIN_OA)) 431 /* GWS and OA don't need any alignment. */
432 page_align = bp->byte_align;
432 size <<= PAGE_SHIFT; 433 size <<= PAGE_SHIFT;
433 else 434 } else if (bp->domain & AMDGPU_GEM_DOMAIN_GDS) {
435 /* Both size and alignment must be a multiple of 4. */
436 page_align = ALIGN(bp->byte_align, 4);
437 size = ALIGN(size, 4) << PAGE_SHIFT;
438 } else {
439 /* Memory should be aligned at least to a page size. */
440 page_align = ALIGN(bp->byte_align, PAGE_SIZE) >> PAGE_SHIFT;
434 size = ALIGN(size, PAGE_SIZE); 441 size = ALIGN(size, PAGE_SIZE);
442 }
435 443
436 if (!amdgpu_bo_validate_size(adev, size, bp->domain)) 444 if (!amdgpu_bo_validate_size(adev, size, bp->domain))
437 return -ENOMEM; 445 return -ENOMEM;