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 757711076387 for ; Wed, 1 Apr 2026 17:09:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FDEC10E292; Wed, 1 Apr 2026 17:09:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FKmRk33E"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BBDC10E9C5 for ; Wed, 1 Apr 2026 17:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775063363; x=1806599363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FcR88ye0Xj+AdDJhNKC0B+7H4CEdWT6aLqFwDOh61K8=; b=FKmRk33EGMyklH8pK9FItMMGpu6sHMNG1jr1dDAwwxrBR9BWA9SlfMoA GQoWsPTKa8efztpWK13edoFxxA1oGTEB9T0CHG76ei52KDb1Jkb+ckqkX bF06iCilVUYyDNARX+KGsXBb4SQVKx2iAr+Vxi6zmc34DuEoxUO3c8L9h RJReGrYGR1PrExsz5HAAcK+30wICMdi7j4yMQNlJCvtgrR5ONQvU02G0g p/Z/2ao+iuaHp6979u8F9i4/5PLEdrev+Wi8SVBRALJLHty7UEOkNfuvK 9kcn1xoi7AhH5BhhDApUElwrUFTE009dLLIVHrBP6/hssZameCLwkGmp9 w==; X-CSE-ConnectionGUID: qYorVUfyQc+xcT/nCSHgKw== X-CSE-MsgGUID: tL5xnmyfQ46XBbJHume6iw== X-IronPort-AV: E=McAfee;i="6800,10657,11745"; a="86724322" X-IronPort-AV: E=Sophos;i="6.23,153,1770624000"; d="scan'208";a="86724322" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2026 10:09:17 -0700 X-CSE-ConnectionGUID: B/OK3oDVTgimQ6kFCrqiDQ== X-CSE-MsgGUID: JoBnZTjHRQe77Si/r0aSNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,153,1770624000"; d="scan'208";a="226593738" Received: from dut4449lnl.fm.intel.com ([10.105.8.75]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2026 10:09:17 -0700 From: Jonathan Cavitt To: igt-dev@lists.freedesktop.org Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@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, matthew.auld@intel.com, kamil.konieczny@linux.intel.com Subject: [PATCH v9 3/4] tests/intel/xe_vm: Add DRM_IOCTL_XE_VM_GET_PROPERTY validation tests Date: Wed, 1 Apr 2026 17:09:18 +0000 Message-ID: <20260401170914.16908-9-jonathan.cavitt@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401170914.16908-6-jonathan.cavitt@intel.com> References: <20260401170914.16908-6-jonathan.cavitt@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" 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) v3: - Add missing invalid extensions and pad tests (Auld) Signed-off-by: Jonathan Cavitt Reviewed-by: Nishit Sharma Cc: Matthew Auld --- tests/intel/xe_vm.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c index ccff8f8046..b9a6282f9a 100644 --- a/tests/intel/xe_vm.c +++ b/tests/intel/xe_vm.c @@ -2450,6 +2450,97 @@ 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-extensions + * Functionality: ioctl_input_validation + * Description: Check query with invalid extensions returns expected error code + * + * SUBTEST: vm-get-property-invalid-pad + * Functionality: ioctl_input_validation + * Description: Check query with invalid pad 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, + }; + + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL); +} + +static void get_property_invalid_extensions(int fd, uint32_t vm) +{ + struct drm_xe_vm_get_property query = { + .extensions = 0xdeadbeef, + }; + + do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL); +} + +static void get_property_invalid_pad(int fd, uint32_t vm) +{ + struct drm_xe_vm_get_property query = { + .pad = 0xdeadbeef, + }; + + 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 +2653,19 @@ 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-extensions", get_property_invalid_extensions }, + { "invalid-pad", get_property_invalid_pad }, + { "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 +2954,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); } -- 2.43.0