Commit 1c472d46 authored by Halil Pasic's avatar Halil Pasic Committed by Martin Schwidefsky

s390/zcrypt: enable AP bus scan without a valid default domain

The AP bus scan is aborted before doing anything worth mentioning if
ap_select_domain() fails, e.g. if the ap_rights.aqm mask is all zeros.
As the result of this the ap bus fails to manage (e.g. create and
register) devices like it is supposed to.

Let us make ap_scan_bus() work even if ap_select_domain() can't select a
default domain. Let's also make ap_select_domain() return void, as there
are no more callers interested in its return value.
Signed-off-by: default avatarHalil Pasic <pasic@linux.ibm.com>
Reported-by: default avatarMichael Mueller <mimu@linux.ibm.com>
Fixes: 7e0bdbe5 "s390/zcrypt: AP bus support for alternate driver(s)"
[freude@linux.ibm.com: title and patch header slightly modified]
Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 8e5a7627
...@@ -1218,11 +1218,10 @@ static struct bus_attribute *const ap_bus_attrs[] = { ...@@ -1218,11 +1218,10 @@ static struct bus_attribute *const ap_bus_attrs[] = {
}; };
/** /**
* ap_select_domain(): Select an AP domain. * ap_select_domain(): Select an AP domain if possible and we haven't
* * already done so before.
* Pick one of the 16 AP domains.
*/ */
static int ap_select_domain(void) static void ap_select_domain(void)
{ {
int count, max_count, best_domain; int count, max_count, best_domain;
struct ap_queue_status status; struct ap_queue_status status;
...@@ -1237,7 +1236,7 @@ static int ap_select_domain(void) ...@@ -1237,7 +1236,7 @@ static int ap_select_domain(void)
if (ap_domain_index >= 0) { if (ap_domain_index >= 0) {
/* Domain has already been selected. */ /* Domain has already been selected. */
spin_unlock_bh(&ap_domain_lock); spin_unlock_bh(&ap_domain_lock);
return 0; return;
} }
best_domain = -1; best_domain = -1;
max_count = 0; max_count = 0;
...@@ -1264,11 +1263,8 @@ static int ap_select_domain(void) ...@@ -1264,11 +1263,8 @@ static int ap_select_domain(void)
if (best_domain >= 0) { if (best_domain >= 0) {
ap_domain_index = best_domain; ap_domain_index = best_domain;
AP_DBF(DBF_DEBUG, "new ap_domain_index=%d\n", ap_domain_index); AP_DBF(DBF_DEBUG, "new ap_domain_index=%d\n", ap_domain_index);
spin_unlock_bh(&ap_domain_lock);
return 0;
} }
spin_unlock_bh(&ap_domain_lock); spin_unlock_bh(&ap_domain_lock);
return -ENODEV;
} }
/* /*
...@@ -1346,8 +1342,7 @@ static void ap_scan_bus(struct work_struct *unused) ...@@ -1346,8 +1342,7 @@ static void ap_scan_bus(struct work_struct *unused)
AP_DBF(DBF_DEBUG, "%s running\n", __func__); AP_DBF(DBF_DEBUG, "%s running\n", __func__);
ap_query_configuration(ap_configuration); ap_query_configuration(ap_configuration);
if (ap_select_domain() != 0) ap_select_domain();
goto out;
for (id = 0; id < AP_DEVICES; id++) { for (id = 0; id < AP_DEVICES; id++) {
/* check if device is registered */ /* check if device is registered */
...@@ -1467,12 +1462,11 @@ static void ap_scan_bus(struct work_struct *unused) ...@@ -1467,12 +1462,11 @@ static void ap_scan_bus(struct work_struct *unused)
} }
} /* end device loop */ } /* end device loop */
if (defdomdevs < 1) if (ap_domain_index >= 0 && defdomdevs < 1)
AP_DBF(DBF_INFO, AP_DBF(DBF_INFO,
"no queue device with default domain %d available\n", "no queue device with default domain %d available\n",
ap_domain_index); ap_domain_index);
out:
mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ); mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment