[PATCH v3 28/30] vfio-pci/zdev: add DTSM to clp group capability

From: Matthew Rosato
Date: Fri Feb 04 2022 - 16:18:18 EST


The DTSM, or designation type supported mask, indicates what IOAT formats
are available to the guest. For an interpreted device, userspace will not
know what format(s) the IOAT assist supports, so pass it via the
capability chain. Since the value belongs to the Query PCI Function Group
clp, let's extend the existing capability with a new version.

Reviewed-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
Signed-off-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
---
drivers/vfio/pci/vfio_pci_zdev.c | 9 ++++++---
include/uapi/linux/vfio_zdev.h | 3 +++
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c
index f0a6e0f0e4b0..046d91085358 100644
--- a/drivers/vfio/pci/vfio_pci_zdev.c
+++ b/drivers/vfio/pci/vfio_pci_zdev.c
@@ -45,19 +45,22 @@ static int zpci_group_cap(struct zpci_dev *zdev, struct vfio_info_cap *caps)
{
struct vfio_device_info_cap_zpci_group cap = {
.header.id = VFIO_DEVICE_INFO_CAP_ZPCI_GROUP,
- .header.version = 1,
+ .header.version = 2,
.dasm = zdev->dma_mask,
.msi_addr = zdev->msi_addr,
.flags = VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH,
.mui = zdev->fmb_update,
.noi = zdev->max_msi,
.maxstbl = ZPCI_MAX_WRITE_SIZE,
- .version = zdev->version
+ .version = zdev->version,
+ .dtsm = 0
};

/* Some values are different for interpreted devices */
- if (zdev->kzdev && zdev->kzdev->interpretation)
+ if (zdev->kzdev && zdev->kzdev->interpretation) {
cap.maxstbl = zdev->maxstbl;
+ cap.dtsm = kvm_s390_pci_get_dtsm(zdev);
+ }

return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
}
diff --git a/include/uapi/linux/vfio_zdev.h b/include/uapi/linux/vfio_zdev.h
index b77e6ef355cb..133df1002ecb 100644
--- a/include/uapi/linux/vfio_zdev.h
+++ b/include/uapi/linux/vfio_zdev.h
@@ -47,6 +47,9 @@ struct vfio_device_info_cap_zpci_group {
__u16 noi; /* Maximum number of MSIs */
__u16 maxstbl; /* Maximum Store Block Length */
__u8 version; /* Supported PCI Version */
+ /* End of version 1 */
+ __u8 dtsm; /* Supported IOAT Designations */
+ /* End of version 2 */
};

/**
--
2.27.0