From patchwork Tue Feb 6 20:30:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10204039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B86E60247 for ; Tue, 6 Feb 2018 20:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F059628D55 for ; Tue, 6 Feb 2018 20:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E500D28D59; Tue, 6 Feb 2018 20:35:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E63C828D55 for ; Tue, 6 Feb 2018 20:35:28 +0000 (UTC) Received: from localhost ([::1]:59040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9xg-0005dd-46 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Feb 2018 15:35:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9tb-0000TQ-B8 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9tX-000302-Rz for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:15 -0500 Received: from mail-db5eur01on0133.outbound.protection.outlook.com ([104.47.2.133]:39312 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej9tX-0002z3-H1 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TkySDg6eRzaOYNWvNFRZgkozAMJx1cvIWRPz06iWAXo=; b=Yqo4lASzRhLo6PKRjqBnOBQHm3Pj5njSwLnilcmFr6T0rsAWOrlCLSmAzfoaOdsdf7FHZjJPddik3yGZhj2IqXdHLjVut/t58xok4bqrKeqejnEAvoesjKjphxdaSRdgjErga+uSEobQOHqSwRvpE1OtCHLxqvgIL4zkkzB39lE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Tue, 6 Feb 2018 20:31:06 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 23:30:16 +0300 Message-Id: <20180206203048.11096-3-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206203048.11096-1-rkagan@virtuozzo.com> References: <20180206203048.11096-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0301CA0008.eurprd03.prod.outlook.com (2603:10a6:3:76::18) To VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11bf7b0e-abf8-4e96-453a-08d56da08e2a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1983; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 3:4WynuUZdI02ss4Jmq56Zm6tQiZqHuYHUGFjr85sByS28/wzkxv5PYeOefNZXo/C68U8Qjs1EI4FRBCn3KHSC/IWz+/b/cnTpYqqTS0hFRugPLn7cUzA/W1yLcvNktxBNw42q+s2RmDDftCBZYJv7C+faq8/jMyuoPbVCXt5pyDShFqAI+Rh5P4SxXD5jSrY4rsNnslD3os53haOBX/Fu02Zfj4atGeHfzxlqhou8xzr1SpWNf4Nz0AKonv8J64lG; 25:6uMAY1QfwyZMIMgRMgMUw+i3BOmTnmgf7AY8dsdqSZha/5lVbsNEM/OGC7NA980OI7LJ25hpA31mFKxdJ6/qFOB8f9nZVW8zpo6bxZSL4xnuVDVW7ibk/RXpvndi2LGHmYC9SemajOg8+M3v9051JeMcGYQlRvm2b+0HhzUjwb6y1UXQUR6qS06kjclC9EwTHA/oi2K4IwvLLOCpZsDVQtLbtHKlfnR4DCaVgBebUjVZ89dIYHlE6sqMXBmQaMOu2VlXmlYCvo+XjE4my2pjfmdU/9a74yI0/geY81bIJYprEJeU/KkUNci81NQnHrV5lQnobgOKqDVJJISJ6/ROIA==; 31:DKUCnSbzBZtqOfTrsYimW0ZGFh90GMaeaVFMB0MiTZ96R2h7uurp2ljKyKhRI5yRRAfrlEQJDxNDB/itQFKElZlyNyNbA8Y2kjQkdZKwL0ccEPsGiUSThLSYYKYHbt88r2QusTLBMSV43HypHW40M0Mw0r3NbtHRlaChL1VJv14Gdew0raCHmGQDsJEivFpYwK6UKAiLl0oikW6M1UUgxBNjWq9NSwVx76B6EWUYAsw= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1983: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:m14akM4HEjX58sfDjuk/O1CEg/SKA2DtNTLAOyPxT+YRgz41PoJ8RRSR7soojw5ScoF6v5V8o3dinb/d2dVW/LAnMiyHL0jirl8dUVCnApefyp0MEmyNcBX7ByXa+UqpXB+rqTCZa1cgARJmrDhUoOc88jFTcBfuohfBcEggmwEdAiC2T6SaElEDrnkQ9rfRzxKrgLVgza2+wN4awJcKk3US/lktvECgWKAIBtYAwXvVHvJQBHIbTnUxnAIyA2wgi1FLujmHgbxq2hdsbuZcFeQnhLirfAXmDOBFJtZlKlPCGUDJfjJW4+bkyER48w3rJ6ZguBQ1GwtyCbkc4IKprGqLVykOxjetYeGCylTYlfEhTiD/OsTsx72/LhBq4icCFnj29n73kM6jW9pE8uSgW0B1GG4aUYXenxcn+vXZ0yc=; 4:mX7Oaok9ZS4Qa81pBW1ifyzx5M/0ERjwxaanyLbmZcyFpN1ayAzqIL4VRPdP0OIflYTSiQ4gIO7WplVLRugHdP6tc6P9k9dsnVClLxJ9WwIzNdLYrFoUb6h9wfgt0105wqJndOlU/quzgIJJmhM4zQsykByb2qNKIp5ttIypbR1ck9oJdYyfDot9LPZ7R5rWLmUkj8tPBOKHzvNwBp/9FFM95t2qmq3GP9clxE+7rj0NMjPuYcaM5pb32f6TGTa+/QlKpBXZjpXnwklgwuiplw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231101)(2400082)(944501161)(10201501046)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0801MB1983; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1983; X-Forefront-PRVS: 0575F81B58 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(366004)(376002)(39380400002)(39850400004)(346002)(189003)(199004)(16586007)(53936002)(305945005)(54906003)(7736002)(3846002)(316002)(105586002)(2361001)(106356001)(2351001)(6116002)(1076002)(50226002)(8936002)(81156014)(5660300001)(8676002)(81166006)(7416002)(2950100002)(6666003)(6916009)(76176011)(86362001)(68736007)(66066001)(16526019)(47776003)(50466002)(4326008)(97736004)(26005)(6512007)(51416003)(2906002)(52116002)(386003)(6506007)(48376002)(55236004)(36756003)(53416004)(69596002)(6486002)(478600001)(186003)(25786009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1983; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1983; 23:edeTE4ZWULOUoy1EaI58WKqHK4ok/MdabAf3m2V?= =?us-ascii?Q?TIH182U5mm8nsEAZcbDmoLQ3JgGCGfwMWm56Rdj0v6eyXCyBTJFHS2ud+x2Y?= =?us-ascii?Q?duU5/1m55Vw3fo3HjFBXJ2HXXwDToRwiqdiocx3c5PHkV0XlbTQVMK2cKCJf?= =?us-ascii?Q?t1/+nSj86+zclcnycXPSz2TNGPRMg9aX8WtyRJ15wf3On0L9fppiMD0FxJKF?= =?us-ascii?Q?xaYux/UgY7ouSdVmFzM6MilvVKyacwCnjg/j0vCDoD+pjkqDQRtpW4gW0LCv?= =?us-ascii?Q?RRqLtNR72EsdvPPD6x37SJXe9uzCPHihEMdet3KXDcLijziY0mN2IojxD36h?= =?us-ascii?Q?NURsl1p8Qz1fx1m9V/PWwMgIn7ON1i6ZwCablbUIT3GJl6YgTEBDEBUqtykv?= =?us-ascii?Q?1/gEl/Zcc5Ua1XnB9FCKS68A0EkWwJT6Ogs0MhiG69W7hXne6fhgtvnxym1p?= =?us-ascii?Q?+y4XALj9AO2dQNDql+GY8+kBPTgYGZOqikTfbVEyL+ynoVQfLq2leYisa1yW?= =?us-ascii?Q?mpHbduxAgPyf7rTJa2OoE7a7De3ML2jbJQzRHJUuDY8KezFXZY511aqlUFx2?= =?us-ascii?Q?ZNBwAZ22iSjBW9wPypqC+tQz4sdI60hoogqbuGicKFsz0hnvaN2c8+lFM7ES?= =?us-ascii?Q?9F4g+o1E+GwQxAKcZilKhHeJcs2Am3yGMAf03fLLYnnPpiAjz/ilMIZEevLR?= =?us-ascii?Q?mn2YeptY18eGxSh+1fFBSMWvuMzzjh1OaacHLdzmLhSs1KNBF8d/z8LPDD3k?= =?us-ascii?Q?wLAwyIKjx0m68ULbCzxJfa/NkCXJDJ3RnceefPxx95Zc+U2ST04Bjv//Bmcg?= =?us-ascii?Q?1YjX/9MLVFfIEq/HTWMgTSRr6LdSftqErkEDLhLiVdyDWnNdpWzuoIF8ypqk?= =?us-ascii?Q?eHebf8JIR/CV+SHAtlPMId7/zry+hvigb1egFNIRZ1PAZGwJ98IiuRZVa8aU?= =?us-ascii?Q?otq+sBf/OHq5/53/Oy76cVHDoxEfDaNZgY/t66dLh9RuNaa30E+5yV4C3zDM?= =?us-ascii?Q?LLrITr+Vxh+txqziuFvuqF0sh3hEw/ozmdFLv41p0monNJepEkgMBcJH/Rtj?= =?us-ascii?Q?ou/r2o5lJ+5ICb7v0BIpWRDj2pxwoJXxDryFeRO17X269+ssb5emIPneIqpa?= =?us-ascii?Q?Ekns5xVFBSS8ZHJqPNqEu3f3u6pD4QEQLdvoSHWXFstF+VHhvu2OVOfIID9b?= =?us-ascii?Q?352c0NgeoMczlCcjbmSzRELu5xXKk0P+nozmD7CC2zjB9idredIZ9wq7w+NR?= =?us-ascii?Q?TuCOxJUUXPJXxL7q2x8MWYL2s+X4m4hJTKNPP7WS5ZRRVItRse/9wDoIa3pY?= =?us-ascii?Q?KTw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 6:RxPSM4tF5ajLmwnrC0iearfL1ShtzJC7R9YYJ7B2AXibL542tqpjSGhIfExIRENOFjait4Z/f5pftMXfkccp07jyP3I1N+S8JgJz5nlh6+GthnzptNIsS049LVvfByOLsX6GkAGcCQ4GBjGn3XxqoOBVwOF76hMbUJfrZYN1XwJdYP/++8kkEEuCd+Zbh4DniHpWOnmBq3xt+6XVYsuNoLRDbgjWK0viYHwNLIOj/Z0PeEeEGObCWtzvZrLlG6s1iLiu1g65Um25bNDvPlWax8LpHGEYC99tIUVj4Rlcl/5i1n26NIk1eIdDWUkW7s71DFQ4anKg9+yWpRmCN/NQ4lf92CFKMtMRIkw/kC2QFQE=; 5:gpCMw8f0E9bektocu8oezK2z0m118Cey/MdJcNuXKW9ABNBNL8I16Yk+8DCGQeRm7iOpQi3JXUwClkEP4lnnJZVZgkgASHAuWf5d3Ssnjwsgi1Y7IPahTLXLehYBkNqFNgJJ4wBN/20miE91HtlfwYvfcK7oJgdhoCgztulg188=; 24:t8dGDjUd0gTcRl0w39ZksEcJ/yzx2dM/kTXNyON1gwCw4v66YDgcSpvkINSQCHyQlzXJk/EppTXHxEcSoA79WhH38a7bTB6JoZDTVgIm0JQ=; 7:o+vyk3ejdAiL+2oMY6YqfdNv6TxNxjWlDUuQqzPAnFSPfN84Tbb6u0RILbCU3D5IAiePz9KDXdfGH9HeMtD353PFyBPBd7clJrnB/clr7mvy0I/z2aLQxkf95r6FL7ajBgjzKR6/8XjKHnUDZLjBH7QiV1A27Q4fYVBAZZytdXUO74iD/d2ZYfHfu7GcWFZDvxX3jQttSZ+Z+3zI1OIQvVbUx7cYFo1SmDFYzdGQ6/ECEslDAiqoZx9I07kvgV9h SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:mN7ihd/yEnU11x7VEl3z3ZxydvTxo25nVU6+UX+4FPsT/XhqurKg9hDXjPTNnxskAaKqCu2NvacKGw02Hmb2S8asA6cyqsvBglYPOgNb1TB1pfQUziLZnKuhoSfPXk6SO+vHOjwB5iDiV23PJDfiP+PB1Ywd01BhXPo0QGLx6WM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2018 20:31:06.9029 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11bf7b0e-abf8-4e96-453a-08d56da08e2a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1983 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.133 Subject: [Qemu-devel] [RFC PATCH 02/34] hyperv_testdev: refactor for readability 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: Ben Warren , Konrad Rzeszutek Wilk , Krish Sadhukhan , "Marcos E. Matsunaga" , Jan Dakinevich , Vadim Rozenfeld , "Denis V. Lunev" , si-wei liu , Paolo Bonzini , Vitaly Kuznetsov , Cathy Avery Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Make hyperv_testdev slightly easier to follow and enhance in future. For that, put the hyperv sint routes (wrapped in a helper structure) on a linked list rather than a fixed-size array. Signed-off-by: Roman Kagan --- hw/misc/hyperv_testdev.c | 114 ++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 61 deletions(-) diff --git a/hw/misc/hyperv_testdev.c b/hw/misc/hyperv_testdev.c index dbd7cdda07..b47af477cb 100644 --- a/hw/misc/hyperv_testdev.c +++ b/hw/misc/hyperv_testdev.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qemu/queue.h" #include #include "hw/hw.h" #include "hw/qdev.h" @@ -20,12 +21,17 @@ #include "target/i386/hyperv.h" #include "kvm_i386.h" -#define HV_TEST_DEV_MAX_SINT_ROUTES 64 +typedef struct TestSintRoute { + QLIST_ENTRY(TestSintRoute) le; + uint8_t vpidx; + uint8_t sint; + HvSintRoute *sint_route; +} TestSintRoute; struct HypervTestDev { ISADevice parent_obj; MemoryRegion sint_control; - HvSintRoute *sint_route[HV_TEST_DEV_MAX_SINT_ROUTES]; + QLIST_HEAD(, TestSintRoute) sint_routes; }; typedef struct HypervTestDev HypervTestDev; @@ -39,88 +45,74 @@ enum { HV_TEST_DEV_SINT_ROUTE_SET_SINT }; -static int alloc_sint_route_index(HypervTestDev *dev) +static void sint_route_create(HypervTestDev *dev, uint8_t vpidx, uint8_t sint) { - int i; + TestSintRoute *sint_route; - for (i = 0; i < ARRAY_SIZE(dev->sint_route); i++) { - if (dev->sint_route[i] == NULL) { - return i; - } - } - return -1; -} + sint_route = g_new0(TestSintRoute, 1); + assert(sint_route); -static void free_sint_route_index(HypervTestDev *dev, int i) -{ - assert(i >= 0 && i < ARRAY_SIZE(dev->sint_route)); - dev->sint_route[i] = NULL; + sint_route->vpidx = vpidx; + sint_route->sint = sint; + + sint_route->sint_route = kvm_hv_sint_route_create(vpidx, sint, NULL); + assert(sint_route->sint_route); + + QLIST_INSERT_HEAD(&dev->sint_routes, sint_route, le); } -static int find_sint_route_index(HypervTestDev *dev, uint32_t vcpu_id, - uint32_t sint) +static TestSintRoute *sint_route_find(HypervTestDev *dev, + uint8_t vpidx, uint8_t sint) { - HvSintRoute *sint_route; - int i; + TestSintRoute *sint_route; - for (i = 0; i < ARRAY_SIZE(dev->sint_route); i++) { - sint_route = dev->sint_route[i]; - if (sint_route && sint_route->vcpu_id == vcpu_id && - sint_route->sint == sint) { - return i; + QLIST_FOREACH(sint_route, &dev->sint_routes, le) { + if (sint_route->vpidx == vpidx && sint_route->sint == sint) { + return sint_route; } } - return -1; + assert(false); + return NULL; } -static void hv_synic_test_dev_control(HypervTestDev *dev, uint32_t ctl, - uint32_t vcpu_id, uint32_t sint) +static void sint_route_destroy(HypervTestDev *dev, uint8_t vpidx, uint8_t sint) { - int i; - HvSintRoute *sint_route; + TestSintRoute *sint_route; - switch (ctl) { - case HV_TEST_DEV_SINT_ROUTE_CREATE: - i = alloc_sint_route_index(dev); - assert(i >= 0); - sint_route = kvm_hv_sint_route_create(vcpu_id, sint, NULL); - assert(sint_route); - dev->sint_route[i] = sint_route; - break; - case HV_TEST_DEV_SINT_ROUTE_DESTROY: - i = find_sint_route_index(dev, vcpu_id, sint); - assert(i >= 0); - sint_route = dev->sint_route[i]; - kvm_hv_sint_route_destroy(sint_route); - free_sint_route_index(dev, i); - break; - case HV_TEST_DEV_SINT_ROUTE_SET_SINT: - i = find_sint_route_index(dev, vcpu_id, sint); - assert(i >= 0); - sint_route = dev->sint_route[i]; - kvm_hv_sint_route_set_sint(sint_route); - break; - default: - break; - } + sint_route = sint_route_find(dev, vpidx, sint); + QLIST_REMOVE(sint_route, le); + kvm_hv_sint_route_destroy(sint_route->sint_route); + g_free(sint_route); +} + +static void sint_route_set_sint(HypervTestDev *dev, + uint8_t vpidx, uint8_t sint) +{ + TestSintRoute *sint_route; + + sint_route = sint_route_find(dev, vpidx, sint); + + kvm_hv_sint_route_set_sint(sint_route->sint_route); } static void hv_test_dev_control(void *opaque, hwaddr addr, uint64_t data, uint32_t len) { HypervTestDev *dev = HYPERV_TEST_DEV(opaque); - uint8_t ctl; + uint8_t sint = data & 0xFF; + uint8_t vpidx = (data >> 8ULL) & 0xFF; + uint8_t ctl = (data >> 16ULL) & 0xFF; - ctl = (data >> 16ULL) & 0xFF; switch (ctl) { case HV_TEST_DEV_SINT_ROUTE_CREATE: + sint_route_create(dev, vpidx, sint); + break; case HV_TEST_DEV_SINT_ROUTE_DESTROY: - case HV_TEST_DEV_SINT_ROUTE_SET_SINT: { - uint8_t sint = data & 0xFF; - uint8_t vcpu_id = (data >> 8ULL) & 0xFF; - hv_synic_test_dev_control(dev, ctl, vcpu_id, sint); + sint_route_destroy(dev, vpidx, sint); + break; + case HV_TEST_DEV_SINT_ROUTE_SET_SINT: + sint_route_set_sint(dev, vpidx, sint); break; - } default: break; } @@ -139,7 +131,7 @@ static void hv_test_dev_realizefn(DeviceState *d, Error **errp) HypervTestDev *dev = HYPERV_TEST_DEV(d); MemoryRegion *io = isa_address_space_io(isa); - memset(dev->sint_route, 0, sizeof(dev->sint_route)); + QLIST_INIT(&dev->sint_routes); memory_region_init_io(&dev->sint_control, OBJECT(dev), &synic_test_sint_ops, dev, "hyperv-testdev-ctl", 4);