Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.18-rc3 70 lines 1.8 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright © 2023 Intel Corporation 4 */ 5 6#include <drm/drm_drv.h> 7#include <drm/drm_kunit_helpers.h> 8 9#include <kunit/test.h> 10 11#include "tests/xe_test.h" 12 13#include "xe_device.h" 14#include "xe_pci_test.h" 15#include "xe_pci_types.h" 16 17static void check_graphics_ip(struct kunit *test) 18{ 19 const struct xe_ip *param = test->param_value; 20 const struct xe_graphics_desc *graphics = param->desc; 21 u64 mask = graphics->hw_engine_mask; 22 23 /* RCS, CCS, and BCS engines are allowed on the graphics IP */ 24 mask &= ~(XE_HW_ENGINE_RCS_MASK | 25 XE_HW_ENGINE_CCS_MASK | 26 XE_HW_ENGINE_BCS_MASK); 27 28 /* Any remaining engines are an error */ 29 KUNIT_ASSERT_EQ(test, mask, 0); 30} 31 32static void check_media_ip(struct kunit *test) 33{ 34 const struct xe_ip *param = test->param_value; 35 const struct xe_media_desc *media = param->desc; 36 u64 mask = media->hw_engine_mask; 37 38 /* VCS, VECS and GSCCS engines are allowed on the media IP */ 39 mask &= ~(XE_HW_ENGINE_VCS_MASK | 40 XE_HW_ENGINE_VECS_MASK | 41 XE_HW_ENGINE_GSCCS_MASK); 42 43 /* Any remaining engines are an error */ 44 KUNIT_ASSERT_EQ(test, mask, 0); 45} 46 47static void check_platform_gt_count(struct kunit *test) 48{ 49 const struct pci_device_id *pci = test->param_value; 50 const struct xe_device_desc *desc = 51 (const struct xe_device_desc *)pci->driver_data; 52 int max_gt = desc->max_gt_per_tile; 53 54 KUNIT_ASSERT_GT(test, max_gt, 0); 55 KUNIT_ASSERT_LE(test, max_gt, XE_MAX_GT_PER_TILE); 56} 57 58static struct kunit_case xe_pci_tests[] = { 59 KUNIT_CASE_PARAM(check_graphics_ip, xe_pci_graphics_ip_gen_param), 60 KUNIT_CASE_PARAM(check_media_ip, xe_pci_media_ip_gen_param), 61 KUNIT_CASE_PARAM(check_platform_gt_count, xe_pci_id_gen_param), 62 {} 63}; 64 65static struct kunit_suite xe_pci_test_suite = { 66 .name = "xe_pci", 67 .test_cases = xe_pci_tests, 68}; 69 70kunit_test_suite(xe_pci_test_suite);