From: Jason Gunthorpe <jgg@nvidia.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: kvm@vger.kernel.org, Fabiano Rosas <farosas@linux.ibm.com>,
Robin Murphy <robin.murphy@arm.com>,
Daniel Henrique Barboza <danielhb413@gmail.com>,
Deming Wang <wangdeming@inspur.com>,
kvm-ppc@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
Nicholas Piggin <npiggin@gmail.com>,
Murilo Opsfelder Araujo <muriloo@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH kernel 1/3] powerpc/iommu: Add "borrowing" iommu_table_group_ops
Date: Mon, 18 Jul 2022 13:49:20 -0300 [thread overview]
Message-ID: <20220718164920.GC4609@nvidia.com> (raw)
In-Reply-To: <20220714081822.3717693-2-aik@ozlabs.ru>
On Thu, Jul 14, 2022 at 06:18:20PM +1000, Alexey Kardashevskiy wrote:
> PPC64 IOMMU API defines iommu_table_group_ops which handles DMA windows
> for PEs: control the ownership, create/set/unset a table the hardware
> for dynamic DMA windows (DDW). VFIO uses the API to implement support
> on POWER.
>
> So far only PowerNV IODA2 (POWER8 and newer machines) implemented this and other cases (POWER7 or nested KVM) did not and instead reused
> existing iommu_table structs. This means 1) no DDW 2) ownership transfer
> is done directly in the VFIO SPAPR TCE driver.
>
> Soon POWER is going to get its own iommu_ops and ownership control is
> going to move there. This implements spapr_tce_table_group_ops which
> borrows iommu_table tables. The upside is that VFIO needs to know less
> about POWER.
>
> The new ops returns the existing table from create_table() and
> only checks if the same window is already set. This is only going to work
> if the default DMA window starts table_group.tce32_start and as big as
> pe->table_group.tce32_size (not the case for IODA2+ PowerNV).
>
> This changes iommu_table_group_ops::take_ownership() to return an error
> if borrowing a table failed.
>
> This should not cause any visible change in behavior for PowerNV.
> pSeries was not that well tested/supported anyway.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> arch/powerpc/include/asm/iommu.h | 6 +-
> arch/powerpc/kernel/iommu.c | 98 ++++++++++++++++++++++-
> arch/powerpc/platforms/powernv/pci-ioda.c | 6 +-
> arch/powerpc/platforms/pseries/iommu.c | 3 +
> drivers/vfio/vfio_iommu_spapr_tce.c | 94 ++++------------------
> 5 files changed, 121 insertions(+), 86 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
next prev parent reply other threads:[~2022-07-18 16:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 8:18 [PATCH kernel 0/3] powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains Alexey Kardashevskiy
2022-07-14 8:18 ` [PATCH kernel 1/3] powerpc/iommu: Add "borrowing" iommu_table_group_ops Alexey Kardashevskiy
2022-07-18 16:49 ` Jason Gunthorpe [this message]
2022-07-14 8:18 ` [PATCH kernel 2/3] powerpc/pci_64: Init pcibios subsys a bit later Alexey Kardashevskiy
2022-07-18 16:49 ` Jason Gunthorpe
2022-07-14 8:18 ` [PATCH kernel 3/3] powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains Alexey Kardashevskiy
2022-07-18 18:09 ` Jason Gunthorpe
2022-07-19 3:18 ` Alexey Kardashevskiy
2022-09-02 0:20 ` [PATCH kernel 0/3] " Jason Gunthorpe
2022-09-02 7:33 ` Michael Ellerman
2022-09-02 11:46 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220718164920.GC4609@nvidia.com \
--to=jgg@nvidia.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=danielhb413@gmail.com \
--cc=farosas@linux.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=muriloo@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=robin.murphy@arm.com \
--cc=wangdeming@inspur.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).