^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2015 IBM Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "hcalls.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "trace.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define CXL_HCALL_TIMEOUT 60000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define CXL_HCALL_TIMEOUT_DOWNLOAD 120000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define H_ATTACH_CA_PROCESS 0x344
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define H_CONTROL_CA_FUNCTION 0x348
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define H_DETACH_CA_PROCESS 0x34C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define H_COLLECT_CA_INT_INFO 0x350
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define H_CONTROL_CA_FAULTS 0x354
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define H_DOWNLOAD_CA_FUNCTION 0x35C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define H_DOWNLOAD_CA_FACILITY 0x364
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define H_CONTROL_CA_FACILITY 0x368
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define H_CONTROL_CA_FUNCTION_RESET 1 /* perform a reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define H_CONTROL_CA_FUNCTION_SUSPEND_PROCESS 2 /* suspend a process from being executed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define H_CONTROL_CA_FUNCTION_RESUME_PROCESS 3 /* resume a process to be executed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define H_CONTROL_CA_FUNCTION_READ_ERR_STATE 4 /* read the error state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define H_CONTROL_CA_FUNCTION_GET_AFU_ERR 5 /* collect the AFU error buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define H_CONTROL_CA_FUNCTION_GET_CONFIG 6 /* collect configuration record */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define H_CONTROL_CA_FUNCTION_GET_DOWNLOAD_STATE 7 /* query to return download status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define H_CONTROL_CA_FUNCTION_TERMINATE_PROCESS 8 /* terminate the process before completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define H_CONTROL_CA_FUNCTION_COLLECT_VPD 9 /* collect VPD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define H_CONTROL_CA_FUNCTION_GET_FUNCTION_ERR_INT 11 /* read the function-wide error data based on an interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define H_CONTROL_CA_FUNCTION_ACK_FUNCTION_ERR_INT 12 /* acknowledge function-wide error data based on an interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define H_CONTROL_CA_FUNCTION_GET_ERROR_LOG 13 /* retrieve the Platform Log ID (PLID) of an error log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define H_CONTROL_CA_FAULTS_RESPOND_PSL 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define H_CONTROL_CA_FAULTS_RESPOND_AFU 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define H_CONTROL_CA_FACILITY_RESET 1 /* perform a reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define H_CONTROL_CA_FACILITY_COLLECT_VPD 2 /* collect VPD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define H_DOWNLOAD_CA_FACILITY_DOWNLOAD 1 /* download adapter image */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define H_DOWNLOAD_CA_FACILITY_VALIDATE 2 /* validate adapter image */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define _CXL_LOOP_HCALL(call, rc, retbuf, fn, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) unsigned int delay, total_delay = 0; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) u64 token = 0; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) memset(retbuf, 0, sizeof(retbuf)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) while (1) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) rc = call(fn, retbuf, __VA_ARGS__, token); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) token = retbuf[0]; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) if (rc != H_BUSY && !H_IS_LONG_BUSY(rc)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) break; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) if (rc == H_BUSY) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) delay = 10; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) else \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) delay = get_longbusy_msecs(rc); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) total_delay += delay; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) if (total_delay > CXL_HCALL_TIMEOUT) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) WARN(1, "Warning: Giving up waiting for CXL hcall " \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) "%#x after %u msec\n", fn, total_delay); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) rc = H_BUSY; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) break; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) msleep(delay); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define CXL_H_WAIT_UNTIL_DONE(...) _CXL_LOOP_HCALL(plpar_hcall, __VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define CXL_H9_WAIT_UNTIL_DONE(...) _CXL_LOOP_HCALL(plpar_hcall9, __VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define _PRINT_MSG(rc, format, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) if ((rc != H_SUCCESS) && (rc != H_CONTINUE)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) pr_err(format, __VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) else \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) pr_devel(format, __VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static char *afu_op_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) "UNKNOWN_OP", /* 0 undefined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) "RESET", /* 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) "SUSPEND_PROCESS", /* 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) "RESUME_PROCESS", /* 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) "READ_ERR_STATE", /* 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) "GET_AFU_ERR", /* 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) "GET_CONFIG", /* 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) "GET_DOWNLOAD_STATE", /* 7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) "TERMINATE_PROCESS", /* 8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) "COLLECT_VPD", /* 9 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) "UNKNOWN_OP", /* 10 undefined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) "GET_FUNCTION_ERR_INT", /* 11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) "ACK_FUNCTION_ERR_INT", /* 12 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) "GET_ERROR_LOG", /* 13 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static char *control_adapter_op_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) "UNKNOWN_OP", /* 0 undefined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) "RESET", /* 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) "COLLECT_VPD", /* 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static char *download_op_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) "UNKNOWN_OP", /* 0 undefined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) "DOWNLOAD", /* 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) "VALIDATE", /* 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static char *op_str(unsigned int op, char *name_array[], int array_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (op >= array_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return "UNKNOWN_OP";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) return name_array[op];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define OP_STR(op, name_array) op_str(op, name_array, ARRAY_SIZE(name_array))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define OP_STR_AFU(op) OP_STR(op, afu_op_names)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define OP_STR_CONTROL_ADAPTER(op) OP_STR(op, control_adapter_op_names)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define OP_STR_DOWNLOAD_ADAPTER(op) OP_STR(op, download_op_names)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) long cxl_h_attach_process(u64 unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct cxl_process_element_hcall *element,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) u64 *process_token, u64 *mmio_addr, u64 *mmio_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_ATTACH_CA_PROCESS, unit_address, virt_to_phys(element));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) _PRINT_MSG(rc, "cxl_h_attach_process(%#.16llx, %#.16lx): %li\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) unit_address, virt_to_phys(element), rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) trace_cxl_hcall_attach(unit_address, virt_to_phys(element), retbuf[0], retbuf[1], retbuf[2], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) pr_devel("token: 0x%.8lx mmio_addr: 0x%lx mmio_size: 0x%lx\nProcess Element Structure:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) retbuf[0], retbuf[1], retbuf[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) cxl_dump_debug_buffer(element, sizeof(*element));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) case H_SUCCESS: /* The process info is attached to the coherent platform function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) *process_token = retbuf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (mmio_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) *mmio_addr = retbuf[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (mmio_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) *mmio_size = retbuf[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) case H_FUNCTION: /* The function is not supported. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) case H_AUTHORITY: /* The partition does not have authority to perform this hcall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) case H_RESOURCE: /* The coherent platform function does not have enough additional resource to attach the process */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) case H_HARDWARE: /* A hardware event prevented the attach operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) case H_STATE: /* The coherent platform function is not in a valid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) case H_BUSY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * cxl_h_detach_process - Detach a process element from a coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * platform function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) long cxl_h_detach_process(u64 unit_address, u64 process_token)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_DETACH_CA_PROCESS, unit_address, process_token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) _PRINT_MSG(rc, "cxl_h_detach_process(%#.16llx, 0x%.8llx): %li\n", unit_address, process_token, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) trace_cxl_hcall_detach(unit_address, process_token, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) case H_SUCCESS: /* The process was detached from the coherent platform function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) case H_AUTHORITY: /* The partition does not have authority to perform this hcall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) case H_RESOURCE: /* The function has page table mappings for MMIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) case H_HARDWARE: /* A hardware event prevented the detach operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) case H_STATE: /* The coherent platform function is not in a valid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) case H_BUSY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * cxl_h_control_function - This H_CONTROL_CA_FUNCTION hypervisor call allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * the partition to manipulate or query
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * certain coherent platform function behaviors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static long cxl_h_control_function(u64 unit_address, u64 op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) u64 p1, u64 p2, u64 p3, u64 p4, u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FUNCTION, unit_address, op, p1, p2, p3, p4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) _PRINT_MSG(rc, "cxl_h_control_function(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) unit_address, OP_STR_AFU(op), p1, p2, p3, p4, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) trace_cxl_hcall_control_function(unit_address, OP_STR_AFU(op), p1, p2, p3, p4, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) case H_SUCCESS: /* The operation is completed for the coherent platform function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if ((op == H_CONTROL_CA_FUNCTION_GET_FUNCTION_ERR_INT ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) op == H_CONTROL_CA_FUNCTION_READ_ERR_STATE ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) op == H_CONTROL_CA_FUNCTION_COLLECT_VPD))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) *out = retbuf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) case H_FUNCTION: /* The function is not supported. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) case H_NOT_FOUND: /* The operation supplied was not valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) case H_NOT_AVAILABLE: /* The operation cannot be performed because the AFU has not been downloaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) case H_SG_LIST: /* An block list entry was invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) case H_AUTHORITY: /* The partition does not have authority to perform this hcall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) case H_RESOURCE: /* The function has page table mappings for MMIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) case H_HARDWARE: /* A hardware event prevented the attach operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) case H_STATE: /* The coherent platform function is not in a valid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) case H_BUSY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) * cxl_h_reset_afu - Perform a reset to the coherent platform function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) long cxl_h_reset_afu(u64 unit_address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) H_CONTROL_CA_FUNCTION_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 0, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * cxl_h_suspend_process - Suspend a process from being executed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * process was attached.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) long cxl_h_suspend_process(u64 unit_address, u64 process_token)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) H_CONTROL_CA_FUNCTION_SUSPEND_PROCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) process_token, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * cxl_h_resume_process - Resume a process to be executed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * process was attached.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) long cxl_h_resume_process(u64 unit_address, u64 process_token)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) H_CONTROL_CA_FUNCTION_RESUME_PROCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) process_token, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * cxl_h_read_error_state - Checks the error state of the coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * platform function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) * R4 contains the error state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) long cxl_h_read_error_state(u64 unit_address, u64 *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) H_CONTROL_CA_FUNCTION_READ_ERR_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 0, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * cxl_h_get_afu_err - collect the AFU error buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * Parameter1 = byte offset into error buffer to retrieve, valid values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * are between 0 and (ibm,error-buffer-size - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) * Parameter2 = 4K aligned real address of error buffer, to be filled in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) * Parameter3 = length of error buffer, valid values are 4K or less
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) long cxl_h_get_afu_err(u64 unit_address, u64 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) u64 buf_address, u64 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) H_CONTROL_CA_FUNCTION_GET_AFU_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) offset, buf_address, len, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) * cxl_h_get_config - collect configuration record for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * coherent platform function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * Parameter1 = # of configuration record to retrieve, valid values are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * between 0 and (ibm,#config-records - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) * Parameter2 = byte offset into configuration record to retrieve,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * valid values are between 0 and (ibm,config-record-size - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * Parameter3 = 4K aligned real address of configuration record buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * to be filled in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) * Parameter4 = length of configuration buffer, valid values are 4K or less
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) long cxl_h_get_config(u64 unit_address, u64 cr_num, u64 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) u64 buf_address, u64 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) H_CONTROL_CA_FUNCTION_GET_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) cr_num, offset, buf_address, len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) * cxl_h_terminate_process - Terminate the process before completion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) * Parameter1 = process-token as returned from H_ATTACH_CA_PROCESS when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) * process was attached.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) long cxl_h_terminate_process(u64 unit_address, u64 process_token)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) H_CONTROL_CA_FUNCTION_TERMINATE_PROCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) process_token, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * cxl_h_collect_vpd - Collect VPD for the coherent platform function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * Parameter1 = # of VPD record to retrieve, valid values are between 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * and (ibm,#config-records - 1).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * Parameter2 = 4K naturally aligned real buffer containing block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * list entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * Parameter3 = number of block list entries in the block list, valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * values are between 0 and 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) long cxl_h_collect_vpd(u64 unit_address, u64 record, u64 list_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) u64 num, u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) H_CONTROL_CA_FUNCTION_COLLECT_VPD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) record, list_address, num, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) * cxl_h_get_fn_error_interrupt - Read the function-wide error data based on an interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) long cxl_h_get_fn_error_interrupt(u64 unit_address, u64 *reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) H_CONTROL_CA_FUNCTION_GET_FUNCTION_ERR_INT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 0, 0, 0, 0, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) * cxl_h_ack_fn_error_interrupt - Acknowledge function-wide error data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) * based on an interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * Parameter1 = value to write to the function-wide error interrupt register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) long cxl_h_ack_fn_error_interrupt(u64 unit_address, u64 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) H_CONTROL_CA_FUNCTION_ACK_FUNCTION_ERR_INT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) value, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * cxl_h_get_error_log - Retrieve the Platform Log ID (PLID) of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * an error log
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) long cxl_h_get_error_log(u64 unit_address, u64 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) return cxl_h_control_function(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) H_CONTROL_CA_FUNCTION_GET_ERROR_LOG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 0, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) * cxl_h_collect_int_info - Collect interrupt info about a coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) * platform function after an interrupt occurred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) long cxl_h_collect_int_info(u64 unit_address, u64 process_token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) struct cxl_irq_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) BUG_ON(sizeof(*info) != sizeof(unsigned long[PLPAR_HCALL9_BUFSIZE]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) rc = plpar_hcall9(H_COLLECT_CA_INT_INFO, (unsigned long *) info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) unit_address, process_token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) _PRINT_MSG(rc, "cxl_h_collect_int_info(%#.16llx, 0x%llx): %li\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) unit_address, process_token, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) trace_cxl_hcall_collect_int_info(unit_address, process_token, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) case H_SUCCESS: /* The interrupt info is returned in return registers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) pr_devel("dsisr:%#llx, dar:%#llx, dsr:%#llx, pid_tid:%#llx, afu_err:%#llx, errstat:%#llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) info->dsisr, info->dar, info->dsr, info->reserved,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) info->afu_err, info->errstat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) case H_AUTHORITY: /* The partition does not have authority to perform this hcall. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) case H_HARDWARE: /* A hardware event prevented the collection of the interrupt info.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) case H_STATE: /* The coherent platform function is not in a valid state to collect interrupt info. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * cxl_h_control_faults - Control the operation of a coherent platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * function after a fault occurs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * control-mask: value to control the faults
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * looks like PSL_TFC_An shifted >> 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * reset-mask: mask to control reset of function faults
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * Set reset_mask = 1 to reset PSL errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) long cxl_h_control_faults(u64 unit_address, u64 process_token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) u64 control_mask, u64 reset_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) memset(retbuf, 0, sizeof(retbuf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) rc = plpar_hcall(H_CONTROL_CA_FAULTS, retbuf, unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) H_CONTROL_CA_FAULTS_RESPOND_PSL, process_token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) control_mask, reset_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) _PRINT_MSG(rc, "cxl_h_control_faults(%#.16llx, 0x%llx, %#llx, %#llx): %li (%#lx)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) unit_address, process_token, control_mask, reset_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) rc, retbuf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) trace_cxl_hcall_control_faults(unit_address, process_token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) control_mask, reset_mask, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) case H_SUCCESS: /* Faults were successfully controlled for the function. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) case H_HARDWARE: /* A hardware event prevented the control of faults. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) case H_STATE: /* The function was in an invalid state. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) case H_AUTHORITY: /* The partition does not have authority to perform this hcall; the coherent platform facilities may need to be licensed. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) case H_FUNCTION: /* The function is not supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) case H_NOT_FOUND: /* The operation supplied was not valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) * cxl_h_control_facility - This H_CONTROL_CA_FACILITY hypervisor call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * allows the partition to manipulate or query
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) * certain coherent platform facility behaviors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) static long cxl_h_control_facility(u64 unit_address, u64 op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) u64 p1, u64 p2, u64 p3, u64 p4, u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FACILITY, unit_address, op, p1, p2, p3, p4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) _PRINT_MSG(rc, "cxl_h_control_facility(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) unit_address, OP_STR_CONTROL_ADAPTER(op), p1, p2, p3, p4, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) trace_cxl_hcall_control_facility(unit_address, OP_STR_CONTROL_ADAPTER(op), p1, p2, p3, p4, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) case H_SUCCESS: /* The operation is completed for the coherent platform facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) if (op == H_CONTROL_CA_FACILITY_COLLECT_VPD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) *out = retbuf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) case H_PARAMETER: /* An incorrect parameter was supplied. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) case H_FUNCTION: /* The function is not supported. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) case H_NOT_FOUND: /* The operation supplied was not valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) case H_NOT_AVAILABLE: /* The operation cannot be performed because the AFU has not been downloaded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) case H_SG_LIST: /* An block list entry was invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) case H_AUTHORITY: /* The partition does not have authority to perform this hcall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) case H_RESOURCE: /* The function has page table mappings for MMIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) case H_HARDWARE: /* A hardware event prevented the attach operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) case H_STATE: /* The coherent platform facility is not in a valid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) case H_BUSY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) * cxl_h_reset_adapter - Perform a reset to the coherent platform facility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) long cxl_h_reset_adapter(u64 unit_address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) return cxl_h_control_facility(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) H_CONTROL_CA_FACILITY_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 0, 0, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) * cxl_h_collect_vpd - Collect VPD for the coherent platform function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) * Parameter1 = 4K naturally aligned real buffer containing block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) * list entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) * Parameter2 = number of block list entries in the block list, valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) * values are between 0 and 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) long cxl_h_collect_vpd_adapter(u64 unit_address, u64 list_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) u64 num, u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) return cxl_h_control_facility(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) H_CONTROL_CA_FACILITY_COLLECT_VPD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) list_address, num, 0, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) * cxl_h_download_facility - This H_DOWNLOAD_CA_FACILITY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) * hypervisor call provide platform support for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) * downloading a base adapter image to the coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) * platform facility, and for validating the entire
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) * image after the download.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) * Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) * op: operation to perform to the coherent platform function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) * Download: operation = 1, the base image in the coherent platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) * facility is first erased, and then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) * programmed using the image supplied
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) * in the scatter/gather list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) * Validate: operation = 2, the base image in the coherent platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) * facility is compared with the image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) * supplied in the scatter/gather list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) * list_address: 4K naturally aligned real buffer containing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) * scatter/gather list entries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) * num: number of block list entries in the scatter/gather list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) static long cxl_h_download_facility(u64 unit_address, u64 op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) u64 list_address, u64 num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) unsigned int delay, total_delay = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) u64 token = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) if (*out != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) token = *out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) memset(retbuf, 0, sizeof(retbuf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) while (1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) rc = plpar_hcall(H_DOWNLOAD_CA_FACILITY, retbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) unit_address, op, list_address, num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) token = retbuf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) if (rc != H_BUSY && !H_IS_LONG_BUSY(rc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) if (rc != H_BUSY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) delay = get_longbusy_msecs(rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) total_delay += delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) if (total_delay > CXL_HCALL_TIMEOUT_DOWNLOAD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) WARN(1, "Warning: Giving up waiting for CXL hcall "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) "%#x after %u msec\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) H_DOWNLOAD_CA_FACILITY, total_delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) rc = H_BUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) msleep(delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) _PRINT_MSG(rc, "cxl_h_download_facility(%#.16llx, %s(%#llx, %#llx), %#lx): %li\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) unit_address, OP_STR_DOWNLOAD_ADAPTER(op), list_address, num, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) trace_cxl_hcall_download_facility(unit_address, OP_STR_DOWNLOAD_ADAPTER(op), list_address, num, retbuf[0], rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) switch (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) case H_SUCCESS: /* The operation is completed for the coherent platform facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) case H_PARAMETER: /* An incorrect parameter was supplied */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) case H_FUNCTION: /* The function is not supported. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) case H_SG_LIST: /* An block list entry was invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) case H_BAD_DATA: /* Image verification failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) case H_AUTHORITY: /* The partition does not have authority to perform this hcall */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) case H_RESOURCE: /* The function has page table mappings for MMIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) case H_HARDWARE: /* A hardware event prevented the attach operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) case H_STATE: /* The coherent platform facility is not in a valid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) case H_BUSY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) case H_CONTINUE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) *out = retbuf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) return 1; /* More data is needed for the complete image */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) WARN(1, "Unexpected return code: %lx", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) * cxl_h_download_adapter_image - Download the base image to the coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) * platform facility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) long cxl_h_download_adapter_image(u64 unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) u64 list_address, u64 num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) return cxl_h_download_facility(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) H_DOWNLOAD_CA_FACILITY_DOWNLOAD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) list_address, num, out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) * cxl_h_validate_adapter_image - Validate the base image in the coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) * platform facility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) long cxl_h_validate_adapter_image(u64 unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) u64 list_address, u64 num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) u64 *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) return cxl_h_download_facility(unit_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) H_DOWNLOAD_CA_FACILITY_VALIDATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) list_address, num, out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) }