Arm SMMU fixes for 6.6 -rc

- Fix TLB range command encoding when TTL, Num and Scale are all zero
 
 - Fix soft lockup by limiting TLB invalidation ops issued by SVA
 
 - Fix clocks description for SDM630 platform in arm-smmu DT binding
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCgAuFiEEPxTL6PPUbjXGY88ct6xw3ITBYzQFAmUNbgwQHHdpbGxAa2Vy
 bmVsLm9yZwAKCRC3rHDchMFjND6PCACVc83E8PykHXnkffJHyBjBLG9l5wAmaA13
 kPqcfevXrSUBL7BcqhskydodQ61+23I3zqgQce+6lXzvSIDwfXqZDUghQWpthYNh
 5ZWeQy/R8XS90MLLMsLl0b7UzwdlZYZPZKY3VPHQJKP0otHrDVB3prz/CQb7Ccnl
 WGGwz2ZgsCatqf599ALFHsE6Xw3GWCODxhrC0FBF7lnyyde/6ElhM/rgrPER4UHz
 IsjF9cwlVgQ4MloWjoJb2MtSUGHnMi9fmHktTrriI07ReJYdI0LmwjJtgBv48Uzr
 CcLbgOyYsHvsz0hGIJZwXR3+FfrVNuoWBo5/AiZQvAHRVxnftGrZ
 =a32m
 -----END PGP SIGNATURE-----

Merge tag 'arm-smmu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into iommu/fixes

Arm SMMU fixes for 6.6 -rc

- Fix TLB range command encoding when TTL, Num and Scale are all zero

- Fix soft lockup by limiting TLB invalidation ops issued by SVA

- Fix clocks description for SDM630 platform in arm-smmu DT binding
This commit is contained in:
Joerg Roedel 2023-09-25 11:34:53 +02:00
commit 7accef5353
3 changed files with 27 additions and 8 deletions

View File

@ -270,6 +270,7 @@ allOf:
contains:
enum:
- qcom,msm8998-smmu-v2
- qcom,sdm630-smmu-v2
then:
anyOf:
- properties:
@ -311,7 +312,6 @@ allOf:
compatible:
contains:
enum:
- qcom,sdm630-smmu-v2
- qcom,sm6375-smmu-v2
then:
anyOf:

View File

@ -186,6 +186,15 @@ static void arm_smmu_free_shared_cd(struct arm_smmu_ctx_desc *cd)
}
}
/*
* Cloned from the MAX_TLBI_OPS in arch/arm64/include/asm/tlbflush.h, this
* is used as a threshold to replace per-page TLBI commands to issue in the
* command queue with an address-space TLBI command, when SMMU w/o a range
* invalidation feature handles too many per-page TLBI commands, which will
* otherwise result in a soft lockup.
*/
#define CMDQ_MAX_TLBI_OPS (1 << (PAGE_SHIFT - 3))
static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn,
struct mm_struct *mm,
unsigned long start,
@ -201,8 +210,13 @@ static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn,
* range. So do a simple translation here by calculating size correctly.
*/
size = end - start;
if (size == ULONG_MAX)
size = 0;
if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_RANGE_INV)) {
if (size >= CMDQ_MAX_TLBI_OPS * PAGE_SIZE)
size = 0;
} else {
if (size == ULONG_MAX)
size = 0;
}
if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) {
if (!size)

View File

@ -1895,18 +1895,23 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd,
/* Get the leaf page size */
tg = __ffs(smmu_domain->domain.pgsize_bitmap);
num_pages = size >> tg;
/* Convert page size of 12,14,16 (log2) to 1,2,3 */
cmd->tlbi.tg = (tg - 10) / 2;
/*
* Determine what level the granule is at. For non-leaf, io-pgtable
* assumes .tlb_flush_walk can invalidate multiple levels at once,
* so ignore the nominal last-level granule and leave TTL=0.
* Determine what level the granule is at. For non-leaf, both
* io-pgtable and SVA pass a nominal last-level granule because
* they don't know what level(s) actually apply, so ignore that
* and leave TTL=0. However for various errata reasons we still
* want to use a range command, so avoid the SVA corner case
* where both scale and num could be 0 as well.
*/
if (cmd->tlbi.leaf)
cmd->tlbi.ttl = 4 - ((ilog2(granule) - 3) / (tg - 3));
num_pages = size >> tg;
else if ((num_pages & CMDQ_TLBI_RANGE_NUM_MAX) == 1)
num_pages++;
}
cmds.num = 0;