Skip to content

Commit bfe6240

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Fix pointer cast warnings on 32 bit
Pointers should be casted to unsigned long to avoid "cast from pointer to integer of different size" warnings. drivers/iommu/intel-pasid.c:818:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] drivers/iommu/intel-pasid.c:821:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] drivers/iommu/intel-pasid.c:824:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] drivers/iommu/intel-svm.c:343:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Fixes: b0d1f87 ("iommu/vt-d: Add nested translation helper function") Fixes: 56722a4 ("iommu/vt-d: Add bind guest PASID support") Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent e70b081 commit bfe6240

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/iommu/intel-pasid.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,13 @@ int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev,
815815
}
816816

817817
/* First level PGD is in GPA, must be supported by the second level */
818-
if ((unsigned long long)gpgd > domain->max_addr) {
818+
if ((uintptr_t)gpgd > domain->max_addr) {
819819
dev_err_ratelimited(dev,
820-
"Guest PGD %llx not supported, max %llx\n",
821-
(unsigned long long)gpgd, domain->max_addr);
820+
"Guest PGD %lx not supported, max %llx\n",
821+
(uintptr_t)gpgd, domain->max_addr);
822822
return -EINVAL;
823823
}
824-
pasid_set_flptr(pte, (u64)gpgd);
824+
pasid_set_flptr(pte, (uintptr_t)gpgd);
825825

826826
ret = intel_pasid_setup_bind_data(iommu, pte, pasid_data);
827827
if (ret)

drivers/iommu/intel-svm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
340340
* call the nested mode setup function here.
341341
*/
342342
spin_lock(&iommu->lock);
343-
ret = intel_pasid_setup_nested(iommu, dev, (pgd_t *)data->gpgd,
343+
ret = intel_pasid_setup_nested(iommu, dev,
344+
(pgd_t *)(uintptr_t)data->gpgd,
344345
data->hpasid, &data->vtd, dmar_domain,
345346
data->addr_width);
346347
spin_unlock(&iommu->lock);

0 commit comments

Comments
 (0)