Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-03-24 Thread David Gibson
a guest-visible (paravirtualized) IOMMU, and that will be backed onto the host IOMMU when necessary. [Actually there is an IOMMU bypass hack that's used by the guest firmware, but I don't think we want to expose that] > Well it's not just the reality, virt setups need somet

Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-20 Thread David Gibson
visor doesn't know that ahead of time. > that isn't extensibe for cases that for example require bounce buffering. In fact bounce buffering isn't really the issue from the hypervisor (or spec's) point of view. It's the fact that not all of guest memory is accessible to

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-20 Thread David Gibson
But, AFAICT, that does require the DMA layer to have some kind of explicit call to turn on this behaviour, which the virtio driver would call during initializsation. I don't think we can do it 100% within the DMA layer, because only the driver can reasonably know when a device has thi

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-20 Thread David Gibson
guests > > > > which I was under the impression was abandoned as unnecessary. > > It has been abondoned on powerpc. We enabled VIRTIO_F_ACCESS_PLATFORM; > by default, flag on powerpc. Uh... we haven't yet, though we're working on it. > We would li

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-23 Thread David Gibson
ry_decrypted() called or for a dma_map_page() call this is an > address from SWIOTLB, which was mapped shared during boot, where the data > will be bounce-buffered. > > We don't currently support an emulated IOMMU in our SEV guest because that > would require a

Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-23 Thread David Gibson
On Fri, Feb 21, 2020 at 07:07:02PM +0100, Halil Pasic wrote: > On Fri, 21 Feb 2020 10:48:15 -0500 > "Michael S. Tsirkin" wrote: > > > On Fri, Feb 21, 2020 at 02:06:39PM +0100, Halil Pasic wrote: > > > On Fri, 21 Feb 2020 14:27:27 +1100 > > > David G

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-23 Thread David Gibson
nse we would be very happy to test any optimization that aim > into that direction. > > Thank you very much for your input! > > Regards, > Halil > > > > > Thanks > > > > > > > > > > Halil Pasic (2): > > >mm: move force_dma

Re: [PATCH 0/2] virtio: decouple protected guest RAM form VIRTIO_F_IOMMU_PLATFORM

2020-02-23 Thread David Gibson
irtio) and 2) access restrictions originating with the guest (e.g. secure VMs). What we need to do to deal with them is basically the same at the driver level, but it has subtle and important differences at the platform level. -- David Gibson| I'll have m

Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected

2020-02-23 Thread David Gibson
On Fri, Feb 21, 2020 at 05:36:45PM +0100, Christoph Hellwig wrote: > On Fri, Feb 21, 2020 at 01:59:15PM +1100, David Gibson wrote: > > > Hell no. This is a detail of the platform DMA direct implementation. > > > Drivers have no business looking at this flag, and virtio fina

Re: [PATCH 1/2] mm: move force_dma_unencrypted() to mem_encrypt.h

2020-02-27 Thread David Gibson
On Tue, Feb 25, 2020 at 07:08:02PM +0100, Cornelia Huck wrote: > On Mon, 24 Feb 2020 19:49:53 +0100 > Halil Pasic wrote: > > > On Mon, 24 Feb 2020 14:33:14 +1100 > > David Gibson wrote: > > > > > On Fri, Feb 21, 2020 at 07:07:02PM +0100, Halil Pasic wrote:

Re: [Qemu-devel] [RFC] Device isolation infrastructure v2

2012-01-24 Thread David Gibson
On Tue, Dec 20, 2011 at 09:30:37PM -0700, Alex Williamson wrote: > On Wed, 2011-12-21 at 14:32 +1100, David Gibson wrote: > > On Mon, Dec 19, 2011 at 04:41:56PM +0100, Joerg Roedel wrote: > > > On Mon, Dec 19, 2011 at 11:11:25AM +1100, David Gibson wrote: > > > > We

Re: [Qemu-devel] [RFC] Device isolation infrastructure v2

2012-01-30 Thread David Gibson
On Wed, Jan 25, 2012 at 04:44:53PM -0700, Alex Williamson wrote: > On Wed, 2012-01-25 at 14:13 +1100, David Gibson wrote: > > On Tue, Dec 20, 2011 at 09:30:37PM -0700, Alex Williamson wrote: > > > On Wed, 2011-12-21 at 14:32 +1100, David Gibson wrote: > > > > On M

