Re: [PATCH 08/16] iommu/fsl: use page allocation function provided by iommu-pages.h

2023-11-28 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 06:00:13PM -0500, Pasha Tatashin wrote: > On Tue, Nov 28, 2023 at 5:53 PM Robin Murphy wrote: > > > > On 2023-11-28 8:49 pm, Pasha Tatashin wrote: > > > Convert iommu/fsl_pamu.c to use the new page allocation functions > > > provided in iommu-pages.h. > > > > Again, this is

Re: [PATCH 09/16] iommu/iommufd: use page allocation function provided by iommu-pages.h

2023-11-28 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 08:49:31PM +, Pasha Tatashin wrote: > Convert iommu/iommufd/* files to use the new page allocation functions > provided in iommu-pages.h. > > Signed-off-by: Pasha Tatashin > --- > drivers/iommu/iommufd/iova_bitmap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 delet

Re: [PATCH 16/16] vfio: account iommu allocations

2023-11-28 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 08:49:38PM +, Pasha Tatashin wrote: > iommu allocations should be accounted in order to allow admins to > monitor and limit the amount of iommu memory. > > Signed-off-by: Pasha Tatashin > --- > drivers/vfio/vfio_iommu_type1.c | 8 +--- > 1 file changed, 5 insertio

Re: [PATCH 00/16] IOMMU memory observability

2023-11-28 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 04:25:03PM -0800, Yosry Ahmed wrote: > > > Right, but as I mention above, if userspace starts depending on this > > > equation, we won't be able to add any more classes of "secondary" page > > > tables to SecPageTables. I'd like to avoid that if possible. We can do > > > th

Re: [PATCH 00/16] IOMMU memory observability

2023-11-28 Thread Jason Gunthorpe
On Tue, Nov 28, 2023 at 04:30:27PM -0800, Yosry Ahmed wrote: > On Tue, Nov 28, 2023 at 4:28 PM Jason Gunthorpe wrote: > > > > On Tue, Nov 28, 2023 at 04:25:03PM -0800, Yosry Ahmed wrote: > > > > > > > Right, but as I mention above, if userspace starts depe

Re: [PATCH 08/16] iommu/fsl: use page allocation function provided by iommu-pages.h

2023-11-29 Thread Jason Gunthorpe
On Wed, Nov 29, 2023 at 02:45:03PM -0500, Pasha Tatashin wrote: > > same kind of big systems where IOMMU pagetables would be of any concern. > > I believe some of the some of the "serious" NICs can easily run up > > hundreds of megabytes if not gigabytes worth of queues, SKB pools, etc. > > - woul

Re: [PATCH V6 vfio 7/9] vfio/pci: Expose vfio_pci_core_setup_barmap()

2023-12-06 Thread Jason Gunthorpe
ches by the vfio/virtio coming > driver. > > Signed-off-by: Yishai Hadas > --- > drivers/vfio/pci/vfio_pci_rdwr.c | 7 --- > include/linux/vfio_pci_core.h| 1 + > 2 files changed, 5 insertions(+), 3 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH V6 vfio 8/9] vfio/pci: Expose vfio_pci_core_iowrite/read##size()

2023-12-06 Thread Jason Gunthorpe
> 2 files changed, 45 insertions(+), 24 deletions(-) Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH V6 vfio 9/9] vfio/virtio: Introduce a vfio driver over virtio devices

2023-12-06 Thread Jason Gunthorpe
_iommufd_physical_attach_ioas, Missing detach_ioas > +static bool virtiovf_bar0_exists(struct pci_dev *pdev) > +{ > + struct resource *res = pdev->resource; > + > + return res->flags ? true : false; ?: isn't necessary cast to bool does this expression automatically I didn't try to check the virtio parts of this, but the construction of the variant driver looks OK, so Reviewed-by: Jason Gunthorpe Jason

Re: [PATCH v3 5/8] iommufd: Associate fault object with iommufd_hw_pgtable

2024-03-08 Thread Jason Gunthorpe
On Thu, Mar 07, 2024 at 09:54:53AM +0800, Baolu Lu wrote: > On 2024/3/7 0:01, Jason Gunthorpe wrote: > > On Wed, Mar 06, 2024 at 11:15:50PM +0800, Zhangfei Gao wrote: > > > Double checked, this does not send flags, 0 is OK, > > > Only domain_alloc_user in iommufd_hwpt_

Re: [PATCH vfio 0/7] Enhances the vfio-virtio driver to support live migration

2024-10-28 Thread Jason Gunthorpe
On Mon, Oct 28, 2024 at 10:13:48AM -0600, Alex Williamson wrote: > On Sun, 27 Oct 2024 12:07:44 +0200 > Yishai Hadas wrote: > > > > - According to the Virtio specification, a device has only two states: > > RUNNING and STOPPED. Consequently, certain VFIO transitions (e.g., > > RUNNING_P2P->ST

Re: [PATCH V1 vfio 5/7] vfio/virtio: Add support for the basic live migration functionality

2024-11-06 Thread Jason Gunthorpe
On Tue, Nov 05, 2024 at 03:47:46PM -0700, Alex Williamson wrote: > I think the API to vfio core also suggests we shouldn't be modifying the > ops pointer after the core device is allocated. Yeah, that is a dangerous pattern we should avoid Jason

Re: [PATCH V1 vfio 7/7] vfio/virtio: Enable live migration once VIRTIO_PCI was configured

2024-11-06 Thread Jason Gunthorpe
On Tue, Nov 05, 2024 at 04:29:04PM -0700, Alex Williamson wrote: > > @@ -1,7 +1,7 @@ > > # SPDX-License-Identifier: GPL-2.0-only > > config VIRTIO_VFIO_PCI > > tristate "VFIO support for VIRTIO NET PCI devices" > > -depends on VIRTIO_PCI && VIRTIO_PCI_ADMIN_LEGACY > > +de

[PATCH 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-02-07 Thread Jason Gunthorpe
ITY as virtio was the last driver using it. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c| 6 -- drivers/iommu/virtio-iommu.c | 114 --- 2 files changed, 53 insertions(+), 67 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iomm

[PATCH 2/5] iommu: Add domain_alloc_identity()

2025-02-07 Thread Jason Gunthorpe
paging domain to return. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 20 include/linux/iommu.h | 4 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 870c3cdbd0f622..ee33d26dfcd40d 100644

[PATCH 5/5] iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU

2025-02-07 Thread Jason Gunthorpe
e it as is. Wrap it's definition in CONFIG_FSL_PAMU to discourage any new drivers from attempting to use it. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ include/linux/iommu.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/io

[PATCH 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-02-07 Thread Jason Gunthorpe
qemu-system-x86_64: iommu map to non memory area 40 Jason Gunthorpe (5): iommu/virtio: Break out bypass identity support into a global static iommu: Add domain_alloc_identity() iommu/virtio: Move to domain_alloc_paging() iommu: Do not call domain_alloc() in iommu_sva_domain_alloc

[PATCH 4/5] iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()

2025-02-07 Thread Jason Gunthorpe
No driver implements SVA under domain_alloc() anymore, this is dead code. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu-sva.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index 503c5d23c1ea27

[PATCH 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-02-07 Thread Jason Gunthorpe
. Signed-off-by: Jason Gunthorpe --- drivers/iommu/virtio-iommu.c | 86 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index b85ce6310ddbda..c71a996760bddb 100644 --- a/drivers/iommu

Re: [PATCH 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-02-12 Thread Jason Gunthorpe
On Tue, Feb 11, 2025 at 04:41:51PM -0800, Jacob Pan wrote: > I see the same on arm64 with v9.0, assigned an ixgbe nic via VFIO. Huh, I figured it worked on ARM.. There is no requirement that an iommu driver implement identity, this is all an optimization. If it doesn't work in alot of cases can

Re: [PATCH 2/5] iommu: Add domain_alloc_identity()

2025-02-12 Thread Jason Gunthorpe
On Wed, Feb 12, 2025 at 01:56:55PM +, Robin Murphy wrote: > On 2025-02-07 2:46 pm, Jason Gunthorpe wrote: > > virtio-iommu has a mode where the IDENTITY domain is actually a paging > > domain with an identity mapping covering some of the system address > > space manually

Re: [PATCH 2/5] iommu: Add domain_alloc_identity()

2025-02-12 Thread Jason Gunthorpe
On Wed, Feb 12, 2025 at 02:16:54PM +, Robin Murphy wrote: > On 2025-02-12 2:03 pm, Jason Gunthorpe wrote: > > On Wed, Feb 12, 2025 at 01:56:55PM +, Robin Murphy wrote: > > > On 2025-02-07 2:46 pm, Jason Gunthorpe wrote: > > > > virtio-iommu has a mode where t

Re: [PATCH 0/3] make MSI IOVA base address and its length configurable

2025-01-30 Thread Jason Gunthorpe
On Thu, Jan 30, 2025 at 03:21:37PM -0800, Shyam Saini wrote: > Unfortunately, it is an HW issue. Well, that's pretty bad to have built HW that can't DMA to low addresses at all.. But OK. > Are you okay with this passing custom MSI_IOVA via DTS approach ? It isn't up to me, but I've understood

Re: [PATCH 0/3] make MSI IOVA base address and its length configurable

2025-01-20 Thread Jason Gunthorpe
On Thu, Jan 16, 2025 at 03:23:04PM -0800, Shyam Saini wrote: > Hi, > > Currently, the MSI_IOVA_BASE address is hard-coded to 0x8000, > assuming that all platforms have this address available for MSI IOVA > reservation. However, this is not always the case, as some platforms > reserve this addr

Re: [PATCH 0/3] make MSI IOVA base address and its length configurable

2025-01-21 Thread Jason Gunthorpe
On Tue, Jan 21, 2025 at 01:49:10PM -0800, Jacob Pan wrote: > > On Thu, Jan 16, 2025 at 03:23:04PM -0800, Shyam Saini wrote: > > > Hi, > > > > > > Currently, the MSI_IOVA_BASE address is hard-coded to 0x8000, > > > assuming that all platforms have this address available for MSI IOVA > > > rese

[PATCH v4 2/5] iommu: Add domain_alloc_identity()

2025-04-08 Thread Jason Gunthorpe
paging domain to return. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 20 include/linux/iommu.h | 4 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index c8033ca6637771..a61cceb706ed43 100644

[PATCH v4 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-04-08 Thread Jason Gunthorpe
-91eed9c8014a+53a37-iommu_virtio_domains_...@nvidia.com Jason Gunthorpe (5): iommu/virtio: Break out bypass identity support into a global static iommu: Add domain_alloc_identity() iommu/virtio: Move to domain_alloc_paging() iommu: Do not call domain_alloc() in iommu_sva_domain_alloc() iommu

[PATCH v4 5/5] iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU

2025-04-08 Thread Jason Gunthorpe
e it as is. Wrap it's definition in CONFIG_FSL_PAMU to discourage any new drivers from attempting to use it. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ include/linux/iommu.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH v4 4/5] iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()

2025-04-08 Thread Jason Gunthorpe
No driver implements SVA under domain_alloc() anymore, this is dead code. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu-sva.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c

Re: [PATCH v4 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-04-10 Thread Jason Gunthorpe
On Thu, Apr 10, 2025 at 05:55:50AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, April 9, 2025 12:36 AM > > > > +static struct iommu_domain *viommu_domain_alloc_identity(struct device > > *dev) > > +{ > > + struct viom

[PATCH v4 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-04-08 Thread Jason Gunthorpe
ITY as virtio was the last driver using it. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c| 6 -- drivers/iommu/virtio-iommu.c | 121 +++ 2 files changed, 53 insertions(+), 74 deletions(-) diff --git a/driv

[PATCH v4 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-04-10 Thread Jason Gunthorpe
. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Jason Gunthorpe --- drivers/iommu/virtio-iommu.c | 86 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index b85ce6310ddbda

Re: [PATCH v4 5/5] iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU

2025-04-10 Thread Jason Gunthorpe
On Thu, Apr 10, 2025 at 05:57:44AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, April 9, 2025 12:36 AM > > > > +#if IS_ENABLED(CONFIG_FSL_PAMU) > > struct iommu_domain *(*domain_alloc)(unsigned > > iommu_domain_type); > >

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-04-10 Thread Jason Gunthorpe
On Thu, Apr 10, 2025 at 03:50:27PM -0700, Shyam Saini wrote: > > Hi, > > Currently, the MSI_IOVA_BASE address is hard-coded to 0x8000, > assuming that all platforms have this address available for MSI IOVA > reservation. However, this is not always the case, as some platforms > reserve this a

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-04-16 Thread Jason Gunthorpe
On Wed, Apr 16, 2025 at 11:04:27AM -0700, Jacob Pan wrote: > Per last discussion "SMMU driver have a list of potential addresses and > select the first one that does not intersect with the non-working IOVA > ranges.". If we don't know what the "non-working IOVA" is, how do we > know it does not in

Re: [PATCH 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-02-18 Thread Jason Gunthorpe
On Wed, Feb 12, 2025 at 09:47:23PM -0800, Jacob Pan wrote: > Hi Jason, > > On Wed, 12 Feb 2025 19:30:53 -0400 > Jason Gunthorpe wrote: > > > On Wed, Feb 12, 2025 at 11:22:35AM -0800, Jacob Pan wrote: > > > > > Do you foresee the implementation can leverage y

Re: [PATCH 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-02-18 Thread Jason Gunthorpe
On Tue, Feb 11, 2025 at 04:43:55PM -0800, Jacob Pan wrote: > > +static int viommu_send_attach_req(struct viommu_dev *viommu, struct > > device *dev, > > + struct virtio_iommu_req_attach > > *req) +{ > > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > > +

[PATCH v2 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-02-27 Thread Jason Gunthorpe
://patch.msgid.link/r/0-v1-91eed9c8014a+53a37-iommu_virtio_domains_...@nvidia.com Cc: Eric Auger Signed-off-by: Jason Gunthorpe Jason Gunthorpe (5): iommu/virtio: Break out bypass identity support into a global static iommu: Add domain_alloc_identity() iommu/virtio: Move to domain_alloc_paging() iommu

Re: [PATCH v2 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-03-03 Thread Jason Gunthorpe
On Mon, Mar 03, 2025 at 03:21:43PM +, Jean-Philippe Brucker wrote: > On Thu, Feb 27, 2025 at 08:20:01PM -0400, Jason Gunthorpe wrote: > > virtio has the complication that it sometimes wants to return a paging > > domain for IDENTITY which makes this conversion a little different

[PATCH v3 5/5] iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU

2025-03-07 Thread Jason Gunthorpe
e it as is. Wrap it's definition in CONFIG_FSL_PAMU to discourage any new drivers from attempting to use it. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ include/linux/iommu.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH v3 2/5] iommu: Add domain_alloc_identity()

2025-03-07 Thread Jason Gunthorpe
paging domain to return. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 20 include/linux/iommu.h | 4 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 870c3cdbd0f622..ee33d26dfcd40d 100644

[PATCH v3 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-03-07 Thread Jason Gunthorpe
ITY as virtio was the last driver using it. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c| 6 -- drivers/iommu/virtio-iommu.c | 121 +++ 2 files changed, 53 insertions(+), 74 deletions(-) diff --git a/driv

[PATCH v3 4/5] iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()

2025-03-07 Thread Jason Gunthorpe
No driver implements SVA under domain_alloc() anymore, this is dead code. Reviewed-by: Lu Baolu Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu-sva.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c

[PATCH v3 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-03-07 Thread Jason Gunthorpe
. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Jason Gunthorpe --- drivers/iommu/virtio-iommu.c | 86 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index b85ce6310ddbda

[PATCH v3 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-03-07 Thread Jason Gunthorpe
patch and re-constify the ops - Fix incorrect tracking in the identity domain attach - Christmas tree variable order and some other formatting v1: https://patch.msgid.link/r/0-v1-91eed9c8014a+53a37-iommu_virtio_domains_...@nvidia.com Jason Gunthorpe (5): iommu/virtio: Break out bypass

[PATCH v2 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-02-27 Thread Jason Gunthorpe
ITY as virtio was the last driver using it. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c| 6 -- drivers/iommu/virtio-iommu.c | 114 --- 2 files changed, 53 insertions(+), 67 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iomm

[PATCH v2 2/5] iommu: Add domain_alloc_identity()

2025-02-27 Thread Jason Gunthorpe
paging domain to return. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c| 20 drivers/iommu/virtio-iommu.c | 11 ++- include/linux/iommu.h| 4 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/iommu/iommu.c b

[PATCH v2 4/5] iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()

2025-02-27 Thread Jason Gunthorpe
No driver implements SVA under domain_alloc() anymore, this is dead code. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu-sva.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index 503c5d23c1ea27

[PATCH v2 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-02-27 Thread Jason Gunthorpe
. Signed-off-by: Jason Gunthorpe --- drivers/iommu/virtio-iommu.c | 86 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index b85ce6310ddbda..55a2188197c621 100644 --- a/drivers/iommu

[PATCH v2 5/5] iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU

2025-02-27 Thread Jason Gunthorpe
e it as is. Wrap it's definition in CONFIG_FSL_PAMU to discourage any new drivers from attempting to use it. Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ include/linux/iommu.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/io

Re: [PATCH v2 2/5] iommu: Add domain_alloc_identity()

2025-02-28 Thread Jason Gunthorpe
On Fri, Feb 28, 2025 at 09:59:53AM +0800, Baolu Lu wrote: > This seems to be a paging domain with identity mappings for some > specific ranges. Sometimes it's the global static too > So perhaps naming the callback as domain_alloc_paging_identity, or > domain_alloc_paging_static? s390 and dart

Re: [PATCH 3/5] iommu/virtio: Move to domain_alloc_paging()

2025-02-12 Thread Jason Gunthorpe
On Wed, Feb 12, 2025 at 11:22:35AM -0800, Jacob Pan wrote: > Do you foresee the implementation can leverage your generic iommu_pt > work? i.e. for building guest IO page tables. It will add a new flavor > (page table based in addition to map/unmap) to > viommu_domain_alloc_paging() i think. Yes I

Re: [PATCH 0/5] Convert virtio-iommu to domain_alloc_paging()

2025-02-24 Thread Jason Gunthorpe
On Fri, Feb 21, 2025 at 11:42:06AM +, Jean-Philippe Brucker wrote: > > There is no requirement that an iommu driver implement identity, this > > is all an optimization. If it doesn't work in alot of cases can we > > just remove it? It would simplfy a lot.. > > No objection. Identity domains a

Re: [PATCH 1/5] iommu/virtio: Break out bypass identity support into a global static

2025-02-24 Thread Jason Gunthorpe
On Fri, Feb 21, 2025 at 11:35:27AM +, Jean-Philippe Brucker wrote: > > +static int viommu_attach_identity_domain(struct iommu_domain *domain, > > +struct device *dev) > > +{ > > + int ret = 0; > > + struct virtio_iommu_req_attach req; > > + struct viomm

Re: [PATCH 0/3] make MSI IOVA base address and its length configurable

2025-04-03 Thread Jason Gunthorpe
On Thu, Apr 03, 2025 at 12:34:58PM -0700, Shyam Saini wrote: > Hi Jason, > > > On Thu, Jan 30, 2025 at 03:21:37PM -0800, Shyam Saini wrote: > > > > > Unfortunately, it is an HW issue. > > > > Well, that's pretty bad to have built HW that can't DMA to low > > addresses at all.. But OK. > > > >

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-05-25 Thread Jason Gunthorpe
On Tue, May 20, 2025 at 03:42:24PM -0700, Shyam Saini wrote: > Hi Jason, > > apologies for the delayed response. > > > On Wed, Apr 16, 2025 at 11:04:27AM -0700, Jacob Pan wrote: > > > > > Per last discussion "SMMU driver have a list of potential addresses and > > > select the first one that does

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-05-27 Thread Jason Gunthorpe
On Tue, May 27, 2025 at 01:54:28PM -0700, Shyam Saini wrote: > > The above is the only place that creates a IOMMU_RESV_SW_MSI so it is > > definately called and used, right? If not where does your > > IOMMU_RESV_SW_MSI come from? > > code tracing and printks in that code path suggests > iommu_dma

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-05-29 Thread Jason Gunthorpe
On Thu, May 29, 2025 at 11:22:19AM -0700, Shyam Saini wrote: > > All IOVA that the platform cannot DMA from should be reported in the > > reserved_regions file as "reserved". You must make your platform > > achieve this. > > so should it be for all the iommu groups? > > no_dma_mem

[PATCH] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-06-24 Thread Jason Gunthorpe
atible way. Fixes: 5fcc26969a16 ("vfio: Add VFIO_DEVICE_BIND_IOMMUFD") Signed-off-by: Jason Gunthorpe --- drivers/vfio/device_cdev.c| 38 +-- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c| 1 + drivers/vfio/pci/mlx5/main.c | 1 + drivers/

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-05-30 Thread Jason Gunthorpe
On Thu, May 29, 2025 at 03:08:39PM -0700, Shyam Saini wrote: > > How does your platform work at all? Isn't 0x0800 physical memory in > > your address map? > > unfornately, this 0x0800 physical address is not in our address map Is your issue PCI related, do you have a PCI switch without A

Re: [PATCH v2 0/3] arm-smmu: select suitable IOVA

2025-05-28 Thread Jason Gunthorpe
On Wed, May 28, 2025 at 03:42:55PM -0700, Jacob Pan wrote: > > All IOVA that the platform cannot DMA from should be reported in the > > reserved_regions file as "reserved". You must make your platform > > achieve this. > > > Just to double confirm, the expected reserved region should be marked as

Re: [PATCH v3] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-15 Thread Jason Gunthorpe
} > 5fcc26969a164e Yi Liu 2023-07-18 123 > be2e70b96c3e54 Jason Gunthorpe 2025-07-14 124ret = > vfio_df_check_token(device, &bind); > be2e70b96c3e54 Jason Gunthorpe 2025-07-14 125if (ret) > be2e70b96c3e54 Jason Gunthorpe 2025-07-14 @126

[PATCH v3] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-14 Thread Jason Gunthorpe
by: Shameer Kolothum Reviewed-by: Yi Liu Signed-off-by: Jason Gunthorpe --- drivers/vfio/device_cdev.c| 38 +-- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c| 1 + drivers/vfio/pci/mlx5/main.c | 1 + drivers/vfio/pci/nvgrace-gpu/main.c

Re: [PATCH v2] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-14 Thread Jason Gunthorpe
On Mon, Jul 14, 2025 at 09:12:52AM -0600, Alex Williamson wrote: > On Mon, 14 Jul 2025 11:29:04 -0300 > Jason Gunthorpe wrote: > > > On Mon, Jul 14, 2025 at 09:12:30PM +0800, Yi Liu wrote: > > > On 2025/7/10 23:30, Jason Gunthorpe wrote: > > > >

[PATCH v2] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-10 Thread Jason Gunthorpe
here is co-ordination with the owner of the PF. Since we no longer have a device name, pass the token directly through VFIO_DEVICE_BIND_IOMMUFD using an optional field indicated by VFIO_DEVICE_BIND_TOKEN. Fixes: 5fcc26969a16 ("vfio: Add VFIO_DEVICE_BIND_IOMMUFD") Signed-off-by: Jason Gunthorp

Re: [PATCH v2] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-11 Thread Jason Gunthorpe
On Fri, Jul 11, 2025 at 12:01:49PM +, Shameerali Kolothum Thodi wrote: > > minsz = offsetofend(struct vfio_device_bind_iommufd, out_devid); > > > > - if (copy_from_user(&bind, arg, minsz)) > > - return -EFAULT; > > + ret = get_user(user_size, &arg->argsz); > > + if (ret) >

Re: [PATCH] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-03 Thread Jason Gunthorpe
On Thu, Jul 03, 2025 at 06:40:48AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, June 25, 2025 2:35 AM > > > > This was missed during the initial implementation. The VFIO PCI encodes > > the vf_token inside the device name when opening

Re: [PATCH] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-02 Thread Jason Gunthorpe
On Tue, Jun 24, 2025 at 02:06:04PM -0600, Alex Williamson wrote: > > This is used to control access to a VF unless there is co-ordination with > > the owner of the PF. > > > > Since we no longer have a device name pass the token directly though > > s/name pass/name, pass/ s/though/through/ Got i

Re: [PATCH v2] vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD

2025-07-14 Thread Jason Gunthorpe
On Mon, Jul 14, 2025 at 09:12:30PM +0800, Yi Liu wrote: > On 2025/7/10 23:30, Jason Gunthorpe wrote: > > This was missed during the initial implementation. The VFIO PCI encodes > > the vf_token inside the device name when opening the device from the group > > FD, something li