1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES 4 * 5 * Template to build the iommu module and kunit from the format and 6 * implementation headers. 7 * 8 * The format should have: 9 * #define PT_FMT <name> 10 * #define PT_SUPPORTED_FEATURES (BIT(PT_FEAT_xx) | BIT(PT_FEAT_yy)) 11 * And optionally: 12 * #define PT_FORCE_ENABLED_FEATURES .. 13 * #define PT_FMT_VARIANT <suffix> 14 */ 15 #include <linux/args.h> 16 #include <linux/stringify.h> 17 18 #ifdef PT_FMT_VARIANT 19 #define PTPFX_RAW \ 20 CONCATENATE(CONCATENATE(PT_FMT, _), PT_FMT_VARIANT) 21 #else 22 #define PTPFX_RAW PT_FMT 23 #endif 24 25 #define PTPFX CONCATENATE(PTPFX_RAW, _) 26 27 #define _PT_FMT_H PT_FMT.h 28 #define PT_FMT_H __stringify(_PT_FMT_H) 29 30 #define _PT_DEFS_H CONCATENATE(defs_, _PT_FMT_H) 31 #define PT_DEFS_H __stringify(_PT_DEFS_H) 32 33 #include <linux/generic_pt/common.h> 34 #include PT_DEFS_H 35 #include "../pt_defs.h" 36 #include PT_FMT_H 37 #include "../pt_common.h" 38 39 #ifndef GENERIC_PT_KUNIT 40 #include "../iommu_pt.h" 41 #else 42 /* 43 * The makefile will compile the .c file twice, once with GENERIC_PT_KUNIT set 44 * which means we are building the kunit modle. 45 */ 46 #include "../kunit_generic_pt.h" 47 #include "../kunit_iommu_pt.h" 48 #endif 49