diff mbox series

[v2,02/19] iommu/arm-smmu-v3: Master cannot be NULL in arm_smmu_write_strtab_ent()

Message ID 2-v2-de8b10590bf5+400-smmuv3_newapi_p1_jgg@nvidia.com (mailing list archive)
State New, archived
Headers show
Series Update SMMUv3 to the modern iommu API (part 1/3) | expand

Commit Message

Jason Gunthorpe Nov. 13, 2023, 5:53 p.m. UTC
The only caller is arm_smmu_install_ste_for_dev() which never has a NULL
master. Remove the confusing if.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Moritz Fischer Nov. 14, 2023, 3:17 p.m. UTC | #1
On Mon, Nov 13, 2023 at 01:53:09PM -0400, Jason Gunthorpe wrote:
> The only caller is arm_smmu_install_ste_for_dev() which never has a NULL
> master. Remove the confusing if.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> 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 519749d15fbda0..9117e769a965e1 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -1269,10 +1269,10 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
>  	 */
>  	u64 val = le64_to_cpu(dst->data[0]);
>  	bool ste_live = false;
> -	struct arm_smmu_device *smmu = NULL;
> +	struct arm_smmu_device *smmu = master->smmu;
>  	struct arm_smmu_ctx_desc_cfg *cd_table = NULL;
>  	struct arm_smmu_s2_cfg *s2_cfg = NULL;
> -	struct arm_smmu_domain *smmu_domain = NULL;
> +	struct arm_smmu_domain *smmu_domain = master->domain;
>  	struct arm_smmu_cmdq_ent prefetch_cmd = {
>  		.opcode		= CMDQ_OP_PREFETCH_CFG,
>  		.prefetch	= {
> @@ -1280,11 +1280,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
>  		},
>  	};
>  
> -	if (master) {
> -		smmu_domain = master->domain;
> -		smmu = master->smmu;
> -	}
> -
>  	if (smmu_domain) {
>  		switch (smmu_domain->stage) {
>  		case ARM_SMMU_DOMAIN_S1:
> -- 
> 2.42.0
>
Michael Shavit Nov. 15, 2023, 11:55 a.m. UTC | #2
On Tue, Nov 14, 2023 at 11:17 PM Moritz Fischer <mdf@kernel.org> wrote:
>
> On Mon, Nov 13, 2023 at 01:53:09PM -0400, Jason Gunthorpe wrote:
> > The only caller is arm_smmu_install_ste_for_dev() which never has a NULL
> > master. Remove the confusing if.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Moritz Fischer <mdf@kernel.org>
Reviewed-by: Michael Shavit <mshavit@google.com>
> > ---
> >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > 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 519749d15fbda0..9117e769a965e1 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > @@ -1269,10 +1269,10 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
> >        */
> >       u64 val = le64_to_cpu(dst->data[0]);
> >       bool ste_live = false;
> > -     struct arm_smmu_device *smmu = NULL;
> > +     struct arm_smmu_device *smmu = master->smmu;
> >       struct arm_smmu_ctx_desc_cfg *cd_table = NULL;
> >       struct arm_smmu_s2_cfg *s2_cfg = NULL;
> > -     struct arm_smmu_domain *smmu_domain = NULL;
> > +     struct arm_smmu_domain *smmu_domain = master->domain;
> >       struct arm_smmu_cmdq_ent prefetch_cmd = {
> >               .opcode         = CMDQ_OP_PREFETCH_CFG,
> >               .prefetch       = {
> > @@ -1280,11 +1280,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
> >               },
> >       };
> >
> > -     if (master) {
> > -             smmu_domain = master->domain;
> > -             smmu = master->smmu;
> > -     }
> > -
> >       if (smmu_domain) {
> >               switch (smmu_domain->stage) {
> >               case ARM_SMMU_DOMAIN_S1:
> > --
> > 2.42.0
> >
Eric Auger Nov. 27, 2023, 3:41 p.m. UTC | #3
Hi Jason,
On 11/13/23 18:53, Jason Gunthorpe wrote:
> The only caller is arm_smmu_install_ste_for_dev() which never has a NULL
> master. Remove the confusing if.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Eric
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> 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 519749d15fbda0..9117e769a965e1 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -1269,10 +1269,10 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
>  	 */
>  	u64 val = le64_to_cpu(dst->data[0]);
>  	bool ste_live = false;
> -	struct arm_smmu_device *smmu = NULL;
> +	struct arm_smmu_device *smmu = master->smmu;
>  	struct arm_smmu_ctx_desc_cfg *cd_table = NULL;
>  	struct arm_smmu_s2_cfg *s2_cfg = NULL;
> -	struct arm_smmu_domain *smmu_domain = NULL;
> +	struct arm_smmu_domain *smmu_domain = master->domain;
>  	struct arm_smmu_cmdq_ent prefetch_cmd = {
>  		.opcode		= CMDQ_OP_PREFETCH_CFG,
>  		.prefetch	= {
> @@ -1280,11 +1280,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
>  		},
>  	};
>  
> -	if (master) {
> -		smmu_domain = master->domain;
> -		smmu = master->smmu;
> -	}
> -
>  	if (smmu_domain) {
>  		switch (smmu_domain->stage) {
>  		case ARM_SMMU_DOMAIN_S1:
Nicolin Chen Dec. 5, 2023, 12:45 a.m. UTC | #4
On Mon, Nov 13, 2023 at 01:53:09PM -0400, Jason Gunthorpe wrote:
> The only caller is arm_smmu_install_ste_for_dev() which never has a NULL
> master. Remove the confusing if.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
diff mbox series

Patch

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 519749d15fbda0..9117e769a965e1 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1269,10 +1269,10 @@  static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
 	 */
 	u64 val = le64_to_cpu(dst->data[0]);
 	bool ste_live = false;
-	struct arm_smmu_device *smmu = NULL;
+	struct arm_smmu_device *smmu = master->smmu;
 	struct arm_smmu_ctx_desc_cfg *cd_table = NULL;
 	struct arm_smmu_s2_cfg *s2_cfg = NULL;
-	struct arm_smmu_domain *smmu_domain = NULL;
+	struct arm_smmu_domain *smmu_domain = master->domain;
 	struct arm_smmu_cmdq_ent prefetch_cmd = {
 		.opcode		= CMDQ_OP_PREFETCH_CFG,
 		.prefetch	= {
@@ -1280,11 +1280,6 @@  static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid,
 		},
 	};
 
-	if (master) {
-		smmu_domain = master->domain;
-		smmu = master->smmu;
-	}
-
 	if (smmu_domain) {
 		switch (smmu_domain->stage) {
 		case ARM_SMMU_DOMAIN_S1: