s390/ap: Expose ap_bindings_complete_count counter via sysfs

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>
This commit is contained in:
Harald Freudenberger 2025-10-17 16:51:52 +02:00 committed by Heiko Carstens
parent 07a75d08cf
commit 51d921a613
1 changed files with 10 additions and 0 deletions

View 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,
};