diff mbox series

[v2,1/2,RFC] arm: Introduce hostinvariant command line option

Message ID 1db52b5ec7066f2fbc286288f97cc4946f94145e.1536948621.git.manish.jaggi@cavium.com
State New
Headers show
Series [v2,1/2,RFC] arm: Introduce hostinvariant command line option | expand

Commit Message

Manish Jaggi Oct. 23, 2018, 9:31 a.m. UTC
From: Manish Jaggi <manish.jaggi@cavium.com>

This option is user opt-in. hostinvariant will replace guest's invariant
registers with hosts.

Signed-off-by: Manish Jaggi <manish.jaggi@cavium.com>

Comments

Juan Quintela Oct. 24, 2018, 10:02 a.m. UTC | #1
<mjaggi@caviumnetworks.com> wrote:
> From: Manish Jaggi <manish.jaggi@cavium.com>
>
> This option is user opt-in. hostinvariant will replace guest's invariant
> registers with hosts.
>
> Signed-off-by: Manish Jaggi <manish.jaggi@cavium.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

As I said in previous discussions, I still think that you should create
a better cpu model.  But as there is nothing like that on ARM, this is a
"showstop" solution.

Later, Juan.
diff mbox series

Patch

diff --git a/qemu-options.hx b/qemu-options.hx
index 654ef48..d8c0da7 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3896,6 +3896,19 @@  STEXI
 prepend a timestamp to each log message.(default:on)
 ETEXI
 
+DEF("hostinvariant", HAS_ARG, QEMU_OPTION_hostinvariant,
+    "-hostinvariant enable[=on|off]\n"
+    "                migrated guest should use invariant register values of host\n"
+    "                on|off controls migration between arch64 systems using -cpu host but with different MIDR values (default:off)\n",
+    QEMU_ARCH_ARM)
+STEXI
+@item -hostinvariant enable[=on|off]
+@findex -hostinvariant
+controls migration between arch64 systems using -cpu host but with different MIDR values.(default:off)
+ETEXI
+
+
+
 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/vl.c b/vl.c
index 5ba06ad..b6df5f0 100644
--- a/vl.c
+++ b/vl.c
@@ -144,6 +144,7 @@  const char *mem_path = NULL;
 int mem_prealloc = 0; /* force preallocation of physical target memory */
 bool enable_mlock = false;
 bool enable_cpu_pm = false;
+bool enable_hostinvariant = false;
 int nb_nics;
 NICInfo nd_table[MAX_NICS];
 int autostart;
@@ -420,6 +421,19 @@  static QemuOptsList qemu_msg_opts = {
     },
 };
 
+static QemuOptsList qemu_hostinvariant_opts = {
+    .name = "hostinvariant",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_hostinvariant_opts.head),
+    .desc = {
+        {
+            .name = "enable",
+            .type = QEMU_OPT_BOOL,
+        },
+        { /* end of list */ }
+    },
+};
+
+
 static QemuOptsList qemu_name_opts = {
     .name = "name",
     .implied_opt_name = "guest",
@@ -2989,6 +3003,7 @@  int main(int argc, char **argv, char **envp)
     qemu_add_opts(&qemu_realtime_opts);
     qemu_add_opts(&qemu_overcommit_opts);
     qemu_add_opts(&qemu_msg_opts);
+    qemu_add_opts(&qemu_hostinvariant_opts);
     qemu_add_opts(&qemu_name_opts);
     qemu_add_opts(&qemu_numa_opts);
     qemu_add_opts(&qemu_icount_opts);
@@ -3948,6 +3963,15 @@  int main(int argc, char **argv, char **envp)
                 }
                 configure_msg(opts);
                 break;
+            case QEMU_OPTION_hostinvariant:
+                opts = qemu_opts_parse_noisily(qemu_find_opts("hostinvariant"), optarg,
+                                               false);
+                if (!opts) {
+                    exit(1);
+                }
+                enable_hostinvariant = qemu_opt_get_bool(opts, "hostinvariant", true);
+                error_report("Host Invariant=%d", enable_hostinvariant);
+                break;
             case QEMU_OPTION_dump_vmstate:
                 if (vmstate_dump_file) {
                     error_report("only one '-dump-vmstate' "