From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::61b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E91510E5B6 for ; Wed, 10 Jan 2024 10:15:58 +0000 (UTC) Message-ID: <98f0eaf7-a449-437b-a3d5-1d2e21f5137c@amd.com> Date: Wed, 10 Jan 2024 11:15:50 +0100 Subject: Re: [PATCH i-g-t] tests/amd_security: fix secure bounce test issue Content-Language: en-US To: "Zhang, Jesse(Jie)" , "igt-dev@lists.freedesktop.org" References: <20231204030007.326044-1-jesse.zhang@amd.com> From: =?UTF-8?Q?Christian_K=C3=B6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Deucher, Alexander" Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From coding style etc it looks good and of hand it seems to make sense. But I don't understand the background of the test and why that direction needs to be reverted. So Vitaly can you take a look? Thanks, Christian. Am 10.01.24 um 10:13 schrieb Zhang, Jesse(Jie): > [AMD Official Use Only - General] > > Ping ... > Can anyone help review this. > -----Original Message----- > From: Jesse Zhang > Sent: Monday, December 4, 2023 11:00 AM > To: igt-dev@lists.freedesktop.org > Cc: Prosyak, Vitaly ; Deucher, Alexander ; Tuikov, Luben ; Koenig, Christian ; Zhang, Jesse(Jie) ; Kamil Konieczny ; Zhang, Jesse(Jie) > Subject: [PATCH i-g-t] tests/amd_security: fix secure bounce test issue > > When it copy from scr (bo) to destination (bo2), and move bo2 from vram to gtt. > Then it need to copy from bo2(src) > to bo (destination) for verification. > > Cc: Vitaly Prosyak > Cc: Luben Tuikov > Cc: Alex Deucher > Cc: Christian Koenig > Cc: Kamil Konieczny > > Signed-off-by: Jesse Zhang > --- > tests/amdgpu/amd_security.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/tests/amdgpu/amd_security.c b/tests/amdgpu/amd_security.c index d1146a7ce..7fb6df3b6 100644 > --- a/tests/amdgpu/amd_security.c > +++ b/tests/amdgpu/amd_security.c > @@ -99,7 +99,7 @@ static void > amdgpu_bo_lcopy(amdgpu_device_handle device, > struct amdgpu_ring_context *ring_context, > const struct amdgpu_ip_block_version *ip_block, uint32_t size, > - uint32_t secure) > + uint32_t secure, int direction) > { > ring_context->pm4 = calloc(PACKET_LCOPY_SIZE, sizeof(*ring_context->pm4)); > ring_context->secure = secure; > @@ -108,8 +108,15 @@ amdgpu_bo_lcopy(amdgpu_device_handle device, > ring_context->res_cnt = 2; > igt_assert(ring_context->pm4); > > - amdgpu_sdma_lcopy(ring_context->pm4, ring_context->bo_mc2, > - ring_context->bo_mc, size, secure); > + if (direction) { > + /* copy from bo2 to bo */ > + amdgpu_sdma_lcopy(ring_context->pm4, ring_context->bo_mc, > + ring_context->bo_mc2, size, secure); > + } else { > + /* copy from bo to bo bo2 */ > + amdgpu_sdma_lcopy(ring_context->pm4, ring_context->bo_mc2, > + ring_context->bo_mc, size, secure); > + } > amdgpu_test_exec_cs_helper(device, ip_block->type, ring_context, 0); > free(ring_context->pm4); > } > @@ -222,7 +229,7 @@ amdgpu_secure_bounce(amdgpu_device_handle device_handle, int fd, > ring_context->resources[1] = ring_context->bo; // Alice > > amdgpu_bo_lcopy(device_handle, ring_context, ip_block, SECURE_BUFFER_SIZE, > - secure == true ? 1 : 0); > + secure == true ? 1 : 0, 0); > > /* Verify the contents of Bob. */ > for (pp = (__typeof__(pp))ring_context->bo2_cpu; > @@ -249,7 +256,7 @@ amdgpu_secure_bounce(amdgpu_device_handle device_handle, int fd, > > /* sDMA TMZ copy from Bob to Alice. */ > amdgpu_bo_lcopy(device_handle, ring_context, ip_block, SECURE_BUFFER_SIZE, > - secure == true ? 1 : 0); > + secure == true ? 1 : 0, 1); > > /* Verify the contents of Alice */ > for (pp = (__typeof__(pp))ring_context->bo_cpu; > -- > 2.25.1 >