Re: [PATCH 10/10] ACPI: IORT: Allow COMPILE_TEST of IORT

2023-11-28 Thread Moritz Fischer
On Tue, Nov 28, 2023 at 08:48:06PM -0400, Jason Gunthorpe wrote: The arm-smmu driver can COMPILE_TEST on x86, so expand this to also enable the IORT code so it can be COMPILE_TEST'd too. Signed-off-by: Jason Gunthorpe --- drivers/acpi/Kconfig| 2 -- drivers/acpi/Makefile | 2

Re: [PATCH 09/10] ACPI: IORT: Cast from ULL to phys_addr_t

2023-11-28 Thread Moritz Fischer
On Tue, Nov 28, 2023 at 08:48:05PM -0400, Jason Gunthorpe wrote: gcc on i386 (when compile testing) warns: This is a weird test. The Makefile for drivers/acpi/arm64 is conditional on CONFIG_ARM64. How does this happen? 8->8 obj-$(CONFIG_ARM64) += arm64/ 8->8 drivers/acpi/ar

Re: [PATCH 07/10] acpi: Do not return struct iommu_ops from acpi_iommu_configure_id()

2023-11-28 Thread Moritz Fischer
On Tue, Nov 28, 2023 at 08:48:03PM -0400, 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'. Acked-by: Rafael J. Wysocki Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-b

Re: [PATCH 04/10] iommu: Mark dev_iommu_get() with lockdep

2023-11-28 Thread Moritz Fischer
On Tue, Nov 28, 2023 at 08:48:00PM -0400, Jason Gunthorpe wrote: Allocation of dev->iommu must be done under the iommu_probe_device_lock. Mark this with lockdep to discourage future mistakes. Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers

Re: [PATCH 03/10] iommu/of: Use -ENODEV consistently in of_iommu_configure()

2023-11-28 Thread Moritz Fischer
On Tue, Nov 28, 2023 at 08:47:59PM -0400, 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 is no r

Re: [PATCH 04/10] iommu: Mark dev_iommu_get() with lockdep

2023-11-28 Thread Baolu Lu
On 2023/11/29 8:48, Jason Gunthorpe wrote: Allocation of dev->iommu must be done under the iommu_probe_device_lock. Mark this with lockdep to discourage future mistakes. Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ 1 f

Re: [PATCH 07/10] acpi: Do not return struct iommu_ops from acpi_iommu_configure_id()

2023-11-28 Thread Baolu Lu
On 2023/11/29 8:48, 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'. Acked-by: Rafael J. Wysocki Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- dr

Re: [PATCH 02/10] iommmu/of: Do not return struct iommu_ops from of_iommu_configure()

2023-11-28 Thread Baolu Lu
On 2023/11/29 8:47, 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'. Reviewed-by: Jerry Snitselaar Acked-by: Rob Herring Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers/

[PATCH 03/10] iommu/of: Use -ENODEV consistently in of_iommu_configure()

2023-11-28 Thread Jason Gunthorpe
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

[PATCH 08/10] iommu/tegra: Use tegra_dev_iommu_get_stream_id() in the remaining places

2023-11-28 Thread Jason Gunthorpe
This API was defined to formalize the access to internal iommu details on some Tegra SOCs, but a few callers got missed. Add them. The helper already masks by 0x so remove this code from the callers. Suggested-by: Thierry Reding Signed-off-by: Jason Gunthorpe --- drivers/dma/tegra186-gpc-d

[PATCH 02/10] iommmu/of: Do not return struct iommu_ops from of_iommu_configure()

2023-11-28 Thread Jason Gunthorpe
Nothing needs this pointer. Return a normal error code with the usual IOMMU semantic that ENODEV means 'there is no IOMMU driver'. Reviewed-by: Jerry Snitselaar Acked-by: Rob Herring Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers/iommu/of_iommu.c | 31 +++-

[PATCH 01/10] iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()

2023-11-28 Thread Jason Gunthorpe
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. Reviewed-by: Jerry Snitselaa

[PATCH 10/10] ACPI: IORT: Allow COMPILE_TEST of IORT

2023-11-28 Thread Jason Gunthorpe
The arm-smmu driver can COMPILE_TEST on x86, so expand this to also enable the IORT code so it can be COMPILE_TEST'd too. Signed-off-by: Jason Gunthorpe --- drivers/acpi/Kconfig| 2 -- drivers/acpi/Makefile | 2 +- drivers/acpi/arm64/Kconfig | 1 + drivers/acpi/arm64/Makefile | 2

[PATCH 04/10] iommu: Mark dev_iommu_get() with lockdep

2023-11-28 Thread Jason Gunthorpe
Allocation of dev->iommu must be done under the iommu_probe_device_lock. Mark this with lockdep to discourage future mistakes. Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers/iommu/iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/d

[PATCH 06/10] iommu: Replace iommu_device_lock with iommu_probe_device_lock

2023-11-28 Thread Jason Gunthorpe
The iommu_device_lock protects the iommu_device_list which is only read by iommu_ops_from_fwnode(). This is now always called under the iommu_probe_device_lock, so we don't need to double lock the linked list. Use the iommu_probe_device_lock on the write side too. Signed-off-by: Jason Gunthorpe

[PATCH 05/10] iommu: Mark dev_iommu_priv_set() with a lockdep

2023-11-28 Thread Jason Gunthorpe
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

[PATCH 07/10] acpi: Do not return struct iommu_ops from acpi_iommu_configure_id()

2023-11-28 Thread Jason Gunthorpe
Nothing needs this pointer. Return a normal error code with the usual IOMMU semantic that ENODEV means 'there is no IOMMU driver'. Acked-by: Rafael J. Wysocki Reviewed-by: Jerry Snitselaar Tested-by: Hector Martin Signed-off-by: Jason Gunthorpe --- drivers/acpi/scan.c | 29 +--

[PATCH 00/10] IOMMU related FW parsing cleanup

2023-11-28 Thread Jason Gunthorpe
These are the patches from the from the prior series without the "fwspec polishing": https://lore.kernel.org/r/0-v2-36a0088ecaa7+22c6e-iommu_fwspec_...@nvidia.com Rebased onto Robin's patch: https://lore.kernel.org/all/16f433658661d7cadfea51e7c65da95826112a2b.1700071477.git.robin.mur...@arm.com

[PATCH 09/10] ACPI: IORT: Cast from ULL to phys_addr_t

2023-11-28 Thread Jason Gunthorpe
gcc on i386 (when compile testing) warns: drivers/acpi/arm64/iort.c:2014:18: warning: implicit conversion from 'unsigned long long' to 'phys_addr_t' (aka 'unsigned int') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion] local_limit = DMA_B