Commit Graph

683 Commits (287cdb0390983b862a1dd4d8cda0a791d7701569)

Author SHA1 Message Date
Sathishkumar S 294b9c8322 tests/amdgpu: add jpeg tests support
v2:
- remove dec create/destroy msg as its not relevant to jpeg (Leo)
- enable the test for jpeg2/jpeg3 (Leo)
- validate checksum of result (Leo)
- add appropriate comments (Leo)

v3:
- linux style function definition indent (James)
- use multiline comment delimiter (Leo)

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2021-12-09 19:31:45 -05:00
Luigi Santivetti e641e2a632 xf86drm: add iterator API for DRM/KMS IN_FORMATS blobs
Add support for parsing IN_FORMATS property blobs. Providing libdrm
with this functionality helps to standardise how user-space reads
kernel blobs and decreases duplication on the client side.

drmModeFormatModifierBlobIterNext() allows the caller to view
formats and associated modifiers given a valid property blob.
An example is available inside the libdrm unit test, modetest.c.

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-11-08 16:20:04 +00:00
Alex Richardson fda3d0010f Fix -Werror=format build errors on FreeBSD
On 64-bit FreeBSD targets uint64_t is generally defined as `unsigned long`
and not `unsigned long long`. Use the PRI macros to fix -Wformat.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-11-02 10:44:30 +00:00
Christian König d77ccdf3ba amdgpu: add amdgpu_stress utility v2
Simple yet useful command line utility to simulate memory pressure.

Already found quite a number of problems in TTM with that.

v2: replace spaces with tabs

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2021-10-20 15:15:30 +02:00
ZhiJie.Zhang d201a41d1a tests/modetest: get cursor width and height by drmGetCap
Should get cursor width and height by drmGetCap.

Signed-off-by: ZhiJie.Zhang <zhangzhijie@loongson.cn>
2021-09-02 09:26:17 +00:00
Aaron Liu 4ac7d6bf5d test/amdgpu: Bob to Alice copy should be TMZ in secure bounce test
SDMA copy from Alice to Bob is in TMZ mode. Therefore
SDMA copy back from Bob to Alice should be in TMZ mode too.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
2021-07-23 10:24:22 +08:00
Luben Tuikov 87a68fe9e4 tests/amdgpu: Fix TMZ secure bounce test
Fix the TMZ secure bounce test, in that Bob's
buffer has to be created encrypted (with the
encrypted flag set), so that when we copy from
Alice's buffer, which is also encrypted, to Bob's
buffer, the copy can be successful and the data
actually copied.

This fixes the test and it no longer fails. Tested
on Sienna Cichlid.

Cc: Alex Deucher <Alexander.Deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Aaron Liu <aaron.liu@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
2021-07-16 12:10:06 -04:00
Marius Vlad 67e911977f xf86drm: Add a human readable representation for format modifiers
Introduces two new methods to retrieve a human readable representation of a
format modifier:

drmGetFormatModifierName() - returns a format modifier as a string,
from a token modifier
drmGetFormatModifierVendor() - returns the vendor as a string, from a
token modifier

and the fourcc_mod_get_vendor macro that returns the vendor.

New format modifiers added in drm_fourcc.h uapi kernel header should be
sync'ed up with libdrm and should include a human readable
representation for that format modifier, in order to display it
correctly as a string.

That happens with the help of a python script that reads up drm_fourcc
header file and outputs a static table comprised of token modifiers
alongside a vendor table (Suggested-by Simon Ser <contact@emersion.fr>).

The reason for doing it in libdrm is to have a unified place instead of each
user of libdrm having a way to keep track of the format modifiers.

With this patch, modetest has also been modified to make use of it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-06-22 11:16:04 +00:00
Eleni Maria Stea f287d1990b Conditionally include <linux/limits.h> and <sys/params.h> on Linux, BSD
<linux/limits.h> should be included conditionally for Linux only, also
SPECNAMELEN used conditionally when the OS is FreeBSD requires to
include <sys/params.h>.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2021-06-20 14:32:33 +03:00
Andrey Grodzovsky d615430c68 tests/amdgpu/hotunplug: Add hotunplug with exported fence
Disconnect device while fence is exported.
Also disable this test for sytem with single GPU.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Andrey Grodzovsky 93a4708ac0 tests/amdgpu/hotunplug: Add hotunplug with exported bo test
Disconnect device while BO is exported.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Andrey Grodzovsky b5f611cc37 tests/amdgpu/hotunplug: Add unplug with cs test.
Same as simple test but while doing cs

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Andrey Grodzovsky d4b780a735 test/amdgpu/hotunplug: Add test suite for GPU unplug
Add plug/unplug device and open/close device file
infrastructure.
Add basic test - unplug device while device file still
open. Close device file afterwards and replug the device.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Andrey Grodzovsky d330f68c11 test/amdgpu: Add helper functions for hot unplug
Expose close device and add open device wich preserves
test index.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Andrey Grodzovsky ae2e2bd68a tests/amdgpu: Fix valgrind warning
Struct access after free

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
2021-06-09 20:27:09 +00:00
Lang Yu 4e178807b9 Revert "tests/amdgpu: fix bo eviction test issue"
This reverts commit a5a400c958.

