From: Robert Hoo <robert.hu@linux.intel.com>
To: kvm@vger.kernel.org, bsd@redhat.com
Cc: Robert Hoo <robert.hu@linux.intel.com>
Subject: [kvm-unit-tests PATCH] x86: vmx_tests: pml: Skip PML test if it's not enabled in underlying
Date: Sun, 25 Jul 2021 10:24:14 +0800 [thread overview]
Message-ID: <1627179854-1878-1-git-send-email-robert.hu@linux.intel.com> (raw)
PML in VM depends on "enable PML" in VM-execution control, check this
before vmwrite to PMLADDR, because this field doesn't exist if PML is
disabled in VM-execution control.
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
---
x86/vmx_tests.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 4f712eb..8663112 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1502,13 +1502,16 @@ static int pml_init(struct vmcs *vmcs)
return VMX_TEST_EXIT;
}
+ ctrl_cpu = vmcs_read(CPU_EXEC_CTRL1) & CPU_PML;
+ if (!ctrl_cpu) {
+ printf("\tPML is not enabled\n");
+ return VMX_TEST_EXIT;
+ }
+
pml_log = alloc_page();
vmcs_write(PMLADDR, (u64)pml_log);
vmcs_write(GUEST_PML_INDEX, PML_INDEX - 1);
- ctrl_cpu = vmcs_read(CPU_EXEC_CTRL1) | CPU_PML;
- vmcs_write(CPU_EXEC_CTRL1, ctrl_cpu);
-
return VMX_TEST_START;
}
--
1.8.3.1
next reply other threads:[~2021-07-25 2:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-25 2:24 Robert Hoo [this message]
2021-07-27 0:20 ` [kvm-unit-tests PATCH] x86: vmx_tests: pml: Skip PML test if it's not enabled in underlying Sean Christopherson
2021-07-27 3:12 ` Robert Hoo
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=1627179854-1878-1-git-send-email-robert.hu@linux.intel.com \
--to=robert.hu@linux.intel.com \
--cc=bsd@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.