linux-stable/drivers/s390
Tony Krowiak 08f65c9067 s390/vfio-ap: fix sysfs status attribute for AP queue devices
[ Upstream commit a0d8f4eeb7 ]

The 'status' attribute for AP queue devices bound to the vfio_ap device
driver displays incorrect status when the mediated device is attached to a
guest, but the queue device is not passed through. In the current
implementation, the status displayed is 'in_use' which is not correct; it
should be 'assigned'. This can happen if one of the queue devices
associated with a given adapter is not bound to the vfio_ap device driver.
For example:

Queues listed in /sys/bus/ap/drivers/vfio_ap:
14.0005
14.0006
14.000d
16.0006
16.000d

Queues listed in /sys/devices/vfio_ap/matrix/$UUID/matrix
14.0005
14.0006
14.000d
16.0005
16.0006
16.000d

Queues listed in /sys/devices/vfio_ap/matrix/$UUID/guest_matrix
14.0005
14.0006
14.000d

The reason no queues for adapter 0x16 are listed in the guest_matrix is
because queue 16.0005 is not bound to the vfio_ap device driver, so no
queue associated with the adapter is passed through to the guest;
therefore, each queue device for adapter 0x16 should display 'assigned'
instead of 'in_use', because those queues are not in use by a guest, but
only assigned to the mediated device.

Let's check the AP configuration for the guest to determine whether a
queue device is passed through before displaying a status of 'in_use'.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Acked-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://lore.kernel.org/r/20231108201135.351419-1-akrowiak@linux.ibm.com
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:12:49 +00:00
..
block s390/scm: fix virtual vs physical address confusion 2024-01-20 11:50:08 +01:00
char s390/early: fix sclp_early_sccb variable lifetime 2023-03-10 09:32:53 +01:00
cio s390/cio: fix a memleak in css_alloc_subchannel 2023-10-25 12:03:15 +02:00
crypto s390/vfio-ap: fix sysfs status attribute for AP queue devices 2024-02-05 20:12:49 +00:00
net s390/qeth: Don't call dev_close/dev_open (DOWN/UP) 2023-08-11 12:08:17 +02:00
scsi scsi: zfcp: Fix a double put in zfcp_port_enqueue() 2023-10-10 22:00:38 +02:00
virtio virtio: Revert "virtio: find_vqs() add arg sizes" 2022-08-16 01:40:24 -04:00
Makefile