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(const struct xe_graphics_desc *graphics) 18{ 19 struct kunit *test = xe_cur_kunit(); 20 u64 mask = graphics->hw_engine_mask; 21 22 /* RCS, CCS, and BCS engines are allowed on the graphics IP */ 23 mask &= ~(XE_HW_ENGINE_RCS_MASK | 24 XE_HW_ENGINE_CCS_MASK | 25 XE_HW_ENGINE_BCS_MASK); 26 27 /* Any remaining engines are an error */ 28 KUNIT_ASSERT_EQ(test, mask, 0); 29} 30 31static void check_media_ip(const struct xe_media_desc *media) 32{ 33 struct kunit *test = xe_cur_kunit(); 34 u64 mask = media->hw_engine_mask; 35 36 /* VCS, VECS and GSCCS engines are allowed on the media IP */ 37 mask &= ~(XE_HW_ENGINE_VCS_MASK | 38 XE_HW_ENGINE_VECS_MASK | 39 XE_HW_ENGINE_GSCCS_MASK); 40 41 /* Any remaining engines are an error */ 42 KUNIT_ASSERT_EQ(test, mask, 0); 43} 44 45static void xe_gmdid_graphics_ip(struct kunit *test) 46{ 47 xe_call_for_each_graphics_ip(check_graphics_ip); 48} 49 50static void xe_gmdid_media_ip(struct kunit *test) 51{ 52 xe_call_for_each_media_ip(check_media_ip); 53} 54 55static struct kunit_case xe_pci_tests[] = { 56 KUNIT_CASE(xe_gmdid_graphics_ip), 57 KUNIT_CASE(xe_gmdid_media_ip), 58 {} 59}; 60 61static struct kunit_suite xe_pci_test_suite = { 62 .name = "xe_pci", 63 .test_cases = xe_pci_tests, 64}; 65 66kunit_test_suite(xe_pci_test_suite); 67