Bo evict test was disabled by default per below commit.
So still keep it as disabled.

1f6a85cc test/amdgpu: disable bo eviction test by default

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2021-06-01 12:56:24 +00:00
Jinzhou Su c7dc0465cf test/amdgpu: Add emit mem sync flag for test IB
In syncobj test, 3 threads will be created. Sometimes
the first gfx IB and the third sdma IB will use same
physical page. There will be risk that sdma engine will
read gfx IB in the same physical page. So better to flush
the cache before commit the sdma IB.

Signed-off-by: Jinzhou Su <Jinzhou.Su@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2021-04-19 14:04:22 +08:00
Huang Rui 67a64bb946 test/amdgpu: use tmz ids to check whether enable security tests
Using tmz ids that reported from kernel to decide whether enable
security tests.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2021-04-14 09:52:33 +02:00
James Zhu 3c02304c04 tests/amdgpu/vcn: update to support aldebaran
VCN is supported after AI family Arcturus.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2021-04-14 02:41:56 +00:00
Feifei Xu 7b844dabf9 tests/amdgpu:retire asic_id check on unsupported cases
Retire the asic_id check for AI family.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2021-04-12 17:46:31 +08:00
Feifei Xu 991e95fd13 tests/amdgpu: update gfx9 BufferCopy/BufferClear
buffer_load/store_format_xyzw require 64bit vgpr_a[2].
The original parameter is one u32. Modify the shader binary to
fit the 64bit parameter.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Tested-by: Gang Long <Gang.Long@amd.com>
2021-04-09 15:11:08 +08:00
Lang Yu a5a400c958 tests/amdgpu: fix bo eviction test issue
On Raven2/Picasso, the default VRAM size is 2048M,
and the default GTT size is 3072M. If max_allocation
of VRAM exceeds half of GTT size, GTT memory can't
hold evicted bo from VRAM and bo in itself at the
same time. Then amdgpu_cs_list_validate will failed
with "Not enough memory for command submission" error.

NOTE:
The installed DRAM should be larger than 8GB,
if the VRAM size is 2048M.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2021-04-01 11:41:51 -04:00
Lang Yu af871ec1a6 drm/tests/amdgpu: fix Metadata test failed issue
The unit of size_metadata is one byte not four bytes.
Enable Metadata test.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2021-04-01 11:41:49 -04:00
Jinzhou Su f5abbc3033 test/amdgpu: remove static varible in Syncobj test
In syncobj test, wait thread and signal thread create
simultaneously. The ptr for GFX IB and SDMA IP should be
operated separately. With static, there will be risk that
GFX NOP is in SDMA IB or SDMA NOP is in GFX IB, then GFX or
SDMA hang caused.

Signed-off-by: Jinzhou Su <Jinzhou.Su@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2021-03-24 11:34:04 -04:00
Victor Hugo Vianna Silva a43cac24db Avoid some compiler errors for tests/util/pattern.c
- Remove one unused variable.
- Convert two int-s into 'unsigned int'.
Motivated by a failed build of Chromium.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Victor Hugo Vianna Silva <victor.vianna10@gmail.com>
2021-02-10 21:14:47 +00:00
Sonny Jiang 19f0a9cb87 tests/amdgpu/vcn: clean abundant codes
Remove useless codes.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2021-01-23 15:31:00 -05:00
James Zhu 2315bcddd6 tests/amdgpu: add vcn test support for dimgrey_cavefish
add dimgrey_cavefish chip id in vcn test

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2021-01-23 15:31:00 -05:00
Tao Zhou 10377d661a tests/amdgpu: add vcn test support for navy_flounder
add navy_flounder chip id in vcn test

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Jiansong Chen <Jiansong.Chen@amd.com>
2021-01-23 15:31:00 -05:00
Fabio Estevam 5f85a6d98b tests/util: Add mxsfb-drm driver
Add an entry for the "mxsfb-drm" driver, so that the test utilities
work with the mxsfb driver without passing the -M argument.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
2021-01-22 11:17:58 +01:00
Emmanuel Vadot d034db142d tests/amdgpu: Fix on FreeBSD
FreeBSD have endian.h under the sys directory.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
2020-12-12 11:34:17 +00:00
Luben Tuikov d4fdeaf19b tests/amdgpu: Fix a typo
Fix a typo: "TZM" --> "TMZ"

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2020-12-11 16:51:35 -05:00
Nicolas Caramelli 1a2b1a6cac tests/modetest: remove bracket in dump_connectors()
Signed-off-by: Nicolas Caramelli <caramelli.devel@gmail.com>
2020-12-11 16:35:20 +00:00
Lubomir Rintel 9a7afcf198 tests/etnaviv_2d_test: check whether the rendering is correct
Instead of always dumping the rendered picture, check whether it matches
the expectations. This makes more sense for automated testing.

