[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMK4hEJXb2m36VOF@nvidia.com>
Date: Thu, 27 Jul 2023 15:33:40 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Michael Shavit <mshavit@...gle.com>
Cc: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>, jean-philippe@...aro.org,
nicolinc@...dia.com, baolu.lu@...ux.intel.com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 5/7] iommu/arm-smmu-v3: Skip cd sync if CD table isn't
active
On Fri, Jul 28, 2023 at 02:26:21AM +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.
>
> Signed-off-by: Michael Shavit <mshavit@...gle.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++++
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 ++
> 2 files changed, 6 insertions(+)
>
> 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 654acf6002bf3..af7949b62327b 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -987,6 +987,9 @@ static void arm_smmu_sync_cd(struct arm_smmu_domain *smmu_domain,
> },
> };
>
> + if (!smmu_domain->cd_table.installed)
> + return;
> +
> cmds.num = 0;
>
> spin_lock_irqsave(&smmu_domain->devices_lock, flags);
> @@ -1368,6 +1371,7 @@ 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;
> }
>
> 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 0e55ca0d40e6b..f301efe90b599 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -599,6 +599,8 @@ struct arm_smmu_ctx_desc_cfg {
> u8 max_cds_bits;
> /* Whether CD entries in this table have the stall bit set. */
> bool stall_enabled;
> + /* Whether this CD table is installed in any STE */
> + bool installed;
Do
u8 xx:1;
u8 yy:1;
For these things, Linus has complained about lists of bools in structs
before.
Jason
Powered by blists - more mailing lists