From patchwork Thu Dec 17 18:50:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 58617 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp568701lbb; Thu, 17 Dec 2015 11:25:36 -0800 (PST) X-Received: by 10.140.41.234 with SMTP id z97mr69956127qgz.64.1450380336792; Thu, 17 Dec 2015 11:25:36 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s30si12610360qge.104.2015.12.17.11.25.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 Dec 2015 11:25:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:56505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9eBE-00046U-75 for patch@linaro.org; Thu, 17 Dec 2015 14:25:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9ddn-0007Yj-J5 for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:51:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9ddk-0007OU-Jq for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:51:03 -0500 Received: from vms173021pub.verizon.net ([206.46.173.21]:43291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9ddk-0007OE-Dn for qemu-devel@nongnu.org; Thu, 17 Dec 2015 13:51:00 -0500 Received: from serve.minyard.net ([173.57.176.17]) by vms173021.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0NZI00DRZN053KJ0@vms173021.mailsrvcs.net> for qemu-devel@nongnu.org; Thu, 17 Dec 2015 12:50:32 -0600 (CST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=WcjxEBVX c=1 sm=1 tr=0 a=bXmWQgKa9n63w7XTPFb8JQ==:117 a=N54-gffFAAAA:8 a=HL3alpDKAAAA:8 a=oR5dmqMzAAAA:8 a=xqWC_Br6kY4A:10 a=wUQvQvOEmiQA:10 a=fk1lIlRQAAAA:8 a=7wVY5b3Fr4ZkKyYMdgUA:9 a=xfFlBQJItVka5yVf:21 a=RdAh341WXkJXqMq3:21 Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:53a:188f:9b92:a0a7]) by serve.minyard.net (Postfix) with ESMTPA id 053ED35E4; Thu, 17 Dec 2015 12:50:29 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 664F9300FF0; Thu, 17 Dec 2015 12:50:27 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org, Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov Date: Thu, 17 Dec 2015 12:50:18 -0600 Message-id: <1450378219-25799-16-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.5.0 In-reply-to: <1450378219-25799-1-git-send-email-minyard@acm.org> References: <1450378219-25799-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.46.173.21 X-Mailman-Approved-At: Thu, 17 Dec 2015 14:22:15 -0500 Cc: Corey Minyard Subject: [Qemu-devel] [PATCH v5 15/16] bios: Add tests for the IPMI ACPI and SMBIOS entries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Corey Minyard Signed-off-by: Corey Minyard --- tests/acpi-test-data/pc/SSDT.ipmikcs | Bin 0 -> 2582 bytes tests/acpi-test-data/q35/SSDT.ipmibt | Bin 0 -> 790 bytes tests/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 tests/acpi-test-data/pc/SSDT.ipmikcs create mode 100644 tests/acpi-test-data/q35/SSDT.ipmibt -- 2.5.0 diff --git a/tests/acpi-test-data/pc/SSDT.ipmikcs b/tests/acpi-test-data/pc/SSDT.ipmikcs new file mode 100644 index 0000000000000000000000000000000000000000..f1107c37c8fa3523546b1759e488a624ebbd896d GIT binary patch literal 2582 zcma);%Wm676o$`Gv`vqwm{RCV;yC82K(a{WICj#VD2leEm@>hUj1)4!MG#a*FE)~9 zVR&P^sM~#CAZWdg9-)1NK0@B1KsR>bpTx zdG(iZpzxjm04meJ6PEWMrK+CBL91$|L88j_8Tsu`B`|EX0Y-EY+v3W;vW12BgDb?g<$8r=HYio zU%&hEKeONid=Tz2I1l!zruDQkZ3=8OmY=2-%an#RGPOYtb-?j|*r(UmKYw99qIVc4 zp~{+I`+vykybnR#`+wCBVJJN8%4wXat|-D#di^sy6L?8$PXGJ$Ag)&PSLfPk!Zr-ta;LlXh4EhgJb(*&{J;w0-A<(-gcDi&j|)8hQ8R8> zQKOS!hiN8c?-$2W!V)#A8Ak~=O3J1F*(!-bl+<@TyfpE$L!})o#V=EA^$Gz#)MON@ zR79XQEi70HRqJK7@Kd(Z3YB$`&iwZn*(UJ7FD&HTB+YiP&`y? zV}bL}02fDQtpS%=;RzSksn9=vpw^z_gR0k&h3t8JqyTOudpB_qwy6TL34KDbgqn<+ zT9i|#7@g9g>zs-+0Xu*VnAW14I>YFU4t>h07NeFH<(I|RwZdpci*o91 zMsMp-pHp!O{i;OPn(125y7+un$oO*}RJ36$%sdpK@ zt3^3=nbBn(8glAAM(=4+PF-PiMTc&2>U~D~*@vd;4S{Ex4e) z?jREm3f#?d;gMjch5~n_+&LvdPU&P&1c3^-m9a8NO*|77ZVqFQ>e`riR2eSuu}8IS zPCTj(7wXuf`ks+DcQU|z5Kq+$g$s@~o~x*@eLP(+6fPb1txRA04ryEj?0cEM_G_eZ zI1#jhF-}bO@i4hi!402!jZ`vV{l3U8hZ;Kr>YS9eB&m;S@SrB+qb(7M;(KiR_SFh-! i2)~r@=H$%&#s1Y6#xb3Wtu6dQ5UxyBvImz%F#ZLb|5+aZ literal 0 HcmV?d00001 diff --git a/tests/acpi-test-data/q35/SSDT.ipmibt b/tests/acpi-test-data/q35/SSDT.ipmibt new file mode 100644 index 0000000000000000000000000000000000000000..5c2078ce396decb418b4f1416fd541a7c9aaf902 GIT binary patch literal 790 zcmaJDK06#Ij6o0w1qJux) zT?Sak0XVEyRXU1a35p11r0>gW_4(Hy_-F$8EUL6sjQKlB(@}jDguw%_%`P(X`^Wny zhiAvn_D|5MvyfNUl{%canQ!?Pb0^^598t7xYF33|BEd_FVTQB7Mm`zZ>h=@mV}-gDTZqB=^ZtO}fO<kQncsP?gO_&$p?m4Izz*12^1Gi!Qqb<=P4rx%42|bCsA#Q8{qZLS<@zKk% pd3uVfaZAug+FkCn**EwOtbE;v33wYOX<@T@+2cm1Lzq{g^c#SctpNZ4 literal 0 HcmV?d00001 diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 6d37332..4b4c4e0 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -51,6 +51,8 @@ typedef struct { GArray *tables; uint32_t smbios_ep_addr; struct smbios_21_entry_point smbios_ep_table; + uint8_t *required_struct_types; + int required_struct_types_len; } test_data; #define LOW(x) ((x) & 0xff) @@ -372,7 +374,7 @@ static void test_acpi_tables(test_data *data) for (i = 0; i < tables_nr; i++) { AcpiSdtTable ssdt_table; - memset(&ssdt_table, 0 , sizeof(ssdt_table)); + memset(&ssdt_table, 0, sizeof(ssdt_table)); uint32_t addr = data->rsdt_tables_addr[i + 1]; /* fadt is first */ test_dst_table(&ssdt_table, addr); g_array_append_val(data->tables, ssdt_table); @@ -675,7 +677,6 @@ static void test_smbios_structs(test_data *data) uint32_t addr = ep_table->structure_table_address; int i, len, max_len = 0; uint8_t type, prv, crt; - uint8_t required_struct_types[] = {0, 1, 3, 4, 16, 17, 19, 32, 127}; /* walk the smbios tables */ for (i = 0; i < ep_table->number_of_structures; i++) { @@ -715,8 +716,8 @@ static void test_smbios_structs(test_data *data) g_assert_cmpuint(ep_table->max_structure_size, ==, max_len); /* required struct types must all be present */ - for (i = 0; i < ARRAY_SIZE(required_struct_types); i++) { - g_assert(test_bit(required_struct_types[i], struct_bitmap)); + for (i = 0; i < data->required_struct_types_len; i++) { + g_assert(test_bit(data->required_struct_types[i], struct_bitmap)); } } @@ -777,6 +778,9 @@ static void test_acpi_one(const char *params, test_data *data) g_free(args); } +static uint8_t base_required_struct_types[] = + {0, 1, 3, 4, 16, 17, 19, 32, 127}; + static void test_acpi_piix4_tcg(void) { test_data data; @@ -786,6 +790,8 @@ static void test_acpi_piix4_tcg(void) */ memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one("-machine accel=tcg", &data); free_test_data(&data); } @@ -797,6 +803,8 @@ static void test_acpi_piix4_tcg_bridge(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".bridge"; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data); free_test_data(&data); } @@ -807,6 +815,8 @@ static void test_acpi_q35_tcg(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one("-machine q35,accel=tcg", &data); free_test_data(&data); } @@ -818,11 +828,49 @@ static void test_acpi_q35_tcg_bridge(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; data.variant = ".bridge"; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1", &data); free_test_data(&data); } +static uint8_t ipmi_required_struct_types[] = + {0, 1, 3, 4, 16, 17, 19, 32, 38, 127}; + +static void test_acpi_q35_tcg_ipmi(void) +{ + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_Q35; + data.variant = ".ipmibt"; + data.required_struct_types = ipmi_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); + test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0" + " -device isa-ipmi-bt,bmc=bmc0", + &data); + free_test_data(&data); +} + +static void test_acpi_piix4_tcg_ipmi(void) +{ + test_data data; + + /* Supplying -machine accel argument overrides the default (qtest). + * This is to make guest actually run. + */ + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_PC; + data.variant = ".ipmikcs"; + data.required_struct_types = ipmi_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); + test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0" + " -device isa-ipmi-kcs,irq=0,bmc=bmc0", + &data); + free_test_data(&data); +} + int main(int argc, char *argv[]) { const char *arch = qtest_get_arch(); @@ -843,6 +891,8 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge); + qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi); + qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi); } ret = g_test_run(); unlink(disk);