From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663682389; cv=none; d=zohomail.com; s=zohoarc; b=c8agDN7FWpn0jyPZvZ0txuLijjdHrmAs2T1sJgaq2PeIjY2ja+4Oym8udkzrjL7yLb2RSMrBCcMSU0wN1NMP4XgPrC2GWV0rgc9Uax0Rj704i3XofQL7k7h/57i98nhHYs6eAxmfq/PlJogni4BN5docPDt5Ba7TquKpd5bRDoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663682389; h=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:Reply-To:References:Sender:Subject:To; bh=lV8UB/UtOw5OSkGY6vR/gLUSXvau5CG9NAv5Twii2Yg=; b=UvSnkJET+S+DegpYgmwYZyKzDCfDlD7wnTOivESCXx0ue4t7Iuuqkha1Wg43myqAX2i4sqNXopTUXhS2SQkgXS/hPia+HLjsahu93kPYzjHlzNsPUDU4cug+nGeSXfK1G7ni2xBnR0cZhYAjel9+ZIF8I8a1uw88bX+0A85amYo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663682388484485.22248447825825; Tue, 20 Sep 2022 06:59:48 -0700 (PDT) Received: from localhost ([::1]:42468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadms-0001aD-7P for importer@patchew.org; Tue, 20 Sep 2022 09:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoO-0003zm-54 for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:09 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoG-0007zQ-OT for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:03 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaalj-004fUv-LR; Tue, 20 Sep 2022 12:48:36 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 1/7] tests/x86: Move common code to function in device-plug-test Date: Tue, 20 Sep 2022 13:48:36 +0300 Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663682389764100001 Content-Type: text/plain; charset="utf-8" Move common code for device removing to function. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 42 ++++++++++++++-------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index a1fb99c8ff..e595b45b66 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -61,6 +61,18 @@ static void wait_device_deleted_event(QTestState *qtest,= const char *id) } } =20 +static void process_device_remove(QTestState *qtest, const char *id) +{ + /* + * Request device removal. As the guest is not running, the request wo= n't + * be processed. However during system reset, the removal will be + * handled, removing the device. + */ + device_del(qtest, id); + system_reset(qtest); + wait_device_deleted_event(qtest, id); +} + static void test_pci_unplug_request(void) { const char *arch =3D qtest_get_arch(); @@ -73,14 +85,7 @@ static void test_pci_unplug_request(void) QTestState *qtest =3D qtest_initf("%s -device virtio-mouse-pci,id=3Dde= v0", machine_addition); =20 - /* - * Request device removal. As the guest is not running, the request wo= n't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -98,14 +103,7 @@ static void test_pci_unplug_json_request(void) "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"", machine_addition); =20 - /* - * Request device removal. As the guest is not running, the request wo= n't - * be processed. However during system reset, the removal will be - * handled, removing the device. - */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -128,9 +126,7 @@ static void test_spapr_cpu_unplug_request(void) "-device power9_v2.0-spapr-cpu-core,core-id=3D1,id= =3Ddev0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -144,9 +140,7 @@ static void test_spapr_memory_unplug_request(void) "-device pc-dimm,id=3Ddev0,memdev=3Dmem0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } @@ -158,9 +152,7 @@ static void test_spapr_phb_unplug_request(void) qtest =3D qtest_initf("-device spapr-pci-host-bridge,index=3D1,id=3Dde= v0"); =20 /* similar to test_pci_unplug_request */ - device_del(qtest, "dev0"); - system_reset(qtest); - wait_device_deleted_event(qtest, "dev0"); + process_device_remove(qtest, "dev0"); =20 qtest_quit(qtest); } --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663682060; cv=none; d=zohomail.com; s=zohoarc; b=JzJot2zn4NaLYC2XYNjwYqNKDcRp8pKMDc/RrLhTnLnL8gK2ykGjDODi2uEeQ1X8iEH2K2NKf/adgOqdtFx2f23SpvEOq0706zkEqjbsNn/eb+viGr0HYgnTa9P8vTPo7rqrT+wlZpwOuBGaEv4uCHXT53dGHdyFMHN9YjHf668= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663682060; h=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:Reply-To:References:Sender:Subject:To; bh=WW9VChynDDlLLNd5Z0nwMWxp+XGi79VmMqaPW0S9pzE=; b=GFuO57vrvwXexdEpxEPB98mTXJ9Xp8yJTO5bkXTVqQcxUBbtvV3h4XNBK+n6cu3pflVYtY6/Qz5aQdXA5n/zr6fftm5iHiYFwRoYhknCTw4joNvNL5exu/4npmSEebf4ZGpzsRPPN4WU6asUcn7RCkrZ+y2YsJFi1UtGHG3AnRo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663682060878922.0472869224989; Tue, 20 Sep 2022 06:54:20 -0700 (PDT) Received: from localhost ([::1]:48530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadhQ-0004kZ-NS for importer@patchew.org; Tue, 20 Sep 2022 09:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoO-0003zo-4X for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:09 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoG-0007zS-Nc for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:03 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaalk-004fUv-LZ; Tue, 20 Sep 2022 12:48:36 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 2/7] tests/x86: Add subtest with 'q35' machine type to device-plug-test Date: Tue, 20 Sep 2022 13:48:37 +0300 Message-Id: <20220920104842.605530-3-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663682061232100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to plug pci device and unplug. Signed-off-by: Michael Labiuk Reviewed-by: Thomas Huth --- tests/qtest/device-plug-test.c | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index e595b45b66..d66c386ef4 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -90,6 +90,19 @@ static void test_pci_unplug_request(void) qtest_quit(qtest); } =20 +static void test_q35_pci_unplug_request(void) +{ + + QTestState *qtest =3D qtest_initf("-machine q35 " + "-device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id= =3Db1 " + "-device virtio-mouse-pci,bus=3Db1,id= =3Ddev0"); + + process_device_remove(qtest, "dev0"); + + qtest_quit(qtest); +} + static void test_pci_unplug_json_request(void) { const char *arch =3D qtest_get_arch(); @@ -108,6 +121,27 @@ static void test_pci_unplug_json_request(void) qtest_quit(qtest); } =20 +static void test_q35_pci_unplug_json_request(void) +{ + const char *port =3D "-device '{\"driver\": \"pcie-root-port\", " + "\"id\": \"p1\"}'"; + + const char *bridge =3D "-device '{\"driver\": \"pcie-pci-bridge\", " + "\"id\": \"b1\", " + "\"bus\": \"p1\"}'"; + + const char *device =3D "-device '{\"driver\": \"virtio-mouse-pci\", " + "\"bus\": \"b1\", " + "\"id\": \"dev0\"}'"; + + QTestState *qtest =3D qtest_initf("-machine q35 %s %s %s", + port, bridge, device); + + process_device_remove(qtest, "dev0"); + + qtest_quit(qtest); +} + static void test_ccw_unplug(void) { QTestState *qtest =3D qtest_initf("-device virtio-balloon-ccw,id=3Ddev= 0"); @@ -187,5 +221,12 @@ int main(int argc, char **argv) test_spapr_phb_unplug_request); } =20 + if (!strcmp(arch, "x86_64")) { + qtest_add_func("/device-plug/q35-pci-unplug-request", + test_q35_pci_unplug_request); + qtest_add_func("/device-plug/q35-pci-unplug-json-request", + test_q35_pci_unplug_json_request); + } + return g_test_run(); } --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663683029; cv=none; d=zohomail.com; s=zohoarc; b=Z0hBNFAk7uQ0x6ZHtdbDlynXCF8YmR2S9NWtvbcMGn4Z5xnTib1xtz2k5PJIiCZfP6MDhDv13RfjqBJM6Us4eQKlUa+HsRETpzLXklkJuu56QVuJ/5RhEUL+QAXvJJQ7y7BABFCMeYzMso2E+Uqrdc4YbPzIU49poVimk2MHzH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663683029; h=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:Reply-To:References:Sender:Subject:To; bh=uU409x6g+bcNYqZBs1MXljnWVo1QKyyzgDbpZKZnGJw=; b=iBvYwr2DY/Y3mdzpX0DJ7AHBP9KgbtYPDM978BoyQe8Ef745B91beKRO15QGWqxGQ9H25b/3JPlE55MzsYPt49NutLf/isz8Fm+s/RzUJA6lHF8Dvx3tPef5GwzPjlDmGOdEBoiUVidousMth/rGaLNTGV75Ce38SnNdTd8tgfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663683028938391.7477963543556; Tue, 20 Sep 2022 07:10:28 -0700 (PDT) Received: from localhost ([::1]:51440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadxD-0001Li-BT for importer@patchew.org; Tue, 20 Sep 2022 10:10:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoI-0003yV-Uj for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:05 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoE-0007zR-SN for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:01 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaall-004fUv-FO; Tue, 20 Sep 2022 12:48:37 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 3/7] tests/x86: Add 'q35' machine type to ivshmem-test Date: Tue, 20 Sep 2022 13:48:38 +0300 Message-Id: <20220920104842.605530-4-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663683029918100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to test ivshmem on 'q35'. Signed-off-by: Michael Labiuk --- tests/qtest/ivshmem-test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 9611d05eb5..0f9755abc6 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -378,6 +378,32 @@ static void test_ivshmem_server(void) close(thread.pipe[0]); } =20 +static void device_del(QTestState *qtest, const char *id) +{ + QDict *resp; + + resp =3D qtest_qmp(qtest, + "{'execute': 'device_del'," + " 'arguments': { 'id': %s } }", id); + + g_assert(qdict_haskey(resp, "return")); + qobject_unref(resp); +} + +static void test_ivshmem_hotplug_q35(void) +{ + QTestState *qts =3D qtest_init("-object memory-backend-ram,size=3D1M,i= d=3Dmb1 " + "-device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1= " + "-machine q35"); + + qtest_qmp_device_add(qts, "ivshmem-plain", "iv1", + "{'memdev': 'mb1', 'bus': 'b1'}"); + device_del(qts, "iv1"); + + qtest_quit(qts); +} + #define PCI_SLOT_HP 0x06 =20 static void test_ivshmem_hotplug(void) @@ -469,6 +495,7 @@ int main(int argc, char **argv) { int ret, fd; gchar dir[] =3D "/tmp/ivshmem-test.XXXXXX"; + const char *arch =3D qtest_get_arch(); =20 g_test_init(&argc, &argv, NULL); =20 @@ -494,6 +521,9 @@ int main(int argc, char **argv) qtest_add_func("/ivshmem/pair", test_ivshmem_pair); qtest_add_func("/ivshmem/server", test_ivshmem_server); } + if (!strcmp(arch, "x86_64")) { + qtest_add_func("/ivshmem/hotplug-q35", test_ivshmem_hotplug_q35); + } =20 out: ret =3D g_test_run(); --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663680499; cv=none; d=zohomail.com; s=zohoarc; b=X9xqjW52opoxQnPVJhE8y/l1XaXs2aXOLyG61vkaZao1qpq52Xcg9gCR3s4S5DI8MZ4MRjveiaTogV8sRjMWbp35MO0xVN7dOsbXqf3dLqHJXHdEeMugXMtOJ0GGoTibt5iLBrkNZf0zDZgKBCfksDVuzLgPW6dbra6jcw7YVDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663680499; h=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:Reply-To:References:Sender:Subject:To; bh=Ew3iA20OKfi4N3F4KXZHIe9T/JLnlxY2phDBor32OR4=; b=OEII1KbjNS3ckzY7eB0UWuq7zOd3bRyHKSU5+vdfNBgsWzEwiJ2W5YaMJEGZYBGshYPyNdCfqDfHisSWSdFaMKPVdDcZ2p6sQD19byx0aXP2jbFOntewMx06tyyCgb/Si2vFYZxG4SNy43J7MQCCp+IDd2GCiGXxDKxHeDV429A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663680499177836.2422450152458; Tue, 20 Sep 2022 06:28:19 -0700 (PDT) Received: from localhost ([::1]:49462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadIP-0003eA-EM for importer@patchew.org; Tue, 20 Sep 2022 09:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoJ-0003yc-5f for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:05 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoF-0007zi-HJ for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:01 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaalm-004fUv-9B; Tue, 20 Sep 2022 12:48:38 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 4/7] tests/x86: Add 'q35' machine type to drive_del-test Date: Tue, 20 Sep 2022 13:48:39 +0300 Message-Id: <20220920104842.605530-5-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663680499988100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to run tests on 'q35' machine type. Signed-off-by: Michael Labiuk --- tests/qtest/drive_del-test.c | 111 +++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 5e6d58b4dd..3a2ddecf22 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -258,6 +258,27 @@ static void test_cli_device_del(void) qtest_quit(qts); } =20 +static void test_cli_device_del_q35(void) +{ + QTestState *qts; + + /* + * -drive/-device and device_del. Start with a drive used by a + * device that unplugs after reset. + */ + qts =3D qtest_initf("-drive if=3Dnone,id=3Ddrive0,file=3Dnull-co://," + "file.read-zeroes=3Don,format=3Draw " + "-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1 " + "-device virtio-blk-%s,drive=3Ddrive0,bus=3Db1,id=3D= dev0", + qvirtio_get_dev_type()); + + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_empty_device_del(void) { QTestState *qts; @@ -294,6 +315,45 @@ static void test_device_add_and_del(void) qtest_quit(qts); } =20 +static void device_add_q35(QTestState *qts) +{ + QDict *response; + char driver[32]; + snprintf(driver, sizeof(driver), "virtio-blk-%s", + qvirtio_get_dev_type()); + + response =3D qtest_qmp(qts, "{'execute': 'device_add'," + " 'arguments': {" + " 'driver': %s," + " 'drive': 'drive0'," + " 'id': 'dev0'," + " 'bus': 'b1'" + "}}", driver); + g_assert(response); + g_assert(qdict_haskey(response, "return")); + qobject_unref(response); +} + +static void test_device_add_and_del_q35(void) +{ + QTestState *qts; + + /* + * -drive/device_add and device_del. Start with a drive used by a + * device that unplugs after reset. + */ + qts =3D qtest_initf("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1 " + "-drive if=3Dnone,id=3Ddrive0,file=3Dnull-co://," + "file.read-zeroes=3Don,format=3Draw"); + + device_add_q35(qts); + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_drive_add_device_add_and_del(void) { QTestState *qts; @@ -318,6 +378,25 @@ static void test_drive_add_device_add_and_del(void) qtest_quit(qts); } =20 +static void test_drive_add_device_add_and_del_q35(void) +{ + QTestState *qts; + + qts =3D qtest_init("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1"); + + /* + * drive_add/device_add and device_del. The drive is used by a + * device that unplugs after reset. + */ + drive_add_with_media(qts); + device_add_q35(qts); + device_del(qts, true); + g_assert(!has_drive(qts)); + + qtest_quit(qts); +} + static void test_blockdev_add_device_add_and_del(void) { QTestState *qts; @@ -342,8 +421,29 @@ static void test_blockdev_add_device_add_and_del(void) qtest_quit(qts); } =20 +static void test_blockdev_add_device_add_and_del_q35(void) +{ + QTestState *qts; + + qts =3D qtest_init("-machine q35 -device pcie-root-port,id=3Dp1 " + "-device pcie-pci-bridge,bus=3Dp1,id=3Db1"); + + /* + * blockdev_add/device_add and device_del. The it drive is used by a + * device that unplugs after reset, but it doesn't go away. + */ + blockdev_add_with_media(qts); + device_add_q35(qts); + device_del(qts, true); + g_assert(has_blockdev(qts)); + + qtest_quit(qts); +} + int main(int argc, char **argv) { + const char *arch =3D qtest_get_arch(); + g_test_init(&argc, &argv, NULL); =20 qtest_add_func("/drive_del/without-dev", test_drive_without_dev); @@ -363,6 +463,17 @@ int main(int argc, char **argv) test_empty_device_del); qtest_add_func("/device_del/blockdev", test_blockdev_add_device_add_and_del); + + if (!strcmp(arch, "x86_64")) { + qtest_add_func("/device_del/drive/cli_device_q35", + test_cli_device_del_q35); + qtest_add_func("/device_del/drive/device_add_q35", + test_device_add_and_del_q35); + qtest_add_func("/device_del/drive/drive_add_device_add_q35", + test_drive_add_device_add_and_del_q35); + qtest_add_func("/device_del/blockdev_q35", + test_blockdev_add_device_add_and_del_q35); + } } =20 return g_test_run(); --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663683573; cv=none; d=zohomail.com; s=zohoarc; b=lnHeZzxMVq/9mBbHkbs3N4yWwO8jnNt71ri565TreJhc+YPbWpHne4fOAy+rZGiUudDqPRN/cXvYraulLT/N+KbZArxW4ASvvqQy3g5aFoqAo0476K/hFlfvNPXT8DpSgTu33SwA4kvE6PWqAKng+0ZJ/I2val0McoxPQC8Fk+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663683573; h=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:Reply-To:References:Sender:Subject:To; bh=7wA4d3nRWZiL58RynjWzXgQ2LKrRG4TriBlCztLAEGc=; b=jZVerd1+aPH0idjv4lacexbGPZTtdmx7JeS59IhtB4fwYs7GbZB7pGrBwJOKtSzNTti+IUi1pbQWhfUWDIt1LgvLYEK5nDD3GwVE6nuTNbnqqsgShPjgiKMGwmZjw3tZ4bnnHZI9AGr5ViT0+vooaAFKGnJoFyMnMu7wudpnYyM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663683572984750.7499503727516; Tue, 20 Sep 2022 07:19:32 -0700 (PDT) Received: from localhost ([::1]:45234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oae5x-0007CT-Hw for importer@patchew.org; Tue, 20 Sep 2022 10:19:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoI-0003yY-Ui for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:05 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52113) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoD-0007yT-UM for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:00 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaaln-004fUv-30; Tue, 20 Sep 2022 12:48:39 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 5/7] tests/x86: Add 'q35' machine type to override-tests in hd-geo-test Date: Tue, 20 Sep 2022 13:48:40 +0300 Message-Id: <20220920104842.605530-6-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663683575989100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michael Labiuk --- tests/qtest/hd-geo-test.c | 105 +++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 7 deletions(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 413cf964c0..58b1107d64 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -693,7 +693,8 @@ static void add_virtio_disk(TestArgs *args, args->n_virtio_disks++; } =20 -static void test_override(TestArgs *args, CHSResult expected[]) +static void test_override(TestArgs *args, const char *arch, + CHSResult expected[]) { QTestState *qts; char *joined_args; @@ -702,7 +703,7 @@ static void test_override(TestArgs *args, CHSResult exp= ected[]) =20 joined_args =3D g_strjoinv(" ", args->argv); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); + qts =3D qtest_initf("-machine %s %s", arch, joined_args); fw_cfg =3D pc_fw_cfg_init(qts); =20 read_bootdevices(fw_cfg, expected); @@ -739,7 +740,28 @@ static void test_override_ide(void) add_ide_disk(args, 1, 0, 1, 9000, 120, 30); add_ide_disk(args, 2, 1, 0, 0, 1, 1); add_ide_disk(args, 3, 1, 1, 1, 0, 0); - test_override(args, expected); + test_override(args, "pc", expected); +} + +static void test_override_sata(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/pci8086,2922@1f,2/drive@0/disk@0", {10000, 120, 30} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@1/disk@0", {9000, 120, 30} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@2/disk@0", {0, 1, 1} }, + {"/pci@i0cf8/pci8086,2922@1f,2/drive@3/disk@0", {1, 0, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 0, 0, 10000, 120, 30); + add_ide_disk(args, 1, 1, 0, 9000, 120, 30); + add_ide_disk(args, 2, 2, 0, 0, 1, 1); + add_ide_disk(args, 3, 3, 0, 1, 0, 0); + test_override(args, "q35", expected); } =20 static void test_override_scsi(void) @@ -761,7 +783,43 @@ static void test_override_scsi(void) add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); add_scsi_disk(args, 2, 0, 0, 2, 0, 1, 0, 0); add_scsi_disk(args, 3, 0, 0, 3, 0, 0, 1, 0); - test_override(args, expected); + test_override(args, "pc", expected); +} + +static void setup_pci_bridge(TestArgs *args, const char *id, const char *r= ootid) +{ + + char *root, *br; + root =3D g_strdup_printf("-device pcie-root-port,id=3D%s", rootid); + br =3D g_strdup_printf("-device pcie-pci-bridge,bus=3D%s,id=3D%s", roo= tid, id); + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, root); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, br); +} + +static void test_override_scsi_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { "/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@0,0", + {10000, 120, 30} + }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@1,0", {9000, 120, = 30} }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@2,0", {1, 0, 0} }, + {"/pci@i0cf8/pci-bridge@1/scsi@3/channel@0/disk@3,0", {0, 1, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + setup_pci_bridge(args, "pcie.0", "br"); + add_scsi_controller(args, "lsi53c895a", "br", 3); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); + add_scsi_disk(args, 2, 0, 0, 2, 0, 1, 0, 0); + add_scsi_disk(args, 3, 0, 0, 3, 0, 0, 1, 0); + test_override(args, "q35", expected); } =20 static void test_override_scsi_2_controllers(void) @@ -784,7 +842,7 @@ static void test_override_scsi_2_controllers(void) add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); add_scsi_disk(args, 2, 1, 0, 0, 1, 1, 0, 0); add_scsi_disk(args, 3, 1, 0, 1, 2, 0, 1, 0); - test_override(args, expected); + test_override(args, "pc", expected); } =20 static void test_override_virtio_blk(void) @@ -799,7 +857,23 @@ static void test_override_virtio_blk(void) add_drive_with_mbr(args, empty_mbr, 1); add_virtio_disk(args, 0, "pci.0", 3, 10000, 120, 30); add_virtio_disk(args, 1, "pci.0", 4, 9000, 120, 30); - test_override(args, expected); + test_override(args, "pc", expected); +} + +static void test_override_virtio_blk_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/pci-bridge@2/scsi@3/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/pci-bridge@2/scsi@4/disk@0,0", {9000, 120, 30} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + setup_pci_bridge(args, "pcie.0", "br"); + add_virtio_disk(args, 0, "br", 3, 10000, 120, 30); + add_virtio_disk(args, 1, "br", 4, 9000, 120, 30); + test_override(args, "pc", expected); } =20 static void test_override_zero_chs(void) @@ -810,7 +884,18 @@ static void test_override_zero_chs(void) }; add_drive_with_mbr(args, empty_mbr, 1); add_ide_disk(args, 0, 1, 1, 0, 0, 0); - test_override(args, expected); + test_override(args, "pc", expected); +} + +static void test_override_zero_chs_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 0, 0, 0, 0, 0); + test_override(args, "q35", expected); } =20 static void test_override_scsi_hot_unplug(void) @@ -965,13 +1050,19 @@ int main(int argc, char **argv) qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chs= t); if (have_qemu_img()) { qtest_add_func("hd-geo/override/ide", test_override_ide); + qtest_add_func("hd-geo/override/sata", test_override_sata); if (qtest_has_device("lsi53c895a")) { qtest_add_func("hd-geo/override/scsi", test_override_scsi); + qtest_add_func("hd-geo/override/scsiq35", test_override_scsi_q= 35); qtest_add_func("hd-geo/override/scsi_2_controllers", test_override_scsi_2_controllers); } qtest_add_func("hd-geo/override/virtio_blk", test_override_virtio_= blk); + qtest_add_func("hd-geo/override/virtio_blk_q35", + test_override_virtio_blk_q35); qtest_add_func("hd-geo/override/zero_chs", test_override_zero_chs); + qtest_add_func("hd-geo/override/zero_chs_q35", + test_override_zero_chs_q35); qtest_add_func("hd-geo/override/scsi_hot_unplug", test_override_scsi_hot_unplug); qtest_add_func("hd-geo/override/virtio_hot_unplug", --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663680827; cv=none; d=zohomail.com; s=zohoarc; b=Ilhxzr5VgAqARevutGjFLM+WgEYbIFzaG5nI3+sitzgvCFg+9ZR55hFT3WAF40o1haawJ52i9RI9mL/BuxTSn9JLayn1svN7Ds5AKyvrsjIK1FlBxLJgiGM0K1cSPxjxfPHZ/od3QooKVBDIoWnsfyqmsVGkuxK/sRO9EK13EEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663680827; h=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:Reply-To:References:Sender:Subject:To; bh=LAJuXqTKyGxp48C7jrF/n5WFNBM3rBGSCVal35SGG4U=; b=m3INuIH92L1tnvapnLxIZpegrFExJxXG9tXrur8fpMQDw2rZZpn8xn/LniFwSFoF9qpPlEqLyl9fa6JJlA36eGlOddxysG36Sj+5GLBBdL7jR+epR90h60CPz+swDCAdOW/sdU5h7rctOxebf3pMqnsMgOq/+u3kbX9Y9pWTHTY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16636808277411012.226753931751; Tue, 20 Sep 2022 06:33:47 -0700 (PDT) Received: from localhost ([::1]:36228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadNi-0001Nf-HR for importer@patchew.org; Tue, 20 Sep 2022 09:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoI-0003yT-LC for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:05 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoE-0007yS-8O for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:01 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaaln-004fUv-T8; Tue, 20 Sep 2022 12:48:40 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 6/7] tests/x86: Refactor hot unplug hd-geo-test Date: Tue, 20 Sep 2022 13:48:41 +0300 Message-Id: <20220920104842.605530-7-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663680828639100001 Content-Type: text/plain; charset="utf-8" Moving common code to function. Signed-off-by: Michael Labiuk --- tests/qtest/hd-geo-test.c | 133 +++++++++++++++----------------------- 1 file changed, 53 insertions(+), 80 deletions(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 58b1107d64..d488ad9ac0 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -898,13 +898,55 @@ static void test_override_zero_chs_q35(void) test_override(args, "q35", expected); } =20 +static void test_override_hot_unplug(TestArgs *args, const char *devid, + CHSResult expected[], CHSResult expec= ted2[]) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_initf("%s", joined_args); + fw_cfg =3D pc_fw_cfg_init(qts); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + response =3D qtest_qmp(qts, + "{ 'execute': 'device_del'," + " 'arguments': {'id': %s }}", devid); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + response =3D qtest_qmp(qts, + "{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(qts, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_quit(qts); + + g_free(fw_cfg); + + for (i =3D 0; i < args->n_drives; i++) { + unlink(args->drives[i]); + free(args->drives[i]); + } + g_free(args->drives); + g_strfreev(args->argv); + g_free(args); +} + static void test_override_scsi_hot_unplug(void) { - QTestState *qts; - char *joined_args; - QFWCFG *fw_cfg; - QDict *response; - int i; TestArgs *args =3D create_args(); CHSResult expected[] =3D { {"/pci@i0cf8/scsi@2/channel@0/disk@0,0", {10000, 120, 30} }, @@ -921,51 +963,14 @@ static void test_override_scsi_hot_unplug(void) add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); add_scsi_disk(args, 1, 0, 0, 1, 0, 20, 20, 20); =20 - joined_args =3D g_strjoinv(" ", args->argv); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-machine pc")); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); - fw_cfg =3D pc_fw_cfg_init(qts); - - read_bootdevices(fw_cfg, expected); - - /* unplug device an restart */ - response =3D qtest_qmp(qts, - "{ 'execute': 'device_del'," - " 'arguments': {'id': 'scsi-disk0' }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - response =3D qtest_qmp(qts, - "{ 'execute': 'system_reset', 'arguments': { }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_qmp_eventwait(qts, "RESET"); - - read_bootdevices(fw_cfg, expected2); - - g_free(joined_args); - qtest_quit(qts); - - g_free(fw_cfg); - - for (i =3D 0; i < args->n_drives; i++) { - unlink(args->drives[i]); - free(args->drives[i]); - } - g_free(args->drives); - g_strfreev(args->argv); - g_free(args); + test_override_hot_unplug(args, "scsi-disk0", expected, expected2); } =20 static void test_override_virtio_hot_unplug(void) { - QTestState *qts; - char *joined_args; - QFWCFG *fw_cfg; - QDict *response; - int i; TestArgs *args =3D create_args(); CHSResult expected[] =3D { {"/pci@i0cf8/scsi@2/disk@0,0", {10000, 120, 30} }, @@ -981,42 +986,10 @@ static void test_override_virtio_hot_unplug(void) add_virtio_disk(args, 0, "pci.0", 2, 10000, 120, 30); add_virtio_disk(args, 1, "pci.0", 3, 20, 20, 20); =20 - joined_args =3D g_strjoinv(" ", args->argv); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-machine pc")); =20 - qts =3D qtest_initf("-machine pc %s", joined_args); - fw_cfg =3D pc_fw_cfg_init(qts); - - read_bootdevices(fw_cfg, expected); - - /* unplug device an restart */ - response =3D qtest_qmp(qts, - "{ 'execute': 'device_del'," - " 'arguments': {'id': 'virtio-disk0' }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - response =3D qtest_qmp(qts, - "{ 'execute': 'system_reset', 'arguments': { }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_qmp_eventwait(qts, "RESET"); - - read_bootdevices(fw_cfg, expected2); - - g_free(joined_args); - qtest_quit(qts); - - g_free(fw_cfg); - - for (i =3D 0; i < args->n_drives; i++) { - unlink(args->drives[i]); - free(args->drives[i]); - } - g_free(args->drives); - g_strfreev(args->argv); - g_free(args); + test_override_hot_unplug(args, "virtio-disk0", expected, expected2); } =20 int main(int argc, char **argv) --=20 2.34.1 From nobody Mon Feb 9 04:08:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1663681652; cv=none; d=zohomail.com; s=zohoarc; b=iihEqHnmj+obTv+7MzsfTxhI0nvIoc7jLLEc6DvfiytBrORJ59GusgavgJCVxEboOBetttExW/JB+GWHJJJRhaIPlJlP/+EwFuQKzJajoJ4rEtLsnT8Z/vHEgvQCv0Z3TdjktpLlei5zucCB5ukn8iW3YWGARl7hSs9cVKd27L8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663681652; h=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:Reply-To:References:Sender:Subject:To; bh=9hQJup0j4AefcSke+1bYEZvFatPjjKeWJZwWwo16i5Q=; b=W80wAMhEj3wnkplDN+x3HVNY2OCkQ+0TE4p6laMbKy2vrPVmRS8fogqFA7muIb9Umvuv9innwJv59SeKG+inU6kJorjcK8Jj6jf5Mzc/nhT3h/d7e0tIqQs4yj8b1BNIuU5JueHmbttBhlOZhV1ExdrfMGzhBguk0ufI28UU2po= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663681652667733.2215168225922; Tue, 20 Sep 2022 06:47:32 -0700 (PDT) Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oadb1-00079H-96 for importer@patchew.org; Tue, 20 Sep 2022 09:47:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoH-0003xW-1m for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:01 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:52114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaaoD-0007yR-U3 for qemu-devel@nongnu.org; Tue, 20 Sep 2022 06:49:00 -0400 Received: from [192.168.16.178] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oaalo-004fUv-My; Tue, 20 Sep 2022 12:48:40 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v4 7/7] tests/x86: Add 'q35' machine type to hotplug hd-geo-test Date: Tue, 20 Sep 2022 13:48:42 +0300 Message-Id: <20220920104842.605530-8-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> References: <20220920104842.605530-1-michael.labiuk@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=130.117.225.111; envelope-from=michael.labiuk@virtuozzo.com; helo=relay.virtuozzo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Michael Labiuk From: Michael Labiuk via X-ZM-MESSAGEID: 1663681653964100001 Content-Type: text/plain; charset="utf-8" Add pci bridge setting to test hotplug. Duplicate tests for plugging scsi and virtio devices for q35 machine type. Signed-off-by: Michael Labiuk --- tests/qtest/hd-geo-test.c | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index d488ad9ac0..ada80d8828 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -969,6 +969,42 @@ static void test_override_scsi_hot_unplug(void) test_override_hot_unplug(args, "scsi-disk0", expected, expected2); } =20 +static void test_override_scsi_hot_unplug_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@0,= 0", + {10000, 120, 30} + }, + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@1,= 0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/channel@0/disk@1,= 0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id= =3Db1 " + "-machine q35")); + + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_scsi_controller(args, "virtio-scsi-pci", "b1", 2); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 20, 20, 20); + + test_override_hot_unplug(args, "scsi-disk0", expected, expected2); +} + static void test_override_virtio_hot_unplug(void) { TestArgs *args =3D create_args(); @@ -992,6 +1028,41 @@ static void test_override_virtio_hot_unplug(void) test_override_hot_unplug(args, "virtio-disk0", expected, expected2); } =20 +static void test_override_virtio_hot_unplug_q35(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@2/disk@0,0", + {10000, 120, 30} + }, + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@3/disk@0,0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + { + "/pci@i0cf8/pci-bridge@1/pci-bridge@0/scsi@3/disk@0,0", + {20, 20, 20} + }, + {NULL, {0, 0, 0} } + }; + + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, + g_strdup("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id= =3Db1 " + "-machine q35")); + + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_virtio_disk(args, 0, "b1", 2, 10000, 120, 30); + add_virtio_disk(args, 1, "b1", 3, 20, 20, 20); + + test_override_hot_unplug(args, "virtio-disk0", expected, expected2); +} + int main(int argc, char **argv) { Backend i; @@ -1038,8 +1109,13 @@ int main(int argc, char **argv) test_override_zero_chs_q35); qtest_add_func("hd-geo/override/scsi_hot_unplug", test_override_scsi_hot_unplug); + qtest_add_func("hd-geo/override/scsi_hot_unplug_q35", + test_override_scsi_hot_unplug_q35); qtest_add_func("hd-geo/override/virtio_hot_unplug", test_override_virtio_hot_unplug); + qtest_add_func("hd-geo/override/virtio_hot_unplug_q35", + test_override_virtio_hot_unplug_q35); + } else { g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " "skipping hd-geo/override/* tests"); --=20 2.34.1