Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio-pci/zdev: different maxstbl for interpreted devices

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>

authored by

Matthew Rosato and committed by
Christian Borntraeger
ba6090ff faf3bfcb

+8 -2
+4 -2
drivers/vfio/pci/vfio_pci_zdev.c
··· 45 45 { 46 46 struct vfio_device_info_cap_zpci_group cap = { 47 47 .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_GROUP, 48 - .header.version = 1, 48 + .header.version = 2, 49 49 .dasm = zdev->dma_mask, 50 50 .msi_addr = zdev->msi_addr, 51 51 .flags = VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH, 52 52 .mui = zdev->fmb_update, 53 53 .noi = zdev->max_msi, 54 54 .maxstbl = ZPCI_MAX_WRITE_SIZE, 55 - .version = zdev->version 55 + .version = zdev->version, 56 + .reserved = 0, 57 + .imaxstbl = zdev->maxstbl 56 58 }; 57 59 58 60 return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
+4
include/uapi/linux/vfio_zdev.h
··· 50 50 __u16 noi; /* Maximum number of MSIs */ 51 51 __u16 maxstbl; /* Maximum Store Block Length */ 52 52 __u8 version; /* Supported PCI Version */ 53 + /* End of version 1 */ 54 + __u8 reserved; 55 + __u16 imaxstbl; /* Maximum Interpreted Store Block Length */ 56 + /* End of version 2 */ 53 57 }; 54 58 55 59 /**