xen/arm: smmuv3: remove unused function
PATCH 1/1 xen/arm: smmuv3: remove unused function
When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:
drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
^
Remove the function.
---
There is also a definition of arm_smmu_disable_pasid() just above, guarded by #ifdef CONFIG_PCI_ATS. Should this one be removed too? It might be nice to keep this definition for ease of backporting patches from Linux, but if we ever plan on supporting PCI_ATS in Xen this may need to be re-visited.
This is a candidate for backport to 4.17, 4.16, and possibly 4.15, although 4.15 has other issues with clang 12.
--- xen/drivers/passthrough/arm/smmu-v3.c | 2 -- 1 file changed, 2 deletions(-)
xen/drivers/passthrough/arm/smmu-v3.c +0 -2
@@ -1404,8 +1404,6 @@ static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master) {return 0 ; } - -static inline void arm_smmu_disable_pasid (struct arm_smmu_master *master) { }#endif /* CONFIG_PCI_ATS */ static void arm_smmu_detach_dev (struct arm_smmu_master *master)
Signature · 1 line
2.38.2
Hi Stewart,
Quoted 9 lines · Stewart Hildebrand
When building with clang 12 and
CONFIG_ARM_SMMU_V3=y, we observe the following build error:
drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline voidarm_smmu_disable_pasid(struct arm_smmu_master *master){ }^Remove the function.
Quoted 7 lines
Signed-off-by Stewart Hildebrand <[email protected]>---
There is also a definition ofarm_smmu_disable_pasid()just above, guarded by #ifdefCONFIG_PCI_ATS. Should this one be removed too? It might be nice to keep this definition for ease of backporting patches from Linux, but if we ever plan on supportingPCI_ATSin Xen this may need to be re-visited.
Given the function is not called at all, I think this is a bit odd to remove the stub but leave the implementation when CONFIG_PCI_ATS is defined.
Rahul, do you plan to use it in the PCI passthrough code? If yes, then I would consider to use __maybe_unused.
Quoted 3 lines
This is a candidate for backport to 4.17, 4.16, and possibly 4.15, although 4.15 has other issues with clang 12.
The SMMUv3 is a tech preview feature. So we don't usually backport fixes. I don't see any reason to diverge here.
Also, note that 4.15 is in any case only security supported since October 2022. So such patch would not qualify for backport.
Cheers,
Signature · 1 line
Julien Grall
Hi Julien,
Quoted 19 lines · Julien Grall
Hi Stewart,
Quoted 5 lines · Stewart Hildebrand
When building with clang 12 and
CONFIG_ARM_SMMU_V3=y, we observe the
following build error:drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline voidarm_smmu_disable_pasid(struct arm_smmu_master *master){ }^Quoted 8 lines
Remove the function.
Signed-off-by Stewart Hildebrand <[email protected]>---
There is also a definition ofarm_smmu_disable_pasid()just above, guarded by #ifdefCONFIG_PCI_ATS. Should this one be removed too? It might be nice to keep this definition for ease of backporting patches from Linux, but if we ever plan on supportingPCI_ATSin Xen this may need to be re-visited.
Quoted 3 lines
Given the function is not called at all, I think this is a bit odd to remove the stub but leave the implementation when
CONFIG_PCI_ATSis defined.Rahul, do you plan to use it in the PCI passthrough code? If yes, then I would consider to use
__maybe_unused.
No, this function will not be used in PCI passthrough code, but when we merged the SMMUv3 code from Linux at that time we decided to have this code and gate with CONFIG_PCI_ATS so that in the future if someone wants to implement the PASID feature will use these functions.
I also agree with Julien we would consider using __maybe_unused.
Regards,
Rahul
Quoted 23 lines · Rahul Singh
Hi Julien,
Quoted 21 lines · Julien Grall
Hi Stewart,
Quoted 5 lines · Stewart Hildebrand
When building with clang 12 and
CONFIG_ARM_SMMU_V3=y, we observe the
following build error:drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline voidarm_smmu_disable_pasid(struct arm_smmu_master *master){ }^Quoted 8 lines
Remove the function.
Signed-off-by Stewart Hildebrand <[email protected]>---
There is also a definition ofarm_smmu_disable_pasid()just above, guarded by #ifdefCONFIG_PCI_ATS. Should this one be removed too? It might be nice to keep this definition for ease of backporting patches from Linux, but if we ever plan on supportingPCI_ATSin Xen this may need to be re-visited.Given the function is not called at all, I think this is a bit odd to remove the stub but leave the implementation when
CONFIG_PCI_ATSis defined.
Quoted 7 lines
Quoted 1 line
Rahul, do you plan to use it in the PCI passthrough code? If yes, then I would consider to use
__maybe_unused.No, this function will not be used in PCI passthrough code, but when we merged the SMMUv3 code from Linux at that time we decided to have this code and gate with
CONFIG_PCI_ATSso that in the future if someone wants to implement the PASID feature will use these functions.I also agree with Julien we would consider using
__maybe_unused.
OK, I will send a v2 with the __maybe_unused attribute (in both locations), in case PASID is to be implemented in the future.