RFC: Device isolation groups

2012-01-31 Thread David Gibson
This patch series introduces a new infrastructure to the driver core for representing "device isolation groups". That is, groups of devices which can be "isolated" in such a way that the rest of the system can be protected from them, even in the presence of userspace or a guest OS directly driving

[PATCH 2/3] device_isolation: Support isolation on POWER p5ioc2 bridges

2012-01-31 Thread David Gibson
This patch adds code to the code for the powernv platform to create and populate isolation groups on hardware using the p5ioc2 PCI host bridge used on some IBM POWER systems. Signed-off-by: Alexey Kardashevskiy Signed-off-by: David Gibson --- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 14

[PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges

2012-01-31 Thread David Gibson
This patch adds code to the code for the powernv platform to create and populate isolation groups on hardware using the p7ioc (aka IODA) PCI host bridge used on some IBM POWER systems. Signed-off-by: Alexey Kardashevskiy Signed-off-by: David Gibson --- arch/powerpc/platforms/powernv/pci-ioda.c

[PATCH 1/3] Device isolation group infrastructure (v3)

2012-01-31 Thread David Gibson
vskiy Signed-off-by: David Gibson --- drivers/base/Kconfig |3 + drivers/base/Makefile|1 + drivers/base/base.h |3 + drivers/base/core.c |6 ++ drivers/base/device_isolation.c | 184 ++

Re: RFC: Device isolation groups

2012-02-01 Thread David Gibson
On Wed, Feb 01, 2012 at 01:08:39PM -0700, Alex Williamson wrote: > On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote: > > This patch series introduces a new infrastructure to the driver core > > for representing "device isolation groups". That is, groups of > >

Re: [PATCH 3/3] device_isolation: Support isolation on POWER p7ioc (IODA) bridges

2012-02-01 Thread David Gibson
On Wed, Feb 01, 2012 at 12:17:05PM -0700, Alex Williamson wrote: > On Wed, 2012-02-01 at 15:46 +1100, David Gibson wrote: > > This patch adds code to the code for the powernv platform to create > > and populate isolation groups on hardware using the p7ioc (aka IODA) PCI > >

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-08 Thread David Gibson
On Wed, Feb 08, 2012 at 04:27:48PM +0100, Joerg Roedel wrote: > On Wed, Feb 01, 2012 at 03:46:52PM +1100, David Gibson wrote: > > In order to safely drive a device with a userspace driver, or to pass > > it through to a guest system, we must first make sure that the device > >

Re: [PATCH 1/3] Device isolation group infrastructure (v3)

2012-02-09 Thread David Gibson
uld iterate over > all devices on a bus and build up group structures based on isolation > information provided by the arch specific code. And how exactly do you suggest it provide that information. I really can't see how an iommu driver would specify its isolation constraints generally enough

Re: RFC: Device isolation groups

2012-03-08 Thread David Gibson
On Wed, Feb 29, 2012 at 12:30:55PM -0700, Alex Williamson wrote: > On Thu, 2012-02-02 at 12:24 +1100, David Gibson wrote: > > On Wed, Feb 01, 2012 at 01:08:39PM -0700, Alex Williamson wrote: [snip] > Any update to this series? It would be great if we could map out the > functionali

Re: [PATCH 0/2] RFC Isolation API

2012-03-13 Thread David Gibson
roposal is far from complete, but I hope it can re-fire some > discussion and work in this space. Please let me know what you like, > what you don't like, and ideas for the gaps. Thanks, -- David Gibson| I'll have m

Re: [PATCH 1/2] Isolation groups

2012-03-13 Thread David Gibson
ct isolation_group *group, > +struct device *dev); > +extern int isolation_group_del_dev(struct device *dev); > +extern int isolation_register_notifier(struct bus_type *bus, > +struct notifier_block *nb); > +extern int

Re: [PATCH 1/2] Isolation groups

2012-03-14 Thread David Gibson
On Tue, Mar 13, 2012 at 10:49:47AM -0600, Alex Williamson wrote: > On Wed, 2012-03-14 at 01:33 +1100, David Gibson wrote: > > On Mon, Mar 12, 2012 at 04:32:54PM -0600, Alex Williamson wrote: > > > Signed-off-by: Alex Williamson > > > --- > > > >

