ocxl.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /* Copyright 2017 IBM Corp. */
  3. #ifndef _UAPI_MISC_OCXL_H
  4. #define _UAPI_MISC_OCXL_H
  5. #include <linux/types.h>
  6. #include <linux/ioctl.h>
  7. enum ocxl_event_type {
  8. OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0,
  9. };
  10. #define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */
  11. struct ocxl_kernel_event_header {
  12. __u16 type;
  13. __u16 flags;
  14. __u32 reserved;
  15. };
  16. struct ocxl_kernel_event_xsl_fault_error {
  17. __u64 addr;
  18. __u64 dsisr;
  19. __u64 count;
  20. __u64 reserved;
  21. };
  22. struct ocxl_ioctl_attach {
  23. __u64 amr;
  24. __u64 reserved1;
  25. __u64 reserved2;
  26. __u64 reserved3;
  27. };
  28. struct ocxl_ioctl_metadata {
  29. __u16 version; // struct version, always backwards compatible
  30. // Version 0 fields
  31. __u8 afu_version_major;
  32. __u8 afu_version_minor;
  33. __u32 pasid; // PASID assigned to the current context
  34. __u64 pp_mmio_size; // Per PASID MMIO size
  35. __u64 global_mmio_size;
  36. // End version 0 fields
  37. __u64 reserved[13]; // Total of 16*u64
  38. };
  39. struct ocxl_ioctl_p9_wait {
  40. __u16 thread_id; // The thread ID required to wake this thread
  41. __u16 reserved1;
  42. __u32 reserved2;
  43. __u64 reserved3[3];
  44. };
  45. #define OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT 0x01
  46. struct ocxl_ioctl_features {
  47. __u64 flags[4];
  48. };
  49. struct ocxl_ioctl_irq_fd {
  50. __u64 irq_offset;
  51. __s32 eventfd;
  52. __u32 reserved;
  53. };
  54. /* ioctl numbers */
  55. #define OCXL_MAGIC 0xCA
  56. /* AFU devices */
  57. #define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach)
  58. #define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64)
  59. #define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64)
  60. #define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd)
  61. #define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata)
  62. #define OCXL_IOCTL_ENABLE_P9_WAIT _IOR(OCXL_MAGIC, 0x15, struct ocxl_ioctl_p9_wait)
  63. #define OCXL_IOCTL_GET_FEATURES _IOR(OCXL_MAGIC, 0x16, struct ocxl_ioctl_features)
  64. #endif /* _UAPI_MISC_OCXL_H */