Re: [PATCH v4 7/8] iommu/arm-smmu-v3: Skip cd sync if CD table isn't active

From: Nicolin Chen
Date: Fri Aug 04 2023 - 15:59:22 EST


On Thu, Aug 03, 2023 at 12:32:35AM +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.

> @@ -1360,6 +1363,9 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
> cd_table->l1_desc ?
> STRTAB_STE_0_S1FMT_64K_L2 :
> STRTAB_STE_0_S1FMT_LINEAR);
> + cd_table->installed = true;
> + } else {
> + master->cd_table.installed = false;

Before this chunk, there is another fork for "Bypass/fault", where
we could set "installed" to false too, although it doesn't seem to
cause a problem at this moment since arm_smmu_sync_cd() is called
only in the context of an ARM_SMMU_DOMAIN_S1.

Otherwise,

Reviewed-by: Nicolin Chen <nicolinc@xxxxxxxxxx>