aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-02 13:01:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-02 13:01:04 -0500
commit03f51d4efa2287cc628bb20b0c032036d2a9e66a (patch)
treeec7fb3b6624d53092e2768578f3ef887c8d77f22 /include
parent367b0df173b0ebea5d18b6971c244e260b5feb17 (diff)
parent015eb1b89e959c9349f0a01803fb8ed1ced36f09 (diff)
Merge tag 'powerpc-4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: "Highlights: - Enable support for memory protection keys aka "pkeys" on Power7/8/9 when using the hash table MMU. - Extend our interrupt soft masking to support masking PMU interrupts as well as "normal" interrupts, and then use that to implement local_t for a ~4x speedup vs the current atomics-based implementation. - A new driver "ocxl" for "Open Coherent Accelerator Processor Interface (OpenCAPI)" devices. - Support for new device tree properties on PowerVM to describe hotpluggable memory and devices. - Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE to the 64-bit VDSO. - Freescale updates from Scott: fixes for CPM GPIO and an FSL PCI erratum workaround, plus a minor cleanup patch. As well as quite a lot of other changes all over the place, and small fixes and cleanups as always. Thanks to: Alan Modra, Alastair D'Silva, Alexey Kardashevskiy, Alistair Popple, Andreas Schwab, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anshuman Khandual, Anton Blanchard, Arnd Bergmann, Balbir Singh, Benjamin Herrenschmidt, Bhaktipriya Shridhar, Bryant G. Ly, Cédric Le Goater, Christophe Leroy, Christophe Lombard, Cyril Bur, David Gibson, Desnes A. Nunes do Rosario, Dmitry Torokhov, Frederic Barrat, Geert Uytterhoeven, Guilherme G. Piccoli, Gustavo A. R. Silva, Gustavo Romero, Ivan Mikhaylov, Joakim Tjernlund, Joe Perches, Josh Poimboeuf, Juan J. Alvarez, Julia Cartwright, Kamalesh Babulal, Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu Malaterre, Michael Bringmann, Michael Hanselmann, Michael Neuling, Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Paul Mackerras, Philippe Bergheaud, Ram Pai, Russell Currey, Santosh Sivaraj, Scott Wood, Seth Forshee, Simon Guo, Stewart Smith, Sukadev Bhattiprolu, Thiago Jung Bauermann, Vaibhav Jain, Vasyl Gomonovych" * tag 'powerpc-4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (199 commits) powerpc/mm/radix: Fix build error when RADIX_MMU=n macintosh/ams-input: Use true and false for boolean values macintosh: change some data types from int to bool powerpc/watchdog: Print the NIP in soft_nmi_interrupt() powerpc/watchdog: regs can't be null in soft_nmi_interrupt() powerpc/watchdog: Tweak watchdog printks powerpc/cell: Remove axonram driver rtc-opal: Fix handling of firmware error codes, prevent busy loops powerpc/mpc52xx_gpt: make use of raw_spinlock variants macintosh/adb: Properly mark continued kernel messages powerpc/pseries: Fix cpu hotplug crash with memoryless nodes powerpc/numa: Ensure nodes initialized for hotplug powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes powerpc/kernel: Block interrupts when updating TIDR powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn powerpc/mm/nohash: do not flush the entire mm when range is a single page powerpc/pseries: Add Initialization of VF Bars powerpc/pseries/pci: Associate PEs to VFs in configure SR-IOV powerpc/eeh: Add EEH notify resume sysfs powerpc/eeh: Add EEH operations to notify resume ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/pci.h38
-rw-r--r--include/misc/ocxl-config.h45
-rw-r--r--include/misc/ocxl.h214
-rw-r--r--include/uapi/linux/elf.h1
-rw-r--r--include/uapi/misc/cxl.h10
-rw-r--r--include/uapi/misc/ocxl.h49
6 files changed, 353 insertions, 4 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0314e0716c30..ad35aac87971 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1965,6 +1965,7 @@ int pci_vfs_assigned(struct pci_dev *dev);
1965int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1965int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1966int pci_sriov_get_totalvfs(struct pci_dev *dev); 1966int pci_sriov_get_totalvfs(struct pci_dev *dev);
1967resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno); 1967resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
1968void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);
1968#else 1969#else
1969static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id) 1970static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
1970{ 1971{
@@ -1992,6 +1993,7 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1992{ return 0; } 1993{ return 0; }
1993static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno) 1994static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
1994{ return 0; } 1995{ return 0; }
1996static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
1995#endif 1997#endif
1996 1998
1997#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1999#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
@@ -2279,6 +2281,42 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
2279 return false; 2281 return false;
2280} 2282}
2281 2283
2284/**
2285 * pci_uevent_ers - emit a uevent during recovery path of pci device
2286 * @pdev: pci device to check
2287 * @err_type: type of error event
2288 *
2289 */
2290static inline void pci_uevent_ers(struct pci_dev *pdev,
2291 enum pci_ers_result err_type)
2292{
2293 int idx = 0;
2294 char *envp[3];
2295
2296 switch (err_type) {
2297 case PCI_ERS_RESULT_NONE:
2298 case PCI_ERS_RESULT_CAN_RECOVER:
2299 envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
2300 envp[idx++] = "DEVICE_ONLINE=0";
2301 break;
2302 case PCI_ERS_RESULT_RECOVERED:
2303 envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY";
2304 envp[idx++] = "DEVICE_ONLINE=1";
2305 break;
2306 case PCI_ERS_RESULT_DISCONNECT:
2307 envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY";
2308 envp[idx++] = "DEVICE_ONLINE=0";
2309 break;
2310 default:
2311 break;
2312 }
2313
2314 if (idx > 0) {
2315 envp[idx++] = NULL;
2316 kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp);
2317 }
2318}
2319
2282/* provide the legacy pci_dma_* API */ 2320/* provide the legacy pci_dma_* API */
2283#include <linux/pci-dma-compat.h> 2321#include <linux/pci-dma-compat.h>
2284 2322
diff --git a/include/misc/ocxl-config.h b/include/misc/ocxl-config.h
new file mode 100644
index 000000000000..3526fa996a22
--- /dev/null
+++ b/include/misc/ocxl-config.h
@@ -0,0 +1,45 @@
1// SPDX-License-Identifier: GPL-2.0+
2// Copyright 2017 IBM Corp.
3#ifndef _OCXL_CONFIG_H_
4#define _OCXL_CONFIG_H_
5
6/*
7 * This file lists the various constants used to read the
8 * configuration space of an opencapi adapter.
9 *
10 * It follows the specification for opencapi 3.0
11 */
12
13#define OCXL_EXT_CAP_ID_DVSEC 0x23
14
15#define OCXL_DVSEC_VENDOR_OFFSET 0x4
16#define OCXL_DVSEC_ID_OFFSET 0x8
17#define OCXL_DVSEC_TL_ID 0xF000
18#define OCXL_DVSEC_TL_BACKOFF_TIMERS 0x10
19#define OCXL_DVSEC_TL_RECV_CAP 0x18
20#define OCXL_DVSEC_TL_SEND_CAP 0x20
21#define OCXL_DVSEC_TL_RECV_RATE 0x30
22#define OCXL_DVSEC_TL_SEND_RATE 0x50
23#define OCXL_DVSEC_FUNC_ID 0xF001
24#define OCXL_DVSEC_FUNC_OFF_INDEX 0x08
25#define OCXL_DVSEC_FUNC_OFF_ACTAG 0x0C
26#define OCXL_DVSEC_AFU_INFO_ID 0xF003
27#define OCXL_DVSEC_AFU_INFO_AFU_IDX 0x0A
28#define OCXL_DVSEC_AFU_INFO_OFF 0x0C
29#define OCXL_DVSEC_AFU_INFO_DATA 0x10
30#define OCXL_DVSEC_AFU_CTRL_ID 0xF004
31#define OCXL_DVSEC_AFU_CTRL_AFU_IDX 0x0A
32#define OCXL_DVSEC_AFU_CTRL_TERM_PASID 0x0C
33#define OCXL_DVSEC_AFU_CTRL_ENABLE 0x0F
34#define OCXL_DVSEC_AFU_CTRL_PASID_SUP 0x10
35#define OCXL_DVSEC_AFU_CTRL_PASID_EN 0x11
36#define OCXL_DVSEC_AFU_CTRL_PASID_BASE 0x14
37#define OCXL_DVSEC_AFU_CTRL_ACTAG_SUP 0x18
38#define OCXL_DVSEC_AFU_CTRL_ACTAG_EN 0x1A
39#define OCXL_DVSEC_AFU_CTRL_ACTAG_BASE 0x1C
40#define OCXL_DVSEC_VENDOR_ID 0xF0F0
41#define OCXL_DVSEC_VENDOR_CFG_VERS 0x0C
42#define OCXL_DVSEC_VENDOR_TLX_VERS 0x10
43#define OCXL_DVSEC_VENDOR_DLX_VERS 0x20
44
45#endif /* _OCXL_CONFIG_H_ */
diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h
new file mode 100644
index 000000000000..51ccf76db293
--- /dev/null
+++ b/include/misc/ocxl.h
@@ -0,0 +1,214 @@
1// SPDX-License-Identifier: GPL-2.0+
2// Copyright 2017 IBM Corp.
3#ifndef _MISC_OCXL_H_
4#define _MISC_OCXL_H_
5
6#include <linux/pci.h>
7
8/*
9 * Opencapi drivers all need some common facilities, like parsing the
10 * device configuration space, adding a Process Element to the Shared
11 * Process Area, etc...
12 *
13 * The ocxl module provides a kernel API, to allow other drivers to
14 * reuse common code. A bit like a in-kernel library.
15 */
16
17#define OCXL_AFU_NAME_SZ (24+1) /* add 1 for NULL termination */
18
19/*
20 * The following 2 structures are a fairly generic way of representing
21 * the configuration data for a function and AFU, as read from the
22 * configuration space.
23 */
24struct ocxl_afu_config {
25 u8 idx;
26 int dvsec_afu_control_pos; /* offset of AFU control DVSEC */
27 char name[OCXL_AFU_NAME_SZ];
28 u8 version_major;
29 u8 version_minor;
30 u8 afuc_type;
31 u8 afum_type;
32 u8 profile;
33 u8 global_mmio_bar; /* global MMIO area */
34 u64 global_mmio_offset;
35 u32 global_mmio_size;
36 u8 pp_mmio_bar; /* per-process MMIO area */
37 u64 pp_mmio_offset;
38 u32 pp_mmio_stride;
39 u8 log_mem_size;
40 u8 pasid_supported_log;
41 u16 actag_supported;
42};
43
44struct ocxl_fn_config {
45 int dvsec_tl_pos; /* offset of the Transaction Layer DVSEC */
46 int dvsec_function_pos; /* offset of the Function DVSEC */
47 int dvsec_afu_info_pos; /* offset of the AFU information DVSEC */
48 s8 max_pasid_log;
49 s8 max_afu_index;
50};
51
52/*
53 * Read the configuration space of a function and fill in a
54 * ocxl_fn_config structure with all the function details
55 */
56extern int ocxl_config_read_function(struct pci_dev *dev,
57 struct ocxl_fn_config *fn);
58
59/*
60 * Check if an AFU index is valid for the given function.
61 *
62 * AFU indexes can be sparse, so a driver should check all indexes up
63 * to the maximum found in the function description
64 */
65extern int ocxl_config_check_afu_index(struct pci_dev *dev,
66 struct ocxl_fn_config *fn, int afu_idx);
67
68/*
69 * Read the configuration space of a function for the AFU specified by
70 * the index 'afu_idx'. Fills in a ocxl_afu_config structure
71 */
72extern int ocxl_config_read_afu(struct pci_dev *dev,
73 struct ocxl_fn_config *fn,
74 struct ocxl_afu_config *afu,
75 u8 afu_idx);
76
77/*
78 * Get the max PASID value that can be used by the function
79 */
80extern int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count);
81
82/*
83 * Tell an AFU, by writing in the configuration space, the PASIDs that
84 * it can use. Range starts at 'pasid_base' and its size is a multiple
85 * of 2
86 *
87 * 'afu_control_offset' is the offset of the AFU control DVSEC which
88 * can be found in the function configuration
89 */
90extern void ocxl_config_set_afu_pasid(struct pci_dev *dev,
91 int afu_control_offset,
92 int pasid_base, u32 pasid_count_log);
93
94/*
95 * Get the actag configuration for the function:
96 * 'base' is the first actag value that can be used.
97 * 'enabled' it the number of actags available, starting from base.
98 * 'supported' is the total number of actags desired by all the AFUs
99 * of the function.
100 */
101extern int ocxl_config_get_actag_info(struct pci_dev *dev,
102 u16 *base, u16 *enabled, u16 *supported);
103
104/*
105 * Tell a function, by writing in the configuration space, the actags
106 * it can use.
107 *
108 * 'func_offset' is the offset of the Function DVSEC that can found in
109 * the function configuration
110 */
111extern void ocxl_config_set_actag(struct pci_dev *dev, int func_offset,
112 u32 actag_base, u32 actag_count);
113
114/*
115 * Tell an AFU, by writing in the configuration space, the actags it
116 * can use.
117 *
118 * 'afu_control_offset' is the offset of the AFU control DVSEC for the
119 * desired AFU. It can be found in the AFU configuration
120 */
121extern void ocxl_config_set_afu_actag(struct pci_dev *dev,
122 int afu_control_offset,
123 int actag_base, int actag_count);
124
125/*
126 * Enable/disable an AFU, by writing in the configuration space.
127 *
128 * 'afu_control_offset' is the offset of the AFU control DVSEC for the
129 * desired AFU. It can be found in the AFU configuration
130 */
131extern void ocxl_config_set_afu_state(struct pci_dev *dev,
132 int afu_control_offset, int enable);
133
134/*
135 * Set the Transaction Layer configuration in the configuration space.
136 * Only needed for function 0.
137 *
138 * It queries the host TL capabilities, find some common ground
139 * between the host and device, and set the Transaction Layer on both
140 * accordingly.
141 */
142extern int ocxl_config_set_TL(struct pci_dev *dev, int tl_dvsec);
143
144/*
145 * Request an AFU to terminate a PASID.
146 * Will return once the AFU has acked the request, or an error in case
147 * of timeout.
148 *
149 * The hardware can only terminate one PASID at a time, so caller must
150 * guarantee some kind of serialization.
151 *
152 * 'afu_control_offset' is the offset of the AFU control DVSEC for the
153 * desired AFU. It can be found in the AFU configuration
154 */
155extern int ocxl_config_terminate_pasid(struct pci_dev *dev,
156 int afu_control_offset, int pasid);
157
158/*
159 * Set up the opencapi link for the function.
160 *
161 * When called for the first time for a link, it sets up the Shared
162 * Process Area for the link and the interrupt handler to process
163 * translation faults.
164 *
165 * Returns a 'link handle' that should be used for further calls for
166 * the link
167 */
168extern int ocxl_link_setup(struct pci_dev *dev, int PE_mask,
169 void **link_handle);
170
171/*
172 * Remove the association between the function and its link.
173 */
174extern void ocxl_link_release(struct pci_dev *dev, void *link_handle);
175
176/*
177 * Add a Process Element to the Shared Process Area for a link.
178 * The process is defined by its PASID, pid, tid and its mm_struct.
179 *
180 * 'xsl_err_cb' is an optional callback if the driver wants to be
181 * notified when the translation fault interrupt handler detects an
182 * address error.
183 * 'xsl_err_data' is an argument passed to the above callback, if
184 * defined
185 */
186extern int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr,
187 u64 amr, struct mm_struct *mm,
188 void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr),
189 void *xsl_err_data);
190
191/*
192 * Remove a Process Element from the Shared Process Area for a link
193 */
194extern int ocxl_link_remove_pe(void *link_handle, int pasid);
195
196/*
197 * Allocate an AFU interrupt associated to the link.
198 *
199 * 'hw_irq' is the hardware interrupt number
200 * 'obj_handle' is the 64-bit object handle to be passed to the AFU to
201 * trigger the interrupt.
202 * On P9, 'obj_handle' is an address, which, if written, triggers the
203 * interrupt. It is an MMIO address which needs to be remapped (one
204 * page).
205 */
206extern int ocxl_link_irq_alloc(void *link_handle, int *hw_irq,
207 u64 *obj_handle);
208
209/*
210 * Free a previously allocated AFU interrupt
211 */
212extern void ocxl_link_free_irq(void *link_handle, int hw_irq);
213
214#endif /* _MISC_OCXL_H_ */
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index bb6836986200..3bf73fb58045 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -396,6 +396,7 @@ typedef struct elf64_shdr {
396#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ 396#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */
397#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ 397#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */
398#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ 398#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */
399#define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */
399#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 400#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
400#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 401#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
401#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ 402#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
diff --git a/include/uapi/misc/cxl.h b/include/uapi/misc/cxl.h
index 49e8fd08855a..56376d3907d8 100644
--- a/include/uapi/misc/cxl.h
+++ b/include/uapi/misc/cxl.h
@@ -20,20 +20,22 @@ struct cxl_ioctl_start_work {
20 __u64 work_element_descriptor; 20 __u64 work_element_descriptor;
21 __u64 amr; 21 __u64 amr;
22 __s16 num_interrupts; 22 __s16 num_interrupts;
23 __s16 reserved1; 23 __u16 tid;
24 __s32 reserved2; 24 __s32 reserved1;
25 __u64 reserved2;
25 __u64 reserved3; 26 __u64 reserved3;
26 __u64 reserved4; 27 __u64 reserved4;
27 __u64 reserved5; 28 __u64 reserved5;
28 __u64 reserved6;
29}; 29};
30 30
31#define CXL_START_WORK_AMR 0x0000000000000001ULL 31#define CXL_START_WORK_AMR 0x0000000000000001ULL
32#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL 32#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
33#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL 33#define CXL_START_WORK_ERR_FF 0x0000000000000004ULL
34#define CXL_START_WORK_TID 0x0000000000000008ULL
34#define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\ 35#define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\
35 CXL_START_WORK_NUM_IRQS |\ 36 CXL_START_WORK_NUM_IRQS |\
36 CXL_START_WORK_ERR_FF) 37 CXL_START_WORK_ERR_FF |\
38 CXL_START_WORK_TID)
37 39
38 40
39/* Possible modes that an afu can be in */ 41/* Possible modes that an afu can be in */
diff --git a/include/uapi/misc/ocxl.h b/include/uapi/misc/ocxl.h
new file mode 100644
index 000000000000..4b0b0b756f3e
--- /dev/null
+++ b/include/uapi/misc/ocxl.h
@@ -0,0 +1,49 @@
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
6#include <linux/types.h>
7#include <linux/ioctl.h>
8
9enum ocxl_event_type {
10 OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0,
11};
12
13#define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */
14
15struct ocxl_kernel_event_header {
16 __u16 type;
17 __u16 flags;
18 __u32 reserved;
19};
20
21struct ocxl_kernel_event_xsl_fault_error {
22 __u64 addr;
23 __u64 dsisr;
24 __u64 count;
25 __u64 reserved;
26};
27
28struct ocxl_ioctl_attach {
29 __u64 amr;
30 __u64 reserved1;
31 __u64 reserved2;
32 __u64 reserved3;
33};
34
35struct ocxl_ioctl_irq_fd {
36 __u64 irq_offset;
37 __s32 eventfd;
38 __u32 reserved;
39};
40
41/* ioctl numbers */
42#define OCXL_MAGIC 0xCA
43/* AFU devices */
44#define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach)
45#define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64)
46#define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64)
47#define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd)
48
49#endif /* _UAPI_MISC_OCXL_H */