aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2014-10-08 04:55:03 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2014-10-08 05:15:57 -0400
commit66b43081c0bde3171208a7cb52f5807dce4a79e4 (patch)
tree65715b6e6dccf426bf6de100bb58ec3da955fdcf
parentf204e0b8cedd7da1dfcfd05ed6b7692737e24029 (diff)
cxl: Add userspace header file
This adds a header file for use by userspace programs wanting to interact with the kernel cxl driver. It defines structs and magic numbers required for userspace to interact with devices in /dev/cxl/afuM.N. Further documentation on this interface is added in a subsequent patch in Documentation/powerpc/cxl.txt. It also adds this new userspace header file to Kbuild so it's exported when doing "make headers_installs". Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--include/uapi/Kbuild1
-rw-r--r--include/uapi/misc/Kbuild2
-rw-r--r--include/uapi/misc/cxl.h87
3 files changed, 90 insertions, 0 deletions
diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
index 81d2106287fe..245aa6e05e6a 100644
--- a/include/uapi/Kbuild
+++ b/include/uapi/Kbuild
@@ -12,3 +12,4 @@ header-y += video/
12header-y += drm/ 12header-y += drm/
13header-y += xen/ 13header-y += xen/
14header-y += scsi/ 14header-y += scsi/
15header-y += misc/
diff --git a/include/uapi/misc/Kbuild b/include/uapi/misc/Kbuild
new file mode 100644
index 000000000000..e96cae7d58c9
--- /dev/null
+++ b/include/uapi/misc/Kbuild
@@ -0,0 +1,2 @@
1# misc Header export list
2header-y += cxl.h
diff --git a/include/uapi/misc/cxl.h b/include/uapi/misc/cxl.h
new file mode 100644
index 000000000000..c232be6ae21f
--- /dev/null
+++ b/include/uapi/misc/cxl.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright 2014 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _UAPI_MISC_CXL_H
11#define _UAPI_MISC_CXL_H
12
13#include <linux/types.h>
14#include <linux/ioctl.h>
15
16/* Structs for IOCTLS for userspace to talk to the kernel */
17struct cxl_ioctl_start_work {
18 __u64 flags;
19 __u64 work_element_descriptor;
20 __u64 amr;
21 __s16 num_interrupts;
22 __s16 reserved1;
23 __s32 reserved2;
24 __u64 reserved3;
25 __u64 reserved4;
26 __u64 reserved5;
27 __u64 reserved6;
28};
29#define CXL_START_WORK_AMR 0x0000000000000001ULL
30#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
31#define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\
32 CXL_START_WORK_NUM_IRQS)
33
34/* IOCTL numbers */
35#define CXL_MAGIC 0xCA
36#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
37#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
38
39/* Events from read() */
40#define CXL_READ_MIN_SIZE 0x1000 /* 4K */
41
42enum cxl_event_type {
43 CXL_EVENT_RESERVED = 0,
44 CXL_EVENT_AFU_INTERRUPT = 1,
45 CXL_EVENT_DATA_STORAGE = 2,
46 CXL_EVENT_AFU_ERROR = 3,
47};
48
49struct cxl_event_header {
50 __u16 type;
51 __u16 size;
52 __u16 process_element;
53 __u16 reserved1;
54};
55
56struct cxl_event_afu_interrupt {
57 __u16 flags;
58 __u16 irq; /* Raised AFU interrupt number */
59 __u32 reserved1;
60};
61
62struct cxl_event_data_storage {
63 __u16 flags;
64 __u16 reserved1;
65 __u32 reserved2;
66 __u64 addr;
67 __u64 dsisr;
68 __u64 reserved3;
69};
70
71struct cxl_event_afu_error {
72 __u16 flags;
73 __u16 reserved1;
74 __u32 reserved2;
75 __u64 error;
76};
77
78struct cxl_event {
79 struct cxl_event_header header;
80 union {
81 struct cxl_event_afu_interrupt irq;
82 struct cxl_event_data_storage fault;
83 struct cxl_event_afu_error afu_error;
84 };
85};
86
87#endif /* _UAPI_MISC_CXL_H */