From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: kvm <kvm@vger.kernel.org>, Bandan Das <bsd@redhat.com>
Subject: Re: [PATCH 4/5] VMX: Validate capability MSRs
Date: Mon, 16 Jun 2014 13:00:28 +0200 [thread overview]
Message-ID: <539ECE4C.9020604@redhat.com> (raw)
In-Reply-To: <6a1106d8fefb4c808cdacc2a0632a5a55bd825b6.1402842281.git.jan.kiszka@web.de>
Il 15/06/2014 16:24, Jan Kiszka ha scritto:
> + for (n = 0; n < ARRAY_SIZE(vmx_ctl_msr); n++) {
> + val = rdmsr(vmx_ctl_msr[n].index);
> + default1 = vmx_ctl_msr[n].default1;
> + ok = (val & default1) == default1 &&
> + ((((u32)val) ^ (val >> 32)) & ~(val >> 32)) == 0;
Ouch, this can sure be make this more readable.
Please unify these:
union vmx_ctrl_pin {
u64 val;
struct {
u32 set, clr;
};
};
union vmx_ctrl_cpu {
u64 val;
struct {
u32 set, clr;
};
};
union vmx_ctrl_exit {
u64 val;
struct {
u32 set, clr;
};
};
union vmx_ctrl_ent {
u64 val;
struct {
u32 set, clr;
};
};
into a single "union vmx_ctl_msr", and use this union for val and
true_val as well.
Paolo
> + if (ok && basic.ctrl) {
> + true_val = rdmsr(vmx_ctl_msr[n].true_index);
> + ok = (val >> 32) == (true_val >> 32) &&
> + ((u32)(val ^ true_val) & ~default1) == 0;
> + }
> + report(vmx_ctl_msr[n].name, ok);
next prev parent reply other threads:[~2014-06-16 11:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-15 14:24 [PATCH 0/5] kvm-unit-tests: more instr. interceptions, debug control migration Jan Kiszka
2014-06-15 14:24 ` [PATCH 1/5] VMX: Add tests for CR3 and CR8 interception Jan Kiszka
2014-06-16 10:53 ` Paolo Bonzini
2014-06-16 11:31 ` Jan Kiszka
2014-06-15 14:24 ` [PATCH 2/5] VMX: Only use get_stage accessor Jan Kiszka
2014-06-16 17:19 ` Bandan Das
2014-06-15 14:24 ` [PATCH 3/5] VMX: Test both interception and execution of instructions Jan Kiszka
2014-06-15 14:24 ` [PATCH 4/5] VMX: Validate capability MSRs Jan Kiszka
2014-06-16 11:00 ` Paolo Bonzini [this message]
2014-06-16 11:26 ` Jan Kiszka
2014-06-15 14:24 ` [PATCH 5/5] VMX: Test behavior on set and cleared save/load debug controls Jan Kiszka
2014-06-16 11:02 ` Paolo Bonzini
2014-06-16 11:28 ` Jan Kiszka
2014-06-16 11:03 ` [PATCH 0/5] kvm-unit-tests: more instr. interceptions, debug control migration 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=539ECE4C.9020604@redhat.com \
--to=pbonzini@redhat.com \
--cc=bsd@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.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