From: Hao Xiang <hao.xiang@bytedance.com>
To: pbonzini@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org
Cc: Hao Xiang <hao.xiang@bytedance.com>
Subject: [PATCH 4/4] Add QEMU command line argument to enable DSA offloading.
Date: Mon, 29 May 2023 18:20:01 +0000 [thread overview]
Message-ID: <20230529182001.2232069-5-hao.xiang@bytedance.com> (raw)
In-Reply-To: <20230529182001.2232069-1-hao.xiang@bytedance.com>
This change adds a new argument --dsa-accelerate to qemu.
Signed-off-by: Hao Xiang <hao.xiang@bytedance.com>
---
qemu-options.hx | 10 ++++++++++
softmmu/runstate.c | 4 ++++
softmmu/vl.c | 22 ++++++++++++++++++++++
storage-daemon/qemu-storage-daemon.c | 2 ++
4 files changed, 38 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
index b37eb9662b..29491ee691 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4890,6 +4890,16 @@ SRST
otherwise the option is ignored. Default is off.
ERST
+DEF("dsa-accelerate", HAS_ARG, QEMU_OPTION_dsa,
+ "-dsa-accelerate <file>\n"
+ " Use Intel Data Streaming Accelerator for certain QEMU\n"
+ " operations, eg, checkpoint.\n",
+ QEMU_ARCH_I386)
+SRST
+``-dsa-accelerate path``
+ The device path to a DSA accelerator.
+ERST
+
DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
"-dump-vmstate <file>\n"
" Output vmstate information in JSON format to file.\n"
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 2f2396c819..1f938e192f 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -41,6 +41,7 @@
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-events-run-state.h"
#include "qemu/accel.h"
+#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "qemu/job.h"
#include "qemu/log.h"
@@ -834,6 +835,9 @@ void qemu_cleanup(void)
tpm_cleanup();
net_cleanup();
audio_cleanup();
+
+ dsa_cleanup();
+
monitor_cleanup();
qemu_chr_cleanup();
user_creatable_cleanup();
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b0b96f67fa..8ace491183 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -161,6 +161,7 @@ static const char *mem_path;
static const char *incoming;
static const char *loadvm;
static const char *accelerators;
+static const char *dsa_path;
static bool have_custom_ram_size;
static const char *ram_memdev_id;
static QDict *machine_opts_dict;
@@ -373,6 +374,20 @@ static QemuOptsList qemu_msg_opts = {
},
};
+static QemuOptsList qemu_dsa_opts = {
+ .name = "dsa-accelerate",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_dsa_opts.head),
+ .desc = {
+ {
+ .name = "device",
+ .type = QEMU_OPT_STRING,
+ .help = "The device path to DSA accelerator used for certain "
+ "QEMU operations, eg, checkpoint\n",
+ },
+ { /* end of list */ }
+ },
+};
+
static QemuOptsList qemu_name_opts = {
.name = "name",
.implied_opt_name = "guest",
@@ -2704,6 +2719,7 @@ void qemu_init(int argc, char **argv)
qemu_add_opts(&qemu_semihosting_config_opts);
qemu_add_opts(&qemu_fw_cfg_opts);
qemu_add_opts(&qemu_action_opts);
+ qemu_add_opts(&qemu_dsa_opts);
module_call_init(MODULE_INIT_OPTS);
error_init(argv[0]);
@@ -3504,6 +3520,12 @@ void qemu_init(int argc, char **argv)
}
configure_msg(opts);
break;
+ case QEMU_OPTION_dsa:
+ dsa_path = optarg;
+ if (configure_dsa(dsa_path)) {
+ exit(1);
+ }
+ break;
case QEMU_OPTION_dump_vmstate:
if (vmstate_dump_file) {
error_report("only one '-dump-vmstate' "
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index 0e9354faa6..0e4375407a 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -439,6 +439,8 @@ int main(int argc, char *argv[])
job_cancel_sync_all();
bdrv_close_all();
+ dsa_cleanup();
+
monitor_cleanup();
qemu_chr_cleanup();
user_creatable_cleanup();
--
2.30.2
next prev parent reply other threads:[~2023-05-29 18:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 18:19 [PATCH 0/4] Add Intel Data Streaming Accelerator offloading Hao Xiang
2023-05-29 18:19 ` [PATCH 1/4] Introduce new instruction set enqcmd/mmovdir64b to the build system Hao Xiang
2023-05-29 18:19 ` [PATCH 2/4] Add dependency idxd Hao Xiang
2023-05-29 18:20 ` [PATCH 3/4] Implement zero page checking using DSA Hao Xiang
2023-05-29 18:20 ` Hao Xiang [this message]
2023-05-29 18:24 ` [PATCH 0/4] Add Intel Data Streaming Accelerator offloading Hao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230529182001.2232069-5-hao.xiang@bytedance.com \
--to=hao.xiang@bytedance.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).