|
@@ -86,7 +86,7 @@ out:
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
-static int map_afu_irq(struct vm_area_struct *vma, unsigned long address,
|
|
|
|
|
|
+static vm_fault_t map_afu_irq(struct vm_area_struct *vma, unsigned long address,
|
|
u64 offset, struct ocxl_context *ctx)
|
|
u64 offset, struct ocxl_context *ctx)
|
|
{
|
|
{
|
|
u64 trigger_addr;
|
|
u64 trigger_addr;
|
|
@@ -95,15 +95,15 @@ static int map_afu_irq(struct vm_area_struct *vma, unsigned long address,
|
|
if (!trigger_addr)
|
|
if (!trigger_addr)
|
|
return VM_FAULT_SIGBUS;
|
|
return VM_FAULT_SIGBUS;
|
|
|
|
|
|
- vm_insert_pfn(vma, address, trigger_addr >> PAGE_SHIFT);
|
|
|
|
- return VM_FAULT_NOPAGE;
|
|
|
|
|
|
+ return vmf_insert_pfn(vma, address, trigger_addr >> PAGE_SHIFT);
|
|
}
|
|
}
|
|
|
|
|
|
-static int map_pp_mmio(struct vm_area_struct *vma, unsigned long address,
|
|
|
|
|
|
+static vm_fault_t map_pp_mmio(struct vm_area_struct *vma, unsigned long address,
|
|
u64 offset, struct ocxl_context *ctx)
|
|
u64 offset, struct ocxl_context *ctx)
|
|
{
|
|
{
|
|
u64 pp_mmio_addr;
|
|
u64 pp_mmio_addr;
|
|
int pasid_off;
|
|
int pasid_off;
|
|
|
|
+ vm_fault_t ret;
|
|
|
|
|
|
if (offset >= ctx->afu->config.pp_mmio_stride)
|
|
if (offset >= ctx->afu->config.pp_mmio_stride)
|
|
return VM_FAULT_SIGBUS;
|
|
return VM_FAULT_SIGBUS;
|
|
@@ -121,27 +121,27 @@ static int map_pp_mmio(struct vm_area_struct *vma, unsigned long address,
|
|
pasid_off * ctx->afu->config.pp_mmio_stride +
|
|
pasid_off * ctx->afu->config.pp_mmio_stride +
|
|
offset;
|
|
offset;
|
|
|
|
|
|
- vm_insert_pfn(vma, address, pp_mmio_addr >> PAGE_SHIFT);
|
|
|
|
|
|
+ ret = vmf_insert_pfn(vma, address, pp_mmio_addr >> PAGE_SHIFT);
|
|
mutex_unlock(&ctx->status_mutex);
|
|
mutex_unlock(&ctx->status_mutex);
|
|
- return VM_FAULT_NOPAGE;
|
|
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int ocxl_mmap_fault(struct vm_fault *vmf)
|
|
|
|
|
|
+static vm_fault_t ocxl_mmap_fault(struct vm_fault *vmf)
|
|
{
|
|
{
|
|
struct vm_area_struct *vma = vmf->vma;
|
|
struct vm_area_struct *vma = vmf->vma;
|
|
struct ocxl_context *ctx = vma->vm_file->private_data;
|
|
struct ocxl_context *ctx = vma->vm_file->private_data;
|
|
u64 offset;
|
|
u64 offset;
|
|
- int rc;
|
|
|
|
|
|
+ vm_fault_t ret;
|
|
|
|
|
|
offset = vmf->pgoff << PAGE_SHIFT;
|
|
offset = vmf->pgoff << PAGE_SHIFT;
|
|
pr_debug("%s: pasid %d address 0x%lx offset 0x%llx\n", __func__,
|
|
pr_debug("%s: pasid %d address 0x%lx offset 0x%llx\n", __func__,
|
|
ctx->pasid, vmf->address, offset);
|
|
ctx->pasid, vmf->address, offset);
|
|
|
|
|
|
if (offset < ctx->afu->irq_base_offset)
|
|
if (offset < ctx->afu->irq_base_offset)
|
|
- rc = map_pp_mmio(vma, vmf->address, offset, ctx);
|
|
|
|
|
|
+ ret = map_pp_mmio(vma, vmf->address, offset, ctx);
|
|
else
|
|
else
|
|
- rc = map_afu_irq(vma, vmf->address, offset, ctx);
|
|
|
|
- return rc;
|
|
|
|
|
|
+ ret = map_afu_irq(vma, vmf->address, offset, ctx);
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static const struct vm_operations_struct ocxl_vmops = {
|
|
static const struct vm_operations_struct ocxl_vmops = {
|