Skip to content

Commit

Permalink
vfio-pci/zdev: different maxstbl for interpreted devices
Browse files Browse the repository at this point in the history
When doing load/store interpretation, the maximum store block length is
determined by the underlying firmware, not the host kernel API.  Reflect
that in the associated Query PCI Function Group clp capability and let
userspace decide which is appropriate to present to the guest.

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Link: https://lore.kernel.org/r/20220606203325.110625-20-mjrosato@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
  • Loading branch information
Matthew Rosato authored and Christian Borntraeger committed Jul 11, 2022
1 parent faf3bfc commit ba6090f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/vfio/pci/vfio_pci_zdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ 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,
.reserved = 0,
.imaxstbl = zdev->maxstbl
};

return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
Expand Down
4 changes: 4 additions & 0 deletions include/uapi/linux/vfio_zdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ 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 reserved;
__u16 imaxstbl; /* Maximum Interpreted Store Block Length */
/* End of version 2 */
};

/**
Expand Down

0 comments on commit ba6090f

Please sign in to comment.