2 * Copyright 2015 IBM Corp.
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.
13 #include <linux/types.h>
14 #include <asm/byteorder.h>
15 #include <asm/hvcall.h>
18 #define SG_BUFFER_SIZE 4096
19 #define SG_MAX_ENTRIES 256
27 * This is straight out of PAPR, but replacing some of the compound fields with
28 * a single field, where they were identical to the register layout.
30 * The 'flags' parameter regroups the various bit-fields
32 #define CXL_PE_CSRP_VALID (1ULL << 63)
33 #define CXL_PE_PROBLEM_STATE (1ULL << 62)
34 #define CXL_PE_SECONDARY_SEGMENT_TBL_SRCH (1ULL << 61)
35 #define CXL_PE_TAGS_ACTIVE (1ULL << 60)
36 #define CXL_PE_USER_STATE (1ULL << 59)
37 #define CXL_PE_TRANSLATION_ENABLED (1ULL << 58)
38 #define CXL_PE_64_BIT (1ULL << 57)
39 #define CXL_PE_PRIVILEGED_PROCESS (1ULL << 56)
41 #define CXL_PROCESS_ELEMENT_VERSION 1
42 struct cxl_process_element_hcall
{
47 u8 applicationVirtualIsnBitmap
[256];
49 struct cxl_process_element_common common
;
53 #define H_STATE_NORMAL 1
54 #define H_STATE_DISABLE 2
55 #define H_STATE_TEMP_UNAVAILABLE 3
56 #define H_STATE_PERM_UNAVAILABLE 4
58 /* NOTE: element must be a logical real address, and must be pinned */
59 long cxl_h_attach_process(u64 unit_address
, struct cxl_process_element_hcall
*element
,
60 u64
*process_token
, u64
*mmio_addr
, u64
*mmio_size
);
63 * cxl_h_detach_process - Detach a process element from a coherent
66 long cxl_h_detach_process(u64 unit_address
, u64 process_token
);
69 * cxl_h_reset_afu - Perform a reset to the coherent platform function.
71 long cxl_h_reset_afu(u64 unit_address
);
74 * cxl_h_suspend_process - Suspend a process from being executed
75 * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
76 * process was attached.
78 long cxl_h_suspend_process(u64 unit_address
, u64 process_token
);
81 * cxl_h_resume_process - Resume a process to be executed
82 * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
83 * process was attached.
85 long cxl_h_resume_process(u64 unit_address
, u64 process_token
);
88 * cxl_h_read_error_state - Reads the error state of the coherent
90 * R4 contains the error state
92 long cxl_h_read_error_state(u64 unit_address
, u64
*state
);
95 * cxl_h_get_afu_err - collect the AFU error buffer
96 * Parameter1 = byte offset into error buffer to retrieve, valid values
97 * are between 0 and (ibm,error-buffer-size - 1)
98 * Parameter2 = 4K aligned real address of error buffer, to be filled in
99 * Parameter3 = length of error buffer, valid values are 4K or less
101 long cxl_h_get_afu_err(u64 unit_address
, u64 offset
, u64 buf_address
, u64 len
);
104 * cxl_h_get_config - collect configuration record for the
105 * coherent platform function
106 * Parameter1 = # of configuration record to retrieve, valid values are
107 * between 0 and (ibm,#config-records - 1)
108 * Parameter2 = byte offset into configuration record to retrieve,
109 * valid values are between 0 and (ibm,config-record-size - 1)
110 * Parameter3 = 4K aligned real address of configuration record buffer,
112 * Parameter4 = length of configuration buffer, valid values are 4K or less
114 long cxl_h_get_config(u64 unit_address
, u64 cr_num
, u64 offset
,
115 u64 buf_address
, u64 len
);
118 * cxl_h_terminate_process - Terminate the process before completion
119 * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
120 * process was attached.
122 long cxl_h_terminate_process(u64 unit_address
, u64 process_token
);
125 * cxl_h_collect_vpd - Collect VPD for the coherent platform function.
126 * Parameter1 = # of VPD record to retrieve, valid values are between 0
127 * and (ibm,#config-records - 1).
128 * Parameter2 = 4K naturally aligned real buffer containing block
130 * Parameter3 = number of block list entries in the block list, valid
131 * values are between 0 and 256
133 long cxl_h_collect_vpd(u64 unit_address
, u64 record
, u64 list_address
,
137 * cxl_h_get_fn_error_interrupt - Read the function-wide error data based on an interrupt
139 long cxl_h_get_fn_error_interrupt(u64 unit_address
, u64
*reg
);
142 * cxl_h_ack_fn_error_interrupt - Acknowledge function-wide error data
143 * based on an interrupt
144 * Parameter1 = value to write to the function-wide error interrupt register
146 long cxl_h_ack_fn_error_interrupt(u64 unit_address
, u64 value
);
149 * cxl_h_get_error_log - Retrieve the Platform Log ID (PLID) of
152 long cxl_h_get_error_log(u64 unit_address
, u64 value
);
155 * cxl_h_collect_int_info - Collect interrupt info about a coherent
156 * platform function after an interrupt occurred.
158 long cxl_h_collect_int_info(u64 unit_address
, u64 process_token
,
159 struct cxl_irq_info
*info
);
162 * cxl_h_control_faults - Control the operation of a coherent platform
163 * function after a fault occurs.
166 * control-mask: value to control the faults
167 * looks like PSL_TFC_An shifted >> 32
168 * reset-mask: mask to control reset of function faults
169 * Set reset_mask = 1 to reset PSL errors
171 long cxl_h_control_faults(u64 unit_address
, u64 process_token
,
172 u64 control_mask
, u64 reset_mask
);
175 * cxl_h_reset_adapter - Perform a reset to the coherent platform facility.
177 long cxl_h_reset_adapter(u64 unit_address
);
180 * cxl_h_collect_vpd - Collect VPD for the coherent platform function.
181 * Parameter1 = 4K naturally aligned real buffer containing block
183 * Parameter2 = number of block list entries in the block list, valid
184 * values are between 0 and 256
186 long cxl_h_collect_vpd_adapter(u64 unit_address
, u64 list_address
,
190 * cxl_h_download_adapter_image - Download the base image to the coherent
193 long cxl_h_download_adapter_image(u64 unit_address
,
194 u64 list_address
, u64 num
,
198 * cxl_h_validate_adapter_image - Validate the base image in the coherent
201 long cxl_h_validate_adapter_image(u64 unit_address
,
202 u64 list_address
, u64 num
,
204 #endif /* _HCALLS_H */