From: Joerg Roedel Subject: [PATCH 4/4] test: Add test to check if asid 0 is allowed Date: Mon, 2 Aug 2010 15:33:36 +0200 Message-ID: <1280756016-11330-5-git-send-email-joerg.roedel@amd.com> References: <1280756016-11330-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , Joerg Roedel To: Avi Kivity , Marcelo Tosatti Return-path: Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:15921 "EHLO VA3EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751521Ab0HBNan (ORCPT ); Mon, 2 Aug 2010 09:30:43 -0400 In-Reply-To: <1280756016-11330-1-git-send-email-joerg.roedel@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Joerg Roedel --- kvm/test/x86/svm.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/kvm/test/x86/svm.c b/kvm/test/x86/svm.c index fd98505..2f1c900 100644 --- a/kvm/test/x86/svm.c +++ b/kvm/test/x86/svm.c @@ -342,6 +342,21 @@ static bool check_mode_switch(struct test *test) return test->scratch == 2; } +static void prepare_asid_zero(struct test *test) +{ + test->vmcb->control.asid = 0; +} + +static void test_asid_zero(struct test *test) +{ + asm volatile ("vmmcall\n\t"); +} + +static bool check_asid_zero(struct test *test) +{ + return test->vmcb->control.exit_code == SVM_EXIT_ERR; +} + static struct test tests[] = { { "null", default_supported, default_prepare, null_test, default_finished, null_check }, @@ -360,6 +375,8 @@ static struct test tests[] = { default_finished, check_next_rip }, { "mode_switch", default_supported, prepare_mode_switch, test_mode_switch, mode_switch_finished, check_mode_switch }, + { "asid_zero", default_supported, prepare_asid_zero, test_asid_zero, + default_finished, check_asid_zero }, }; -- 1.7.0.4