Skip to content

Commit 71cbbff

Browse files
Harald FreudenbergerMartin Schwidefsky
authored andcommitted
s390/zcrypt: Remove deprecated zcrypt proc interface.
This patch removes the deprecated zcrypt proc interface. It is outdated and deprecated and does not support the latest 3 generations of CEX cards. Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 2a80786 commit 71cbbff

File tree

1 file changed

+0
-231
lines changed

1 file changed

+0
-231
lines changed

drivers/s390/crypto/zcrypt_api.c

Lines changed: 0 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <linux/interrupt.h>
1919
#include <linux/miscdevice.h>
2020
#include <linux/fs.h>
21-
#include <linux/proc_fs.h>
22-
#include <linux/seq_file.h>
2321
#include <linux/compat.h>
2422
#include <linux/slab.h>
2523
#include <linux/atomic.h>
@@ -739,27 +737,6 @@ static int zcrypt_requestq_count(void)
739737
return requestq_count;
740738
}
741739

742-
static int zcrypt_count_type(int type)
743-
{
744-
struct zcrypt_card *zc;
745-
struct zcrypt_queue *zq;
746-
int device_count;
747-
748-
device_count = 0;
749-
spin_lock(&zcrypt_list_lock);
750-
for_each_zcrypt_card(zc) {
751-
if (zc->card->id != type)
752-
continue;
753-
for_each_zcrypt_queue(zq, zc) {
754-
if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index)
755-
continue;
756-
device_count++;
757-
}
758-
}
759-
spin_unlock(&zcrypt_list_lock);
760-
return device_count;
761-
}
762-
763740
static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
764741
unsigned long arg)
765742
{
@@ -1092,201 +1069,6 @@ static struct miscdevice zcrypt_misc_device = {
10921069
.fops = &zcrypt_fops,
10931070
};
10941071

1095-
/*
1096-
* Deprecated /proc entry support.
1097-
*/
1098-
static struct proc_dir_entry *zcrypt_entry;
1099-
1100-
static void sprintcl(struct seq_file *m, unsigned char *addr, unsigned int len)
1101-
{
1102-
int i;
1103-
1104-
for (i = 0; i < len; i++)
1105-
seq_printf(m, "%01x", (unsigned int) addr[i]);
1106-
seq_putc(m, ' ');
1107-
}
1108-
1109-
static void sprintrw(struct seq_file *m, unsigned char *addr, unsigned int len)
1110-
{
1111-
int inl, c, cx;
1112-
1113-
seq_printf(m, " ");
1114-
inl = 0;
1115-
for (c = 0; c < (len / 16); c++) {
1116-
sprintcl(m, addr+inl, 16);
1117-
inl += 16;
1118-
}
1119-
cx = len%16;
1120-
if (cx) {
1121-
sprintcl(m, addr+inl, cx);
1122-
inl += cx;
1123-
}
1124-
seq_putc(m, '\n');
1125-
}
1126-
1127-
static void sprinthx(unsigned char *title, struct seq_file *m,
1128-
unsigned char *addr, unsigned int len)
1129-
{
1130-
int inl, r, rx;
1131-
1132-
seq_printf(m, "\n%s\n", title);
1133-
inl = 0;
1134-
for (r = 0; r < (len / 64); r++) {
1135-
sprintrw(m, addr+inl, 64);
1136-
inl += 64;
1137-
}
1138-
rx = len % 64;
1139-
if (rx) {
1140-
sprintrw(m, addr+inl, rx);
1141-
inl += rx;
1142-
}
1143-
seq_putc(m, '\n');
1144-
}
1145-
1146-
static void sprinthx4(unsigned char *title, struct seq_file *m,
1147-
unsigned int *array, unsigned int len)
1148-
{
1149-
seq_printf(m, "\n%s\n", title);
1150-
seq_hex_dump(m, " ", DUMP_PREFIX_NONE, 32, 4, array, len, false);
1151-
seq_putc(m, '\n');
1152-
}
1153-
1154-
static int zcrypt_proc_show(struct seq_file *m, void *v)
1155-
{
1156-
char workarea[sizeof(int) * AP_DEVICES];
1157-
1158-
seq_printf(m, "\nzcrypt version: %d.%d.%d\n",
1159-
ZCRYPT_VERSION, ZCRYPT_RELEASE, ZCRYPT_VARIANT);
1160-
seq_printf(m, "Cryptographic domain: %d\n", ap_domain_index);
1161-
seq_printf(m, "Total device count: %d\n", zcrypt_device_count);
1162-
seq_printf(m, "PCICA count: %d\n", zcrypt_count_type(ZCRYPT_PCICA));
1163-
seq_printf(m, "PCICC count: %d\n", zcrypt_count_type(ZCRYPT_PCICC));
1164-
seq_printf(m, "PCIXCC MCL2 count: %d\n",
1165-
zcrypt_count_type(ZCRYPT_PCIXCC_MCL2));
1166-
seq_printf(m, "PCIXCC MCL3 count: %d\n",
1167-
zcrypt_count_type(ZCRYPT_PCIXCC_MCL3));
1168-
seq_printf(m, "CEX2C count: %d\n", zcrypt_count_type(ZCRYPT_CEX2C));
1169-
seq_printf(m, "CEX2A count: %d\n", zcrypt_count_type(ZCRYPT_CEX2A));
1170-
seq_printf(m, "CEX3C count: %d\n", zcrypt_count_type(ZCRYPT_CEX3C));
1171-
seq_printf(m, "CEX3A count: %d\n", zcrypt_count_type(ZCRYPT_CEX3A));
1172-
seq_printf(m, "requestq count: %d\n", zcrypt_requestq_count());
1173-
seq_printf(m, "pendingq count: %d\n", zcrypt_pendingq_count());
1174-
seq_printf(m, "Total open handles: %d\n\n",
1175-
atomic_read(&zcrypt_open_count));
1176-
zcrypt_status_mask(workarea);
1177-
sprinthx("Online devices: 1=PCICA 2=PCICC 3=PCIXCC(MCL2) "
1178-
"4=PCIXCC(MCL3) 5=CEX2C 6=CEX2A 7=CEX3C 8=CEX3A",
1179-
m, workarea, AP_DEVICES);
1180-
zcrypt_qdepth_mask(workarea);
1181-
sprinthx("Waiting work element counts", m, workarea, AP_DEVICES);
1182-
zcrypt_perdev_reqcnt((int *) workarea);
1183-
sprinthx4("Per-device successfully completed request counts",
1184-
m, (unsigned int *) workarea, AP_DEVICES);
1185-
return 0;
1186-
}
1187-
1188-
static int zcrypt_proc_open(struct inode *inode, struct file *file)
1189-
{
1190-
return single_open(file, zcrypt_proc_show, NULL);
1191-
}
1192-
1193-
static void zcrypt_disable_card(int index)
1194-
{
1195-
struct zcrypt_card *zc;
1196-
struct zcrypt_queue *zq;
1197-
1198-
spin_lock(&zcrypt_list_lock);
1199-
for_each_zcrypt_card(zc) {
1200-
for_each_zcrypt_queue(zq, zc) {
1201-
if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index)
1202-
continue;
1203-
zq->online = 0;
1204-
ap_flush_queue(zq->queue);
1205-
}
1206-
}
1207-
spin_unlock(&zcrypt_list_lock);
1208-
}
1209-
1210-
static void zcrypt_enable_card(int index)
1211-
{
1212-
struct zcrypt_card *zc;
1213-
struct zcrypt_queue *zq;
1214-
1215-
spin_lock(&zcrypt_list_lock);
1216-
for_each_zcrypt_card(zc) {
1217-
for_each_zcrypt_queue(zq, zc) {
1218-
if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index)
1219-
continue;
1220-
zq->online = 1;
1221-
ap_flush_queue(zq->queue);
1222-
}
1223-
}
1224-
spin_unlock(&zcrypt_list_lock);
1225-
}
1226-
1227-
static ssize_t zcrypt_proc_write(struct file *file, const char __user *buffer,
1228-
size_t count, loff_t *pos)
1229-
{
1230-
unsigned char *lbuf, *ptr;
1231-
size_t local_count;
1232-
int j;
1233-
1234-
if (count <= 0)
1235-
return 0;
1236-
1237-
#define LBUFSIZE 1200UL
1238-
lbuf = kmalloc(LBUFSIZE, GFP_KERNEL);
1239-
if (!lbuf)
1240-
return 0;
1241-
1242-
local_count = min(LBUFSIZE - 1, count);
1243-
if (copy_from_user(lbuf, buffer, local_count) != 0) {
1244-
kfree(lbuf);
1245-
return -EFAULT;
1246-
}
1247-
lbuf[local_count] = '\0';
1248-
1249-
ptr = strstr(lbuf, "Online devices");
1250-
if (!ptr)
1251-
goto out;
1252-
ptr = strstr(ptr, "\n");
1253-
if (!ptr)
1254-
goto out;
1255-
ptr++;
1256-
1257-
if (strstr(ptr, "Waiting work element counts") == NULL)
1258-
goto out;
1259-
1260-
for (j = 0; j < 64 && *ptr; ptr++) {
1261-
/*
1262-
* '0' for no device, '1' for PCICA, '2' for PCICC,
1263-
* '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3,
1264-
* '5' for CEX2C and '6' for CEX2A'
1265-
* '7' for CEX3C and '8' for CEX3A
1266-
*/
1267-
if (*ptr >= '0' && *ptr <= '8')
1268-
j++;
1269-
else if (*ptr == 'd' || *ptr == 'D')
1270-
zcrypt_disable_card(j++);
1271-
else if (*ptr == 'e' || *ptr == 'E')
1272-
zcrypt_enable_card(j++);
1273-
else if (*ptr != ' ' && *ptr != '\t')
1274-
break;
1275-
}
1276-
out:
1277-
kfree(lbuf);
1278-
return count;
1279-
}
1280-
1281-
static const struct file_operations zcrypt_proc_fops = {
1282-
.owner = THIS_MODULE,
1283-
.open = zcrypt_proc_open,
1284-
.read = seq_read,
1285-
.llseek = seq_lseek,
1286-
.release = single_release,
1287-
.write = zcrypt_proc_write,
1288-
};
1289-
12901072
static int zcrypt_rng_device_count;
12911073
static u32 *zcrypt_rng_buffer;
12921074
static int zcrypt_rng_buffer_index;
@@ -1388,27 +1170,15 @@ int __init zcrypt_api_init(void)
13881170
if (rc)
13891171
goto out;
13901172

1391-
atomic_set(&zcrypt_rescan_req, 0);
1392-
13931173
/* Register the request sprayer. */
13941174
rc = misc_register(&zcrypt_misc_device);
13951175
if (rc < 0)
13961176
goto out;
13971177

1398-
/* Set up the proc file system */
1399-
zcrypt_entry = proc_create("driver/z90crypt", 0644, NULL,
1400-
&zcrypt_proc_fops);
1401-
if (!zcrypt_entry) {
1402-
rc = -ENOMEM;
1403-
goto out_misc;
1404-
}
1405-
14061178
zcrypt_msgtype6_init();
14071179
zcrypt_msgtype50_init();
14081180
return 0;
14091181

1410-
out_misc:
1411-
misc_deregister(&zcrypt_misc_device);
14121182
out:
14131183
return rc;
14141184
}
@@ -1420,7 +1190,6 @@ int __init zcrypt_api_init(void)
14201190
*/
14211191
void __exit zcrypt_api_exit(void)
14221192
{
1423-
remove_proc_entry("driver/z90crypt", NULL);
14241193
misc_deregister(&zcrypt_misc_device);
14251194
zcrypt_msgtype6_exit();
14261195
zcrypt_msgtype50_exit();

0 commit comments

Comments
 (0)