lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1513711816-2618-56-git-send-email-dongwon.kim@intel.com>
Date:   Tue, 19 Dec 2017 11:30:12 -0800
From:   Dongwon Kim <dongwon.kim@...el.com>
To:     linux-kernel@...r.kernel.org
Cc:     dri-devel@...ts.freedesktop.org, xen-devel@...ts.xenproject.org,
        mateuszx.potrola@...el.com, dongwon.kim@...el.com
Subject: [RFC PATCH 56/60] hyper_dmabuf: add initialization and cleanup to bknd_ops

From: Mateusz Polrola <mateuszx.potrola@...el.com>

Introduced additional init and cleanup routines in the backend
API structure that might be useful for hypervisors other than Xen.

Signed-off-by: Mateusz Polrola <mateuszx.potrola@...el.com>
Signed-off-by: Dongwon Kim <dongwon.kim@...el.com>
---
 drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c         | 14 ++++++++++++++
 drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.h         |  6 ++++++
 drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
index 161fee7..f2731bf 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.c
@@ -330,6 +330,16 @@ static int __init hyper_dmabuf_drv_init(void)
 	hy_drv_priv->pending = 0;
 #endif
 
+	if (hy_drv_priv->bknd_ops->init) {
+		ret = hy_drv_priv->bknd_ops->init();
+
+		if (ret < 0) {
+			dev_dbg(hy_drv_priv->dev,
+				"failed to initialize backend.\n");
+			return ret;
+		}
+	}
+
 	hy_drv_priv->domid = hy_drv_priv->bknd_ops->get_vm_id();
 
 	ret = hy_drv_priv->bknd_ops->init_comm_env();
@@ -362,6 +372,10 @@ static void hyper_dmabuf_drv_exit(void)
 
 	hy_drv_priv->bknd_ops->destroy_comm();
 
+	if (hy_drv_priv->bknd_ops->cleanup) {
+		hy_drv_priv->bknd_ops->cleanup();
+	};
+
 	/* destroy workqueue */
 	if (hy_drv_priv->work_queue)
 		destroy_workqueue(hy_drv_priv->work_queue);
diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.h b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.h
index 4a51f9e..9337d53 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.h
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_drv.h
@@ -73,6 +73,12 @@ struct list_reusable_id {
 };
 
 struct hyper_dmabuf_bknd_ops {
+	/* backend initialization routine (optional) */
+	int (*init)(void);
+
+	/* backend cleanup routine (optional) */
+	int (*cleanup)(void);
+
 	/* retreiving id of current virtual machine */
 	int (*get_vm_id)(void);
 
diff --git a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
index 1d7249d..14ed3bc 100644
--- a/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
+++ b/drivers/xen/hyper_dmabuf/xen/hyper_dmabuf_xen_drv.c
@@ -31,6 +31,8 @@
 #include "hyper_dmabuf_xen_shm.h"
 
 struct hyper_dmabuf_bknd_ops xen_bknd_ops = {
+	.init = NULL, /* not needed for xen */
+	.cleanup = NULL, /* not needed for xen */
 	.get_vm_id = xen_be_get_domid,
 	.share_pages = xen_be_share_pages,
 	.unshare_pages = xen_be_unshare_pages,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