]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/ap: Expose ap_bindings_complete_count counter via sysfs
authorHarald Freudenberger <freude@linux.ibm.com>
Fri, 17 Oct 2025 14:51:52 +0000 (16:51 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 23 Oct 2025 14:11:38 +0000 (16:11 +0200)
The AP bus udev event BINDINGS=complete is sent out when the
first time all devices detected by the AP bus scan have been
bound to device drivers. This is the ideal time to for example
change the AP bus masks apmask and aqmask to re-establish a
persistent change on the decision about which cards/domains
should be available for the host and which should go into the
pool for kvm guests.

However, if exactly this initial udev event is sent out early
in the boot process a udev rule may not have been established
yet and thus this event will never be recognized. To have
some indication about if the AP bus binding complete has
already happened, the internal ap_bindings_complete_count
counter is exposed via sysfs with this patch.

Suggested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/crypto/ap_bus.c

index 65f1a127cc3f6bb9bbe480b34bf6129f419cfa39..c8589ac744e4b8d96f2fb8906a43181fb5f765e6 100644 (file)
@@ -1650,6 +1650,15 @@ static ssize_t bindings_show(const struct bus_type *bus, char *buf)
 
 static BUS_ATTR_RO(bindings);
 
+static ssize_t bindings_complete_count_show(const struct bus_type *bus,
+                                           char *buf)
+{
+       return sysfs_emit(buf, "%llu\n",
+                         atomic64_read(&ap_bindings_complete_count));
+}
+
+static BUS_ATTR_RO(bindings_complete_count);
+
 static ssize_t features_show(const struct bus_type *bus, char *buf)
 {
        int n = 0;
@@ -1690,6 +1699,7 @@ static struct attribute *ap_bus_attrs[] = {
        &bus_attr_aqmask.attr,
        &bus_attr_scans.attr,
        &bus_attr_bindings.attr,
+       &bus_attr_bindings_complete_count.attr,
        &bus_attr_features.attr,
        NULL,
 };