summaryrefslogtreecommitdiff
path: root/drivers/s390/crypto/ap_bus.c
diff options
context:
space:
mode:
authorHolger Dengler <dengler@linux.ibm.com>2024-02-19 17:32:54 +0100
committerAlexander Gordeev <agordeev@linux.ibm.com>2024-04-09 17:29:55 +0200
commit2a483d333fd84acc009c7199fdd962af3ffc6b3b (patch)
tree44cd6dea80511873ef4d5481b9ea5938b115c828 /drivers/s390/crypto/ap_bus.c
parent05272aa499c48f230d862577d423de3e2b268e47 (diff)
s390/chsc: use notifier for AP configuration changes
The direct dependency of chsc and the AP bus prevents the modularization of ap bus. Introduce a notifier interface for AP changes, which decouples the producer of the change events (chsc) from the consumer (ap_bus). Remove the ap_cfg_chg() interface and replace it with the notifier invocation. The ap bus module registers a notification handler, which triggers the AP bus scan. Cc: Vineeth Vijayan <vneethv@linux.ibm.com> Cc: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'drivers/s390/crypto/ap_bus.c')
-rw-r--r--drivers/s390/crypto/ap_bus.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index cdfaa321b44e..9284ae63074d 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -39,6 +39,7 @@
#include <linux/ctype.h>
#include <linux/module.h>
#include <asm/uv.h>
+#include <asm/chsc.h>
#include "ap_bus.h"
#include "ap_debug.h"
@@ -1024,13 +1025,23 @@ EXPORT_SYMBOL(ap_bus_force_rescan);
/*
* A config change has happened, force an ap bus rescan.
*/
-void ap_bus_cfg_chg(void)
+static int ap_bus_cfg_chg(struct notifier_block *nb,
+ unsigned long action, void *data)
{
+ if (action != CHSC_NOTIFY_AP_CFG)
+ return NOTIFY_DONE;
+
pr_debug("%s config change, forcing bus rescan\n", __func__);
ap_bus_force_rescan();
+
+ return NOTIFY_OK;
}
+static struct notifier_block ap_bus_nb = {
+ .notifier_call = ap_bus_cfg_chg,
+};
+
/*
* hex2bitmap() - parse hex mask string and set bitmap.
* Valid strings are "0x012345678" with at least one valid hex number.
@@ -2291,16 +2302,22 @@ static inline int __init ap_async_init(void)
queue_work(system_long_wq, &ap_scan_bus_work);
+ rc = chsc_notifier_register(&ap_bus_nb);
+ if (rc)
+ goto out;
+
/* Start the low priority AP bus poll thread. */
if (!ap_thread_flag)
return 0;
rc = ap_poll_thread_start();
if (rc)
- goto out;
+ goto out_notifier;
return 0;
+out_notifier:
+ chsc_notifier_unregister(&ap_bus_nb);
out:
cancel_work(&ap_scan_bus_work);
hrtimer_cancel(&ap_poll_timer);