nvscic2c-pcie: Fix the argument of iommu_map() for Linux 6.3

There is additional argument added in iommu_map() from Linux6.3.
Pass the proper argument from the drier who are using this
APIs. Using conftest methods for differentiating whether
additional argument is needed or not.

Bug 4374520

Change-Id: Ica06363802d31be317675a50194f34670521e023
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014986
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-11-12 18:28:00 +00:00
committed by mobile promotions
parent 3c1c8cb672
commit b91f49ff74

View File

@@ -3,6 +3,8 @@
#define pr_fmt(fmt) "nvscic2c-pcie: pci-client: " fmt #define pr_fmt(fmt) "nvscic2c-pcie: pci-client: " fmt
#include <nvidia/conftest.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <linux/dma-map-ops.h> #include <linux/dma-map-ops.h>
#include <linux/errno.h> #include <linux/errno.h>
@@ -246,7 +248,11 @@ allocate_edma_rx_desc_iova(struct pci_client_t *ctx)
goto err; goto err;
} }
prot = (IOMMU_CACHE | IOMMU_READ | IOMMU_WRITE); prot = (IOMMU_CACHE | IOMMU_READ | IOMMU_WRITE);
#if defined(NV_IOMMU_MAP_HAS_GFP_ARG) /* Linux v6.3 */
ret = iommu_map(ctx->domain, ctx->edma_ch_desc_iova, phys_addr, EDMA_CH_DESC_SZ, prot, GFP_KERNEL);
#else
ret = iommu_map(ctx->domain, ctx->edma_ch_desc_iova, phys_addr, EDMA_CH_DESC_SZ, prot); ret = iommu_map(ctx->domain, ctx->edma_ch_desc_iova, phys_addr, EDMA_CH_DESC_SZ, prot);
#endif
if (ret) { if (ret) {
pr_err("pci client failed to map iova to 60K physical backing\n"); pr_err("pci client failed to map iova to 60K physical backing\n");
goto err; goto err;
@@ -408,7 +414,11 @@ pci_client_map_addr(void *pci_client_h, u64 to_iova, phys_addr_t paddr,
if (WARN_ON(!ctx || !to_iova || !paddr || !size)) if (WARN_ON(!ctx || !to_iova || !paddr || !size))
return -EINVAL; return -EINVAL;
#if defined(NV_IOMMU_MAP_HAS_GFP_ARG) /* Linux v6.3 */
return iommu_map(ctx->domain, to_iova, paddr, size, prot, GFP_KERNEL);
#else
return iommu_map(ctx->domain, to_iova, paddr, size, prot); return iommu_map(ctx->domain, to_iova, paddr, size, prot);
#endif
} }
size_t size_t