Commit e3a56b3
iommu/arm-smmu-v3: Pre-allocate a per-master invalidation array
When a master is attached from an old domain to a new domain, it needs to
build an invalidation array to delete and add the array entries from/onto
the invalidation arrays of those two domains, passed via the to_merge and
to_unref arguments into arm_smmu_invs_merge/unref() respectively.
Since the master->num_streams might differ across masters, a memory would
have to be allocated when building an to_merge/to_unref array which might
fail with -ENOMEM.
On the other hand, an attachment to arm_smmu_blocked_domain must not fail
so it's the best to avoid any memory allocation in that path.
Pre-allocate a fixed size invalidation array for every master. This array
will be used as a scratch to fill dynamically when building a to_merge or
to_unref invs array. Sort fwspec->ids in an ascending order to fit to the
arm_smmu_invs_merge() function.
Co-developed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>1 parent 15a2a56 commit e3a56b3
2 files changed
Lines changed: 45 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3789 | 3789 | | |
3790 | 3790 | | |
3791 | 3791 | | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
3792 | 3800 | | |
3793 | 3801 | | |
3794 | 3802 | | |
3795 | 3803 | | |
3796 | 3804 | | |
3797 | 3805 | | |
| 3806 | + | |
| 3807 | + | |
3798 | 3808 | | |
3799 | 3809 | | |
3800 | 3810 | | |
3801 | 3811 | | |
3802 | 3812 | | |
3803 | 3813 | | |
3804 | | - | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
| 3823 | + | |
| 3824 | + | |
| 3825 | + | |
3805 | 3826 | | |
3806 | 3827 | | |
3807 | | - | |
3808 | | - | |
3809 | 3828 | | |
3810 | | - | |
| 3829 | + | |
3811 | 3830 | | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
3812 | 3843 | | |
3813 | 3844 | | |
3814 | 3845 | | |
| |||
3838 | 3869 | | |
3839 | 3870 | | |
3840 | 3871 | | |
| 3872 | + | |
3841 | 3873 | | |
3842 | 3874 | | |
3843 | 3875 | | |
| |||
3859 | 3891 | | |
3860 | 3892 | | |
3861 | 3893 | | |
| 3894 | + | |
3862 | 3895 | | |
3863 | 3896 | | |
3864 | 3897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
931 | 939 | | |
932 | 940 | | |
933 | 941 | | |
| |||
0 commit comments