[igt-dev] [PATCH i-g-t] tests/xe/xe_access_counter: Negative access counter test

Daniel Mrzyglod daniel.t.mrzyglod at intel.com
Tue Oct 10 10:21:39 UTC 2023


On Tue, Oct 10, 2023 at 02:16:52PM +0530, priyanka.dandamudi at intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> 
> Added a negative test related to access counter.
> It tries to test GRANULARITY access counter parameter.
> It should return -EINVAL parameter beyond SZ_64M.
> 
> v2: Added subtest description.
> 
LGTM, 
Description is valid, and test is doing directly what describe.

Reviewed-by: Daniel Mrzyglod <daniel.t.mrzyglod at intel.com>


> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> ---
>  tests/intel/xe_access_counter.c | 69 +++++++++++++++++++++++++++++++++
>  tests/meson.build               |  1 +
>  2 files changed, 70 insertions(+)
>  create mode 100644 tests/intel/xe_access_counter.c
> 
> diff --git a/tests/intel/xe_access_counter.c b/tests/intel/xe_access_counter.c
> new file mode 100644
> index 000000000..d98cdf56e
> --- /dev/null
> +++ b/tests/intel/xe_access_counter.c
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: Basic tests for access counter functionality
> + * Category: Software building block
> + * Run type: FULL
> + * Sub-category: access counter
> + * Functionality: access counter
> + * Test category: functionality test
> + * SUBTEST: invalid-param
> + * Description: Giving invalid granularity size parameter and checks for invalid error.
> + */
> +
> +#include "igt.h"
> +#include "lib/igt_syncobj.h"
> +#include "lib/intel_reg.h"
> +#include "xe_drm.h"
> +
> +#include "xe/xe_ioctl.h"
> +#include "xe/xe_query.h"
> +#include <string.h>
> +
> +#define SZ_64M  3
> +igt_main
> +{
> +	int fd;
> +
> +	igt_fixture {
> +		uint16_t devid;
> +
> +		fd = drm_open_driver(DRIVER_XE);
> +		devid = intel_get_drm_devid(fd);
> +		igt_require(IS_PONTEVECCHIO(devid));
> +	}
> +
> +	igt_subtest("invalid-param") {
> +		struct drm_xe_engine_class_instance instance = {
> +			 .engine_class = DRM_XE_ENGINE_CLASS_VM_BIND,
> +		 };
> +
> +		int err;
> +		const int expected = -EINVAL;
> +
> +		struct drm_xe_ext_exec_queue_set_property ext = {
> +			.base.next_extension = 0,
> +			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
> +			.property = XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY,
> +			.value = SZ_64M + 1,
> +		};
> +
> +		struct drm_xe_exec_queue_create create = {
> +			.extensions = to_user_pointer(&ext),
> +			.vm_id = xe_vm_create(fd, 0, 0),
> +			.width = 1,
> +			.num_placements = 1,
> +			.instances = to_user_pointer(&instance),
> +		};
> +
> +		err = igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create);
> +
> +		igt_assert_eq(err, expected);
> +	}
> +
> +	igt_fixture
> +		drm_close_driver(fd);
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 05fda7d94..aa0b4e888 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -271,6 +271,7 @@ intel_kms_progs = [
>  ]
>  
>  intel_xe_progs = [
> +	'xe_access_counter',
>  	'xe_ccs',
>  	'xe_create',
>  	'xe_compute',
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list