Re: [PATCH] drm/amdgpu: fill the alignment for secure buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 15.01.20 um 08:48 schrieb Huang Rui:
On Wed, Jan 15, 2020 at 03:45:50PM +0800, Koenig, Christian wrote:
Am 15.01.20 um 08:07 schrieb Huang Rui:
The alignment should match the page size for secure buffer.
That is superfluous, buffer are aligned to a page size anyway.

If use huge page, will buffer still be aligned?

Yes, the minimum alignment is always one page.

Christian.


Thanks,
Ray

Christian.

Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
   1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index f39012e..a03eead 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -261,9 +261,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   		resv = vm->root.base.bo->tbo.base.resv;
   	}
- if (flags & AMDGPU_GEM_CREATE_ENCRYPTED) {
-		/* XXX: pad out alignment to meet TMZ requirements */
-	}
+	/* TMZ requires the secure buffer to align with page size at least */
+	if (flags & AMDGPU_GEM_CREATE_ENCRYPTED)
+		args->in.alignment = roundup(args->in.alignment,
+					     AMDGPU_GPU_PAGE_SIZE);
r = amdgpu_gem_object_create(adev, size, args->in.alignment,
   				     (u32)(0xffffffff & args->in.domains),

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux