From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH kernel 2/3] vfio_pci: Allow regions to add own capabilities Date: Thu, 8 Nov 2018 17:21:39 +1100 Message-ID: <20181108062139.GQ5575@umbus.fritz.box> References: <20181015094233.1324-1-aik@ozlabs.ru> <20181015094233.1324-3-aik@ozlabs.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7a4X6VOqfbl9xMrG" Cc: kvm@vger.kernel.org, Alistair Popple , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, Alex Williamson , Reza Arbab To: Alexey Kardashevskiy Return-path: Content-Disposition: inline In-Reply-To: <20181015094233.1324-3-aik@ozlabs.ru> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org --7a4X6VOqfbl9xMrG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 15, 2018 at 08:42:32PM +1100, Alexey Kardashevskiy wrote: > VFIO regions already support region capabilities with a limited set of > fields. However the subdriver might have to report to the userspace > additional bits. >=20 > This adds an add_capability() hook to vfio_pci_regops. >=20 > This is aiming Witherspoon POWER9 machines which have multiple > interconnected NVIDIA V100 GPUs with coherent RAM; each GPU's RAM > is mapped to a system bus and to each of GPU internal system bus and > the GPUs use this for DMA routing as DMA trafic can go via any > of many NVLink2 (GPU-GPU or GPU-CPU) or even stay local within a > GPU. This description doesn't really make clear how per-region capabilities are relevant to these devices. >=20 > Signed-off-by: Alexey Kardashevskiy > --- >=20 > This is based on top of "vfio_pci: Allow mapping extra regions" > --- > drivers/vfio/pci/vfio_pci_private.h | 3 +++ > drivers/vfio/pci/vfio_pci.c | 6 ++++++ > 2 files changed, 9 insertions(+) >=20 > diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_= pci_private.h > index 86aab05..93c1738 100644 > --- a/drivers/vfio/pci/vfio_pci_private.h > +++ b/drivers/vfio/pci/vfio_pci_private.h > @@ -62,6 +62,9 @@ struct vfio_pci_regops { > int (*mmap)(struct vfio_pci_device *vdev, > struct vfio_pci_region *region, > struct vm_area_struct *vma); > + int (*add_capability)(struct vfio_pci_device *vdev, > + struct vfio_pci_region *region, > + struct vfio_info_cap *caps); > }; > =20 > struct vfio_pci_region { > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > index 7923314..4a3b93e 100644 > --- a/drivers/vfio/pci/vfio_pci.c > +++ b/drivers/vfio/pci/vfio_pci.c > @@ -759,6 +759,12 @@ static long vfio_pci_ioctl(void *device_data, > if (ret) > return ret; > =20 > + if (vdev->region[i].ops->add_capability) { > + ret =3D vdev->region[i].ops->add_capability(vdev, > + &vdev->region[i], &caps); > + if (ret) > + return ret; > + } > } > } > =20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --7a4X6VOqfbl9xMrG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlvj1fAACgkQbDjKyiDZ s5IsJw/+LPzZslooDphqPB3Ez7PKgBnYySUUxfAzjZAUjhObVCYLKF6Prprrr2u8 iH+nSGHXWyLyvPm9JBMubiyjcV8Uuwm6DZpBL+OkSmCNJxRfuFYQXa5IPbFHcj/p F8vSjn+kdhp5Yabp8GM+82GqjGnPnYEQJjxTAhgBdIHLBzZPZMb2fXNWTLj4q2pP Kp5hdx5z8H3J19Aln4Dw2vT3KQz1k6eXpp3XDeHmI+xg7B17HdKOxkdzukO1sy3W ZLrVtWGcdvfSabWflPEx1tuQTjJiQMUHmakf4lyjfVnqK8H/VX0YiUnU2gBcp65Y gfdaRzEMEDIA1ky8M32+baLXy8TjXoo58rOpWuTfc2JbxoVnh83xZ8IQ7GU+G/Ob fOGtOXp191Dp/ygJ75ViZukLM1M+CXDMqVzssVCJi1LnBRhuTAYYskXgZsaPzXFN gO3BN21LD75pJCJtP47O/8h4OW51ULHWIBiVRDS+re91B47s0NtSNY842QjzTGDe yVP6hiA300XvHD0vjtWsyO5AKRZUZHABG9jJPSDWCrES4MwyMUOdLh6ikn6tESiQ c+d27Rg/Xd3yCI6iZ/gLmmmjYnvtqreQbmhwCly1jYBPEN+ibuG81sgnPzzey36q YmcbVDGtU/3R5FarRMZbCMM+V1jdNGJaMe4GIt9sEUqR/IAhuiY= =TRHB -----END PGP SIGNATURE----- --7a4X6VOqfbl9xMrG--