Re: [PATCH 1/2] Isolation groups

2012-03-15 Thread David Gibson
On Thu, Mar 15, 2012 at 02:15:01PM -0600, Alex Williamson wrote: > On Wed, 2012-03-14 at 20:58 +1100, David Gibson wrote: > > On Tue, Mar 13, 2012 at 10:49:47AM -0600, Alex Williamson wrote: > > > On Wed, 2012-03-14 at 01:33 +1100, David Gibson wrote: > > > > On M

Re: [PATCH 1/2] Isolation groups

2012-03-16 Thread David Gibson
On Fri, Mar 16, 2012 at 01:31:18PM -0600, Alex Williamson wrote: > On Fri, 2012-03-16 at 14:45 +1100, David Gibson wrote: > > On Thu, Mar 15, 2012 at 02:15:01PM -0600, Alex Williamson wrote: > > > On Wed, 2012-03-14 at 20:58 +1100, David Gibson wrote: > > > > On T

Re: [PATCH 1/2] Isolation groups

2012-03-26 Thread David Gibson
On Wed, Mar 21, 2012 at 03:12:58PM -0600, Alex Williamson wrote: > On Sat, 2012-03-17 at 15:57 +1100, David Gibson wrote: > > On Fri, Mar 16, 2012 at 01:31:18PM -0600, Alex Williamson wrote: > > > On Fri, 2012-03-16 at 14:45 +1100, David Gibson wrote: > > > > On T

Re: [PATCH 1/2] Isolation groups

2012-03-29 Thread David Gibson
oprobe, > maybe setup notifications for the group, and hopefully include a way to > share iommu mappings between groups. Anything much beyond that we > should probably leave for something like the vfio driver. Thanks, Yes, well, I was hoping for a simpl

Re: [RFC PATCH 1/3] iommu: Introduce iommu_group

2012-04-18 Thread David Gibson
entity, ignoring (here) any other factors which might affect isolation. Or am I missing something? -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _

Re: [RFC PATCH 2/3] iommu: Create basic group infrastructure and update AMD-Vi & Intel VT-d

2012-04-18 Thread David Gibson
n_has_cap)(struct iommu_domain *domain, > unsigned long cap); > int (*device_group)(struct device *dev, unsigned int *groupid); > + int (*add_device)(struct device *dev); > + void (*remove_device)(struct device *dev); > unsigned long pgsize_bit

Re: [PATCH 02/13] iommu: IOMMU Groups

