Nothing needs this pointer. Return a normal error code with the usual
IOMMU semantic that ENODEV means 'there is no IOMMU driver'.
Signed-off-by: Jason Gunthorpe
---
drivers/acpi/scan.c | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/sca
Allocation of dev->iommu must be done under the
iommu_probe_device_lock. Mark this with lockdep to discourage future
mistakes.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/iommu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 9f23e1
This call chain is using dev->iommu->fwspec to pass around the fwspec
between the three parts (of_iommu_configure(), of_iommu_xlate(),
iommu_probe_device()).
However there is no locking around the accesses to dev->iommu, so this is
all racy.
Allocate a clean, local, fwspec at the start of of_iomm
Allow fwspec to exist independently from the dev->iommu by providing
functions to allow allocating and freeing the raw struct iommu_fwspec.
Reflow the existing paths to call the new alloc/dealloc functions.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/iommu.c | 82 ++
This is only used internally to iommu.c now, get rid of it to discourage
things outside iommu.c from trying to manipulate dev->iommu->fwspec.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/iommu.c | 2 +-
include/linux/iommu.h | 6 --
2 files changed, 1 insertion(+), 7 deletions(-)
diff -
Instead of obtaining an iommu_fwspec from dev->iommu allow a caller
allocated fwspec to be passed into the probe logic. To keep the driver ops
APIs the same the fwspec is stored in dev->iommu under the
iommu_probe_device_lock.
If a fwspec is available use it to provide the ops instead of the bus.
Instead of returning 1 and trying to handle positive error codes just
stick to the convention of returning -ENODEV. Remove references to ops
from of_iommu_configure(), a NULL ops will already generate an error code.
There is no reason to check dev->bus, if err=0 at this point then the
called confi
This is not being used to pass ops, it is just a way to tell if an
iommu driver was probed. These days this can be detected directly via
device_iommu_mapped(). Call device_iommu_mapped() in the two places that
need to check it and remove the iommu parameter everywhere.
Signed-off-by: Jason Gunthor
This resolves the race around touching dev->iommu while generating the OF
fwspec on the of_iommu_configure() flow:
CPU0 CPU1
of_iommu_configure()iommu_device_register()
.. bus_iommu_probe()
iommu_fwspec_o
This is a version of iommu_fwspec_add_ids() that takes in the fwspec as an
argument instead of getting it through dev->iommu.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/iommu.c | 17 +++--
include/linux/iommu.h | 1 +
2 files changed, 12 insertions(+), 6 deletions(-)
diff --g
This is a more complete solution that the first attempt here:
https://lore.kernel.org/r/1698825902-10685-1-git-send-email-quic_zhenh...@quicinc.com
I haven't been able to test this on any HW that touches these paths, so if
some people with HW can help get it in shape it can become non-RFC.
The i
The optimization of kreallocing the entire fwspec only works if the fwspec
pointer is always stored in the dev->iommu. Since we want to change this
remove the optimization and make the ids array a distinct allocation.
Allow a single id to be stored inside the iommu_fwspec as a common case
optimiza
There are no external callers now.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/iommu.c | 3 ++-
include/linux/iommu.h | 6 --
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 62c82a28cd5db3..becd1b881e62dc 100644
--- a/dr
The new callback takes in the fwspec instead of retrieving it from the
dev->iommu. Provide iommu_fwspec_append_ids() to work directly on the
fwspec.
Convert SMMU, SMMUv3, and virtio to use iommu_fwspec_append_ids() and the
new entry point.
This avoids having to touch dev->iommu at all, and doesn'
These days the core code will free the fwspec if probe fails, no reason
for any driver to call this on a probe failure path.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/arm/arm-smmu/arm-smmu.c | 14 +-
drivers/iommu/tegra-smmu.c| 1 -
2 files changed, 5 insertions(+
This call chain is using dev->iommu->fwspec to pass around the fwspec
between the three parts (acpi_iommu_configure(), acpi_iommu_fwspec_init(),
iommu_probe_device()).
However there is no locking around the accesses to dev->iommu, so this is
all racy.
Allocate a clean, local, fwspec at the start
Nothing needs this pointer. Return a normal error code with the usual
IOMMU semantic that ENODEV means 'there is no IOMMU driver'.
Signed-off-by: Jason Gunthorpe
---
drivers/iommu/of_iommu.c | 29 ++---
drivers/of/device.c | 22 +++---
include/linux/o
A perfect driver would only call dev_iommu_priv_set() from its probe
callback. We've made it functionally correct to call it from the of_xlate
by adding a lock around that call.
lockdep assert that iommu_probe_device_lock is held to discourage misuse.
Exclude PPC kernels with CONFIG_FSL_PAMU turn
Reviewed-by: Jerry Snitselaar
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
On Fri, Nov 03, 2023 at 01:44:47PM -0300, Jason Gunthorpe wrote:
> Nothing needs this pointer. Return a normal error code with the usual
> IOMMU semantic that ENODEV means 'there is no IOMMU driver'.
>
> Signed-off-by: Jason Gunthorpe
> ---
> drivers/iommu/of_iommu.c | 29 ++-
On Fri, Nov 03, 2023 at 02:42:01PM -0700, Jerry Snitselaar wrote:
> On Fri, Nov 03, 2023 at 01:44:47PM -0300, Jason Gunthorpe wrote:
> > Nothing needs this pointer. Return a normal error code with the usual
> > IOMMU semantic that ENODEV means 'there is no IOMMU driver'.
> >
> > Signed-off-by: Jas
On Fri, Nov 03, 2023 at 01:44:48PM -0300, Jason Gunthorpe wrote:
> Instead of returning 1 and trying to handle positive error codes just
> stick to the convention of returning -ENODEV. Remove references to ops
> from of_iommu_configure(), a NULL ops will already generate an error code.
>
> There i
On Fri, Nov 03, 2023 at 01:44:49PM -0300, Jason Gunthorpe wrote:
> Nothing needs this pointer. Return a normal error code with the usual
> IOMMU semantic that ENODEV means 'there is no IOMMU driver'.
>
> Signed-off-by: Jason Gunthorpe
> ---
> drivers/acpi/scan.c | 24 +++-
>
23 matches
Mail list logo