From patchwork Fri Jun 24 05:54:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 70798 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp781249qgy; Thu, 23 Jun 2016 23:12:14 -0700 (PDT) X-Received: by 10.55.88.65 with SMTP id m62mr2808184qkb.0.1466748734365; Thu, 23 Jun 2016 23:12:14 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q7si3762917qkb.260.2016.06.23.23.12.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 23 Jun 2016 23:12:14 -0700 (PDT) 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]:41109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGKLd-0001xp-Pe for patch@linaro.org; Fri, 24 Jun 2016 02:12:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGK4P-0006kp-9Z for qemu-devel@nongnu.org; Fri, 24 Jun 2016 01:54:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGK4L-0005b0-3a for qemu-devel@nongnu.org; Fri, 24 Jun 2016 01:54:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGK4K-0005av-RD for qemu-devel@nongnu.org; Fri, 24 Jun 2016 01:54:21 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A939C04B305; Fri, 24 Jun 2016 05:54:20 +0000 (UTC) Received: from redhat.com (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u5O5sEBf030751; Fri, 24 Jun 2016 01:54:15 -0400 Date: Fri, 24 Jun 2016 08:54:13 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20160624085413-mutt-send-email-mst@redhat.com> References: <1466747621-4342-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1466747621-4342-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 24 Jun 2016 05:54:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/34] bios: Add tests for the IPMI ACPI and SMBIOS entries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Apfelbaum , Peter Maydell , Michael Tokarev , Corey Minyard Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Signed-off-by: Corey Minyard Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/bios-tables-test.c | 60 ++++++++++++++++++++++++++++++++--- tests/acpi-test-data/pc/DSDT.ipmikcs | Bin 0 -> 5575 bytes tests/acpi-test-data/q35/DSDT.ipmibt | Bin 0 -> 8340 bytes 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tests/acpi-test-data/pc/DSDT.ipmikcs create mode 100644 tests/acpi-test-data/q35/DSDT.ipmibt diff --git a/tests/acpi-test-data/pc/DSDT.ipmikcs b/tests/acpi-test-data/pc/DSDT.ipmikcs new file mode 100644 index 0000000000000000000000000000000000000000..f10cd9e296c942b66d6f2404f1a95fe5cc4a6796 GIT binary patch literal 5575 zcmb7I-ESMm5ud#yrQ?#6j?!6{?Ib4Tug0xye%Nw?7KO+=N~FxA&OFL>aYpYb$tcw( z^+Ab&$U*>_0Td^1DdVDjqg_7Re?s%tKITtI|AiDy{1kQOj!Ushu1E>+I3K^Ancbb4 z-J@X}t-qfDU|*Ei^s1dL-?elDWefm_reC!dy9ds`QC@LbQi?I>aWbIsQC75{8RhjA z_UDfGC(nETV~@3c*m$l!-DvwCJ@GbxKo2*3&WTVLT)XT#-7}V6%PDTPW~54Aa#?Xp zMiUfwy=E}gR6b|%B84iY$HG!8L< zT~IGvrD!Nzr+dn}n=b~jret6kij^P?vhB#bU!d=hl68AWUd+|3{ z$qJ1Gs9uA~x>ac~cnf5`M1-uD@khON?wTwdlQpM%rP_=eKc@-_V_@B z#}_~)U`bgv^wB0x4kJ3l=U3R*^4BuNR@k@lx42LXOK>?B*v>E4t&-U6WurEeRe{I( z8qYEQl1uyoerNa@e#qb9-|%U!DDJXR$(-aGrQ!HTLdNO-vTn6TvBp4~54WC{)ay^+ zb`RiLY&2(;r&rhq@&~e_EbIsIRATy?nHP&1XJG~kGqfR5W?sp!WKb5=z|1n4DI7Dy zrI8)n(MUVeD+%o=Lpx?IKb+6S1YkIJtC`;R-`#e9zxm# zY_g;pDu~g`jde5YuyS3$1=m3;#5AG z!CkA_0)Ix@_k3tSFDIV1`M&?C%_Z3I_jcMFz-8F%tG!JGC9wSJjavq6_0RVY|cZeR4*y+|Mahg~ZVPU7R5mB2{aINgj9H0GU3KDW0 zvz_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xk`!Biiaa{qA#= zWY_UehBSXh+W1eKf)i$T!b-d6#BxTX`+jjD#Hu!>hoG@;*gAJMzap3K{aA=Bt_S<~ z-JbgC-eI_hCoCe$X$-chnzLxuRrA?qMfbjd=CF4@EWSF#9!0YrhpkebNYrRjA~c$H zB2c4ANw%n)8pNf54-H6ch>)57`+-g zqbDFnZ}0JG`cb&n?xe;*H^Q~bmH4+f7^sx~Qiy9mF$Q$dJsg0?*F4{*xndACmX~ow z`$upStca^Grt~*Jy6Wjt^%~jXt-)V;$pTB0^7kL-L;`OWXkuuCZ+efikFt)7en(B- zw>bPLyC3Ix8vkQXuEeC$lQjJjf{*ZXI>N8^_Wtr69}r)?OyB;36mC@Ym3ibgr2hZA zvJ}#Vw1W?b-t$*!-C60)rc(|Ip?$VD>!xG^i!4Pi(Ge=@{o=9Y?)ItbD}l15+@(r* z8S{09&?D=YH{neLVNjVD!?go1Pr`=x{PIu8fSE4g&XN8SnY`a0dp?SY5)KL literal 0 HcmV?d00001 -- MST diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 16d11aa..92c90dd 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -49,6 +49,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 ACPI_READ_FIELD(field, addr) \ @@ -334,7 +336,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); @@ -661,7 +663,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++) { @@ -701,8 +702,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)); } } @@ -742,6 +743,10 @@ 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; @@ -751,6 +756,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); } @@ -762,6 +769,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); } @@ -772,6 +781,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); } @@ -783,11 +794,50 @@ 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(); @@ -804,6 +854,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(); boot_sector_cleanup(disk);