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

vfio-pci/zdev: add function handle to clp base capability

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>

authored by

Matthew Rosato and committed by
Christian Borntraeger
faf3bfcb 8061d1c3

+6 -2
+3 -2
drivers/vfio/pci/vfio_pci_zdev.c
··· 24 24 { 25 25 struct vfio_device_info_cap_zpci_base cap = { 26 26 .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_BASE, 27 - .header.version = 1, 27 + .header.version = 2, 28 28 .start_dma = zdev->start_dma, 29 29 .end_dma = zdev->end_dma, 30 30 .pchid = zdev->pchid, 31 31 .vfn = zdev->vfn, 32 32 .fmb_length = zdev->fmb_length, 33 33 .pft = zdev->pft, 34 - .gid = zdev->pfgid 34 + .gid = zdev->pfgid, 35 + .fh = zdev->fh 35 36 }; 36 37 37 38 return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
+3
include/uapi/linux/vfio_zdev.h
··· 29 29 __u16 fmb_length; /* Measurement Block Length (in bytes) */ 30 30 __u8 pft; /* PCI Function Type */ 31 31 __u8 gid; /* PCI function group ID */ 32 + /* End of version 1 */ 33 + __u32 fh; /* PCI function handle */ 34 + /* End of version 2 */ 32 35 }; 33 36 34 37 /**