Skip to content

Commit 6917f43

Browse files
hfreudehcahca
authored andcommitted
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: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 2a2153a commit 6917f43

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/s390/crypto/ap_bus.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ static int __verify_card_reservations(struct device_driver *drv, void *data)
14521452
int rc = 0;
14531453
struct ap_driver *ap_drv = to_ap_drv(drv);
14541454
unsigned long *newapm = (unsigned long *)data;
1455+
unsigned long aqm_any[BITS_TO_LONGS(AP_DOMAINS)];
14551456

14561457
/*
14571458
* 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)
14611462
return 0;
14621463

14631464
if (ap_drv->in_use) {
1464-
rc = ap_drv->in_use(newapm, ap_perms.aqm);
1465+
bitmap_fill(aqm_any, AP_DOMAINS);
1466+
rc = ap_drv->in_use(newapm, aqm_any);
14651467
if (rc)
14661468
rc = -EBUSY;
14671469
}
@@ -1544,6 +1546,7 @@ static int __verify_queue_reservations(struct device_driver *drv, void *data)
15441546
int rc = 0;
15451547
struct ap_driver *ap_drv = to_ap_drv(drv);
15461548
unsigned long *newaqm = (unsigned long *)data;
1549+
unsigned long apm_any[BITS_TO_LONGS(AP_DEVICES)];
15471550

15481551
/*
15491552
* 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)
15531556
return 0;
15541557

15551558
if (ap_drv->in_use) {
1556-
rc = ap_drv->in_use(ap_perms.apm, newaqm);
1559+
bitmap_fill(apm_any, AP_DEVICES);
1560+
rc = ap_drv->in_use(apm_any, newaqm);
15571561
if (rc)
15581562
rc = -EBUSY;
15591563
}

0 commit comments

Comments
 (0)