2012-05-13 Thread David Gibson
into iommu driver ops if provided, which may > + * result in ADD/DEL notifiers to group->notifier > + */ > + if (action == BUS_NOTIFY_ADD_DEVICE) { > + if (ops->add_device) > + return ops->add_device(dev); > +

Re: [PATCH 02/13] iommu: IOMMU Groups

2012-05-14 Thread David Gibson
On Mon, May 14, 2012 at 11:11:42AM -0600, Alex Williamson wrote: > On Mon, 2012-05-14 at 11:16 +1000, David Gibson wrote: > > On Fri, May 11, 2012 at 04:55:41PM -0600, Alex Williamson wrote: [snip] > > > +struct iommu_group { > > > + struct kobject kobj; > >

Re: [PATCH 02/13] iommu: IOMMU Groups

2012-05-16 Thread David Gibson
On Tue, May 15, 2012 at 12:34:03AM -0600, Alex Williamson wrote: > On Tue, 2012-05-15 at 12:03 +1000, David Gibson wrote: > > On Mon, May 14, 2012 at 11:11:42AM -0600, Alex Williamson wrote: > > > On Mon, 2012-05-14 at 11:16 +1000, David Gibson wrote: > > > > On F

Re: [PATCH 03/13] iommu: IOMMU groups for VT-d and AMD-Vi

2012-05-16 Thread David Gibson
iommu groups to create and remove groups. Looks ok to me. -- 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://ww

Re: [PATCH 04/13] pci: New pci_dma_quirk()

2012-05-16 Thread David Gibson
pci_get_slot(dev->bus, > +PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); > + } Hrm. This seems like a very generic name for a function performing a very specific test. We could well have devices with the same problem in future, so shouldn't this be

Re: [PATCH 1/2] dma-mapping: Add dma_addr_is_phys_addr()

2019-10-13 Thread David Gibson
t; > cc: Benjamin Herrenschmidt > cc: David Gibson > cc: Michael Ellerman > cc: Paul Mackerras > cc: Michael Roth > cc: Alexey Kardashevskiy > cc: Paul Burton > cc: Robin Murphy > cc: Bartlomiej Zolnierkiewicz > cc: Marek Szyprowski > cc: Christoph Hellwig > Sugg

Re: [PATCH 2/2] virtio_ring: Use DMA API if memory is encrypted

2019-10-13 Thread David Gibson
LATFORM due to a set of hypervisor and architectural bugs. > To guard against platform changes, breaking any of these assumptions down > the road, we check at probe time and fail if that's not the case. > > cc: Benjamin Herrenschmidt > cc: David Gibson > cc: Michael Ell

Re: [PATCH 2/2] virtio_ring: Use DMA API if memory is encrypted

2019-10-21 Thread David Gibson
ces are (usually) magic. So were you envisaging the virtio driver explicitly telling the platform to use bypassing DMA operations? -- 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 signature.asc Description: PGP signature

Re: [RFC PATCH v5 5/5] vfio-pci: Allow to expose MSI-X table to userspace when safe

2017-08-09 Thread David Gibson
by > an IOMMU group. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson > --- > include/linux/vfio.h | 1 + > drivers/vfio/pci/vfio_pci.c | 20 +--- > drivers/vfio/pci/vfio_pci_rdwr.c | 5 - > drivers/vfio/vfio.c

Re: [RFC PATCH v5 1/5] iommu: Add capabilities to a group

2017-08-09 Thread David Gibson
ing; this is useful when deciding whether or not to allow mapping > of MSIX table to the userspace. Various architectures will enable it > when they decide that it is safe to do so. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson This seems like a reasonable concept th

Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-08-12 Thread David Gibson
ravisor and co games. It's not like we > haven't been through this a few times before, have we? -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-08-13 Thread David Gibson
On Tue, Aug 13, 2019 at 03:26:17PM +0200, Christoph Hellwig wrote: > On Mon, Aug 12, 2019 at 07:51:56PM +1000, David Gibson wrote: > > AFAICT we already kind of abuse this for the VIRTIO_F_IOMMU_PLATFORM, > > because to handle for cases where it *is* a device limitation, we > &g

Re: [PATCH RFC 08/12] iommufd: IOCTLs for the io_pagetable

2022-03-30 Thread David Gibson
@ioas_id: IOAS ID to change the mapping of > + * @iova: IOVA to start the unmapping at > + * @length: Number of bytes to unmap > + * > + * Unmap an IOVA range. The iova/length must exactly match a range > + * used with IOMMU_IOAS_PAGETABLE_MAP, or be the va

Re: [PATCH RFC 08/12] iommufd: IOCTLs for the io_pagetable

2022-04-27 Thread David Gibson
On Thu, Mar 31, 2022 at 09:58:41AM -0300, Jason Gunthorpe wrote: > On Thu, Mar 31, 2022 at 03:36:29PM +1100, David Gibson wrote: > > > > +/** > > > + * struct iommu_ioas_iova_ranges - ioctl(IOMMU_IOAS_IOVA_RANGES) > > > + * @size: sizeof(struct iommu_ioas_iova_ra

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-04-28 Thread David Gibson
ensible way to expose that to users. You might be able to do this by simply failing this outright if there's anything other than exactly one IOMMU group bound to the container / IOAS (which I think might be what VFIO itself does now). Handling that with a devic

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-04-28 Thread David Gibson
window can be a separate > domain then the existing aperture should still work? Maybe. There might be several different ways to represent it, but the vital piece is that any individual device (well, group, technically) must atomically join/leave both windows at once. -- David G

Re: [PATCH RFC 08/12] iommufd: IOCTLs for the io_pagetable

2022-04-28 Thread David Gibson
On Thu, Apr 28, 2022 at 11:22:58AM -0300, Jason Gunthorpe wrote: > On Thu, Apr 28, 2022 at 03:58:30PM +1000, David Gibson wrote: > > On Thu, Mar 31, 2022 at 09:58:41AM -0300, Jason Gunthorpe wrote: > > > On Thu, Mar 31, 2022 at 03:36:29PM +1100,

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-04-29 Thread David Gibson
On Thu, Apr 28, 2022 at 12:10:37PM -0300, Jason Gunthorpe wrote: > On Fri, Apr 29, 2022 at 12:53:16AM +1000, David Gibson wrote: > > > 2) Costly GUPs. pseries (the most common ppc machine type) always > > expects a (v)IOMMU. That means that unlike the common x86 model of a &

Re: [PATCH RFC 08/12] iommufd: IOCTLs for the io_pagetable

2022-04-30 Thread David Gibson
On Fri, Apr 29, 2022 at 09:54:42AM -0300, Jason Gunthorpe wrote: > On Fri, Apr 29, 2022 at 04:00:14PM +1000, David Gibson wrote: > > > But I don't have a use case in mind? The simplified things I know > > > about want to attach their devices then allocate valid IOVA, they

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-02 Thread David Gibson
On Fri, Apr 29, 2022 at 09:50:30AM -0300, Jason Gunthorpe wrote: > On Fri, Apr 29, 2022 at 04:22:56PM +1000, David Gibson wrote: > > On Fri, Apr 29, 2022 at 01:21:30AM +, Tian, Kevin wrote: > > > > From: Jason Gunthorpe > > > > Sent:

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-02 Thread David Gibson
On Fri, Apr 29, 2022 at 09:48:38AM -0300, Jason Gunthorpe wrote: > On Fri, Apr 29, 2022 at 04:20:36PM +1000, David Gibson wrote: > > > > I think PPC and S390 are solving the same problem here. I think S390 > > > is going to go to a SW nested model where it has an iommu_do

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-05 Thread David Gibson
On Thu, May 05, 2022 at 04:07:28PM -0300, Jason Gunthorpe wrote: > On Mon, May 02, 2022 at 05:30:05PM +1000, David Gibson wrote: > > > > It is a bit more CPU work since maps in the lower range would have to > > > be copied over, but conceptually the model matches the HW n

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-08 Thread David Gibson
On Fri, May 06, 2022 at 10:42:21AM +, Tian, Kevin wrote: > > From: David Gibson > > Sent: Friday, May 6, 2022 1:25 PM > > > > > > > > When the iommu_domain is created I want to have a > > > iommu-driver-specific struct, so PPC can cust

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-08 Thread David Gibson
On Fri, May 06, 2022 at 09:48:37AM -0300, Jason Gunthorpe wrote: > On Fri, May 06, 2022 at 03:25:03PM +1000, David Gibson wrote: > > On Thu, May 05, 2022 at 04:07:28PM -0300, Jason Gunthorpe wrote: > > > > When the iommu_domain is created I want to have a > > > io

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-10 Thread David Gibson
On Mon, May 09, 2022 at 11:00:41AM -0300, Jason Gunthorpe wrote: > On Mon, May 09, 2022 at 04:01:52PM +1000, David Gibson wrote: > > > > The default iommu_domain that the iommu driver creates will be used > > > here, it is up to the iommu driver to choose something rea

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-10 Thread David Gibson
On Tue, May 10, 2022 at 04:00:09PM -0300, Jason Gunthorpe wrote: > On Tue, May 10, 2022 at 05:12:04PM +1000, David Gibson wrote: > > On Mon, May 09, 2022 at 11:00:41AM -0300, Jason Gunthorpe wrote: > > > On Mon, May 09, 2022 at 04:01:52PM +1000, David Gibson wrote: > >

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-12 Thread David Gibson
On Wed, May 11, 2022 at 03:15:22AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, May 11, 2022 3:00 AM > > > > On Tue, May 10, 2022 at 05:12:04PM +1000, David Gibson wrote: > > > Ok... here's a revised version of my proposal which

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-05-24 Thread David Gibson
is no swap, or you call GUP for each vIOMMU > hypercall. > > Since everyone says PPC doesn't call GUP during the hypercall - how is > it working? The current implementation does GUP during the pre-reserve. I think Alexey's talking about a new PowerVM (IBM h

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-26 Thread David Gibson
ow what things were doing today. And chance are they will break cryptically if you give them a device in a multi-device group. That's not something we want to encourage. > > > I expect it would be a subtly missed by any userspace driver > > developer unless they

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-26 Thread David Gibson
ble. Yes, it makes set up more of a pain, but it's necessary complexity to actually understand what's going on here. > These two routes can have identical outcomes and identical security > checks. > > In both cases if userspace wants a list of BDFs in the same group as &g

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-26 Thread David Gibson
> But type1 is \just\ an IOMMU backend, not "/dev/vfio". Given that > > > nobody flinched at removing NVLink support, maybe just deprecate SPAPR > > > now and see if anyone objects ;) > > > > Would simplify this project, but I wonder :) > > > &

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-26 Thread David Gibson
> domain is allowed, the ioasid_fd is equivalent to the scope of VFIO > container. It is supposed to have only one gpa_ioasid_id since one > iommu domain can only have a single 2nd level pgtable. Then all other > ioasids, once allocated, must be nested on this gpa_io

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-27 Thread David Gibson
On Tue, Apr 27, 2021 at 01:39:54PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 27, 2021 at 03:11:25PM +1000, David Gibson wrote: > > > > So your proposal sort of moves the entire container/group/domain > > > managment into /dev/ioasid and then leaves vfio only provide de

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-27 Thread David Gibson
On Tue, Apr 27, 2021 at 02:24:32PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 27, 2021 at 02:50:45PM +1000, David Gibson wrote: > > > > > I say this because the SPAPR looks quite a lot like PASID when it has > > > > APIs for allocating multiple table

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-27 Thread David Gibson
On Tue, Apr 27, 2021 at 02:12:12PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 27, 2021 at 03:08:46PM +1000, David Gibson wrote: > > > Starting from a BDF the general pseudo code is: > > > device_name = first_directory_of("/sys/bus/pci/devices/BDF/vfio/") >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-28 Thread David Gibson
On Wed, Apr 28, 2021 at 09:21:49PM -0300, Jason Gunthorpe wrote: > On Wed, Apr 28, 2021 at 11:23:39AM +1000, David Gibson wrote: > > > Yes. My proposed model for a unified interface would be that when you > > create a new container/IOASID, *no* IOVAs are valid. > > Hurm,

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-28 Thread David Gibson
On Wed, Apr 28, 2021 at 11:56:22AM -0300, Jason Gunthorpe wrote: > On Wed, Apr 28, 2021 at 10:58:29AM +1000, David Gibson wrote: > > On Tue, Apr 27, 2021 at 02:12:12PM -0300, Jason Gunthorpe wrote: > > > On Tue, Apr 27, 2021 at 03:08:46PM +1000, David Gibson wrote: > > &

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-03 Thread David Gibson
On Mon, May 03, 2021 at 01:05:30PM -0300, Jason Gunthorpe wrote: > On Thu, Apr 29, 2021 at 01:20:22PM +1000, David Gibson wrote: > > > There is a certain appeal to having some > > > 'PPC_TCE_CREATE_SPECIAL_IOASID' entry point that has a wack of extra > > &

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-12 Thread David Gibson
On Mon, May 03, 2021 at 01:15:18PM -0300, Jason Gunthorpe wrote: > On Thu, Apr 29, 2021 at 01:04:05PM +1000, David Gibson wrote: > > Again, I don't know enough about VDPA to make sense of that. Are we > > essentially talking non-PCI virtual devices here? In which case you

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-12 Thread David Gibson
On Tue, May 04, 2021 at 03:15:37PM -0300, Jason Gunthorpe wrote: > On Tue, May 04, 2021 at 01:54:55PM +1000, David Gibson wrote: > > On Mon, May 03, 2021 at 01:05:30PM -0300, Jason Gunthorpe wrote: > > > On Thu, Apr 29, 2021 at 01:20:22PM +1000, David Gibson wrote: > >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-12 Thread David Gibson
er case the GPA/gIOVA to userspace and userspace to HPA mappings are basically arbitrary. -- 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_! ht

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-24 Thread David Gibson
On Thu, May 13, 2021 at 10:50:30AM -0300, Jason Gunthorpe wrote: > On Thu, May 13, 2021 at 04:07:07PM +1000, David Gibson wrote: > > On Wed, May 05, 2021 at 01:39:02PM -0300, Jason Gunthorpe wrote: > > > On Wed, May 05, 2021 at 02:28:53PM +1000, Alexey Kardashevskiy wrote: > &

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-24 Thread David Gibson
On Thu, May 13, 2021 at 10:59:38AM -0300, Jason Gunthorpe wrote: > On Thu, May 13, 2021 at 03:48:19PM +1000, David Gibson wrote: > > On Mon, May 03, 2021 at 01:15:18PM -0300, Jason Gunthorpe wrote: > > > On Thu, Apr 29, 2021 at 01:04:05PM +1000, David Gibson wrote: > >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-27 Thread David Gibson
hes this properly by fully linking the struct > > pci_device of the VF throughout the entire VFIO scheme, including the > > group and container, while still allowing override of various VFIO > > operations. > > > > Jason > > > -- David Gibson

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-27 Thread David Gibson
On Mon, May 24, 2021 at 08:37:44PM -0300, Jason Gunthorpe wrote: > On Mon, May 24, 2021 at 05:52:58PM +1000, David Gibson wrote: > > > > > I don't really see a semantic distinction between "always one-device > > > > groups" and "groups don't

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-05-27 Thread David Gibson
; Max's series approaches this properly by fully linking the struct > pci_device of the VF throughout the entire VFIO scheme, including the > group and container, while still allowing override of various VFIO > operations. > > Jason > -- David Gibson| I&

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-06-01 Thread David Gibson
On Thu, May 27, 2021 at 03:48:47PM -0300, Jason Gunthorpe wrote: > On Thu, May 27, 2021 at 02:58:30PM +1000, David Gibson wrote: > > On Tue, May 25, 2021 at 04:52:57PM -0300, Jason Gunthorpe wrote: > > > On Wed, May 26, 2021 at 12:56:30AM +0530, Kirti Wankhede wrote: > > &g

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-06-01 Thread David Gibson
On Thu, May 27, 2021 at 04:06:20PM -0300, Jason Gunthorpe wrote: > On Thu, May 27, 2021 at 02:53:42PM +1000, David Gibson wrote: > > > > > If the physical device had a bug which meant the mdevs *weren't* > > > > properly isolated from each other, then those mde

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-06-01 Thread David Gibson
On Thu, May 27, 2021 at 11:55:00PM +0530, Kirti Wankhede wrote: > > > On 5/27/2021 10:30 AM, David Gibson wrote: > > On Wed, May 26, 2021 at 02:48:03AM +0530, Kirti Wankhede wrote: > > > > > > > > > On 5/26/2021 1:22 AM, Jason Gunthorpe wrote: > &

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
ace > so it would be quite rasonable to harmonize these somehow. > > But that is too complicated and far out for me at least to guess on at > this point.. > > > > Still a little unsure why the vPASID is here not on the gva_ioasid. Is > > > there any scenario where we

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
.user_pasid = gpasid1; > > }; > > ioctl(device_fd1, VFIO_ATTACH_IOASID, &at_data); > > > > /* Bind guest I/O page table. Because SET_PASID_TABLE has been > > * used, the kernel will not update the PASID table. Instead, just > &g

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
* Bind a vfio_device to the specified IOASID fd > >* > >* Multiple vfio devices can be bound to a single ioasid_fd, but a single > >* vfio device should not be bound to multiple ioasid_fd's. > >* > >* Input parameters: > &g

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
ng when I reach that boundary. Can anyone > summarize what is going on there? > > Most likely passing the /dev/ioasid into KVM's FD (or vicevera) is the > right answer. Eg if ARM needs to get the VMID from KVM and set it to > ioasid then a KVM "ioctl set_arm_vmid(/dev/ioa

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Thu, May 27, 2021 at 07:58:12AM +, Tian, Kevin wrote: > /dev/ioasid provides an unified interface for managing I/O page tables for > devices assigned to userspace. Device passthrough frameworks (VFIO, vDPA, > etc.) are expected to use this interface instead of creating their own logic > t

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Wed, Jun 02, 2021 at 01:37:53PM -0300, Jason Gunthorpe wrote: > On Wed, Jun 02, 2021 at 04:57:52PM +1000, David Gibson wrote: > > > I don't think presence or absence of a group fd makes a lot of > > difference to this design. Having a group fd just means we attach &

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
h the caches. If the page table > > is changed and invalidation is not issued then then the implementation > > is free to ignore the changes. > > > > In this way the SW mode is the same as a HW mode with an infinite > > cache. > > > > The collaposed s

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Thu, Jun 03, 2021 at 02:49:56AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, June 3, 2021 12:59 AM > > > > On Wed, Jun 02, 2021 at 04:48:35PM +1000, David Gibson wrote: > > > > > /* Bind guest I/O p

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Wed, Jun 02, 2021 at 01:58:38PM -0300, Jason Gunthorpe wrote: > On Wed, Jun 02, 2021 at 04:48:35PM +1000, David Gibson wrote: > > > > /* Bind guest I/O page table */ > > > > bind_data = { > > > > .ioasid = gv

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Wed, Jun 02, 2021 at 01:16:48PM -0300, Jason Gunthorpe wrote: > On Wed, Jun 02, 2021 at 04:32:27PM +1000, David Gibson wrote: > > > I agree with Jean-Philippe - at the very least erasing this > > > information needs a major rational - but I don't really see why it &g

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
On Wed, Jun 02, 2021 at 02:19:30PM -0300, Jason Gunthorpe wrote: > On Wed, Jun 02, 2021 at 04:15:07PM +1000, David Gibson wrote: > > > Is there a compelling reason to have all the IOASIDs handled by one > > FD? > > There was an answer on this, if every PASID needs an IOA

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread David Gibson
eed to support 2), Isn't (2) the equivalent of using the using the host-managed pagetable then doing a giant MAP of all your user address space into it? But maybe we should identify that case explicitly in case the host can optimize it. > 3) and beyond? If so, it seems that we ne

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Thu, Jun 03, 2021 at 08:52:24AM -0300, Jason Gunthorpe wrote: > On Thu, Jun 03, 2021 at 03:13:44PM +1000, David Gibson wrote: > > > > We can still consider it a single "address space" from the IOMMU > > > perspective. What has happened is that the address tab

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
eed to pass in /dev/ioasid, > > thus increasing the complexity in container setup (or orchestration). > > Containers already needed to do this today. Container orchestration is > hard. Right to use VFIO a container already needs both /dev/vfio and one or more /dev/vfi

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-06-07 Thread David Gibson
On Tue, Jun 01, 2021 at 09:57:12AM -0300, Jason Gunthorpe wrote: > On Tue, Jun 01, 2021 at 02:03:33PM +1000, David Gibson wrote: > > On Thu, May 27, 2021 at 03:48:47PM -0300, Jason Gunthorpe wrote: > > > On Thu, May 27, 2021 at 02:58:30PM +1000, David Gibson wrote: > > >

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Thu, Jun 03, 2021 at 06:49:20AM +, Tian, Kevin wrote: > > From: David Gibson > > Sent: Thursday, June 3, 2021 1:09 PM > [...] > > > > In this way the SW mode is the same as a HW mode with an infinite > > > > cache. > > > > > > &g

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
t; AIUI, IOMMU programming on PPC is done through hypercalls, so KVM needs > to know how to handle those for in-kernel acceleration. Thanks, For PAPR guests, which is the common case, yes. Bare metal POWER hosts have their own page table format. And probably some of the newer embedded

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Thu, Jun 03, 2021 at 09:28:32AM -0300, Jason Gunthorpe wrote: > On Thu, Jun 03, 2021 at 03:23:17PM +1000, David Gibson wrote: > > On Wed, Jun 02, 2021 at 01:37:53PM -0300, Jason Gunthorpe wrote: > > > On Wed, Jun 02, 2021 at 04:57:52PM +1000, David Gibson wrote: > >

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Fri, Jun 04, 2021 at 12:24:08PM +0200, Jean-Philippe Brucker wrote: > On Thu, Jun 03, 2021 at 03:45:09PM +1000, David Gibson wrote: > > > > But it would certainly be possible for a system to have two > > > > different host bridges with two different IOMMUs with

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Thu, Jun 03, 2021 at 07:17:23AM +, Tian, Kevin wrote: > > From: David Gibson > > Sent: Wednesday, June 2, 2021 2:15 PM > > > [...] > > > An I/O address space takes effect in the IOMMU only after it is attached > > > to a device. The device in the

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread David Gibson
On Thu, Jun 03, 2021 at 09:11:05AM -0300, Jason Gunthorpe wrote: > On Thu, Jun 03, 2021 at 03:45:09PM +1000, David Gibson wrote: > > On Wed, Jun 02, 2021 at 01:58:38PM -0300, Jason Gunthorpe wrote: > > > On Wed, Jun 02, 2021 at 04:48:35PM +1000, David Gibson wrote: > > >

  1   2   >