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 995F6109B489 for ; Tue, 31 Mar 2026 15:57:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4925C10EAB8; Tue, 31 Mar 2026 15:57:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="PQGOaJFd"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id F3DCB10EA8E for ; Tue, 31 Mar 2026 15:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774972622; x=1806508622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MFPWmajiJE97nLQPe0gisC9RGRb+ef9v4A5LC9EdBRg=; b=PQGOaJFdEYfff9c3e8QYgKs8Z5hRNgS0qUCL6JTMeAOHoCl+AERc5XLl jZp2dQWlHSrJgRHbtFpLHiKElaTe9YubtoW1NiU/Rv6mY97aaXba8Ftpc 2UExCWRwDC1zQrGJi6atiSk19GX2TIUHfrydNzBiO5hIlixYhMNWdxpJD Kd0Qdm2NwaGnbCHguYxzst9E8XkgZTznqiqpa22dzhWXD4bNgZdJquDLM mffcBJR/SHVopEYVTVg2Mgt1IY8YHQ4LpPv+7M0iQLXmGqwjTqX8wHzcX YsMLOmDrPDUdFZImxNk+92nFUo8FgOUp+VQpdsld60qN4BOuk0ImXz/4Q g==; X-CSE-ConnectionGUID: P+0tJYFcQge9xU38JDBvHw== X-CSE-MsgGUID: HTRzFclmSF2M4ltzT/oACw== X-IronPort-AV: E=McAfee;i="6800,10657,11745"; a="75026172" X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="75026172" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 08:57:01 -0700 X-CSE-ConnectionGUID: 1Q4m9YNRQIKMgYtZttEKKg== X-CSE-MsgGUID: i62EL+ElTVa4AjFzcxuNtA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,152,1770624000"; d="scan'208";a="219744547" Received: from dut4449lnl.fm.intel.com ([10.105.8.75]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 08:57:01 -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 Subject: [PATCH v8 3/4] tests/intel/xe_vm: Add DRM_IOCTL_XE_VM_GET_PROPERTY validation tests Date: Tue, 31 Mar 2026 15:57:04 +0000 Message-ID: <20260331155700.7245-9-jonathan.cavitt@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260331155700.7245-6-jonathan.cavitt@intel.com> References: <20260331155700.7245-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) 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, + }; + + 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); } -- 2.43.0