From 4aedda03ca7e1e237cf9b3de8473303aadb8d112 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 28 Jun 2017 11:24:55 +0100 Subject: [PATCH] Test basic driver initialisation in the selftests Signed-off-by: Andrew Cooper --- tests/selftest/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/selftest/main.c b/tests/selftest/main.c index 8ff42b9..402c3e3 100644 --- a/tests/selftest/main.c +++ b/tests/selftest/main.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -283,6 +284,22 @@ static void test_custom_idte(void) xtf_failure("Fail: Unexpected result %#x\n", res); }; +static void test_driver_init(void) +{ + int rc; + + printk("Test: Driver basic initialisation\n"); + + if ( IS_DEFINED(CONFIG_HVM) ) + { + rc = apic_init(APIC_MODE_XAPIC); + + /* Cope with guests which have LAPIC emulation disabled. */ + if ( rc && rc != -ENODEV ) + xtf_failure("Fail: apic_init() returned %d\n", rc); + } +} + void test_main(void) { /* @@ -311,6 +328,7 @@ void test_main(void) test_unhandled_exception_hook(); test_extable_handler(); test_custom_idte(); + test_driver_init(); xtf_success(NULL); } -- 2.39.5