]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vfio-pci/zdev: add function handle to clp base capability
authorMatthew Rosato <mjrosato@linux.ibm.com>
Mon, 6 Jun 2022 20:33:22 +0000 (16:33 -0400)
committerChristian Borntraeger <borntraeger@linux.ibm.com>
Mon, 11 Jul 2022 07:54:36 +0000 (09:54 +0200)
The function handle is a system-wide unique identifier for a zPCI
device.  With zPCI instruction interpretation, the host will no
longer be executing the zPCI instructions on behalf of the guest.
As a result, the guest needs to use the real function handle in
order for firmware to associate the instruction with the proper
PCI function.  Let's provide that handle to the guest.

Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
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-19-mjrosato@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
drivers/vfio/pci/vfio_pci_zdev.c
include/uapi/linux/vfio_zdev.h

index 686f2e75e3929283e7fce55d551530b8172d76a0..4f28cdd7ecd1c41bfbdce848da4e2d02a8c7342f 100644 (file)
@@ -24,14 +24,15 @@ static int zpci_base_cap(struct zpci_dev *zdev, struct vfio_info_cap *caps)
 {
        struct vfio_device_info_cap_zpci_base cap = {
                .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_BASE,
-               .header.version = 1,
+               .header.version = 2,
                .start_dma = zdev->start_dma,
                .end_dma = zdev->end_dma,
                .pchid = zdev->pchid,
                .vfn = zdev->vfn,
                .fmb_length = zdev->fmb_length,
                .pft = zdev->pft,
-               .gid = zdev->pfgid
+               .gid = zdev->pfgid,
+               .fh = zdev->fh
        };
 
        return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
index b4309397b6b273bb66e80cc53da769625cec939a..78c022af3d29acaf1dce4ce5a13d99f64f5d5754 100644 (file)
@@ -29,6 +29,9 @@ struct vfio_device_info_cap_zpci_base {
        __u16 fmb_length;       /* Measurement Block Length (in bytes) */
        __u8 pft;               /* PCI Function Type */
        __u8 gid;               /* PCI function group ID */
+       /* End of version 1 */
+       __u32 fh;               /* PCI function handle */
+       /* End of version 2 */
 };
 
 /**