Re: [PATCH v5 8/9] iommu/arm-smmu-v3: Skip cd sync if CD table isn't active
From: Will Deacon
Date: Wed Aug 09 2023 - 09:50:23 EST
On Wed, Aug 09, 2023 at 01:12:04AM +0800, Michael Shavit wrote:
> This commit explicitly keeps track of whether a CD table is installed in
> an STE so that arm_smmu_sync_cd can skip the sync when unnecessary. This
> was previously achieved through the domain->devices list, but we are
> moving to a model where arm_smmu_sync_cd directly operates on a master
> and the master's CD table instead of a domain.
Why is this path worth optimising?
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index f5ad386cc8760..488d12dd2d4aa 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -985,6 +985,9 @@ static void arm_smmu_sync_cd(struct arm_smmu_master *master,
> },
> };
>
> + if (!master->cd_table.installed)
> + return;
Doesn't this interact badly with the sync in arm_smmu_detach_dev(), which I
think happens after zapping the STE?
> cmds.num = 0;
> for (i = 0; i < master->num_streams; i++) {
> cmd.cfgi.sid = master->streams[i].id;
> @@ -1091,7 +1094,7 @@ int arm_smmu_write_ctx_desc(struct arm_smmu_master *master, int ssid,
> cdptr[3] = cpu_to_le64(cd->mair);
>
> /*
> - * STE is live, and the SMMU might read dwords of this CD in any
> + * STE may be live, and the SMMU might read dwords of this CD in any
> * order. Ensure that it observes valid values before reading
> * V=1.
> */
Why does this patch need to update this comment?
Will