drm/amdgpu: fill the alignment for secure buffer
Subsystems (2)
PATCH 1/1 drm/amdgpu: fill the alignment for secure buffer
The alignment should match the page size for secure buffer.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -3
@@ -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),
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerAm 15.01.20 um 08:07 schrieb Huang Rui:
Quoted 1 line
The alignment should match the page size for secure buffer.
That is superfluous, buffer are aligned to a page size anyway.
Christian.
Quoted 14 lines
Signed-off-by Huang Rui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0
-0@@ -261,9 +261,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, resv = vm->root.base.bo->tbo.base.resv; }
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 270
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4
-3-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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Christian
Am 15.01.20 um 08:07 schrieb Huang Rui:
Quoted 1 line
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?
Thanks,
Ray
Quoted 24 lines
Christian.
Quoted 22 lines
Signed-off-by Huang Rui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4
-3@@ -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 );
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 270
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0
-0r = amdgpu_gem_object_create(adev, size, args->in.alignment, (u32)(0xffffffff & args->in.domains),
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerAm 15.01.20 um 08:48 schrieb Huang Rui:
Quoted 6 lines · Christian
Quoted 4 lines
Am 15.01.20 um 08:07 schrieb Huang Rui:
Quoted 1 line
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.
Quoted 27 lines
Thanks,
RayQuoted 23 lines
Christian.
Quoted 21 lines
Signed-off-by Huang Rui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4
-3@@ -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 );
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 270
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0
-0r = amdgpu_gem_object_create(adev, size, args->in.alignment, (u32)(0xffffffff & args->in.domains),
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 10 lines · Christian König
Am 15.01.20 um 08:48 schrieb Huang Rui:
Quoted 6 lines · Christian
Quoted 4 lines
Am 15.01.20 um 08:07 schrieb Huang Rui:
Quoted 1 line
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.
We can drop the empty code block and XXX comment however.
Alex
Quoted 30 lines
Christian.
Quoted 27 lines
Thanks,
RayQuoted 23 lines
Christian.
Quoted 21 lines
Signed-off-by Huang Rui <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4
-3@@ -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 );
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 270
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0
-0r = amdgpu_gem_object_create(adev, size, args->in.alignment, (u32)(0xffffffff & args->in.domains),_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx