Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 2bd5059c6cc04b02073d4d9f57137ab74e1d8e7a
- Merge: a38297e3fb012 209516caff7b0 da55da5a42d42 de111f6b4f6a3 8b80549f1bc69 ba00196ca41c4
- Author: Joerg Roedel <[email protected]>
- Date: Mon May 13 14:06:54 2024 +0200
- Merge branches 'arm/renesas', 'arm/smmu', 'x86/amd', 'core' and 'x86/vt-d' into next
- commit da55da5a42d4247d7a48b843fa5fcd9a4a10f4fe
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue May 7 10:21:10 2024 -0300
- iommu/arm-smmu-v3: Make the kunit into a module
- It turns out kconfig has problems ensuring the SMMU module and the KUNIT
- module are consistently y/m to allow linking. It will permit KUNIT to be a
- module while SMMU is built in.
- Also, Fedora apparently enables kunit on production kernels.
- So, put the entire kunit in its own module using the
- VISIBLE_IF_KUNIT/EXPORT_SYMBOL_IF_KUNIT machinery. This keeps it out of
- vmlinus on Fedora and makes the kconfig work in the normal way. There is
- no cost if kunit is disabled.
- Fixes: 56e1a4cc2588 ("iommu/arm-smmu-v3: Add unit tests for arm_smmu_write_entry")
- Reported-by: Thorsten Leemhuis <[email protected]>
- Link: https://lore.kernel.org/all/[email protected]
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Tested-by: Thorsten Leemhuis <[email protected]>
- Acked-by: Will Deacon <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Joerg Roedel <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/Makefile | 3 ++-
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 1 +
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c | 3 +++
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 ++++++++
- 4 files changed, 14 insertions(+), 1 deletion(-)
- commit 56e1a4cc2588a7cb9664457a62fd7a77e005aa01
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:41 2024 -0300
- iommu/arm-smmu-v3: Add unit tests for arm_smmu_write_entry
- Add tests for some of the more common STE update operations that we expect
- to see, as well as some artificial STE updates to test the edges of
- arm_smmu_write_entry. These also serve as a record of which common
- operation is expected to be hitless, and how many syncs they require.
- arm_smmu_write_entry implements a generic algorithm that updates an STE/CD
- to any other abritrary STE/CD configuration. The update requires a
- sequence of write+sync operations with some invariants that must be held
- true after each sync. arm_smmu_write_entry lends itself well to
- unit-testing since the function's interaction with the STE/CD is already
- abstracted by input callbacks that we can hook to introspect into the
- sequence of operations. We can use these hooks to guarantee that
- invariants are held throughout the entire update operation.
- Link: https://lore.kernel.org/r/[email protected]
- Tested-by: Nicolin Chen <[email protected]>
- Signed-off-by: Michael Shavit <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/Makefile | 1 +
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 8 +-
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c | 465 +++++++++++++++++++++++
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 +--
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 30 ++
- 5 files changed, 521 insertions(+), 26 deletions(-)
- commit 04905c17f64890311e6b5a5065d8c220602712e5
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:40 2024 -0300
- iommu/arm-smmu-v3: Build the whole CD in arm_smmu_make_s1_cd()
- Half the code was living in arm_smmu_domain_finalise_s1(), just move it
- here and take the values directly from the pgtbl_ops instead of storing
- copies.
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 47 +++++++++++------------------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 --
- 2 files changed, 18 insertions(+), 32 deletions(-)
- commit 7b87c93c8b86d9d9b9567d83f0ca3d3046fdfc5a
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:39 2024 -0300
- iommu/arm-smmu-v3: Move the CD generation for SVA into a function
- Pull all the calculations for building the CD table entry for a mmu_struct
- into arm_smmu_make_sva_cd().
- Call it in the two places installing the SVA CD table entry.
- Open code the last caller of arm_smmu_update_ctx_desc_devices() and remove
- the function.
- Remove arm_smmu_write_ctx_desc() since all callers are gone. Add the
- locking assertions to arm_smmu_alloc_cd_ptr() since
- arm_smmu_update_ctx_desc_devices() was the last problematic caller.
- Remove quiet_cd since all users are gone, arm_smmu_make_sva_cd() creates
- the same value.
- The behavior of quiet_cd changes slightly, the old implementation edited
- the CD in place to set CTXDESC_CD_0_TCR_EPD0 assuming it was a SVA CD
- entry. This version generates a full CD entry with a 0 TTB0 and relies on
- arm_smmu_write_cd_entry() to install it hitlessly.
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 155 +++++++++++++++---------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 77 ++----------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 7 +-
- 3 files changed, 107 insertions(+), 132 deletions(-)
- commit 13abe4faac4348da0cf1c4eeb2b1b39fcfdb4b8f
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:38 2024 -0300
- iommu/arm-smmu-v3: Allocate the CD table entry in advance
- Avoid arm_smmu_attach_dev() having to undo the changes to the
- smmu_domain->devices list, acquire the cdptr earlier so we don't need to
- handle that error.
- Now there is a clear break in arm_smmu_attach_dev() where all the
- prep-work has been done non-disruptively and we commit to making the HW
- change, which cannot fail.
- This completes transforming arm_smmu_attach_dev() so that it does not
- disturb the HW if it fails.
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 24 ++++++++----------------
- 1 file changed, 8 insertions(+), 16 deletions(-)
- commit b2f4c0fcf094dacd2d1fb96a6fd6598919501589
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:37 2024 -0300
- iommu/arm-smmu-v3: Make arm_smmu_alloc_cd_ptr()
- Only the attach callers can perform an allocation for the CD table entry,
- the other callers must not do so, they do not have the correct locking and
- they cannot sleep. Split up the functions so this is clear.
- arm_smmu_get_cd_ptr() will return pointer to a CD table entry without
- doing any kind of allocation.
- arm_smmu_alloc_cd_ptr() will allocate the table and any required
- leaf.
- A following patch will add lockdep assertions to arm_smmu_alloc_cd_ptr()
- once the restructuring is completed and arm_smmu_alloc_cd_ptr() is never
- called in the wrong context.
- Tested-by: Nicolin Chen <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 59 +++++++++++++++++++----------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +-
- 2 files changed, 39 insertions(+), 23 deletions(-)
- commit af8f0b83ea2bcc7cd365c32044f31bdadc07c351
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:36 2024 -0300
- iommu/arm-smmu-v3: Consolidate clearing a CD table entry
- A cleared entry is all 0's. Make arm_smmu_clear_cd() do this sequence.
- If we are clearing an entry and for some reason it is not already
- allocated in the CD table then something has gone wrong.
- Remove case (5) from arm_smmu_write_ctx_desc().
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Reviewed-by: Moritz Fischer <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 26 +++++++++++++++----------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 +
- 3 files changed, 18 insertions(+), 11 deletions(-)
- commit e9d1e4ff74b96cf180d04be38541a245c8c574c1
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:35 2024 -0300
- iommu/arm-smmu-v3: Move the CD generation for S1 domains into a function
- Introduce arm_smmu_make_s1_cd() to build the CD from the paging S1 domain,
- and reorganize all the places programming S1 domain CD table entries to
- call it.
- Split arm_smmu_update_s1_domain_cd_entry() from
- arm_smmu_update_ctx_desc_devices() so that the S1 path has its own call
- chain separate from the unrelated SVA path.
- arm_smmu_update_s1_domain_cd_entry() only works on S1 domains attached to
- RIDs and refreshes all their CDs. Remove case (3) from
- arm_smmu_write_ctx_desc() as it is now handled by directly calling
- arm_smmu_write_cd_entry().
- Remove the forced clear of the CD during S1 domain attach,
- arm_smmu_write_cd_entry() will do this automatically if necessary.
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- [will: Drop unused arm_smmu_clean_cd_entry() function]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 25 ++++++++-
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 71 +++++++++++++++----------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 9 ++++
- 3 files changed, 76 insertions(+), 29 deletions(-)
- commit 78a5fbe8395b365d58142ff9b7a6aeb556481a1f
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:34 2024 -0300
- iommu/arm-smmu-v3: Make CD programming use arm_smmu_write_entry()
- CD table entries and STE's have the same essential programming sequence,
- just with different types. Use the new ops indirection to link CD
- programming to the common writer.
- In a few more patches all CD writers will call an appropriate make
- function and then directly call arm_smmu_write_cd_entry().
- arm_smmu_write_ctx_desc() will be removed.
- Until then lightly tweak arm_smmu_write_ctx_desc() to also use the new
- programmer by using the same logic as right now to build the target CD on
- the stack, sanitizing it to meet the used rules, and then using the
- writer.
- Sanitizing is necessary because the writer expects that the currently
- programmed CD follows the used rules. Next patches add new make functions
- and new direct calls to arm_smmu_write_cd_entry() which will require this.
- Signed-off-by: Michael Shavit <[email protected]>
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Moritz Fischer <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 89 ++++++++++++++++++++++-------
- 1 file changed, 67 insertions(+), 22 deletions(-)
- commit de31c355541286aa4c938c982dfcafbf062fcb93
- Author: Jason Gunthorpe <[email protected]>
- Date: Tue Apr 30 14:21:33 2024 -0300
- iommu/arm-smmu-v3: Add an ops indirection to the STE code
- Prepare to put the CD code into the same mechanism. Add an ops indirection
- around all the STE specific code and make the worker functions independent
- of the entry content being processed.
- get_used and sync ops are provided to hook the correct code.
- Signed-off-by: Michael Shavit <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 176 ++++++++++++++++------------
- 1 file changed, 104 insertions(+), 72 deletions(-)
- commit 80fea979dd9d48d67c5b48d2f690c5da3e543ebd
- Author: Aleksandr Aprelkov <[email protected]>
- Date: Wed Apr 3 12:37:59 2024 +0700
- iommu/arm-smmu-v3: Free MSIs in case of ENOMEM
- If devm_add_action() returns -ENOMEM, then MSIs are allocated but not
- not freed on teardown. Use devm_add_action_or_reset() instead to keep
- the static analyser happy.
- Found by Linux Verification Center (linuxtesting.org) with SVACE.
- Signed-off-by: Aleksandr Aprelkov <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- [will: Tweak commit message, remove warning message]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- commit d2f85a263883b679f87ed8f911746105658e9c47
- Author: Yi Liu <[email protected]>
- Date: Thu Mar 28 05:29:58 2024 -0700
- iommu: Pass domain to remove_dev_pasid() op
- Existing remove_dev_pasid() callbacks of the underlying iommu drivers
- get the attached domain from the group->pasid_array. However, the domain
- stored in group->pasid_array is not always correct in all scenarios.
- A wrong domain may result in failure in remove_dev_pasid() callback.
- To avoid such problems, it is more reliable to pass the domain to the
- remove_dev_pasid() op.
- Suggested-by: Jason Gunthorpe <[email protected]>
- Signed-off-by: Yi Liu <[email protected]>
- Reviewed-by: Kevin Tian <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Joerg Roedel <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++-------
- 1 file changed, 2 insertions(+), 7 deletions(-)
- commit e8e4398d53f98be7ac48e0bda9ea6e26df24136d
- Author: Jason Gunthorpe <[email protected]>
- Date: Wed Mar 27 15:07:51 2024 -0300
- iommu/arm-smmu-v3: Add a type for the CD entry
- Instead of passing a naked __le16 * around to represent a CD table entry
- wrap it in a "struct arm_smmu_cd" with an array of the correct size. This
- makes it much clearer which functions will comprise the "CD API".
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Moritz Fischer <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 20 +++++++++++---------
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 7 ++++++-
- 2 files changed, 17 insertions(+), 10 deletions(-)
- commit 86e5ca098dd9f8c5b80a6205395aea0535018837
- Author: Jason Gunthorpe <[email protected]>
- Date: Wed Mar 27 15:07:50 2024 -0300
- iommu/arm-smmu-v3: Do not ATC invalidate the entire domain
- At this point we know which master we are going to change the PCI config
- on, this is the only device we need to invalidate. Switch
- arm_smmu_atc_inv_domain() for arm_smmu_atc_inv_master().
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Reviewed-by: Michael Shavit <[email protected]>
- Reviewed-by: Nicolin Chen <[email protected]>
- Reviewed-by: Moritz Fischer <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
- commit fdc69d39e77f88264ee6e8174ff9aaf0953aecd9
- Author: Jason Gunthorpe <[email protected]>
- Date: Wed Mar 27 15:07:49 2024 -0300
- iommu/arm-smmu-v3: Do not allow a SVA domain to be set on the wrong PASID
- The SVA code is wired to assume that the SVA is programmed onto the
- mm->pasid. The current core code always does this, so it is fine.
- Add a check for clarity.
- Tested-by: Nicolin Chen <[email protected]>
- Tested-by: Shameer Kolothum <[email protected]>
- Signed-off-by: Jason Gunthorpe <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 3 +++
- 1 file changed, 3 insertions(+)
- commit 734554fdfce6731b22f0777ec3f1e4a853354883
- Author: Robin Murphy <[email protected]>
- Date: Fri Apr 5 17:52:07 2024 +0100
- iommu/arm-smmu-v3: Retire disable_bypass parameter
- The disable_bypass parameter has been mostly meaningless for a long time
- since the introduction of default domains. Its original intent is now
- fulfilled by the controls users have over the default domain type, and
- its remaining effect in the brief window between Stream Table
- initialisation and default domain creation hardly seems worth the
- complication. Furthermore, thanks to 2-level Stream Tables, disabling
- disable_bypass (there's another reason not to like it right there) has
- never guaranteed that any particular StreamID *will* bypass anyway - any
- device which might actually care about that wants RMRs - so there's not
- really much lost by taking away that option (which has already been
- non-default for nearing 6 years now).
- As part of this, also remove the weird behaviour where we "successfully"
- probe and register a non-functional SMMU if the DT "#iommu-cells"
- property is wrong. I have no memory of what possessed me to think that
- was a good idea at the time, and by now I suspect it's likely to break
- things worse than simply failing probe would.
- Signed-off-by: Robin Murphy <[email protected]>
- Reviewed-by: Mostafa Saleh <[email protected]>
- Link: https://lore.kernel.org/r/ea3ac4cd595a81b5511729601b2f7d4668178438.1712335927.git.robin.murphy@arm.com
- Signed-off-by: Will Deacon <[email protected]>
- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 46 ++++++++---------------------
- 1 file changed, 13 insertions(+), 33 deletions(-)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement