tests/amdgpu: add atomic dma command to verify the secure buffer (v2)
authorAaron Liu <aaron.liu@amd.com>
Fri, 15 Nov 2019 01:42:03 +0000 (09:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 15 Oct 2020 17:46:34 +0000 (13:46 -0400)
commit38c44cccdc03effbbf4b6f1b69e8ea3e40374a73
treee95bac9d7d9afd4fb46a35349c84795021cd44cb
parent00087856fc3dc11667ccb4872cd6df6d41ddff51
tests/amdgpu: add atomic dma command to verify the secure buffer (v2)

DMA's atomic behavir is unlike GFX,If the comparing data is not
equal to destination data,
For GFX, loop again till gfx timeout(system hang).
For DMA, loop again till timer expired and then send interrupt.
So testcase can't use interrupt mechanism.
We take another way to verify. When the comparing data is not
equal to destination data, overwrite the source data to the destination
buffer. Otherwise, original destination data unchanged.
So if the bo_cpu data is overwritten, the result is passed.

Steps:
1. use linear write packet to write 0xdeadbeaf to secure buffer,
2. use atmoic packet and ATOMIC_CMPSWAP_RTN_32 opcode to compare
the cmp_data(0xdeadbeaf) to the written data which has been encrypted.

v2: add the case of (dest_data != cmp_data).

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
tests/amdgpu/basic_tests.c