Re: [RFC v12 13/13] iommu/arm-smmu: Add a init_context_bank implementation hook

From: Will Deacon
Date: Thu Aug 13 2020 - 09:03:51 EST


On Mon, Aug 10, 2020 at 04:26:57PM -0600, Jordan Crouse wrote:
> Add a new implementation hook to allow the implementation specific code
> to tweek the context bank configuration just before it gets written.
> The first user will be the Adreno GPU implementation to turn on
> SCTLR.HUPCF to ensure that a page fault doesn't terminating pending
> transactions. Doing so could hang the GPU if one of the terminated
> transactions is a CP read.
>
> Signed-off-by: Jordan Crouse <jcrouse@xxxxxxxxxxxxxx>
> ---
>
> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 16 ++++++++++++++++
> drivers/iommu/arm/arm-smmu/arm-smmu.c | 21 +++++++++++++--------
> drivers/iommu/arm/arm-smmu/arm-smmu.h | 5 +++++
> 3 files changed, 34 insertions(+), 8 deletions(-)

We already have ->init_context(), so I'd prefer to use that instead of
adding another callback. Could we stick a couple of fields in
smmu_domain->cfg (e.g. sctlr_set, sctlr_clr) and handle those a bit like
we do for the asid/vmid on cavium implementations?

Will