Commit 6917f434 authored by Harald Freudenberger's avatar Harald Freudenberger Committed by Heiko Carstens
Browse files

s390/ap: Use all-bits-one apmask/aqmask for vfio in_use() checks



For the in_use() check of an updated apmask the host's aqmask
was provided to the vfio function. Similar on an update of the
aqmask the host's apmask was provided to the vfio in_use()
function. This led to false results on the check for apmask or
aqmask updates. For example with only one APQN when exactly
this card is tried to be re-assigned back to the host, the
in_use() check did not complain.

The correct behavior is achieved with providing a full mask
for aqmask when an adapter is to be checked and similar a full
mask for aqmask when a domain is to be checked for usage.

Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Reviewed-by: default avatarHolger Dengler <dengler@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 2a2153a2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1452,6 +1452,7 @@ static int __verify_card_reservations(struct device_driver *drv, void *data)
	int rc = 0;
	struct ap_driver *ap_drv = to_ap_drv(drv);
	unsigned long *newapm = (unsigned long *)data;
	unsigned long aqm_any[BITS_TO_LONGS(AP_DOMAINS)];

	/*
	 * increase the driver's module refcounter to be sure it is not
@@ -1461,7 +1462,8 @@ static int __verify_card_reservations(struct device_driver *drv, void *data)
		return 0;

	if (ap_drv->in_use) {
		rc = ap_drv->in_use(newapm, ap_perms.aqm);
		bitmap_fill(aqm_any, AP_DOMAINS);
		rc = ap_drv->in_use(newapm, aqm_any);
		if (rc)
			rc = -EBUSY;
	}
@@ -1544,6 +1546,7 @@ static int __verify_queue_reservations(struct device_driver *drv, void *data)
	int rc = 0;
	struct ap_driver *ap_drv = to_ap_drv(drv);
	unsigned long *newaqm = (unsigned long *)data;
	unsigned long apm_any[BITS_TO_LONGS(AP_DEVICES)];

	/*
	 * increase the driver's module refcounter to be sure it is not
@@ -1553,7 +1556,8 @@ static int __verify_queue_reservations(struct device_driver *drv, void *data)
		return 0;

	if (ap_drv->in_use) {
		rc = ap_drv->in_use(ap_perms.apm, newaqm);
		bitmap_fill(apm_any, AP_DEVICES);
		rc = ap_drv->in_use(apm_any, newaqm);
		if (rc)
			rc = -EBUSY;
	}