From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB2F910F92E5 for ; Tue, 31 Mar 2026 16:25:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 75E1E10EB5D; Tue, 31 Mar 2026 16:25:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OJB00eKs"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id DDC6810EAE9 for ; Tue, 31 Mar 2026 16:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774974296; x=1806510296; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=lrkqLsjma8YrFv1K1qjW3OLuQ4XonBW39+Y0s6Qz/6o=; b=OJB00eKsNG0IuP1SnN+LV4ZTmQsL99PSgIgpr/I8l8RUMCvZn4hA6XVQ d+FxVMkgJH0pLt9vTBW+2mb+MuQKztvwyEMc3tOea6u/5ZITc/oRvCLhO hlhx/ViPxAdy3eaNm13Y/OdhlkH25wc+XlGE1zn/f9JXFBdEoIytKFHCE JlKT9jB0xNvS5iZ4oSGd+FLf7YAMi237DkvqPIFeu0MnZnTBDqlBZT0YW a8jbd8b9MxPd+D/rfAUkPOXP/S/wr5r3F4ZpLrQ1xMq7Y28efXP05fcmP Q2AgNjSpJJ4nuQR5X0rHW27hKmO37UQ7ydjWLAwCmNn4z8VYaNjn2lwPb A==; X-CSE-ConnectionGUID: Gly1laXNSOGGfFuja0d/rw== X-CSE-MsgGUID: Cxxrz+c6QBODYxX4iN+7JA== X-IronPort-AV: E=McAfee;i="6800,10657,11745"; a="86691101" X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="86691101" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 09:24:55 -0700 X-CSE-ConnectionGUID: qf8lMcN3Q+Cy82K5BewBHQ== X-CSE-MsgGUID: wOshmwvsShy8SDFIZI4oMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="256908882" Received: from vpanait-mobl.ger.corp.intel.com (HELO [10.245.244.19]) ([10.245.244.19]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 09:24:53 -0700 Message-ID: <4d9f07de-178a-4259-9b34-5a92e842196f@intel.com> Date: Tue, 31 Mar 2026 17:24:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 3/4] tests/intel/xe_vm: Add DRM_IOCTL_XE_VM_GET_PROPERTY validation tests To: Jonathan Cavitt , igt-dev@lists.freedesktop.org Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, joonas.lahtinen@linux.intel.com, matthew.brost@intel.com, jianxun.zhang@intel.com, stuart.summers@intel.com, shuicheng.lin@intel.com, nishit.sharma@intel.com References: <20260331155700.7245-6-jonathan.cavitt@intel.com> <20260331155700.7245-9-jonathan.cavitt@intel.com> Content-Language: en-GB From: Matthew Auld In-Reply-To: <20260331155700.7245-9-jonathan.cavitt@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On 31/03/2026 16:57, Jonathan Cavitt wrote: > Add tests to xe_vm that exercise the new DRM_IOCTL_XE_VM_GET_PROPERTY > ioctl. Specifically, add input validation tests that exercise the > return values for improperly formatted ioctl structures. > > v2: > - Make vm creation consistent between patches (jcavitt) > > Signed-off-by: Jonathan Cavitt > Reviewed-by: Nishit Sharma > --- > tests/intel/xe_vm.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 81 insertions(+) > > diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c > index ccff8f8046..778d9ac86d 100644 > --- a/tests/intel/xe_vm.c > +++ b/tests/intel/xe_vm.c > @@ -2450,6 +2450,71 @@ static void test_oom(int fd) > } > } > > +/** > + * SUBTEST: vm-get-property-invalid-reserved > + * Functionality: ioctl_input_validation > + * Description: Check query with invalid reserved returns expected error code > + * > + * SUBTEST: vm-get-property-invalid-vm-id > + * Functionality: ioctl_input_validation > + * Description: Check query with invalid vm_id returns expected error code > + * > + * SUBTEST: vm-get-property-invalid-size > + * Functionality: ioctl_input_validation > + * Description: Check query with invalid size return expected error code > + * > + * SUBTEST: vm-get-property-invalid-property > + * Functionality: ioctl_input_validation > + * Description: Check query with invalid property returns expected error code > + */ > +static void get_property_invalid_reserved(int fd, uint32_t vm) > +{ > + struct drm_xe_vm_get_property query = { > + .reserved[0] = 0xdeadbeef, What about also validating .pad? Also I think .extensions? It looks like KMD is missing an MBZ check for those? > + }; > + > + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL); > +} > + > +static void get_property_invalid_vm_id(int fd, uint32_t vm) > +{ > + struct drm_xe_vm_get_property query = { > + .vm_id = 0xdeadbeef, > + }; > + > + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, ENOENT); > +} > + > +static void get_property_invalid_size(int fd, uint32_t vm) > +{ > + struct drm_xe_vm_get_property query = { > + .vm_id = vm, > + .property = DRM_XE_VM_GET_PROPERTY_FAULTS, > + .size = -1, > + }; > + > + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL); > +} > + > +static void get_property_invalid_property(int fd, uint32_t vm) > +{ > + struct drm_xe_vm_get_property query = { > + .vm_id = vm, > + .property = 0xdeadbeef, > + }; > + > + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL); > +} > + > +static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) > +{ > + uint32_t vm; > + > + vm = xe_vm_create(fd, 0, 0); > + func(fd, vm); > + xe_vm_destroy(fd, vm); > +} > + > int igt_main() > { > struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL; > @@ -2562,6 +2627,17 @@ int igt_main() > { } > }; > > + const struct vm_get_property { > + const char *name; > + void (*test)(int fd, uint32_t vm); > + } xe_vm_get_property_tests[] = { > + { "invalid-reserved", get_property_invalid_reserved }, > + { "invalid-vm-id", get_property_invalid_vm_id }, > + { "invalid-size", get_property_invalid_size }, > + { "invalid-property", get_property_invalid_property }, > + { } > + }; > + > igt_fixture() { > fd = drm_open_driver(DRIVER_XE); > > @@ -2850,6 +2926,11 @@ int igt_main() > test_oom(fd); > } > > + for (const struct vm_get_property *f = xe_vm_get_property_tests; f->name; f++) { > + igt_subtest_f("vm-get-property-%s", f->name) > + test_get_property(fd, f->test); > + } > + > igt_fixture() > drm_close_driver(fd); > }