From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 14/17] vmxcap: port to Python 3
Date: Mon, 27 Feb 2017 13:45:48 +0100 [thread overview]
Message-ID: <20170227124551.8673-15-pbonzini@redhat.com> (raw)
In-Reply-To: <20170227124551.8673-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/kvm/vmxcap | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
index 2220255..af8de15 100755
--- a/scripts/kvm/vmxcap
+++ b/scripts/kvm/vmxcap
@@ -27,9 +27,9 @@ MSR_IA32_VMX_VMFUNC = 0x491
class msr(object):
def __init__(self):
try:
- self.f = open('/dev/cpu/0/msr', 'r', 0)
+ self.f = open('/dev/cpu/0/msr', 'rb', 0)
except:
- self.f = open('/dev/msr0', 'r', 0)
+ self.f = open('/dev/msr0', 'rb', 0)
def read(self, index, default = None):
import struct
self.f.seek(index)
@@ -49,7 +49,7 @@ class Control(object):
val = m.read(nr, 0)
return (val & 0xffffffff, val >> 32)
def show(self):
- print self.name
+ print(self.name)
mbz, mb1 = self.read2(self.cap_msr)
tmbz, tmb1 = 0, 0
if self.true_cap_msr:
@@ -69,7 +69,7 @@ class Control(object):
s = 'forced'
elif one and zero:
s = 'yes'
- print ' %-40s %s' % (self.bits[bit], s)
+ print(' %-40s %s' % (self.bits[bit], s))
class Misc(object):
def __init__(self, name, bits, msr):
@@ -77,9 +77,9 @@ class Misc(object):
self.bits = bits
self.msr = msr
def show(self):
- print self.name
+ print(self.name)
value = msr().read(self.msr, 0)
- print ' Hex: 0x%x' % (value)
+ print(' Hex: 0x%x' % (value))
def first_bit(key):
if type(key) is tuple:
return key[0]
@@ -94,7 +94,7 @@ class Misc(object):
def fmt(x):
return { True: 'yes', False: 'no' }[x]
v = (value >> lo) & ((1 << (hi - lo + 1)) - 1)
- print ' %-40s %s' % (self.bits[bits], fmt(v))
+ print(' %-40s %s' % (self.bits[bits], fmt(v)))
controls = [
Misc(
--
2.9.3
next prev parent reply other threads:[~2017-02-27 12:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 12:45 [Qemu-devel] [PULL v2 00/17] KVM and cpu-exec patches for 2.9 soft freeze Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 01/17] cpu-exec: unify icount_decr and tcg_exit_req Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 02/17] replay: check icount in cpu exec loop Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 03/17] cpu-exec: remove unnecessary check of cpu->exit_request Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 04/17] update-linux-headers: update for 4.11 Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 05/17] update Linux headers to 4.11 Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 06/17] cpus: remove ugly cast on sigbus_handler Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 07/17] KVM: x86: cleanup SIGBUS handlers Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 08/17] cpus: reorganize signal handling code Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 09/17] KVM: remove kvm_arch_on_sigbus Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 10/17] KVM: do not use sigtimedwait to catch SIGBUS Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 11/17] KVM: move SIG_IPI handling to kvm-all.c Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 12/17] kvm: use atomic_read/atomic_set to access cpu->exit_request Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 13/17] KVM: use KVM_CAP_IMMEDIATE_EXIT Paolo Bonzini
2017-02-27 12:45 ` Paolo Bonzini [this message]
2017-02-27 12:45 ` [Qemu-devel] [PATCH 15/17] vmxcap: update for September 2016 SDM Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 16/17] qapi: flatten GuestPanicInformation union Paolo Bonzini
2017-02-27 12:45 ` [Qemu-devel] [PATCH 17/17] qmp-events: fix GUEST_PANICKED description formatting Paolo Bonzini
2017-02-27 14:03 ` [Qemu-devel] [PULL v2 00/17] KVM and cpu-exec patches for 2.9 soft freeze no-reply
2017-02-27 14:37 ` Peter Maydell
2017-02-27 15:02 ` 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=20170227124551.8673-15-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).