2018-12-27 17:53:01 +08:00
|
|
|
From 398e76518d11e9d070a0bfcdc0c7700df6e9c26b Mon Sep 17 00:00:00 2001
|
2018-10-11 02:06:46 +08:00
|
|
|
From: Mateusz Polrola <mateuszx.potrola@intel.com>
|
|
|
|
Date: Thu, 20 Sep 2018 14:01:22 +0200
|
2018-12-27 17:53:01 +08:00
|
|
|
Subject: [PATCH 181/214] hyper_dmabuf: Align with dma_buf_ops changes
|
2018-10-11 02:06:46 +08:00
|
|
|
|
|
|
|
In 4.17.0 kernel, map_atomic and unmap_atomic callbacks were removed
|
|
|
|
from dma_buf_ops, additionally device param for attach callback was
|
|
|
|
removed.
|
|
|
|
|
|
|
|
Signed-off-by: Mateusz Polrola <mateuszx.potrola@intel.com>
|
|
|
|
---
|
|
|
|
drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c | 7 +++++++
|
|
|
|
drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c | 5 +++++
|
|
|
|
2 files changed, 12 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c
|
|
|
|
index 10b5510b3816..3bd13c584ffc 100644
|
|
|
|
--- a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c
|
|
|
|
+++ b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c
|
|
|
|
@@ -30,6 +30,7 @@
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/dma-buf.h>
|
|
|
|
+#include <linux/version.h>
|
|
|
|
#include "hyper_dmabuf_drv.h"
|
|
|
|
#include "hyper_dmabuf_struct.h"
|
|
|
|
#include "hyper_dmabuf_ops.h"
|
|
|
|
@@ -86,7 +87,9 @@ static int sync_request(hyper_dmabuf_id_t hid, int dmabuf_ops)
|
|
|
|
}
|
|
|
|
|
|
|
|
static int hyper_dmabuf_ops_attach(struct dma_buf *dmabuf,
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
|
|
|
struct device *dev,
|
|
|
|
+#endif
|
|
|
|
struct dma_buf_attachment *attach)
|
|
|
|
{
|
|
|
|
struct imported_sgt_info *imported;
|
|
|
|
@@ -255,6 +258,7 @@ static int hyper_dmabuf_ops_end_cpu_access(struct dma_buf *dmabuf,
|
|
|
|
return sync_request(imported->hid, HYPER_DMABUF_OPS_END_CPU_ACCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
|
|
|
static void *hyper_dmabuf_ops_kmap_atomic(struct dma_buf *dmabuf,
|
|
|
|
unsigned long pgnum)
|
|
|
|
{
|
|
|
|
@@ -283,6 +287,7 @@ static void hyper_dmabuf_ops_kunmap_atomic(struct dma_buf *dmabuf,
|
|
|
|
|
|
|
|
sync_request(imported->hid, HYPER_DMABUF_OPS_KUNMAP_ATOMIC);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
static void *hyper_dmabuf_ops_kmap(struct dma_buf *dmabuf, unsigned long pgnum)
|
|
|
|
{
|
|
|
|
@@ -362,8 +367,10 @@ static const struct dma_buf_ops hyper_dmabuf_ops = {
|
|
|
|
.release = hyper_dmabuf_ops_release,
|
|
|
|
.begin_cpu_access = hyper_dmabuf_ops_begin_cpu_access,
|
|
|
|
.end_cpu_access = hyper_dmabuf_ops_end_cpu_access,
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
|
|
|
.map_atomic = hyper_dmabuf_ops_kmap_atomic,
|
|
|
|
.unmap_atomic = hyper_dmabuf_ops_kunmap_atomic,
|
|
|
|
+#endif
|
|
|
|
.map = hyper_dmabuf_ops_kmap,
|
|
|
|
.unmap = hyper_dmabuf_ops_kunmap,
|
|
|
|
.mmap = hyper_dmabuf_ops_mmap,
|
|
|
|
diff --git a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c
|
|
|
|
index a82fd7b087b8..3cd3d6c98c33 100644
|
|
|
|
--- a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c
|
|
|
|
+++ b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c
|
|
|
|
@@ -30,6 +30,7 @@
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/dma-buf.h>
|
|
|
|
+#include <linux/version.h>
|
|
|
|
#include "hyper_dmabuf_drv.h"
|
|
|
|
#include "hyper_dmabuf_struct.h"
|
|
|
|
#include "hyper_dmabuf_list.h"
|
|
|
|
@@ -219,10 +220,12 @@ int hyper_dmabuf_remote_sync(hyper_dmabuf_id_t hid, int ops)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* dummy kmapping of 1 page */
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
|
|
|
if (ops == HYPER_DMABUF_OPS_KMAP_ATOMIC)
|
|
|
|
va_kmapl->vaddr = dma_buf_kmap_atomic(
|
|
|
|
exported->dma_buf, 1);
|
|
|
|
else
|
|
|
|
+#endif
|
|
|
|
va_kmapl->vaddr = dma_buf_kmap(
|
|
|
|
exported->dma_buf, 1);
|
|
|
|
|
|
|
|
@@ -253,11 +256,13 @@ int hyper_dmabuf_remote_sync(hyper_dmabuf_id_t hid, int ops)
|
|
|
|
return PTR_ERR(va_kmapl->vaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
|
|
|
|
/* unmapping 1 page */
|
|
|
|
if (ops == HYPER_DMABUF_OPS_KUNMAP_ATOMIC)
|
|
|
|
dma_buf_kunmap_atomic(exported->dma_buf,
|
|
|
|
1, va_kmapl->vaddr);
|
|
|
|
else
|
|
|
|
+#endif
|
|
|
|
dma_buf_kunmap(exported->dma_buf,
|
|
|
|
1, va_kmapl->vaddr);
|
|
|
|
|
|
|
|
--
|
2018-12-27 17:53:01 +08:00
|
|
|
2.19.1
|
2018-10-11 02:06:46 +08:00
|
|
|
|