Skip to content

Commit 9fe18d8

Browse files
Bibek Kumar Patrowilldeacon
authored andcommitted
iommu/arm-smmu: Introduce ACTLR custom prefetcher settings
Currently in Qualcomm SoCs the default prefetch is set to 1 which allows the TLB to fetch just the next page table. MMU-500 features ACTLR register which is implementation defined and is used for Qualcomm SoCs to have a custom prefetch setting enabling TLB to prefetch the next set of page tables accordingly allowing for faster translations. ACTLR value is unique for each SMR (Stream matching register) and stored in a pre-populated table. This value is set to the register during context bank initialisation. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Bibek Kumar Patro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 7f2ef1b commit 9fe18d8

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,37 @@ static bool qcom_adreno_can_do_ttbr1(struct arm_smmu_device *smmu)
250250
return true;
251251
}
252252

253+
static void qcom_smmu_set_actlr_dev(struct device *dev, struct arm_smmu_device *smmu, int cbndx,
254+
const struct of_device_id *client_match)
255+
{
256+
const struct of_device_id *match =
257+
of_match_device(client_match, dev);
258+
259+
if (!match) {
260+
dev_dbg(dev, "no ACTLR settings present\n");
261+
return;
262+
}
263+
264+
arm_smmu_cb_write(smmu, cbndx, ARM_SMMU_CB_ACTLR, (unsigned long)match->data);
265+
}
266+
253267
static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain,
254268
struct io_pgtable_cfg *pgtbl_cfg, struct device *dev)
255269
{
256270
const struct device_node *np = smmu_domain->smmu->dev->of_node;
271+
struct arm_smmu_device *smmu = smmu_domain->smmu;
272+
struct qcom_smmu *qsmmu = to_qcom_smmu(smmu);
273+
const struct of_device_id *client_match;
274+
int cbndx = smmu_domain->cfg.cbndx;
257275
struct adreno_smmu_priv *priv;
258276

259277
smmu_domain->cfg.flush_walk_prefer_tlbiasid = true;
260278

279+
client_match = qsmmu->data->client_match;
280+
281+
if (client_match)
282+
qcom_smmu_set_actlr_dev(dev, smmu, cbndx, client_match);
283+
261284
/* Only enable split pagetables for the GPU device (SID 0) */
262285
if (!qcom_adreno_smmu_is_gpu_device(dev))
263286
return 0;
@@ -321,8 +344,18 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = {
321344
static int qcom_smmu_init_context(struct arm_smmu_domain *smmu_domain,
322345
struct io_pgtable_cfg *pgtbl_cfg, struct device *dev)
323346
{
347+
struct arm_smmu_device *smmu = smmu_domain->smmu;
348+
struct qcom_smmu *qsmmu = to_qcom_smmu(smmu);
349+
const struct of_device_id *client_match;
350+
int cbndx = smmu_domain->cfg.cbndx;
351+
324352
smmu_domain->cfg.flush_walk_prefer_tlbiasid = true;
325353

354+
client_match = qsmmu->data->client_match;
355+
356+
if (client_match)
357+
qcom_smmu_set_actlr_dev(dev, smmu, cbndx, client_match);
358+
326359
return 0;
327360
}
328361

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct qcom_smmu_match_data {
2828
const struct qcom_smmu_config *cfg;
2929
const struct arm_smmu_impl *impl;
3030
const struct arm_smmu_impl *adreno_impl;
31+
const struct of_device_id * const client_match;
3132
};
3233

3334
irqreturn_t qcom_smmu_context_fault(int irq, void *dev);

0 commit comments

Comments
 (0)