Add an "official" testcase for a guest with PCID disabled but INVPCID enabled, which is supported by SVM and will soon be supported by VMX. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/pcid.c | 9 +++++++-- x86/unittests.cfg | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/x86/pcid.c b/x86/pcid.c index 64efd05..527a4a9 100644 --- a/x86/pcid.c +++ b/x86/pcid.c @@ -68,7 +68,7 @@ report: report(passed, "Test on PCID when disabled"); } -static void test_invpcid_enabled(void) +static void test_invpcid_enabled(int pcid_enabled) { int passed = 0, i; ulong cr4 = read_cr4(); @@ -93,6 +93,10 @@ static void test_invpcid_enabled(void) goto report; } + /* Skip tests that require the PCIDE=1 if PCID isn't supported. */ + if (!pcid_enabled) + goto success; + if (write_cr4_checking(cr4 | X86_CR4_PCIDE) != 0) goto report; @@ -103,6 +107,7 @@ static void test_invpcid_enabled(void) if (invpcid_checking(2, &desc) != 0) goto report; +success: passed = 1; report: @@ -139,7 +144,7 @@ int main(int ac, char **av) test_pcid_disabled(); if (invpcid_enabled) - test_invpcid_enabled(); + test_invpcid_enabled(pcid_enabled); else test_invpcid_disabled(); diff --git a/x86/unittests.cfg b/x86/unittests.cfg index c3a4ee0..d8ef717 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -252,6 +252,11 @@ file = pcid.flat extra_params = -cpu qemu64,-pcid,-invpcid arch = x86_64 +[pcid-asymmetric] +file = pcid.flat +extra_params = -cpu qemu64,-pcid,+invpcid +arch = x86_64 + [rdpru] file = rdpru.flat extra_params = -cpu max -- 2.30.0.478.g8a0d178c01-goog