kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"David Hildenbrand" <david@redhat.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Richard Henderson" <rth@twiddle.net>,
	qemu-s390x@nongnu.org,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	qemu-arm@nongnu.org, "Cornelia Huck" <cohuck@redhat.com>,
	qemu-ppc@nongnu.org,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [RFC PATCH 6/7] target/i386/kvm: Simplify kvm_get_mce_cap_supported()
Date: Tue, 23 Jun 2020 12:50:51 +0200	[thread overview]
Message-ID: <20200623105052.1700-7-philmd@redhat.com> (raw)
In-Reply-To: <20200623105052.1700-1-philmd@redhat.com>

As the MCE supported capabilities should be the same for
all VMs, it is safe to directly use the global kvm_state.
Remove the unnecessary KVMState* argument.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/i386/kvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 19d3db657a..626cb04d88 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -536,7 +536,7 @@ uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
     }
 }
 
-static int kvm_get_mce_cap_supported(KVMState *s, uint64_t *mce_cap,
+static int kvm_get_mce_cap_supported(uint64_t *mce_cap,
                                      int *max_banks)
 {
     int r;
@@ -544,7 +544,7 @@ static int kvm_get_mce_cap_supported(KVMState *s, uint64_t *mce_cap,
     r = kvm_check_extension(KVM_CAP_MCE);
     if (r > 0) {
         *max_banks = r;
-        return kvm_ioctl(s, KVM_X86_GET_MCE_CAP_SUPPORTED, mce_cap);
+        return kvm_ioctl(kvm_state, KVM_X86_GET_MCE_CAP_SUPPORTED, mce_cap);
     }
     return -ENOSYS;
 }
@@ -1707,7 +1707,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         int banks;
         int ret;
 
-        ret = kvm_get_mce_cap_supported(cs->kvm_state, &mcg_cap, &banks);
+        ret = kvm_get_mce_cap_supported(&mcg_cap, &banks);
         if (ret < 0) {
             fprintf(stderr, "kvm_get_mce_cap_supported: %s", strerror(-ret));
             return ret;
-- 
2.21.3


  parent reply	other threads:[~2020-06-23 10:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 10:50 [PATCH 0/7] accel/kvm: Simplify few functions that can use global kvm_state Philippe Mathieu-Daudé
2020-06-23 10:50 ` [PATCH 1/7] accel/kvm: Let kvm_check_extension use global KVM state Philippe Mathieu-Daudé
2020-06-23 15:25   ` Cornelia Huck
2020-06-23 10:50 ` [PATCH 2/7] accel/kvm: Simplify kvm_check_extension() Philippe Mathieu-Daudé
2020-06-23 15:43   ` Cornelia Huck
2020-06-23 10:50 ` [PATCH 3/7] accel/kvm: Simplify kvm_check_extension_list() Philippe Mathieu-Daudé
2020-06-23 15:50   ` Cornelia Huck
2020-06-23 10:50 ` [RFC PATCH 4/7] accel/kvm: Simplify kvm_set_sigmask_len() Philippe Mathieu-Daudé
2020-07-05  7:12   ` Paolo Bonzini
2020-07-05  9:57     ` Philippe Mathieu-Daudé
2020-06-23 10:50 ` [PATCH 5/7] target/i386/kvm: Simplify get_para_features() Philippe Mathieu-Daudé
2020-06-23 15:56   ` Cornelia Huck
2020-06-23 10:50 ` Philippe Mathieu-Daudé [this message]
2020-06-23 10:50 ` [RFC PATCH 7/7] target/i386/kvm: Simplify kvm_get_supported_[feature]_msrs() Philippe Mathieu-Daudé
2020-07-04 16:50 ` [PATCH 0/7] accel/kvm: Simplify few functions that can use global kvm_state Philippe Mathieu-Daudé
2020-07-05  6:16   ` Paolo Bonzini

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=20200623105052.1700-7-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@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).