mirrored from git://xenbits.xen.org/xen.git
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xen/arm: smmuv1: Intelligent SMR allocation
Backport 588888a7399db352d2b1a41c9d5b3bf0fd482390 "iommu/arm-smmu: Intelligent SMR allocation" from the Linux kernel This patch fix the stream match conflict issue when two devices have the same stream-id. Only difference while applying this patch with regard to Linux patch are as follows: 1. Spinlock is used in place of mutex when attaching a device to the SMMU via arm_smmu_master_alloc_smes(..) function call.Replacing the mutex with spinlock is fine here as we are configuring the hardware via registers and it is very fast. 2. move iommu_group_alloc(..) function call in arm_smmu_add_device(..) function from the start of the function to the end. Original commit message: iommu/arm-smmu: Intelligent SMR allocation Stream Match Registers are one of the more awkward parts of the SMMUv2 architecture; there are typically never enough to assign one to each stream ID in the system, and configuring them such that a single ID matches multiple entries is catastrophically bad - at best, every transaction raises a global fault; at worst, they go *somewhere*. To address the former issue, we can mask ID bits such that a single register may be used to match multiple IDs belonging to the same device or group, but doing so also heightens the risk of the latter problem (which can be nasty to debug). Tackle both problems at once by replacing the simple bitmap allocator with something much cleverer. Now that we have convenient in-memory representations of the stream mapping table, it becomes straightforward to properly validate new SMR entries against the current state, opening the door to arbitrary masking and SMR sharing. Another feature which falls out of this is that with IDs shared by separate devices being automatically accounted for, simply associating a group pointer with the S2CR offers appropriate group allocation almost for free, so hook that up in the process. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Rahul Singh <rahul.singh@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Acked-by: Julien GralL <jgrall@amazon.com>
- Loading branch information
Showing
1 changed file
with
142 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters