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