aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/ap_bus.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-11 20:42:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-11 20:42:32 -0500
commitb3d6524ff7956c5a898d51a18eaecb62a60a2b84 (patch)
treecc049e7ec9edd9f5a76f286e04d8db9a1caa516a /drivers/s390/crypto/ap_bus.c
parent07f80d41cf24b7e6e76cd97d420167932c9a7f82 (diff)
parent6a039eab53c01a58bfff95c78fc800ca7de27c77 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky: - The remaining patches for the z13 machine support: kernel build option for z13, the cache synonym avoidance, SMT support, compare-and-delay for spinloops and the CES5S crypto adapater. - The ftrace support for function tracing with the gcc hotpatch option. This touches common code Makefiles, Steven is ok with the changes. - The hypfs file system gets an extension to access diagnose 0x0c data in user space for performance analysis for Linux running under z/VM. - The iucv hvc console gets wildcard spport for the user id filtering. - The cacheinfo code is converted to use the generic infrastructure. - Cleanup and bug fixes. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (42 commits) s390/process: free vx save area when releasing tasks s390/hypfs: Eliminate hypfs interval s390/hypfs: Add diagnose 0c support s390/cacheinfo: don't use smp_processor_id() in preemptible context s390/zcrypt: fixed domain scanning problem (again) s390/smp: increase maximum value of NR_CPUS to 512 s390/jump label: use different nop instruction s390/jump label: add sanity checks s390/mm: correct missing space when reporting user process faults s390/dasd: cleanup profiling s390/dasd: add locking for global_profile access s390/ftrace: hotpatch support for function tracing ftrace: let notrace function attribute disable hotpatching if necessary ftrace: allow architectures to specify ftrace compile options s390: reintroduce diag 44 calls for cpu_relax() s390/zcrypt: Add support for new crypto express (CEX5S) adapter. s390/zcrypt: Number of supported ap domains is not retrievable. s390/spinlock: add compare-and-delay to lock wait loops s390/tape: remove redundant if statement s390/hvc_iucv: add simple wildcard matches to the iucv allow filter ...
Diffstat (limited to 'drivers/s390/crypto/ap_bus.c')
-rw-r--r--drivers/s390/crypto/ap_bus.c144
1 files changed, 100 insertions, 44 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 4d41bf75c233..3d7f19fb9a4e 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -204,6 +204,24 @@ ap_test_queue(ap_qid_t qid, int *queue_depth, int *device_type)
204} 204}
205 205
206/** 206/**
207 * ap_query_facilities(): PQAP(TAPQ) query facilities.
208 * @qid: The AP queue number
209 *
210 * Returns content of general register 2 after the PQAP(TAPQ)
211 * instruction was called.
212 */
213static inline unsigned long ap_query_facilities(ap_qid_t qid)
214{
215 register unsigned long reg0 asm ("0") = qid | 0x00800000UL;
216 register unsigned long reg1 asm ("1");
217 register unsigned long reg2 asm ("2") = 0UL;
218
219 asm volatile(".long 0xb2af0000" /* PQAP(TAPQ) */
220 : "+d" (reg0), "=d" (reg1), "+d" (reg2) : : "cc");
221 return reg2;
222}
223
224/**
207 * ap_reset_queue(): Reset adjunct processor queue. 225 * ap_reset_queue(): Reset adjunct processor queue.
208 * @qid: The AP queue number 226 * @qid: The AP queue number
209 * 227 *
@@ -1007,6 +1025,51 @@ void ap_bus_force_rescan(void)
1007EXPORT_SYMBOL(ap_bus_force_rescan); 1025EXPORT_SYMBOL(ap_bus_force_rescan);
1008 1026
1009/* 1027/*
1028 * ap_test_config(): helper function to extract the nrth bit
1029 * within the unsigned int array field.
1030 */
1031static inline int ap_test_config(unsigned int *field, unsigned int nr)
1032{
1033 if (nr > 0xFFu)
1034 return 0;
1035 return ap_test_bit((field + (nr >> 5)), (nr & 0x1f));
1036}
1037
1038/*
1039 * ap_test_config_card_id(): Test, whether an AP card ID is configured.
1040 * @id AP card ID
1041 *
1042 * Returns 0 if the card is not configured
1043 * 1 if the card is configured or
1044 * if the configuration information is not available
1045 */
1046static inline int ap_test_config_card_id(unsigned int id)
1047{
1048 if (!ap_configuration)
1049 return 1;
1050 return ap_test_config(ap_configuration->apm, id);
1051}
1052
1053/*
1054 * ap_test_config_domain(): Test, whether an AP usage domain is configured.
1055 * @domain AP usage domain ID
1056 *
1057 * Returns 0 if the usage domain is not configured
1058 * 1 if the usage domain is configured or
1059 * if the configuration information is not available
1060 */
1061static inline int ap_test_config_domain(unsigned int domain)
1062{
1063 if (!ap_configuration) /* QCI not supported */
1064 if (domain < 16)
1065 return 1; /* then domains 0...15 are configured */
1066 else
1067 return 0;
1068 else
1069 return ap_test_config(ap_configuration->aqm, domain);
1070}
1071
1072/*
1010 * AP bus attributes. 1073 * AP bus attributes.
1011 */ 1074 */
1012static ssize_t ap_domain_show(struct bus_type *bus, char *buf) 1075static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
@@ -1121,6 +1184,42 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
1121 1184
1122static BUS_ATTR(poll_timeout, 0644, poll_timeout_show, poll_timeout_store); 1185static BUS_ATTR(poll_timeout, 0644, poll_timeout_show, poll_timeout_store);
1123 1186
1187static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf)
1188{
1189 ap_qid_t qid;
1190 int i, nd, max_domain_id = -1;
1191 unsigned long fbits;
1192
1193 if (ap_configuration) {
1194 if (ap_domain_index >= 0 && ap_domain_index < AP_DOMAINS) {
1195 for (i = 0; i < AP_DEVICES; i++) {
1196 if (!ap_test_config_card_id(i))
1197 continue;
1198 qid = AP_MKQID(i, ap_domain_index);
1199 fbits = ap_query_facilities(qid);
1200 if (fbits & (1UL << 57)) {
1201 /* the N bit is 0, Nd field is filled */
1202 nd = (int)((fbits & 0x00FF0000UL)>>16);
1203 if (nd > 0)
1204 max_domain_id = nd;
1205 else
1206 max_domain_id = 15;
1207 } else {
1208 /* N bit is 1, max 16 domains */
1209 max_domain_id = 15;
1210 }
1211 break;
1212 }
1213 }
1214 } else {
1215 /* no APXA support, older machines with max 16 domains */
1216 max_domain_id = 15;
1217 }
1218 return snprintf(buf, PAGE_SIZE, "%d\n", max_domain_id);
1219}
1220
1221static BUS_ATTR(ap_max_domain_id, 0444, ap_max_domain_id_show, NULL);
1222
1124static struct bus_attribute *const ap_bus_attrs[] = { 1223static struct bus_attribute *const ap_bus_attrs[] = {
1125 &bus_attr_ap_domain, 1224 &bus_attr_ap_domain,
1126 &bus_attr_ap_control_domain_mask, 1225 &bus_attr_ap_control_domain_mask,
@@ -1128,50 +1227,10 @@ static struct bus_attribute *const ap_bus_attrs[] = {
1128 &bus_attr_poll_thread, 1227 &bus_attr_poll_thread,
1129 &bus_attr_ap_interrupts, 1228 &bus_attr_ap_interrupts,
1130 &bus_attr_poll_timeout, 1229 &bus_attr_poll_timeout,
1230 &bus_attr_ap_max_domain_id,
1131 NULL, 1231 NULL,
1132}; 1232};
1133 1233
1134static inline int ap_test_config(unsigned int *field, unsigned int nr)
1135{
1136 if (nr > 0xFFu)
1137 return 0;
1138 return ap_test_bit((field + (nr >> 5)), (nr & 0x1f));
1139}
1140
1141/*
1142 * ap_test_config_card_id(): Test, whether an AP card ID is configured.
1143 * @id AP card ID
1144 *
1145 * Returns 0 if the card is not configured
1146 * 1 if the card is configured or
1147 * if the configuration information is not available
1148 */
1149static inline int ap_test_config_card_id(unsigned int id)
1150{
1151 if (!ap_configuration)
1152 return 1;
1153 return ap_test_config(ap_configuration->apm, id);
1154}
1155
1156/*
1157 * ap_test_config_domain(): Test, whether an AP usage domain is configured.
1158 * @domain AP usage domain ID
1159 *
1160 * Returns 0 if the usage domain is not configured
1161 * 1 if the usage domain is configured or
1162 * if the configuration information is not available
1163 */
1164static inline int ap_test_config_domain(unsigned int domain)
1165{
1166 if (!ap_configuration) /* QCI not supported */
1167 if (domain < 16)
1168 return 1; /* then domains 0...15 are configured */
1169 else
1170 return 0;
1171 else
1172 return ap_test_config(ap_configuration->aqm, domain);
1173}
1174
1175/** 1234/**
1176 * ap_query_configuration(): Query AP configuration information. 1235 * ap_query_configuration(): Query AP configuration information.
1177 * 1236 *
@@ -1434,9 +1493,6 @@ static void ap_scan_bus(struct work_struct *unused)
1434 continue; 1493 continue;
1435 } 1494 }
1436 break; 1495 break;
1437 case 11:
1438 ap_dev->device_type = 10;
1439 break;
1440 default: 1496 default:
1441 ap_dev->device_type = device_type; 1497 ap_dev->device_type = device_type;
1442 } 1498 }