Subject: Re: [PATCH 5/9] iommu/arm-smmu-v3: Remove CMDQ_OP_CFGI_CD_ALL from arm_smmu_cmdq_build_cmd()

From: Pranjal Shrivastava <[email-masked]>
Date: Fri, 8 May 2026 17:17:14 +0000

On Fri, May 08, 2026 at 01:02:36PM -0300, Jason Gunthorpe wrote:
> On Fri, May 08, 2026 at 09:45:55AM +0000, Pranjal Shrivastava wrote:
> > On Fri, May 01, 2026 at 11:29:14AM -0300, Jason Gunthorpe wrote:
> > > Nothing uses this, just dead code.
> > > 
> > > Signed-off-by: Jason Gunthorpe <[email-masked]>
> > > ---
> > >  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 ---
> > >  1 file changed, 3 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 b3ef001ce80d23..ef0907b1a2204f 100644
> > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > > @@ -290,9 +290,6 @@ static int arm_smmu_cmdq_build_cmd(struct arm_smmu_cmd *cmd_out,
> > >  		cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SID, ent->cfgi.sid);
> > >  		cmd[1] |= FIELD_PREP(CMDQ_CFGI_1_LEAF, ent->cfgi.leaf);
> > >  		break;
> > > -	case CMDQ_OP_CFGI_CD_ALL:
> > > -		cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SID, ent->cfgi.sid);
> > > -		break;
> > >  	case CMDQ_OP_CFGI_ALL:
> > >  		/* Cover the entire SID range */
> > >  		cmd[1] |= FIELD_PREP(CMDQ_CFGI_1_RANGE, 31);
> > 
> > CMDQ_OP_CFGI_CD_ALL is also present in arm-smmu-v3-iommufd.c
> > I'm wondering if we should remove this from the iommufd.c file too?
> 
> > This op code seems to be unused since 5.15, if a guest is running the
> > same Linux driver, it will never generate this command anyway.
> 
> Yes
>  
> > Unless we care about Guest VMs running non-Linux OSes, 
> 
> We certainly do :)
> 
> And who knows, Linux might start using it someday!
> 
> Guest emulation has to cover all the commands a guest is allowed to
> execute, and that is what the iommufd code is doing.

Alright, it makes sense to keep it in iommufd fir diverse guests.
No further concerns.

Thanks,
Praan