On Mon, May 26, 2025 at 10:18 AM Jason Gunthorpe <j...@nvidia.com> wrote: > > On Fri, May 23, 2025 at 11:29:58PM +0000, David Matlack wrote: > > Import drivers/dma/ioat/{hw.h,registers.h} into tools/include/ so that > > they can be used in VFIO selftests to interact with Intel CBDMA devices. > > > > Changes made when importing: > > - Drop system_has_dca_enabled() prototype from hw.h > > > > Cc: Dave Jiang <dave.ji...@intel.com> > > Cc: Dan Williams <dan.j.willi...@intel.com> > > Signed-off-by: David Matlack <dmatl...@google.com> > > --- > > tools/include/drivers/dma/ioat/hw.h | 270 +++++++++++++++++++++ > > tools/include/drivers/dma/ioat/registers.h | 251 +++++++++++++++++++ > > 2 files changed, 521 insertions(+) > > create mode 100644 tools/include/drivers/dma/ioat/hw.h > > create mode 100644 tools/include/drivers/dma/ioat/registers.h > > I think you'd be better to not duplicate the code but just #include a > shared header from drivers/dma/ioat/ and so on for the other patches > too
I think that makes sense for drivers/ headers and maybe linux/pci_ids.h if the relevant maintainers are ok with it. The changes needed to the headers in the kernel would be pretty minimal. But it starts to get complicated when kernel headers include other kernel headers, and/or contain a lot of code that can't be compiled in tools/, e.g. asm-generic/io.h [1]. For those headers, duplicating seemed like the cleanest option. [1] https://lore.kernel.org/kvm/20250523233018.1702151-11-dmatl...@google.com/