Skip to content

Commit

Permalink
iommu/vt-d: Fix pointer cast warnings on 32 bit
Browse files Browse the repository at this point in the history
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 <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20200519013423.11971-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Lu Baolu authored and Joerg Roedel committed May 25, 2020
1 parent e70b081 commit bfe6240
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions drivers/iommu/intel-pasid.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,13 +815,13 @@ int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev,
}

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

ret = intel_pasid_setup_bind_data(iommu, pte, pasid_data);
if (ret)
Expand Down
3 changes: 2 additions & 1 deletion drivers/iommu/intel-svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
* call the nested mode setup function here.
*/
spin_lock(&iommu->lock);
ret = intel_pasid_setup_nested(iommu, dev, (pgd_t *)data->gpgd,
ret = intel_pasid_setup_nested(iommu, dev,
(pgd_t *)(uintptr_t)data->gpgd,
data->hpasid, &data->vtd, dmar_domain,
data->addr_width);
spin_unlock(&iommu->lock);
Expand Down

0 comments on commit bfe6240

Please sign in to comment.