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

Kumar, Janga Rahul janga.rahul.kumar at intel.com
Mon Oct 16 07:28:57 UTC 2023



> -----Original Message-----
> From: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> Sent: Monday, October 16, 2023 10:40 AM
> To: Kumar, Janga Rahul <janga.rahul.kumar at intel.com>; igt-
> dev at lists.freedesktop.org; Ch, Sai Gowtham <sai.gowtham.ch at intel.com>;
> Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> Subject: [PATCH i-g-t] tests/xe/xe_access_counter: Negative access counter
> test
> 
> 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 for invalid values.
> 
> v2: Added subtest description.
> 
> v3: Added min value -1 to check for min granularity range.(Rahul)
> 
> 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>


Reviewed-by: Janga Rahul Kumar<janga.rahul.kumar at intel.com>

> ---
>  tests/intel/xe_access_counter.c | 72 +++++++++++++++++++++++++++++++++
>  tests/meson.build               |  1 +
>  2 files changed, 73 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..3660184a8
> --- /dev/null
> +++ b/tests/intel/xe_access_counter.c
> @@ -0,0 +1,72 @@
> +// 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);
> +
> +		ext.val = -1;
> +		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