]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/tests/pci: Convert GT count check to general device check
authorGustavo Sousa <gustavo.sousa@intel.com>
Mon, 20 Oct 2025 23:45:56 +0000 (20:45 -0300)
committerGustavo Sousa <gustavo.sousa@intel.com>
Wed, 22 Oct 2025 12:49:16 +0000 (09:49 -0300)
We already have check_graphics_ip() and check_media_ip() as general
functions to check the IP descriptors.  The check in
check_platform_gt_count() is simple enough such that we can convert the
function to a more general device check.  In an upcoming change, we will
also add some checks for other members of struct xe_device_desc. As
such, rename check_platform_gt_count() to check_platform_desc().

While at it, use inline (unsigned int) casting of max_gt_per_tile to
keep checks for each member localized; and use KUNIT_EXPECT_*() variants
of the macros to allow multiple issues to be reported.

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20251020-xe-kunit-dma_mask_size-va_bits-vm_max_level-v2-1-27b03971bc7e@intel.com
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
drivers/gpu/drm/xe/tests/xe_pci_test.c

index 37b344df2dc327b456c964f182b60d45dff425d6..4ba2fb93c9ded31df5563aae8fea8baca6ab4eab 100644 (file)
@@ -44,21 +44,20 @@ static void check_media_ip(struct kunit *test)
        KUNIT_ASSERT_EQ(test, mask, 0);
 }
 
-static void check_platform_gt_count(struct kunit *test)
+static void check_platform_desc(struct kunit *test)
 {
        const struct pci_device_id *pci = test->param_value;
        const struct xe_device_desc *desc =
                (const struct xe_device_desc *)pci->driver_data;
-       int max_gt = desc->max_gt_per_tile;
 
-       KUNIT_ASSERT_GT(test, max_gt, 0);
-       KUNIT_ASSERT_LE(test, max_gt, XE_MAX_GT_PER_TILE);
+       KUNIT_EXPECT_GT(test, (unsigned int)desc->max_gt_per_tile, 0);
+       KUNIT_EXPECT_LE(test, (unsigned int)desc->max_gt_per_tile, XE_MAX_GT_PER_TILE);
 }
 
 static struct kunit_case xe_pci_tests[] = {
        KUNIT_CASE_PARAM(check_graphics_ip, xe_pci_graphics_ip_gen_param),
        KUNIT_CASE_PARAM(check_media_ip, xe_pci_media_ip_gen_param),
-       KUNIT_CASE_PARAM(check_platform_gt_count, xe_pci_id_gen_param),
+       KUNIT_CASE_PARAM(check_platform_desc, xe_pci_id_gen_param),
        {}
 };