From 170387a8877b2c12fee5ae901be1ef4693d06094 Mon Sep 17 00:00:00 2001 From: Ingo Tuchscherer Date: Mon, 8 Sep 2014 13:24:13 +0200 Subject: [PATCH] s390/zcrypt: support for extended number of ap domains Extends the number of ap domains within the zcrypt device driver up to 256. AP domains in the range 00..255 will be detected. Signed-off-by: Ingo Tuchscherer Signed-off-by: Martin Schwidefsky --- drivers/s390/crypto/ap_bus.c | 14 ++++++++++++-- drivers/s390/crypto/ap_bus.h | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 4038437..51e6aa0 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -1188,6 +1188,10 @@ static int ap_select_domain(void) ap_qid_t qid; int rc, i, j; + /* IF APXA isn't installed, only 16 domains could be defined */ + if (!ap_configuration->ap_extended && (ap_domain_index > 15)) + return -EINVAL; + /* * We want to use a single domain. Either the one specified with * the "domain=" parameter or the domain with the maximum number @@ -1900,9 +1904,15 @@ static void ap_reset_all(void) { int i, j; - for (i = 0; i < AP_DOMAINS; i++) - for (j = 0; j < AP_DEVICES; j++) + for (i = 0; i < AP_DOMAINS; i++) { + if (!ap_test_config_domain(i)) + continue; + for (j = 0; j < AP_DEVICES; j++) { + if (!ap_test_config_card_id(j)) + continue; ap_reset_queue(AP_MKQID(j, i)); + } + } } static struct reset_call ap_reset_call = { diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index 6405ae2..db92e9f 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h @@ -31,7 +31,7 @@ #include #define AP_DEVICES 64 /* Number of AP devices. */ -#define AP_DOMAINS 16 /* Number of AP domains. */ +#define AP_DOMAINS 256 /* Number of AP domains. */ #define AP_MAX_RESET 90 /* Maximum number of resets. */ #define AP_RESET_TIMEOUT (HZ*0.7) /* Time in ticks for reset timeouts. */ #define AP_CONFIG_TIME 30 /* Time in seconds between AP bus rescans. */ @@ -45,9 +45,9 @@ extern int ap_domain_index; */ typedef unsigned int ap_qid_t; -#define AP_MKQID(_device,_queue) (((_device) & 63) << 8 | ((_queue) & 15)) +#define AP_MKQID(_device, _queue) (((_device) & 63) << 8 | ((_queue) & 255)) #define AP_QID_DEVICE(_qid) (((_qid) >> 8) & 63) -#define AP_QID_QUEUE(_qid) ((_qid) & 15) +#define AP_QID_QUEUE(_qid) ((_qid) & 255) /** * structy ap_queue_status - Holds the AP queue status. -- 2.7.4