[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 06/19] tools/vhost-user-rpmb: add boilerplate and initial mai
From: |
Alex Bennée |
Subject: |
[RFC PATCH 06/19] tools/vhost-user-rpmb: add boilerplate and initial main |
Date: |
Fri, 25 Sep 2020 13:51:34 +0100 |
This adds the boilerplate files for a new vhost-user helper called
vhost-user-rpmb which will support virtio based RPMB (Replay Protected
Memory Block) devices.
This commit just adds the initial boilerplate for building the binary
with the common vhost-user options. As of this commit the only useful
output you get is when running:
vhost-user-rpmb --help
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
tools/vhost-user-rpmb/main.c | 37 ++++++++++++++++++++++
MAINTAINERS | 5 +++
tools/meson.build | 8 +++++
tools/vhost-user-rpmb/50-qemu-rpmb.json.in | 5 +++
tools/vhost-user-rpmb/meson.build | 11 +++++++
5 files changed, 66 insertions(+)
create mode 100644 tools/vhost-user-rpmb/main.c
create mode 100644 tools/vhost-user-rpmb/50-qemu-rpmb.json.in
create mode 100644 tools/vhost-user-rpmb/meson.build
diff --git a/tools/vhost-user-rpmb/main.c b/tools/vhost-user-rpmb/main.c
new file mode 100644
index 000000000000..a40a680a74ca
--- /dev/null
+++ b/tools/vhost-user-rpmb/main.c
@@ -0,0 +1,37 @@
+/*
+ * VIRTIO RPMB Emulation via vhost-user
+ *
+ * Copyright (c) 2020 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <glib.h>
+
+static gchar *socket_path;
+static gint socket_fd;
+static gboolean print_cap;
+
+static GOptionEntry options[] =
+{
+ { "socket-path", 0, 0, G_OPTION_ARG_FILENAME, &socket_path, "Location of
vhost-user Unix domain socket, incompatible with --fd", "PATH" },
+ { "fd", 0, 0, G_OPTION_ARG_INT, &socket_fd, "Specify the file-descriptor
of the backend, incompatible with --socket-path", "FD" },
+ { "print-capabilities", 0, 0, G_OPTION_ARG_NONE, &print_cap, "Output to
stdout the backend capabilities in JSON format and exit", NULL},
+ { NULL }
+};
+
+int main (int argc, char *argv[])
+{
+ GError *error = NULL;
+ GOptionContext *context;
+
+ context = g_option_context_new ("vhost-user-rpmb - vhost-user emulation of
RPBM device");
+ g_option_context_add_main_entries (context, options, "vhost-user-rpmb");
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_print ("option parsing failed: %s\n", error->message);
+ exit (1);
+ }
+
+
+}
diff --git a/MAINTAINERS b/MAINTAINERS
index 3d17cad19aa0..e325c1024a33 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1873,6 +1873,11 @@ F: hw/virtio/virtio-mem-pci.h
F: hw/virtio/virtio-mem-pci.c
F: include/hw/virtio/virtio-mem.h
+virtio-rpmb
+M: Alex Bennée <alex.bennee@linaro.org>
+S: Supported
+F: tools/vhost-user-rpmb/*
+
nvme
M: Keith Busch <kbusch@kernel.org>
M: Klaus Jensen <its@irrelevant.dk>
diff --git a/tools/meson.build b/tools/meson.build
index 513bd2ff4fd2..408048c6357c 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -8,3 +8,11 @@ have_virtiofsd = (have_system and
if have_virtiofsd
subdir('virtiofsd')
endif
+
+have_virtiorpmb = (have_system and
+ have_tools and
+ 'CONFIG_LINUX' in config_host)
+
+if have_virtiorpmb
+ subdir('vhost-user-rpmb')
+endif
diff --git a/tools/vhost-user-rpmb/50-qemu-rpmb.json.in
b/tools/vhost-user-rpmb/50-qemu-rpmb.json.in
new file mode 100644
index 000000000000..2b033cda567c
--- /dev/null
+++ b/tools/vhost-user-rpmb/50-qemu-rpmb.json.in
@@ -0,0 +1,5 @@
+{
+ "description": "QEMU vhost-user-rpmb",
+ "type": "block",
+ "binary": "@libexecdir@/vhost-user-rpmb"
+}
diff --git a/tools/vhost-user-rpmb/meson.build
b/tools/vhost-user-rpmb/meson.build
new file mode 100644
index 000000000000..e0df1b69a3fb
--- /dev/null
+++ b/tools/vhost-user-rpmb/meson.build
@@ -0,0 +1,11 @@
+executable('vhost-user-rpmb', files(
+ 'main.c'),
+ dependencies: [glib],
+ link_with: [libvhost_user],
+ install: true,
+ install_dir: get_option('libexecdir'))
+
+configure_file(input: '50-qemu-rpmb.json.in',
+ output: '50-qemu-rpmb.json',
+ configuration: config_host,
+ install_dir: qemu_datadir / 'vhost-user')
--
2.20.1
- [RFC PATCH 00/19] vhost-user-rpmb (Replay Protected Memory Block), Alex Bennée, 2020/09/25
- [RFC PATCH 01/19] tools/virtiofsd: add support for --socket-group, Alex Bennée, 2020/09/25
- [RFC PATCH 02/19] hw/block: add boilerplate for vhost-user-rpmb device, Alex Bennée, 2020/09/25
- [RFC PATCH 04/19] hw/block: add vhost-user-rpmb-pci boilerplate, Alex Bennée, 2020/09/25
- [RFC PATCH 05/19] virtio-pci: add notification trace points, Alex Bennée, 2020/09/25
- [RFC PATCH 03/19] hw/virtio: move virtio-pci.h into shared include space, Alex Bennée, 2020/09/25
- [RFC PATCH 06/19] tools/vhost-user-rpmb: add boilerplate and initial main,
Alex Bennée <=
- [RFC PATCH 07/19] tools/vhost-user-rpmb: implement --print-capabilities, Alex Bennée, 2020/09/25
- [RFC PATCH 08/19] tools/vhost-user-rpmb: connect to fd and instantiate basic run loop, Alex Bennée, 2020/09/25
- [RFC PATCH 09/19] tools/vhost-user-rpmb: add a --verbose/debug flags for logging, Alex Bennée, 2020/09/25
- [RFC PATCH 11/19] tools/vhost-user-rpmb: add --flash-path for backing store, Alex Bennée, 2020/09/25
- [RFC PATCH 12/19] tools/vhost-user-rpmb: import hmac_sha256 functions, Alex Bennée, 2020/09/25
- [RFC PATCH 10/19] tools/vhost-user-rpmb: handle shutdown and SIGINT/SIGHUP cleanly, Alex Bennée, 2020/09/25
- [RFC PATCH 17/19] tools/vhost-user-rpmb: add key persistence, Alex Bennée, 2020/09/25
- [RFC PATCH 15/19] tools/vhost-user-rpmb: implement VIRTIO_RPMB_REQ_DATA_WRITE, Alex Bennée, 2020/09/25