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