From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388377; cv=none; d=zoho.com; s=zohoarc; b=kZqLo5ZngLW3fyjzms4KAbSvEy404kaD6W6U0dQdJSOdnlLoQ8us+2J0s+/GMULDJrGJjdB+eTQj3xgj8qj26ftQbgyvF5njMuv3vKeNYh4p2axi9T0maualY++hVCW1LW3U9eq4A2mvZtuIA9wnZIfLSCsGBHJsnLAq1jQrDfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388377; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GplsF84C+uuglmyHlVWU0sOSJaBgPjq8Oyr/J8+epHA=; b=Cja6NiLJPLMIUlagqLFc7hP8y+7bHY6SA+QK+JDoepKIaemSPlgtAdMsRs2RY6N+swZk9tXteKzdyNZqmdEIZ+1tRjdMdPFG2NIpb7aLe/JteQk1lhUMU1AiNYBJtwlEUrGJZusYkKsNy74JxSYesqhqX8MOi10EenIsnVLf448= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388377121129.38685054704183; Mon, 20 May 2019 14:39:37 -0700 (PDT) Received: from localhost ([127.0.0.1]:42241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq0C-00031j-UR for importer@patchew.org; Mon, 20 May 2019 17:39:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpy6-0001sL-S6 for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpy5-0003kG-VR for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpy5-0003jT-QJ for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF42930862BE; Mon, 20 May 2019 21:37:12 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 703B65D704; Mon, 20 May 2019 21:37:10 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:54 +0200 Message-Id: <20190520213700.12620-2-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 20 May 2019 21:37:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 1/7] tests/libqos: Add io_fw_cfg_uninit() and mm_fw_cfg_uninit() 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The mm_fw_cfg_init() allocates a QFWCFG object, add mm_fw_cfg_uninit() to deallocate it. Similarly with io_fw_cfg_init(), add io_fw_cfg_uninit(). Signed-off-by: Li Qiang Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-2-liq3ea@163.com> [PMD: Split patch, filled commit description] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- tests/libqos/fw_cfg.c | 10 ++++++++++ tests/libqos/fw_cfg.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c index d0889d1e22a..c6839c53c80 100644 --- a/tests/libqos/fw_cfg.c +++ b/tests/libqos/fw_cfg.c @@ -81,6 +81,11 @@ QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base) return fw_cfg; } =20 +void mm_fw_cfg_uninit(QFWCFG *fw_cfg) +{ + g_free(fw_cfg); +} + static void io_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key) { qtest_outw(fw_cfg->qts, fw_cfg->base, key); @@ -107,3 +112,8 @@ QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base) =20 return fw_cfg; } + +void io_fw_cfg_uninit(QFWCFG *fw_cfg) +{ + g_free(fw_cfg); +} diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h index 0353416af07..391669031a3 100644 --- a/tests/libqos/fw_cfg.h +++ b/tests/libqos/fw_cfg.h @@ -33,7 +33,9 @@ uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key); uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key); =20 QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base); +void mm_fw_cfg_uninit(QFWCFG *fw_cfg); QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base); +void io_fw_cfg_uninit(QFWCFG *fw_cfg); =20 static inline QFWCFG *pc_fw_cfg_init(QTestState *qts) { --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388586; cv=none; d=zoho.com; s=zohoarc; b=i9N4V4tI6XJLMpTfxrykUuzOZceSR4ppd2G7VhqtJji6yx0pKJxHt6dNClLymQclBD3ZFGIifNeugpPn59uGUXrljBv09Hk7qEIz7JDuToZj9PrBCtV/Mfhs1r2dRPdyiLFoUGutWSOgw7RqrJYvn/TIaQ/MFHhZkc/GSdKAcMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388586; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Qh4nN0Di9SI2k81XN1P6Zkd9wRrZY5slF5XKtYOIkLk=; b=kvDhKjVQO7f2l7YT8gqz4G3WNSZRWjMH48mBWTTSbUj2+KxowZXoUD+evhbmKU9dKatoqFST080kRvSfByPmhDuUbo/LfHMhQs0InVl7prYtqWRHpbzzjTBRbGfjiEoqG+PXc7E2htfOh5uleGCHr7pi74VuspvBa7jJfwHUShg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388586604458.61261241248565; Mon, 20 May 2019 14:43:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:42304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq39-0005tN-0T for importer@patchew.org; Mon, 20 May 2019 17:42:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyB-0001wx-MU for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpy9-0003o2-Sg for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpy9-0003n5-No for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA79E30842A0; Mon, 20 May 2019 21:37:15 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81CEC46475; Mon, 20 May 2019 21:37:13 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:55 +0200 Message-Id: <20190520213700.12620-3-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 20 May 2019 21:37:15 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 2/7] tests/libqos: Add pc_fw_cfg_uninit() and use it 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The pc_fw_cfg_init() function allocates an IO QFWCFG object. Add the pc_fw_cfg_uninit() function to deallocate it (and use it). Signed-off-by: Li Qiang Tested-by: Thomas Huth Message-Id: <20190424140643.62457-2-liq3ea@163.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 [PMD: Split patch, fill commit description, call uninit in malloc-pc.c] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laszlo Ersek --- tests/fw_cfg-test.c | 1 + tests/libqos/fw_cfg.h | 5 +++++ tests/libqos/malloc-pc.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index 1c5103fe1c5..a370ad56678 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -128,6 +128,7 @@ int main(int argc, char **argv) =20 ret =3D g_test_run(); =20 + pc_fw_cfg_uninit(fw_cfg); qtest_quit(s); =20 return ret; diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h index 391669031a3..60de81e8633 100644 --- a/tests/libqos/fw_cfg.h +++ b/tests/libqos/fw_cfg.h @@ -42,4 +42,9 @@ static inline QFWCFG *pc_fw_cfg_init(QTestState *qts) return io_fw_cfg_init(qts, 0x510); } =20 +static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg) +{ + io_fw_cfg_uninit(fw_cfg); +} + #endif diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c index 949a99361d1..6f92ce41350 100644 --- a/tests/libqos/malloc-pc.c +++ b/tests/libqos/malloc-pc.c @@ -29,5 +29,5 @@ void pc_alloc_init(QGuestAllocator *s, QTestState *qts, Q= AllocOpts flags) alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE); =20 /* clean-up */ - g_free(fw_cfg); + pc_fw_cfg_uninit(fw_cfg); } --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388711; cv=none; d=zoho.com; s=zohoarc; b=omHd4+MjdR/pnky+b9ts5qUZKMiheUYrfNnHJtTnMIFztHAnHs/SD4cxkKiX899r7JJdLrVSXWMKXX3qLnLCip+38+JqcjwMLfn4mP7U2XY7s7MOYB8TD0+byQW3nSxGNuJhUAQ3V4lkeLVDUYroNUhmYr7T3lMcrYhcdTTO2Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388711; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EK0ivE5HOpKt4ExUjyT1HWkjOmXh7zGTgKh1QzuRexc=; b=VSiaxr0CTuOq5Uliqf8be3RotldnLN79sjTsjT0e/RUEj80t+/W1V+ZcHG7fNwDIghKC9TqmvOSbIe70mTqPYbKkoZKqDkb0OCNY9AOCrgpBB/ZzTe5pcaS4tULCbdGdgMQzkxj08urtckVaere08GvH7k6dgNGfejBdjkRdydA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388711918441.670561875839; Mon, 20 May 2019 14:45:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:42329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq5e-0007nx-P4 for importer@patchew.org; Mon, 20 May 2019 17:45:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyD-0001yl-N7 for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpyC-0003pe-1P for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpyB-0003oa-Lj for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86BC23086258; Mon, 20 May 2019 21:37:18 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F49F5D704; Mon, 20 May 2019 21:37:16 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:56 +0200 Message-Id: <20190520213700.12620-4-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 20 May 2019 21:37:18 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 3/7] tests: refactor fw_cfg_test 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang Currently, fw_cfg_test uses one QTestState for every test case. This will add all command lines for every test case and this is unnecessary. This patch split the test cases and for every test case it uses his own QTestState. This patch does following things: 1. Get rid of the global 'fw_cfg', this need add a uninit function 2. Convert every test case in a separate QTestState After this patch, we can add fw_cfg test case freely and will not have effect on other test cases. Signed-off-by: Li Qiang Acked-by: Thomas Huth Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-2-liq3ea@163.com> [PMD: Removed 'ret' local variable in main()] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/fw_cfg-test.c | 93 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 15 deletions(-) diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index a370ad56678..4597626dd78 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -21,62 +21,127 @@ static uint16_t nb_cpus =3D 1; static uint16_t max_cpus =3D 1; static uint64_t nb_nodes =3D 0; static uint16_t boot_menu =3D 0; -static QFWCFG *fw_cfg =3D NULL; =20 static void test_fw_cfg_signature(void) { + QFWCFG *fw_cfg; + QTestState *s; char buf[5]; =20 + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + qfw_cfg_get(fw_cfg, FW_CFG_SIGNATURE, buf, 4); buf[4] =3D 0; =20 g_assert_cmpstr(buf, =3D=3D, "QEMU"); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_id(void) { - uint32_t id =3D qfw_cfg_get_u32(fw_cfg, FW_CFG_ID); + QFWCFG *fw_cfg; + QTestState *s; + uint32_t id; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + + id =3D qfw_cfg_get_u32(fw_cfg, FW_CFG_ID); g_assert((id =3D=3D 1) || (id =3D=3D 3)); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_uuid(void) { + QFWCFG *fw_cfg; + QTestState *s; + uint8_t buf[16]; static const uint8_t uuid[16] =3D { 0x46, 0x00, 0xcb, 0x32, 0x38, 0xec, 0x4b, 0x2f, 0x8a, 0xcb, 0x81, 0xc6, 0xea, 0x54, 0xf2, 0xd8, }; =20 + s =3D qtest_init("-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8"); + fw_cfg =3D pc_fw_cfg_init(s); + qfw_cfg_get(fw_cfg, FW_CFG_UUID, buf, 16); g_assert(memcmp(buf, uuid, sizeof(buf)) =3D=3D 0); + + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); + } =20 static void test_fw_cfg_ram_size(void) { + QFWCFG *fw_cfg; + QTestState *s; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE), =3D=3D, ram_= size); + + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_nographic(void) { + QFWCFG *fw_cfg; + QTestState *s; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u16(fw_cfg, FW_CFG_NOGRAPHIC), =3D=3D, 0); + + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_nb_cpus(void) { + QFWCFG *fw_cfg; + QTestState *s; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u16(fw_cfg, FW_CFG_NB_CPUS), =3D=3D, nb_cp= us); + + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_max_cpus(void) { + QFWCFG *fw_cfg; + QTestState *s; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u16(fw_cfg, FW_CFG_MAX_CPUS), =3D=3D, max_= cpus); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_numa(void) { + QFWCFG *fw_cfg; + QTestState *s; uint64_t *cpu_mask; uint64_t *node_mask; =20 + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_NUMA), =3D=3D, nb_nodes= ); =20 cpu_mask =3D g_new0(uint64_t, max_cpus); @@ -92,24 +157,27 @@ static void test_fw_cfg_numa(void) =20 g_free(node_mask); g_free(cpu_mask); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 static void test_fw_cfg_boot_menu(void) { + QFWCFG *fw_cfg; + QTestState *s; + + s =3D qtest_init(""); + fw_cfg =3D pc_fw_cfg_init(s); + g_assert_cmpint(qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_MENU), =3D=3D, boo= t_menu); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); } =20 int main(int argc, char **argv) { - QTestState *s; - int ret; - g_test_init(&argc, &argv, NULL); =20 - s =3D qtest_init("-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8"); - - fw_cfg =3D pc_fw_cfg_init(s); - qtest_add_func("fw_cfg/signature", test_fw_cfg_signature); qtest_add_func("fw_cfg/id", test_fw_cfg_id); qtest_add_func("fw_cfg/uuid", test_fw_cfg_uuid); @@ -126,10 +194,5 @@ int main(int argc, char **argv) qtest_add_func("fw_cfg/numa", test_fw_cfg_numa); qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu); =20 - ret =3D g_test_run(); - - pc_fw_cfg_uninit(fw_cfg); - qtest_quit(s); - - return ret; + return g_test_run(); } --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388567; cv=none; d=zoho.com; s=zohoarc; b=gjSN5r+eXhaTDhwayliMgpCDf+/Il/lEtkVZdNmHEcB47sVJ7ACMwGSuR3CaT1sKDSXq2uLwiyjFpWj3g11mVmFDg+T+O8u39KJSfhzNv+rqpGN/ZF52B2Y0eXVhON3t7B4reO0xJg1mGxYMh8GmIFr2JofgvoERm0/U5v/EdAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388567; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Fnt65UclnaTH2wTFkDSa4SuG3Ckr9L3+airws/8xcB4=; b=MjacnqTWs4/APagnanDSdbNFmcOPMNq0Y6pwZLDo0t7/NnyM3I4E5hAz+NlWUIJTnQkTzLQPjTJQoLcI/As7OXZnvMspats4U/VdraTAJOvCqNeVyT3RuOHo1taAs8xJFf2P+LudsQkI+Odjhg8qM4MThwl0Sp6FtKP/mbwe4s4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388567274430.50418546592016; Mon, 20 May 2019 14:42:47 -0700 (PDT) Received: from localhost ([127.0.0.1]:42306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq3H-0005yy-Uo for importer@patchew.org; Mon, 20 May 2019 17:42:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyH-00020v-Tr for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpyF-0003sb-Po for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57728) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpyF-0003rB-Hz for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FA40C130704; Mon, 20 May 2019 21:37:21 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 016C75D704; Mon, 20 May 2019 21:37:18 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:57 +0200 Message-Id: <20190520213700.12620-5-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 May 2019 21:37:21 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 4/7] tests: fw_cfg: add a function to get the fw_cfg file 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang This is useful to write qtest about fw_cfg file entry. Signed-off-by: Li Qiang Acked-by: Thomas Huth Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-3-liq3ea@163.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/libqos/fw_cfg.c | 45 +++++++++++++++++++++++++++++++++++++++++++ tests/libqos/fw_cfg.h | 2 ++ 2 files changed, 47 insertions(+) diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c index c6839c53c80..1f46258f96b 100644 --- a/tests/libqos/fw_cfg.c +++ b/tests/libqos/fw_cfg.c @@ -16,6 +16,7 @@ #include "libqos/fw_cfg.h" #include "libqtest.h" #include "qemu/bswap.h" +#include "hw/nvram/fw_cfg.h" =20 void qfw_cfg_select(QFWCFG *fw_cfg, uint16_t key) { @@ -59,6 +60,50 @@ static void mm_fw_cfg_select(QFWCFG *fw_cfg, uint16_t ke= y) qtest_writew(fw_cfg->qts, fw_cfg->base, key); } =20 +/* + * The caller need check the return value. When the return value is + * nonzero, it means that some bytes have been transferred. + * + * If the fw_cfg file in question is smaller than the allocated & passed-in + * buffer, then the buffer has been populated only in part. + * + * If the fw_cfg file in question is larger than the passed-in + * buffer, then the return value explains how much room would have been + * necessary in total. And, while the caller's buffer has been fully + * populated, it has received only a starting slice of the fw_cfg file. + */ +size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename, + void *data, size_t buflen) +{ + uint32_t count; + uint32_t i; + unsigned char *filesbuf =3D NULL; + size_t dsize; + FWCfgFile *pdir_entry; + size_t filesize =3D 0; + + qfw_cfg_get(fw_cfg, FW_CFG_FILE_DIR, &count, sizeof(count)); + count =3D be32_to_cpu(count); + dsize =3D sizeof(uint32_t) + count * sizeof(struct fw_cfg_file); + filesbuf =3D g_malloc(dsize); + qfw_cfg_get(fw_cfg, FW_CFG_FILE_DIR, filesbuf, dsize); + pdir_entry =3D (FWCfgFile *)(filesbuf + sizeof(uint32_t)); + for (i =3D 0; i < count; ++i, ++pdir_entry) { + if (!strcmp(pdir_entry->name, filename)) { + uint32_t len =3D be32_to_cpu(pdir_entry->size); + uint16_t sel =3D be16_to_cpu(pdir_entry->select); + filesize =3D len; + if (len > buflen) { + len =3D buflen; + } + qfw_cfg_get(fw_cfg, sel, data, len); + break; + } + } + g_free(filesbuf); + return filesize; +} + static void mm_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len) { uint8_t *ptr =3D data; diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h index 60de81e8633..13325cc4ffe 100644 --- a/tests/libqos/fw_cfg.h +++ b/tests/libqos/fw_cfg.h @@ -31,6 +31,8 @@ void qfw_cfg_get(QFWCFG *fw_cfg, uint16_t key, void *data= , size_t len); uint16_t qfw_cfg_get_u16(QFWCFG *fw_cfg, uint16_t key); uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key); uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key); +size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename, + void *data, size_t buflen); =20 QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base); void mm_fw_cfg_uninit(QFWCFG *fw_cfg); --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388910; cv=none; d=zoho.com; s=zohoarc; b=ex2HaAXVzUW/HuWOMs4qBbLlnn5dYg+FBqAoEBMGdgNwqbxhKqVd00b8NC15WPuSWljhCU9v65rOEhPdh82HLTcI/SWYWBMkPrWCFDOkA20yXbSptGHbKVbEtvuWnHHtk1+Qvv/zsOfYLuMHROBXBX+4zGACUSeAWSiHEIMh3ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388910; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XL9c1451tuiFFnj/maLQygFbEFJQgM25eA65DbhGx5w=; b=Eg7G3xyLXkCZrNEOsU3tN8s7X2Fu5d/FZ5HHbJ09wzPsVYik5B6m/Um/RxLqOMHIVzd3xJTFfdlfpblhBtHqLDbvFb79+uZFRgBYYK3/bg6kGbCUjRqrpS0VOc/ecyzKnDpihvllNSJugec3oG9lvUBtichHY80WoLyxSWZ+XhQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388910426669.2796399809937; Mon, 20 May 2019 14:48:30 -0700 (PDT) Received: from localhost ([127.0.0.1]:42403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq8n-0001nW-E2 for importer@patchew.org; Mon, 20 May 2019 17:48:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyQ-00028P-Su for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpyP-000409-3s for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpyN-0003wR-4U for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF3123084295; Mon, 20 May 2019 21:37:28 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F33F5D704; Mon, 20 May 2019 21:37:21 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:58 +0200 Message-Id: <20190520213700.12620-6-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 20 May 2019 21:37:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 5/7] hw/nvram/fw_cfg: Store 'reboot-timeout' as little endian 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang The current codebase is not specific about the endianess of the fw_cfg 'file' entry 'reboot-timeout'. Per docs/specs/fw_cfg.txt: =3D=3D=3D All Other Data Items =3D=3D=3D Please consult the QEMU source for the most up-to-date and authoritative list of selector keys and their respective items' purpose, format and writeability. Checking the git history, this code was introduced in commit ac05f3492421, very similar to commit 3d3b8303c6f8 for the 'boot-menu-wait' entry, which explicitely use little-endian. OVMF consumes 'boot-menu-wait' as little-endian, however it does not consume 'reboot-timeout'. Regarding the git history and OVMF use, we choose to explicit 'reboot-timeout' endianess as little-endian. Signed-off-by: Li Qiang Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-4-liq3ea@163.com> [PMD: Reword commit description based on review comments] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 5c3a46ce6f2..df4242fc9cb 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -178,6 +178,7 @@ static void fw_cfg_reboot(FWCfgState *s) { const char *reboot_timeout =3D NULL; int64_t rt_val =3D -1; + uint32_t rt_le32; =20 /* get user configuration */ QemuOptsList *plist =3D qemu_find_opts("boot-opts"); @@ -194,7 +195,8 @@ static void fw_cfg_reboot(FWCfgState *s) } } =20 - fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&rt_val, 4), 4); + rt_le32 =3D cpu_to_le32(rt_val); + fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&rt_le32, 4), 4); } =20 static void fw_cfg_write(FWCfgState *s, uint8_t value) --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388650; cv=none; d=zoho.com; s=zohoarc; b=dcpL6OAY9Cz7GUTqJX17c+5uMggXmCmI4S1g4YsjyZrLdQVrTzm1VFw2tXarTES25IG0m6HWIZWKigtNyO8OEvaeg3Qu+bdPU9ZcXDfeHHC3irtIGduuRjfr2QOMMaKrxA0AbeIZJg71NpFhqsACLb6fbHYo8NtIc6EWzlGvx8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=g+HMJqM6X6kh7s7Z6msJQt962bYW6ahRajvYbdVKOqM=; b=Adr9xX1VXeYEn/W/8DMMD4nlDzIStpD4oVTYIPEqzki2LOuq28TdYjvmn5KWAjUmHDUVz/LDNWS/mn9MgITu7exljQFewVuoyuzi0HkgT3vpvGRqsSL5eNrrIUN2aL240zm3LkvJihl8JPPIIdlMYX9/kzoa6q2blerxpBX/Lj8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388650535136.91058122804475; Mon, 20 May 2019 14:44:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:42320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq4b-00072f-2y for importer@patchew.org; Mon, 20 May 2019 17:43:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyR-00028a-3u for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpyP-00040Z-7A for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33464) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpyP-0003yx-1V for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C31D54E908; Mon, 20 May 2019 21:37:31 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27D6746475; Mon, 20 May 2019 21:37:28 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:36:59 +0200 Message-Id: <20190520213700.12620-7-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 20 May 2019 21:37:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 6/7] tests: fw_cfg: add 'reboot-timeout' test case 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang Signed-off-by: Li Qiang Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-5-liq3ea@163.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/fw_cfg-test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index 4597626dd78..20b1eb75f4d 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -15,6 +15,7 @@ #include "libqtest.h" #include "standard-headers/linux/qemu_fw_cfg.h" #include "libqos/fw_cfg.h" +#include "qemu/bswap.h" =20 static uint64_t ram_size =3D 128 << 20; static uint16_t nb_cpus =3D 1; @@ -174,6 +175,25 @@ static void test_fw_cfg_boot_menu(void) qtest_quit(s); } =20 +static void test_fw_cfg_reboot_timeout(void) +{ + QFWCFG *fw_cfg; + QTestState *s; + uint32_t reboot_timeout =3D 0; + size_t filesize; + + s =3D qtest_init("-boot reboot-timeout=3D15"); + fw_cfg =3D pc_fw_cfg_init(s); + + filesize =3D qfw_cfg_get_file(fw_cfg, "etc/boot-fail-wait", + &reboot_timeout, sizeof(reboot_timeout)); + g_assert_cmpint(filesize, =3D=3D, sizeof(reboot_timeout)); + reboot_timeout =3D le32_to_cpu(reboot_timeout); + g_assert_cmpint(reboot_timeout, =3D=3D, 15); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -193,6 +213,7 @@ int main(int argc, char **argv) qtest_add_func("fw_cfg/max_cpus", test_fw_cfg_max_cpus); qtest_add_func("fw_cfg/numa", test_fw_cfg_numa); qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu); + qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout); =20 return g_test_run(); } --=20 2.20.1 From nobody Wed May 15 20:00:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558388720; cv=none; d=zoho.com; s=zohoarc; b=CMzHG/7GsE98tPFMBxwCH5c/OB3Fn37MEVEUh/U0hSbrtLSwwKoks6T3jX2fLj6AbgBfKxWexHt2SsyQVWbaniu+du+VrX0HyjUqTq8Pz8/GTofDntUsR9FWnQrX8ESMyuoX1/8bcfBR2IZKEqxcRMuXGGKIRWcQUjFlzw+UbYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558388720; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hgqR8mUemMeS8rR/5GqHiTaj9X6dJTFsTXjKtPfYr4o=; b=GXsynOQLE9qQLd2Jqvc0FsYXc1i2036KRxdzha8kXgIi2LIjerrIRnUhgVO+I7+Xc1HL0ULroVkgwQdYmqBV2f+5EhPpMYXnm8CPY9EjE5fMp342wJd6nYsDt+TUISmubN2/tigpOTSiAeTaNS+Q6UrYZLtVqpYPFZ4pZgAnFOo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558388720034718.3143034055487; Mon, 20 May 2019 14:45:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:42332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSq5p-0007xK-1I for importer@patchew.org; Mon, 20 May 2019 17:45:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSpyV-0002Ad-PG for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSpyS-00043M-FX for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSpyS-00042o-AT for qemu-devel@nongnu.org; Mon, 20 May 2019 17:37:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6F07308FC4D; Mon, 20 May 2019 21:37:35 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BC295D704; Mon, 20 May 2019 21:37:32 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 20 May 2019 23:37:00 +0200 Message-Id: <20190520213700.12620-8-philmd@redhat.com> In-Reply-To: <20190520213700.12620-1-philmd@redhat.com> References: <20190520213700.12620-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 20 May 2019 21:37:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 7/7] tests: fw_cfg: add 'splash-time' test case 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: Laurent Vivier , Thomas Huth , Laszlo Ersek , Li Qiang , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang Signed-off-by: Li Qiang Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190424140643.62457-6-liq3ea@163.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/fw_cfg-test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index 20b1eb75f4d..1d3147f8214 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -194,6 +194,25 @@ static void test_fw_cfg_reboot_timeout(void) qtest_quit(s); } =20 +static void test_fw_cfg_splash_time(void) +{ + QFWCFG *fw_cfg; + QTestState *s; + uint16_t splash_time =3D 0; + size_t filesize; + + s =3D qtest_init("-boot splash-time=3D12"); + fw_cfg =3D pc_fw_cfg_init(s); + + filesize =3D qfw_cfg_get_file(fw_cfg, "etc/boot-menu-wait", + &splash_time, sizeof(splash_time)); + g_assert_cmpint(filesize, =3D=3D, sizeof(splash_time)); + splash_time =3D le16_to_cpu(splash_time); + g_assert_cmpint(splash_time, =3D=3D, 12); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -214,6 +233,7 @@ int main(int argc, char **argv) qtest_add_func("fw_cfg/numa", test_fw_cfg_numa); qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu); qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout); + qtest_add_func("fw_cfg/splash_time", test_fw_cfg_splash_time); =20 return g_test_run(); } --=20 2.20.1