Skip to content

Commit 9eb6a66

Browse files
nicolincjgunthorpe
authored andcommitted
iommu/arm-smmu-v3-iommufd: Add hw_info to impl_ops
This will be used by Tegra241 CMDQV implementation to report a non-default HW info data. Link: https://patch.msgid.link/r/8a3bf5709358eb21aed2e8434534c30ecf83917c.1752126748.git.nicolinc@nvidia.com Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Pranjal Shrivastava <[email protected]> Signed-off-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 61dd912 commit 9eb6a66

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ void *arm_smmu_hw_info(struct device *dev, u32 *length,
1111
enum iommu_hw_info_type *type)
1212
{
1313
struct arm_smmu_master *master = dev_iommu_priv_get(dev);
14+
const struct arm_smmu_impl_ops *impl_ops = master->smmu->impl_ops;
1415
struct iommu_hw_info_arm_smmuv3 *info;
1516
u32 __iomem *base_idr;
1617
unsigned int i;
1718

1819
if (*type != IOMMU_HW_INFO_TYPE_DEFAULT &&
19-
*type != IOMMU_HW_INFO_TYPE_ARM_SMMUV3)
20-
return ERR_PTR(-EOPNOTSUPP);
20+
*type != IOMMU_HW_INFO_TYPE_ARM_SMMUV3) {
21+
if (!impl_ops || !impl_ops->hw_info)
22+
return ERR_PTR(-EOPNOTSUPP);
23+
return impl_ops->hw_info(master->smmu, length, type);
24+
}
2125

2226
info = kzalloc(sizeof(*info), GFP_KERNEL);
2327
if (!info)

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,13 @@ struct arm_smmu_impl_ops {
721721
int (*init_structures)(struct arm_smmu_device *smmu);
722722
struct arm_smmu_cmdq *(*get_secondary_cmdq)(
723723
struct arm_smmu_device *smmu, struct arm_smmu_cmdq_ent *ent);
724+
/*
725+
* An implementation should define its own type other than the default
726+
* IOMMU_HW_INFO_TYPE_ARM_SMMUV3. And it must validate the input @type
727+
* to return its own structure.
728+
*/
729+
void *(*hw_info)(struct arm_smmu_device *smmu, u32 *length,
730+
enum iommu_hw_info_type *type);
724731
const size_t vsmmu_size;
725732
const enum iommu_viommu_type vsmmu_type;
726733
int (*vsmmu_init)(struct arm_vsmmu *vsmmu,

0 commit comments

Comments
 (0)