On Thu, Jan 09, 2025 at 07:04:10PM +0800, kernel test robot wrote: > sparse warnings: (new ones prefixed by >>) > >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:461:21: sparse: sparse: invalid assignment: &= > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:461:21: sparse: left side has type restricted __le64 > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:461:21: sparse: right side has type unsigned long long > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:462:21: sparse: sparse: invalid assignment: |= > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:462:21: sparse: left side has type restricted __le64 > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:462:21: sparse: right side has type unsigned long long > >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:464:23: sparse: sparse: cast from restricted __le64 > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:465:23: sparse: sparse: cast from restricted __le64 I fixed these with the followings: ----------------------------------------------------------------------------------- diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c index 0c7a5894ba07..aa453e842a39 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c @@ -457,20 +457,28 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct device *dev, return &vsmmu->core; } +/* This is basically iommu_vevent_arm_smmuv3 in u64 for conversion */ +struct arm_vsmmu_evt { + union { + u64 evt[EVTQ_ENT_DWORDS]; + struct iommu_vevent_arm_smmuv3 uevt; + }; +}; + int arm_vmaster_report_event(struct arm_smmu_vmaster *vmaster, u64 *evt) { - struct iommu_vevent_arm_smmuv3 vevt = - *(struct iommu_vevent_arm_smmuv3 *)evt; + struct arm_vsmmu_evt *vevt = (struct arm_vsmmu_evt *)evt; + int i; - vevt.evt[0] &= ~EVTQ_0_SID; - vevt.evt[0] |= FIELD_PREP(EVTQ_0_SID, vmaster->vsid); + vevt->evt[0] &= ~EVTQ_0_SID; + vevt->evt[0] |= FIELD_PREP(EVTQ_0_SID, vmaster->vsid); - vevt.evt[0] = cpu_to_le64(vevt.evt[0]); - vevt.evt[1] = cpu_to_le64(vevt.evt[1]); + for (i = 0; i < EVTQ_ENT_DWORDS; i++) + vevt->uevt.evt[i] = cpu_to_le64(vevt->evt[i]); return iommufd_viommu_report_event(&vmaster->vsmmu->core, - IOMMU_VEVENTQ_TYPE_ARM_SMMUV3, &vevt, - sizeof(vevt)); + IOMMU_VEVENTQ_TYPE_ARM_SMMUV3, + &vevt->uevt, sizeof(vevt->uevt)); } MODULE_IMPORT_NS("IOMMUFD"); ----------------------------------------------------------------------------------- This also fixes the array size from 2 to EVTQ_ENT_DWORDS==(4). @Will, Would it be possible for you to ack or review the two SMMU patches in this series? I am still hoping Jason might be able to take this after I respin a v6. Thanks! Nicolin