Retain the ability to dump the picture instead of checking it when a
file name is given as an argument. This also removes use of a hardcoded
file name in a world writable directory, which is an unsafe thing to
do anyway.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2020-12-09 16:00:51 +01:00
Lubomir Rintel 9638207005 tests/etnaviv_2d_test: pick the 2D core
Run the test on a core capable of 2D rendering instead of hardcoding to
core zero.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2020-12-09 16:00:47 +01:00
Lubomir Rintel f35acf6d3f tests/etnaviv_2d_test: explain the errors
Just so that it's obvious what failed and why.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2020-12-09 16:00:43 +01:00
Thong Thai fc479e133e tests/amdgpu/vcn: update to not use asic_id for Renoir
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2020-11-06 14:41:14 +00:00
Lucas Stach c2e940a8be tests/util: Add imx-dcss driver
This makes the test utilities work with the i.MX DCSS driver without the
necessity of using the -M argument.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
2020-10-28 10:56:18 +01:00
Tianci.Yin 3e9f211303 tests/amdgpu: disable VCN test if no VCN ring available(v2)
If KMD has no VCN support, remove the VCN test.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
2020-10-23 16:22:11 +08:00
Carsten Haitzler 3ec26b03ee tests: add komeda to list of modules to look for for testing
komeda is one of the supported GPUs in the kernel tree so this adds it
to libdrm modules to look for in tests.

Signed-off-by: Carsten Haitzler <carsten.haitzler@arm.com>
2020-10-16 15:14:45 +01:00
Alex Deucher ce1387b591 amdgpu: only enable security tests on raven family
It's the only asic with support at the moment.

Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:47:05 -04:00
Luben Tuikov 253e0383a3 tests/amdgpu: Secure bounce test (v4)
Implement secure bounce test. Steps implemented
as outlined by Christian K.

v2: Remove gpu_info; add comment describing
    the purpose and steps of the test.
v3: Parameterize "secure" in amdgpu_bo_lcopy() and
    amdgpu_bo_move(). Set them both to 0.
    Allocate buffer Bob to be non-TMZ.
v4: Fix an off-by-one bug which was causing
    the test to segfault.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:47:00 -04:00
Luben Tuikov 18a0291273 tests/amdgpu: Remove forward declarations
Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:55 -04:00
Aaron Liu 24b9c9ca47 test/amdgpu: enable security suite tests
This patch enables security suite tests.

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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:50 -04:00
Aaron Liu eb1a17039f test/amdgpu: add drm version checking for security suite
Adding drm version checking for security suite.
drm version need to be at least 3.37.

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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:45 -04:00
Aaron Liu 238acd6f3d tests/amdgpu: add test to submit a sdma command with secure context
This patch add test to submit a sdma command with secure context.

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>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:40 -04:00
Aaron Liu 38c44cccdc 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>
2020-10-15 13:46:34 -04:00
Aaron Liu 00087856fc tests/amdgpu: add test to submit a gfx command with secure context
This patch is to test the command submission with secure context.

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>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:29 -04:00
Aaron Liu 5de99b1fa6 tests/amdgpu: add atomic_mem cp_packet to verify the secure buffer
Secure buffer is only able to be read with trusted ip block.
So we need use GFX ip to read it back instead of CPU.
Steps:
1. use write_data packet to write 0xdeadbeaf to secure buffer,
2. use atmoic_mem packet and ATOMIC_CMPSWAP_RTN_32 opcode to compare
the cmp_data(0xdeadbeaf) to the written data which has been encrypted.
If the result is equal, then overwrite the src_data(0x12345678) to the
secure buffer and return directly. Otherwise loop again until gfx timeout
and the secure buffer data unchanged.

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>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:22 -04:00
Aaron Liu b352ef44b8 tests/amdgpu: expand secure param for exec_cs_helper (v2)
This patch expands secure param for amdgpu_test_exec_cs_helper_raw.
The flag is transfered to kernel with cs.

v2: squash in change from context to IB flag

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>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:16 -04:00
Huang Rui 0cefd4cecd tests/amdgpu: add device handle as input param for exec_cs_helper and write_linear_helper (v4)
This patch is to add add device handle as input param for exec_cs_helper
and write_linear_helper.

Because they are needed in security tests.

v2: fix typo that basic tests should be un-secure.
v3: refine the function implementation.
v4: remove amdgpu_cs_ctx_create3 calling.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-10-15 13:46:11 -04:00