[PATCH 1/7] iommu/arm-smmu-v3: Split struct arm_smmu_strtab_cfg.strtab

Nicolin Chen nicolinc at nvidia.com
Tue Jun 4 01:32:20 PDT 2024


On Mon, Jun 03, 2024 at 07:31:27PM -0300, Jason Gunthorpe wrote:

> 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 1242a086c9f948..4769780259affc 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -612,7 +610,10 @@ struct arm_smmu_s2_cfg {
>  };
>  
>  struct arm_smmu_strtab_cfg {
> -	__le64				*strtab;
> +	union {
> +		struct arm_smmu_ste *linear;
> +		__le64 *l1_desc;
> +	} strtab;
>  	dma_addr_t			strtab_dma;
>  	struct arm_smmu_strtab_l1_desc	*l1_desc;
>  	unsigned int			num_l1_ents;

It looks like we have two "l1_desc" ptrs now in the same struct:
	strtab.l1_desc	// raw level-1 descriptor memory
	l1_desc		// SW array to store level-2 descriptor memory

And it gets a bit more confusing that they even use the same error
prints in arm_smmu_init_strtab_2lvl()...

The "struct arm_smmu_strtab_l1_desc" seems to be only used at one
place in arm_smmu_init_l2_strtab(). So, how about:

struct arm_smmu_strtab_cfg {
	union {
		struct arm_smmu_ste *linear;
		__le64 *l1_desc;
	} strtab;
	dma_addr_t			strtab_dma;
	struct arm_smmu_ste		**l2ptrs;

Thanks
Nicolin



More information about the linux-arm-kernel mailing list