On 9/23/23 1:07 AM, Jason Gunthorpe wrote:
Following the pattern of identity domains, just assign the BLOCKED domain
global statics to a value in ops. Update the core code to use the global
static directly.
Update powerpc to use the new scheme and remove its empty domain_alloc
callback.
Signed-
On 9/23/23 1:07 AM, Jason Gunthorpe wrote:
The global static should pre-define the type and the NOP free function can
be now left as NULL.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/intel/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Lu Baolu
Best re
On 9/23/23 1:07 AM, Jason Gunthorpe wrote:
Trivially migrate to the ops->blocked_domain for the existing global
static.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/intel/iommu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Lu Baolu
P.S. We can further do the s
On 9/25/23 7:41 PM, Jason Gunthorpe wrote:
On Mon, Sep 25, 2023 at 10:29:52AM +0800, Baolu Lu wrote:
On 9/23/23 1:07 AM, Jason Gunthorpe wrote:
Trivially migrate to the ops->blocked_domain for the existing global
static.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/intel/iommu.c
On 2023/7/25 1:21, Jason Gunthorpe wrote:
This allows a driver to set a global static to an IDENTITY domain and
the core code will automatically use it whenever an IDENTITY domain
is requested.
By making it always available it means the IDENTITY can be used in error
handling paths to force the i
On 2023/7/25 1:21, Jason Gunthorpe wrote:
This is used when the iommu driver is taking control of the dma_ops,
currently only on S390 and power spapr. It is designed to preserve the
original ops->detach_dev() semantic that these S390 was built around.
Provide an opaque domain type and a 'default
On 2023/7/25 1:21, Jason Gunthorpe wrote:
Except for dart every driver returns 0 or IDENTITY from def_domain_type().
The drivers that return IDENTITY have some kind of good reason, typically
that quirky hardware really can't support anything other than IDENTITY.
Arrange things so that if the dr
On 2023/7/25 1:22, Jason Gunthorpe wrote:
All drivers are now using IDENTITY or PLATFORM domains for what this did,
we can remove it now. It is no longer possible to attach to a NULL domain.
Tested-by: Heiko Stuebner
Tested-by: Niklas Schnelle
Tested-by: Steven Price
Tested-by: Marek Szyprowski
On 2023/7/25 1:22, Jason Gunthorpe wrote:
At this point every iommu driver will cause a default_domain to be
selected, so we can finally remove this gap from the core code.
The following table explains what each driver supports and what the
resulting default_domain will be:
On 2023/7/25 1:22, Jason Gunthorpe wrote:
Allocate a domain from a group. Automatically obtains the iommu_ops to use
from the device list of the group. Convert the internal callers to use it.
Tested-by: Steven Price
Tested-by: Marek Szyprowski
Tested-by: Nicolin Chen
Signed-off-by: Jason Gunthor
On 2023/7/25 1:22, Jason Gunthorpe wrote:
This callback requests the driver to create only a __IOMMU_DOMAIN_PAGING
domain, so it saves a few lines in a lot of drivers needlessly checking
the type.
More critically, this allows us to sweep out all the
IOMMU_DOMAIN_UNMANAGED and IOMMU_DOMAIN_DMA ch
On 2023/8/3 8:07, Jason Gunthorpe wrote:
This is used when the iommu driver is taking control of the dma_ops,
currently only on S390 and power spapr. It is designed to preserve the
original ops->detach_dev() semantic that these S390 was built around.
Provide an opaque domain type and a 'default_
On 2023/8/3 8:07, Jason Gunthorpe wrote:
@@ -1967,7 +1978,8 @@ void iommu_domain_free(struct iommu_domain *domain)
if (domain->type == IOMMU_DOMAIN_SVA)
mmdrop(domain->mm);
iommu_put_dma_cookie(domain);
- domain->ops->free(domain);
+ if (domain->ops->fr
On 2023/8/3 8:07, Jason Gunthorpe wrote:
Thierry says this is not used anymore, and doesn't think it makes sense as
an iommu driver. The HW it supports is about 10 years old now and newer HW
uses different IOMMU drivers.
As this is the only driver with a GART approach, and it doesn't really
meet
On 2023/8/3 8:07, Jason Gunthorpe wrote:
Except for dart every driver returns 0 or IDENTITY from def_domain_type().
The drivers that return IDENTITY have some kind of good reason, typically
that quirky hardware really can't support anything other than IDENTITY.
Arrange things so that if the dri
On 2023/8/3 8:08, Jason Gunthorpe wrote:
I've avoided doing this because there is no way to make this happen
without an intrusion into the core code. Up till now this has avoided
needing the core code's probe path with some hackery - but now that
default domains are becoming mandatory it is unavo
On 2023/8/3 8:08, Jason Gunthorpe wrote:
+/*
+ * Register an iommu driver against a single bus. This is only used by iommufd
+ * selftest to create a mock iommu driver. The caller must provide
+ * some memory to hold a notifier_block.
+ */
+int iommu_device_register_bus(struct iommu_device *iommu
On 2023/8/12 19:28, Jason Gunthorpe wrote:
On Sat, Aug 12, 2023 at 09:36:33AM +0800, Baolu Lu wrote:
@@ -290,6 +295,7 @@ struct iommu_ops {
unsigned long pgsize_bitmap;
struct module *owner;
struct iommu_domain *identity_domain;
+ struct iommu_domain
On 2023/8/3 8:07, Jason Gunthorpe wrote:
POWER is using the set_platform_dma_ops() callback to hook up its private
dma_ops, but this is buired under some indirection and is weirdly
happening for a BLOCKED domain as well.
For better documentation create a PLATFORM domain to manage the dma_ops,
si
On 2023/8/3 8:07, Jason Gunthorpe wrote:
The PLATFORM domain will be set as the default domain and attached as
normal during probe. The driver will ignore the initial attach from a NULL
domain to the PLATFORM domain.
After this, the PLATFORM domain's attach_dev will be called whenever we
detach
On 2023/8/3 8:07, Jason Gunthorpe wrote:
This driver is nonsensical. To not block migrating the core API away from
NULL default_domains give it a hacky of a PLATFORM domain that keeps it
working exactly as it always did.
Leave some comments around to warn away any future people looking at this.
On 2023/8/3 8:07, Jason Gunthorpe wrote:
What mtk does during mtk_iommu_v1_set_platform_dma() is actually putting
the iommu into identity mode. Make this available as a proper IDENTITY
domain.
The mtk_iommu_v1_def_domain_type() from
commit 8bbe13f52cb7 ("iommu/mediatek-v1: Add def_domain_type")
On 2023/8/3 8:07, Jason Gunthorpe wrote:
Even though dma-iommu.c and CONFIG_ARM_DMA_USE_IOMMU do approximately the
same stuff, the way they relate to the IOMMU core is quiet different.
dma-iommu.c expects the core code to setup an UNMANAGED domain (of type
IOMMU_DOMAIN_DMA) and then configures i
On 2023/8/3 8:07, Jason Gunthorpe wrote:
What exynos calls exynos_iommu_detach_device is actually putting the iommu
into identity mode.
Move to the new core support for ARM_DMA_USE_IOMMU by defining
ops->identity_domain.
Tested-by: Marek Szyprowski
Acked-by: Marek Szyprowski
Signed-off-by: Jaso
On 2023/8/3 8:07, Jason Gunthorpe wrote:
What tegra-smmu does during tegra_smmu_set_platform_dma() is actually
putting the iommu into identity mode.
Move to the new core support for ARM_DMA_USE_IOMMU by defining
ops->identity_domain.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/tegra-smmu
On 2023/8/3 8:07, Jason Gunthorpe wrote:
All ARM64 iommu drivers should support IOMMU_DOMAIN_DMA to enable
dma-iommu.c.
tegra is blocking dma-iommu usage, and also default_domain's, because it
wants an identity translation. This is needed for some device quirk. The
correct way to do this is to s
On 2023/8/3 8:08, Jason Gunthorpe wrote:
What omap does during omap_iommu_set_platform_dma() is actually putting
the iommu into identity mode.
Move to the new core support for ARM_DMA_USE_IOMMU by defining
ops->identity_domain.
This driver does not support IOMMU_DOMAIN_DMA, however it cannot be
On 2023/8/3 8:08, Jason Gunthorpe wrote:
What msm does during msm_iommu_set_platform_dma() is actually putting the
iommu into identity mode.
Move to the new core support for ARM_DMA_USE_IOMMU by defining
ops->identity_domain.
This driver does not support IOMMU_DOMAIN_DMA, however it cannot be
c
On 2023/8/3 8:08, Jason Gunthorpe wrote:
This brings back the ops->detach_dev() code that commit
1b932ceddd19 ("iommu: Remove detach_dev callbacks") deleted and turns it
into an IDENTITY domain.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 39 ++
On 2023/8/3 8:08, Jason Gunthorpe wrote:
This brings back the ops->detach_dev() code that commit
1b932ceddd19 ("iommu: Remove detach_dev callbacks") deleted and turns it
into an IDENTITY domain.
Also reverts commit 584d334b1393 ("iommu/ipmmu-vmsa: Remove
ipmmu_utlb_disable()")
Signed-off-by: Ja
On 2023/8/3 8:08, Jason Gunthorpe wrote:
This brings back the ops->detach_dev() code that commit
1b932ceddd19 ("iommu: Remove detach_dev callbacks") deleted and turns it
into an IDENTITY domain.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/mtk_iommu.c | 23 +++
1 file
On 2023/8/3 8:08, Jason Gunthorpe wrote:
Prior to commit 1b932ceddd19 ("iommu: Remove detach_dev callbacks") the
sun50i_iommu_detach_device() function was being called by
ops->detach_dev().
This is an IDENTITY domain so convert sun50i_iommu_detach_device() into
sun50i_iommu_identity_attach() and
On 2023/8/3 8:08, Jason Gunthorpe wrote:
These drivers are all trivially converted since the function is only
called if the domain type is going to be
IOMMU_DOMAIN_UNMANAGED/DMA.
Tested-by: Heiko Stuebner
Tested-by: Steven Price
Tested-by: Marek Szyprowski
Tested-by: Nicolin Chen
Signed-off-
On 2023/8/3 8:08, Jason Gunthorpe wrote:
These drivers don't support IOMMU_DOMAIN_DMA, so this commit effectively
allows them to support that mode.
The prior work to require default_domains makes this safe because every
one of these drivers is either compilation incompatible with dma-iommu.c,
or
On 2023/8/3 8:07, Jason Gunthorpe wrote:
[ It would be good to get this in linux-next, we have some good test
coverage on the ARM side already, thanks! ]
It has been a long time coming, this series completes the default_domain
transition and makes it so that the core IOMMU code will always have
On 2023/8/14 22:34, Jason Gunthorpe wrote:
@@ -443,7 +459,7 @@ static int mtk_iommu_v1_create_mapping(struct device *dev,
struct of_phandle_arg
static int mtk_iommu_v1_def_domain_type(struct device *dev)
{
- return IOMMU_DOMAIN_UNMANAGED;
+ return IOMMU_DOMAIN_IDENTITY;
def_do
On 2023/8/14 23:36, Jason Gunthorpe wrote:
On Mon, Aug 14, 2023 at 02:32:33PM +0800, Baolu Lu wrote:
+ pm_runtime_get_sync(qcom_iommu->dev);
+ for (i = 0; i < fwspec->num_ids; i++) {
+ struct qcom_iommu_ctx *ctx = to_ctx(qcom_domain,
fwsp
On 2023/8/15 1:25, Jason Gunthorpe wrote:
Ah, I went over all this again and decided to try again, it is too
complicated. This patch can do what the commit message says and the
following patches are even simpler:
Yes. This method is more concise. Some nits below.
/*
* Combine the driver's
On 2023/8/15 1:30, Jason Gunthorpe wrote:
On Mon, Aug 14, 2023 at 04:43:23PM +0800, Baolu Lu wrote:
This is on github:https://github.com/jgunthorpe/linux/commits/iommu_all_defdom
It seems that after this series, all ARM iommu drivers are able to
support the IDENTITY default domain, hence
On 4/20/23 12:11 AM, Jason Gunthorpe wrote:
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index dbaf3ed9012c45..a82516c8ea87ad 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -569,7 +569,6 @@ static void __iommu_group_remove_device(struct device *dev)
On 4/20/23 12:11 AM, Jason Gunthorpe wrote:
@@ -451,16 +454,17 @@ static int __iommu_probe_device(struct device *dev,
struct list_head *group_list
goto out_unlock;
group = dev->iommu_group;
- ret = iommu_group_add_device(group, dev);
+ gdev = iommu_group_alloc_
On 6/10/23 3:56 AM, Jason Gunthorpe wrote:
This callback requests the driver to create only a __IOMMU_DOMAIN_PAGING
domain, so it saves a few lines in a lot of drivers needlessly checking
the type.
More critically, this allows us to sweep out all the
IOMMU_DOMAIN_UNMANAGED and IOMMU_DOMAIN_DMA c
42 matches
Mail list logo