From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: linux-kselftest@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Andrew Jones <drjones@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: [PATCH] selftests/kvm: add test for KVM_GET_MSR_FEATURE_INDEX_LIST
Date: Wed, 17 Mar 2021 08:45:52 +0100 [thread overview]
Message-ID: <20210317074552.8550-1-eesposit@redhat.com> (raw)
Extend the kvm_get_feature_msr function to cover also
KVM_GET_MSR_FEATURE_INDEX_LIST.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
tools/testing/selftests/kvm/lib/x86_64/processor.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index a8906e60a108..3eaa6b0172a9 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -688,13 +688,20 @@ uint64_t kvm_get_feature_msr(uint64_t msr_index)
struct kvm_msr_entry entry;
} buffer = {};
int r, kvm_fd;
+ struct kvm_msr_list features_list;
buffer.header.nmsrs = 1;
buffer.entry.index = msr_index;
+ features_list.nmsrs = 1;
+
kvm_fd = open(KVM_DEV_PATH, O_RDONLY);
if (kvm_fd < 0)
exit(KSFT_SKIP);
+ r = ioctl(kvm_fd, KVM_GET_MSR_FEATURE_INDEX_LIST, &features_list);
+ TEST_ASSERT(r < 0 && r != -E2BIG, "KVM_GET_MSR_FEATURE_INDEX_LIST IOCTL failed,\n"
+ " rc: %i errno: %i", r, errno);
+
r = ioctl(kvm_fd, KVM_GET_MSRS, &buffer.header);
TEST_ASSERT(r == 1, "KVM_GET_MSRS IOCTL failed,\n"
" rc: %i errno: %i", r, errno);
--
2.29.2
next reply other threads:[~2021-03-17 7:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 7:45 Emanuele Giuseppe Esposito [this message]
2021-03-17 10:49 ` [PATCH] selftests/kvm: add test for KVM_GET_MSR_FEATURE_INDEX_LIST Paolo Bonzini
2021-03-17 11:25 ` Emanuele Giuseppe Esposito
2021-03-17 12:07 ` Andrew Jones
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=20210317074552.8550-1-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=vkuznets@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