From nobody Mon Feb 9 16:53:14 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=1663248451; cv=none; d=zohomail.com; s=zohoarc; b=IQ96Rm+zpETHYesiGAROvHrNGzJr2FikZHNzdY/jxB8DvbVV6sbDfuVaSjdN3hz1IHUGRGgsnpV9k4ljLR5Z5TflbL1x4hkEcH9+44MXk/87c3DVR7DzG2j/oi6NraLEp8QaJJM60iFORJrxFzeyInCoJFl9dJZ6aWjFStgXzKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663248451; 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=6gSBkmKdxsK9FPACPpLM5GTsBCeYTFWdHQP0fq/A690=; b=cQwZy2Jz9EZTnVHmAtkyix8Dh33MMZXoSQ3b0xu+RXQImdWo/pLZ9jpoa36L9uZW3bylH4/gf5dqfyWxj8R4sJ2AneDDs46C/ok83LJdQwB31/9s9qRFDM0I6uy8S4qTqEsa/rK2O0F6nZPCCCze+VAmzk1o60pOSWElk0N41sA= 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 1663248451569818.064855454271; Thu, 15 Sep 2022 06:27:31 -0700 (PDT) Received: from localhost ([::1]:54188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYotu-0002Rs-C6 for importer@patchew.org; Thu, 15 Sep 2022 09:27:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohW-0007uJ-0T for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:43 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:51274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohS-0002u2-Px for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:41 -0400 Received: from [192.168.16.215] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oYoeq-004BPT-7Z; Thu, 15 Sep 2022 15:14:08 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v3 1/5] tests/x86: Add subtest with 'q35' machine type to device-plug-test Date: Thu, 15 Sep 2022 16:14:03 +0300 Message-Id: <20220915131407.372485-2-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915131407.372485-1-michael.labiuk@virtuozzo.com> References: <20220915131407.372485-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: 1663248453429100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting to plug pci device and unplug. Move common code for device removing to function. Signed-off-by: Michael Labiuk --- tests/qtest/device-plug-test.c | 83 ++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index a1fb99c8ff..d66c386ef4 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,20 @@ 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"); + + qtest_quit(qtest); +} + +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"); =20 qtest_quit(qtest); } @@ -98,14 +116,28 @@ 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"); + + qtest_quit(qtest); +} + +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"); =20 qtest_quit(qtest); } @@ -128,9 +160,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 +174,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 +186,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); } @@ -195,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 16:53:14 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=1663248590; cv=none; d=zohomail.com; s=zohoarc; b=kz+mzpgBQNenLL/qn2y4f7P/rQjyyM49g3bueUeH80YKdNueeHVRBTi5GndLAXzvCyOSXasHGJWP/3gMp9XUcOqNAIdVBRpY77TP1Z9nw1bQC5AHpLEpMjnPkbGSF2nvFWtT+bcEhyM2UO9skJvYFwNpeoH1HAdCtwRyr8ZVRpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663248590; 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=StVcVLh2A6aWn0H9TdyIaa/0qplAY9bKR7NIv648dHc=; b=ieCoWn9Zc2RAyMezRnZdoFi1c77QTNjCHyjxg83kCO5POynk+QcHwQXdnGRiAQkrLZQ2aOIqoHOepmDUKSDwub0sg8IRla3hLaPEzzYpx/8xRknnUMcioplsnC6g2d538etyWS41DxvRudklYtFlGnFUr0jspSG+NbyxBocF04Y= 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 1663248590850575.7465861315289; Thu, 15 Sep 2022 06:29:50 -0700 (PDT) Received: from localhost ([::1]:56460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYow9-0005wp-My for importer@patchew.org; Thu, 15 Sep 2022 09:29:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohY-0007uY-3M for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:47 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:51284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohS-0002ty-Q0 for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:42 -0400 Received: from [192.168.16.215] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oYoer-004BPT-Bf; Thu, 15 Sep 2022 15:14:09 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v3 2/5] tests/x86: Add 'q35' machine type to ivshmem-test Date: Thu, 15 Sep 2022 16:14:04 +0300 Message-Id: <20220915131407.372485-3-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915131407.372485-1-michael.labiuk@virtuozzo.com> References: <20220915131407.372485-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: 1663248592275100001 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 16:53:14 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=1663247942; cv=none; d=zohomail.com; s=zohoarc; b=kfP/yII/TbwCBKo3SHlXnUoOQsUbGlYI0Hs6Xkn7zk78Layw2FndGUKIv9Z0YM8K6ywkbsMXscXmQvK7+RbFDL6oZQtltDpXYJtgQ7nLAIXDuvJxwx3TPRksOeFgqGwvDvsPGn/GZeYVdPT49aMA1XmdiXpOMw5XP4BAC5a/27o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663247942; 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=hRztKhvXRr3RqUWbgH4mV2inYduyzA/S7owzQeqGrW8=; b=I29FfuC68ufgGQz9kQmTuix0I0HTE/Eg79MiFhPTDTKjaDhIIkqDsJGxG1k59b243hHcTOKF5BkOayzqBlU0NHf3bZYagiEONorgsDUhGIwHUzbT9n4gCaOlPpDKtIT62nOVJoKVH9cglOSXz/ArrQZobGISsviteG1AjQr25/4= 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 1663247942582627.0405101816099; Thu, 15 Sep 2022 06:19:02 -0700 (PDT) Received: from localhost ([::1]:33830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYolf-0001jO-Am for importer@patchew.org; Thu, 15 Sep 2022 09:18:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohY-0007uX-2g for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:47 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:51271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohT-0002u1-Re for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:42 -0400 Received: from [192.168.16.215] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oYoes-004BPT-5H; Thu, 15 Sep 2022 15:14:10 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v3 3/5] tests/x86: Add 'q35' machine type to drive_del-test Date: Thu, 15 Sep 2022 16:14:05 +0300 Message-Id: <20220915131407.372485-4-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915131407.372485-1-michael.labiuk@virtuozzo.com> References: <20220915131407.372485-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: 1663247946149100001 Content-Type: text/plain; charset="utf-8" Configure pci bridge setting Also 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 16:53:15 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=1663248199; cv=none; d=zohomail.com; s=zohoarc; b=F4wCigAbwBxwbaB9LZYAu6L2mLxr/y57E+OSU8rbqCEpY3BCjdI2RhJlChD0vs/3fcxzqAt6PNAyVCmhDwxPx6qCG8FNzVoAXcnf/goninh8RNmZ/hlgmqes6j1/Xis0IPt8oAwp5nu7ULN/663Qs7w+kO076xJAl6Q9N9TcFK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663248199; 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=4b69YP++kKPuvJnK2rTEL8mx4GYwwyWWqmKlB84xKxU=; b=R2Nu74jMYCXD3CmhE3lYdsgOf5VpqaYbtwnvI7CpsN4kjD2W3v4EmLwfHg0EP3FGBYKwSngzCeKMu0CCCgX8t6ImY4neN3/05tewkjiLqWo0+Ky5H4GLIlFnaTGa5tBzVKsh1WJ/kmZTrkwU0OxzwGYFzaYXWuv/pIC2QU/hl/8= 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 1663248199051327.60803365868503; Thu, 15 Sep 2022 06:23:19 -0700 (PDT) Received: from localhost ([::1]:56922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYopp-00058l-PJ for importer@patchew.org; Thu, 15 Sep 2022 09:23:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohW-0007uI-2r for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:43 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:51276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohS-0002tz-EE for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:41 -0400 Received: from [192.168.16.215] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oYoes-004BPT-Uj; Thu, 15 Sep 2022 15:14:11 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v3 4/5] tests/x86: Add 'q35' machine type to hotplug hd-geo-test Date: Thu, 15 Sep 2022 16:14:06 +0300 Message-Id: <20220915131407.372485-5-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915131407.372485-1-michael.labiuk@virtuozzo.com> References: <20220915131407.372485-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: 1663248199696100001 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 | 148 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 413cf964c0..19354690ae 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -874,6 +874,78 @@ static void test_override_scsi_hot_unplug(void) g_free(args); } =20 +static void test_override_scsi_hot_unplug_q35(void) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + 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} } + }; + 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); + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_initf("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id=3Db1 " + "-machine q35 %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); +} + static void test_override_virtio_hot_unplug(void) { QTestState *qts; @@ -934,6 +1006,77 @@ static void test_override_virtio_hot_unplug(void) g_free(args); } =20 +static void test_override_virtio_hot_unplug_q35(void) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + 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} } + }; + 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); + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_initf("-device pcie-root-port,id=3Dp0 " + "-device pcie-pci-bridge,bus=3Dp0,id=3Db1 " + "-machine q35 %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); +} + int main(int argc, char **argv) { Backend i; @@ -974,8 +1117,13 @@ int main(int argc, char **argv) qtest_add_func("hd-geo/override/zero_chs", test_override_zero_chs); 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 From nobody Mon Feb 9 16:53:15 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=1663248309; cv=none; d=zohomail.com; s=zohoarc; b=dbN08y4oj1FJNiyxP/lRYIn29JAv/PRz3h+G3WHmLfrd5TGgGEAoKS5jcJAap/CtRUR1+kcOsaeygTnrdM1VYk7M0cEPt1oDtZoXkc1SPKx9W8D4FbOzX7NK0NCNZM3GhFL4JL5FPKubvNb6g7WeXrkWRKYZRe/f65AFW2FtbIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663248309; 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=FQAPHmuhesdnM352iYUxOebcmYiWIg2fMM/mgst4J3o=; b=HhxMIqRr/6x3XcsF6Ch07DLA9Ul26wYBA7D3Hp3ltGsSPSfkvXWPlME/owG4tZxq1yT1MzROdmocZydBenZLEXklZTxftD8kIIDOlNlHkoGMApZMEB6HTMa9OZT3COo8IseGyp6w936j13KgcI9FCcbLeoJbGcKZ0/4eQfVAodc= 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 1663248309376362.80416622263647; Thu, 15 Sep 2022 06:25:09 -0700 (PDT) Received: from localhost ([::1]:46230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYorc-0007Pm-6b for importer@patchew.org; Thu, 15 Sep 2022 09:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohY-0007uZ-3Z for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:47 -0400 Received: from relay.virtuozzo.com ([130.117.225.111]:51280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYohT-0002u0-Ry for qemu-devel@nongnu.org; Thu, 15 Sep 2022 09:14:42 -0400 Received: from [192.168.16.215] (helo=mikewrk.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.95) (envelope-from ) id 1oYoet-004BPT-Nv; Thu, 15 Sep 2022 15:14:11 +0200 To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Paolo Bonzini , "Dr . David Alan Gilbert" , den@virtuozzo.com Subject: [PATCH v3 5/5] tests/x86: Add 'q35' machine type to override-tests in hd-geo-test Date: Thu, 15 Sep 2022 16:14:07 +0300 Message-Id: <20220915131407.372485-6-michael.labiuk@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915131407.372485-1-michael.labiuk@virtuozzo.com> References: <20220915131407.372485-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: 1663248311146100001 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 19354690ae..61a92bdbe1 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) @@ -1108,13 +1193,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/scsi_hot_unplug_q35", --=20 2.34.1