qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 10/20] KVM: do not allow setting properties at runtime
Date: Mon, 17 May 2021 07:19:51 -0400	[thread overview]
Message-ID: <20210517112001.2564006-11-pbonzini@redhat.com> (raw)
In-Reply-To: <20210517112001.2564006-1-pbonzini@redhat.com>

Only allow accelerator properties to be set when the
accelerator is being created.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/kvm/kvm-all.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 4e0168e88b..54c0860979 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2017,7 +2017,6 @@ static int kvm_init(MachineState *ms)
     QTAILQ_INIT(&s->kvm_sw_breakpoints);
 #endif
     QLIST_INIT(&s->kvm_parked_vcpus);
-    s->vmfd = -1;
     s->fd = qemu_open_old("/dev/kvm", O_RDWR);
     if (s->fd == -1) {
         fprintf(stderr, "Could not access KVM kernel module: %m\n");
@@ -3112,6 +3111,11 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v,
     KVMState *s = KVM_STATE(obj);
     int64_t value;
 
+    if (s->fd != -1) {
+        error_setg(errp, "Cannot set properties after the accelerator has been initialized");
+        return;
+    }
+
     if (!visit_type_int(v, name, &value, errp)) {
         return;
     }
@@ -3126,6 +3130,11 @@ static void kvm_set_kernel_irqchip(Object *obj, Visitor *v,
     KVMState *s = KVM_STATE(obj);
     OnOffSplit mode;
 
+    if (s->fd != -1) {
+        error_setg(errp, "Cannot set properties after the accelerator has been initialized");
+        return;
+    }
+
     if (!visit_type_OnOffSplit(v, name, &mode, errp)) {
         return;
     }
@@ -3172,6 +3181,8 @@ static void kvm_accel_instance_init(Object *obj)
 {
     KVMState *s = KVM_STATE(obj);
 
+    s->fd = -1;
+    s->vmfd = -1;
     s->kvm_shadow_mem = -1;
     s->kernel_irqchip_allowed = true;
     s->kernel_irqchip_split = ON_OFF_AUTO_AUTO;
-- 
2.27.0




  parent reply	other threads:[~2021-05-17 11:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 11:19 [PULL 00/20] Misc patches for 2020-05-17 Paolo Bonzini
2021-05-17 11:19 ` [PULL 01/20] configure: Only clone softfloat-3 repositories if TCG is enabled Paolo Bonzini
2021-05-17 11:19 ` [PULL 02/20] configure: check for submodules if --with-git-submodules=ignore Paolo Bonzini
2021-05-17 11:19 ` [PULL 03/20] configure: simplify assignment to GIT_SUBMODULES Paolo Bonzini
2021-05-17 11:19 ` [PULL 04/20] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on' Paolo Bonzini
2021-05-17 11:19 ` [PULL 05/20] backends/tpm: Replace qemu_mutex_lock calls with QEMU_LOCK_GUARD Paolo Bonzini
2021-05-17 11:19 ` [PULL 06/20] i386/cpu: Expose AVX_VNNI instruction to guest Paolo Bonzini
2021-05-17 11:19 ` [PULL 07/20] meson: bump submodule to 0.57.2 Paolo Bonzini
2021-05-17 11:19 ` [PULL 08/20] object: add more commands to preconfig mode Paolo Bonzini
2021-05-17 11:19 ` [PULL 09/20] qtest: add a QOM object for qtest Paolo Bonzini
2021-05-17 11:19 ` Paolo Bonzini [this message]
2021-05-17 11:19 ` [PULL 11/20] memory: Introduce log_sync_global() to memory listener Paolo Bonzini
2021-05-17 11:19 ` [PULL 12/20] KVM: Use a big lock to replace per-kml slots_lock Paolo Bonzini
2021-05-17 11:19 ` [PULL 13/20] KVM: Create the KVMSlot dirty bitmap on flag changes Paolo Bonzini
2021-05-17 11:19 ` [PULL 14/20] KVM: Provide helper to get kvm dirty log Paolo Bonzini
2021-05-17 11:19 ` [PULL 15/20] KVM: Provide helper to sync dirty bitmap from slot to ramblock Paolo Bonzini
2021-05-17 11:19 ` [PULL 16/20] KVM: Simplify dirty log sync in kvm_set_phys_mem Paolo Bonzini
2021-05-17 11:19 ` [PULL 17/20] KVM: Cache kvm slot dirty bitmap size Paolo Bonzini
2021-05-17 11:19 ` [PULL 18/20] KVM: Add dirty-ring-size property Paolo Bonzini
2021-05-17 11:20 ` [PULL 19/20] KVM: Disable manual dirty log when dirty ring enabled Paolo Bonzini
2021-05-17 11:20 ` [PULL 20/20] KVM: Dirty ring support Paolo Bonzini
2021-05-17 12:15 ` [PULL 00/20] Misc patches for 2020-05-17 no-reply
2021-05-18 15:16 ` Peter Maydell

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=20210517112001.2564006-11-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).