Message ID | 20230816211849.v6.9.Idedc0f496231e2faab3df057219c5e2d937bbfe4@changeid (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Refactor the SMMU's CD table ownership | expand |
On Wed, Aug 16, 2023 at 9:20 PM Michael Shavit <mshavit@google.com> 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. > > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> > Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> > Signed-off-by: Michael Shavit <mshavit@google.com> > --- > Happy to drop this commit if we don't think it's useful. Hi Will, Do you have any recommendations for keeping or dropping this commit in the end? It's only purpose is to minimize any potential performance impact from the refactor but can certainly be dropped if you don't think it's worth the complication.
On Mon, Aug 21, 2023 at 06:16:08PM +0800, Michael Shavit wrote: > On Wed, Aug 16, 2023 at 9:20 PM Michael Shavit <mshavit@google.com> 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. > > > > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> > > Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> > > Signed-off-by: Michael Shavit <mshavit@google.com> > > --- > > Happy to drop this commit if we don't think it's useful. > > Hi Will, > Do you have any recommendations for keeping or dropping this commit in > the end? It's only purpose is to minimize any potential performance > impact from the refactor but can certainly be dropped if you don't > think it's worth the complication. I'd prefer to drop it unless somebody can measure the benefits that it brings. Will
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 3c8bfeca89d5c..104b8d6ea5972 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; + cmds.num = 0; for (i = 0; i < master->num_streams; i++) { cmd.cfgi.sid = master->streams[i].id; @@ -1335,6 +1338,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, */ if (smmu) arm_smmu_sync_ste_for_sid(smmu, sid); + master->cd_table.installed = false; return; } @@ -1358,6 +1362,9 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_S1_TRANS) | FIELD_PREP(STRTAB_STE_0_S1CDMAX, cd_table->s1cdmax) | FIELD_PREP(STRTAB_STE_0_S1FMT, cd_table->s1fmt); + cd_table->installed = true; + } else { + master->cd_table.installed = false; } if (s2_cfg) { diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index 2f4b832e0deb4..b7a91c8e9b523 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -600,6 +600,8 @@ struct arm_smmu_ctx_desc_cfg { u8 s1cdmax; /* Whether CD entries in this table have the stall bit set. */ u8 stall_enabled:1; + /* Whether this CD table is installed in any STE */ + u8 installed:1; }; struct arm_smmu_s2_cfg {