iommu-logger.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. */
  3. #ifndef __LINUX_QTI_IOMMU_LOGGER_H
  4. #define __LINUX_QTI_IOMMU_LOGGER_H
  5. #include <linux/io-pgtable.h>
  6. enum iommu_logger_pgtable_fmt {
  7. IOMMU_LOGGER_ARM_32_LPAE_S1,
  8. IOMMU_LOGGER_ARM_64_LPAE_S1,
  9. IOMMU_LOGGER_MAX_PGTABLE_FMTS,
  10. };
  11. /*
  12. * Each group may have more than one domain; but each domain may
  13. * only have one group.
  14. */
  15. struct iommu_debug_attachment {
  16. struct iommu_domain *domain;
  17. struct iommu_group *group;
  18. char *client_name;
  19. enum iommu_logger_pgtable_fmt fmt;
  20. unsigned int levels;
  21. /*
  22. * Virtual addresses of the top-level page tables are stored here,
  23. * as they are more useful for debug tools than physical addresses.
  24. */
  25. void *ttbr0;
  26. void *ttbr1;
  27. struct list_head list;
  28. };
  29. #if IS_ENABLED(CONFIG_QTI_IOMMU_SUPPORT)
  30. int iommu_logger_register(struct iommu_debug_attachment **a,
  31. struct iommu_domain *domain, struct device *dev,
  32. struct io_pgtable *iop);
  33. void iommu_logger_unregister(struct iommu_debug_attachment *a);
  34. #else
  35. static inline int iommu_logger_register(struct iommu_debug_attachment **a,
  36. struct iommu_domain *domain,
  37. struct device *dev,
  38. struct io_pgtable *iop)
  39. {
  40. return 0;
  41. }
  42. static inline void iommu_logger_unregister(struct iommu_debug_attachment *a) {}
  43. #endif /* CONFIG_QTI_IOMMU_LOGGER */
  44. #endif /* __LINUX_QTI_IOMMU_LOGGER_H */