From patchwork Mon Jul 2 16:58:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10502121 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 645DE60284 for ; Mon, 2 Jul 2018 17:13:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 491C228DC2 for ; Mon, 2 Jul 2018 17:13:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4647528E3A; Mon, 2 Jul 2018 17:13:44 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 AE94A28944 for ; Mon, 2 Jul 2018 17:13:43 +0000 (UTC) Received: from localhost ([::1]:34425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa2OU-0002MF-VW for patchwork-qemu-devel@patchwork.kernel.org; Mon, 02 Jul 2018 13:13:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa2AO-0007w0-Oh for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa2AK-00047F-SQ for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:08 -0400 Received: from mail-eopbgr80117.outbound.protection.outlook.com ([40.107.8.117]:8538 helo=EUR04-VI1-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 1fa2AK-000465-GK for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:59:04 -0400 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:X-MS-Exchange-SenderADCheck; bh=LV5juKlCqKRLJurNvTl9iqwA1kZ2X/IMGmpNHgA+dDA=; b=inM92m8HAfG6ge7RFD/fPC+b/4u61WKTxPeJYtVDxide5+HWKlmzpYRkrIagghsuP9Stxhd1ZNl+tjBbDHqEYBUrYF8ASe1M/YcqwQB2bCC3oGwBivwJsMb2Z+qP3NIS5Z5qtrqbyYzeXWyL4Uxsl0SxD1hTu/W4C23LRLRgwoM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by DB6PR0801MB1974.eurprd08.prod.outlook.com (2603:10a6:4:75::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Mon, 2 Jul 2018 16:59:00 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Mon, 2 Jul 2018 19:58:40 +0300 Message-Id: <20180702165842.11423-5-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180702165842.11423-1-rkagan@virtuozzo.com> References: <20180702165842.11423-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR08CA0234.eurprd08.prod.outlook.com (2603:10a6:802:15::43) To DB6PR0801MB1974.eurprd08.prod.outlook.com (2603:10a6:4:75::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53bde794-5d8e-4937-feb9-08d5e03d1c91 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1974; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 3:RTg1cUawKfvfwepwpOZF7wASmSu9XsyR4FxYHDjRUwB2QqRBq5ZPA0rbKsSSXmI9HtqU1urlK5o5bT9JUIjSTz/WlhCN8oRHX0LwN4Y/8Jbkh/GlL1flvjzSJFzwM+bqIO6JLMPdVEkj+rRmeT6lXGyKzR7eq2KR+oOc2FAlZUey4UEPLXviw8eGnCAvXyu0CV3Yg++c7bTb0+JBz/JnMKKtAzy/V2aisdVEGyRtx8/TNLHNJcGLk47bVJdDGuCM; 25:I3SmFWrLAr22sFZ7X1Iv2GBIaOuz8Hdr7wTxIbsiIuIkngdxR6CFOgVW32RpTKSDPL8EVd8BI/T4MIt4KKd8S/uJ3qmRrUVJ051eaFySC/wp2hCmMGhw85ceOlQx4nn/PU2EjigO6oG5U3fq+/n2CUfsWuf9B5QXHwOb/vaDVKcDmRvNEmM/xzL1bORGVZ9eV4GjTMAjplhIHcTBjd63KqTLO9kY2m2JFnSiiRPC1bjxq9EL6hBW1hpqjqjAqMqjxx2c0dM0ik3pt8hMIE00+HcM8uuTkIByHyAlNfEyADCzV4PKvEMzelxU8ij27o0FwyQeF3+76b3vRlnl6hisfA==; 31:k6pjtxyOmuHgiJ5ZOx3ysKq9D3pY5pS8S/bB/gKlxAxkmKO3xZe8A+hCGEDZKuJAGkvKFOYcEg8qgj/5iOW/rO5hZKDRsHQ1kC5C8W1gxwMqy3b/qS8FThnjAefA1nfjGXIQJqaC2oWbTbn2iJxeqIEdug3/Au5XfDgjxwVnt8CI07jLwpi72vTH2ZNgBnVmxCPjs4tS3nukkw4akszT35wHqSJz9lpZ7aK377uLJcE= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1974: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 20:B5RAvzy71GbO1Cf1zDozAM8xWg2ha9/0JM9HmrzXoweyUqeu8LtIIcGNQLPz4vJOtsDso1D491LDUsHmU2OQ2GUUHndyv8rLFkjKnLah9VOU/D/yij43lgIXuP6iOu6Yak1zrmon/3gVw7IEq9oXpZCpyWjwoWKEz7+6jaEMB+tUgBzOFwFYZcYoL4R0K/zSzH943V6WxHCustPCiF+xLYN6s/hexyCrRDe/T8Shbx0yMwKu4ojvbWqjwRFAOWXv+DCSQ+XAzXEJ3fsG0frT6x1FZi+fwDwUJivYhgCMofgBMAtevU6P5e8DmgWqlYc3Js6sIQUeSoO/fmQgd/UyidCb6J31hjR8Qjk4trp1RG9guHQO69jEbwC9DRfsXRi12rtPJJ0EYmF9ZW/cJdP9gx/saB7KzfEMUVfGoCMVH8WelNtozOsFXEAeE25vvzVzMZN5+8tigyah5bKnBomYM5cCXEmwe9vOI7k9ZtOFHRCKkc8TMZJwN7h1gvony/G9; 4:rodDWSox9uQ9TfeMCSgngBSAVk/K80KzqcBCmMozo5xH8+34C3m5VIR5xNmWGnGYGK3IkFIwUQo6I8U0aElXDbMFzZ4pa2avB7Cjt6FZi//ZTbuEYBp1FZXDY+qdNXgZQxa6aAOW5ysVo1PTc4zXMeIVyq1OzrBPYRR5HNxEsZ4wcWDNH38tnVtB6qDMwxrzUKjzJmmHw7obZ6nC/iVZiNjgg88QH4zDgvJw4B5LF/wOPefoAZAQyik0hGf98l5rgEtiCUQrYIGtQqJqQYR7UQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB1974; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1974; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(189003)(199004)(7736002)(26005)(53936002)(305945005)(4326008)(50466002)(39060400002)(478600001)(6506007)(386003)(186003)(6512007)(51416003)(6486002)(66066001)(47776003)(25786009)(76176011)(97736004)(2906002)(2351001)(52116002)(16526019)(11346002)(105586002)(36756003)(8936002)(69596002)(53416004)(3846002)(6116002)(106356001)(81156014)(81166006)(446003)(2361001)(7416002)(86362001)(54906003)(2616005)(6666003)(16586007)(956004)(316002)(486006)(48376002)(68736007)(1076002)(50226002)(8676002)(476003)(5660300001)(6916009)(575784001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1974; H:rkaganb.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0801MB1974; 23:Q/UBuUThiAUeckYjCCP7ahXRbb4zCpSFtJs9f8/?= =?us-ascii?Q?Uj2+UFcBGhU9Zoo94krDj28lxX1JH/eVBCYBVzTyInN7SHorJQfoUMSF/R7C?= =?us-ascii?Q?PRt+2qXQv2EHA8ApsrRXxwQfxslw6Qn3B3vYpCqJxZB1pM7P/9DWBR0fZtm6?= =?us-ascii?Q?RNr/ucjid/oqEJyxGnD54DcTTS+wjTZgqTP3oc+IZvmHuA1I1BetMvhKPJsz?= =?us-ascii?Q?w9JmBMPC58Ato//5+89OgOnPiXGRWRgqGeLbpDo4enM24CjAdknQxLJiFrMS?= =?us-ascii?Q?LDUs22nv/8N/LBLlcjOp5j6gtwmSdjRhKzS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HafsR2RsKnS1qQeHp1ORiwOFeH3Tb7Ua9w0Ww==; 5:PvVE+DmyEcJk7+U3E6ZFDvYOFsHt0n/NSkK08Bml6OdhNHSai9O+yAmzTdcSYOu0/VeFIH7VhfwrVigsoujJbQT8KB76sOis64e0ZkvAJOL7iYypIgbEYscuPx0jdkPndTWB8XINe2XKhAFCjnVxytG5TdEUQbrFbb7Fh+gjBk0=; 24:wwkBZDBKiEV8Nzr/OAUFEvkyYWSou+UthQ3lcLyJkI6dRkcuwcSC95kFo3h62g0MD8CP+Z4oFsgOrX1kMrK6GKksllToFenhtr4i28epLnM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1974; 7:Hsvum3OaWvQYL5c7lrcLWWVJQvnxhVm+3iuO31/6rJQbhSDFM+7bNb4FcFN6HoEiFAT+wPNq3AGZj9US0kE1DBkRdrSCswvoA/tn4zcMX3KnXT07FDcMMz26O6cI5f/GXPBvJVNhvALp4gPeoAaRyJCiiTyXx71i8SqCqPnlKf3eP5Wd1jWIjlfa88Im+LCFS+Mqy9YvTDYZ/OMQTaeY9BOPZr2+BU8LqtALmwXE/4ffSbRiLMCTrnt1D3xQ42oN; 20:YhlFlaX8hP1Kz5Z12cwjvzzTVRVE3XfkhfO3mg2ZOM35WXM9MrR9RWTmM/NrCu+X7anNFZ6HlIZs5PrEzxbsZdWdooqYPrpwTbHnnOlNbtdNCxk13VC5droT4ItYbKqb6mQIh/oA2bxU/HLstoeZv1N+pQAD4x4MLwRA0B52JsA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 16:59:00.2285 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53bde794-5d8e-4937-feb9-08d5e03d1c91 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1974 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.8.117 Subject: [Qemu-devel] [PATCH 4/6] hyperv: allow passing arbitrary data to sint ack callback 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: Vijayabhaskar Balakrishna , Eduardo Habkost , "Michael S. Tsirkin" , Konrad Rzeszutek Wilk , Venu Busireddy , Liran Alon , Igor Mammedov , Si-Wei Liu , Paolo Bonzini , Boris Ostrovsky , Karl Heubaum , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Make sint ack callback accept an opaque pointer, that is stored on sint_route at creation time. This allows for more convenient interaction with the callback. Besides, nothing outside hyperv.c should need to know the layout of HvSintRoute fields any more so its declaration can be removed from the header. Signed-off-by: Roman Kagan --- target/i386/hyperv.h | 14 +++----------- hw/misc/hyperv_testdev.c | 2 +- target/i386/hyperv.c | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h index 00c9b454bb..93f7300dd6 100644 --- a/target/i386/hyperv.h +++ b/target/i386/hyperv.h @@ -19,21 +19,13 @@ #include "qemu/event_notifier.h" typedef struct HvSintRoute HvSintRoute; -typedef void (*HvSintAckClb)(HvSintRoute *sint_route); - -struct HvSintRoute { - uint32_t sint; - uint32_t vp_index; - int gsi; - EventNotifier sint_set_notifier; - EventNotifier sint_ack_notifier; - HvSintAckClb sint_ack_clb; -}; +typedef void (*HvSintAckClb)(void *data); int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit); HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint, - HvSintAckClb sint_ack_clb); + HvSintAckClb sint_ack_clb, + void *sint_ack_clb_data); void kvm_hv_sint_route_destroy(HvSintRoute *sint_route); diff --git a/hw/misc/hyperv_testdev.c b/hw/misc/hyperv_testdev.c index de07d7e8c3..50dfa6af64 100644 --- a/hw/misc/hyperv_testdev.c +++ b/hw/misc/hyperv_testdev.c @@ -56,7 +56,7 @@ static void sint_route_create(HypervTestDev *dev, sint_route->vp_index = vp_index; sint_route->sint = sint; - sint_route->sint_route = kvm_hv_sint_route_create(vp_index, sint, NULL); + sint_route->sint_route = kvm_hv_sint_route_create(vp_index, sint, NULL, NULL); assert(sint_route->sint_route); QLIST_INSERT_HEAD(&dev->sint_routes, sint_route, le); diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c index acdb0ca9df..11fd1add2c 100644 --- a/target/i386/hyperv.c +++ b/target/i386/hyperv.c @@ -16,6 +16,16 @@ #include "hyperv.h" #include "hyperv-proto.h" +struct HvSintRoute { + uint32_t sint; + uint32_t vp_index; + int gsi; + EventNotifier sint_set_notifier; + EventNotifier sint_ack_notifier; + HvSintAckClb sint_ack_clb; + void *sint_ack_clb_data; +}; + uint32_t hyperv_vp_index(X86CPU *cpu) { return CPU(cpu)->cpu_index; @@ -77,11 +87,12 @@ static void kvm_hv_sint_ack_handler(EventNotifier *notifier) HvSintRoute *sint_route = container_of(notifier, HvSintRoute, sint_ack_notifier); event_notifier_test_and_clear(notifier); - sint_route->sint_ack_clb(sint_route); + sint_route->sint_ack_clb(sint_route->sint_ack_clb_data); } HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint, - HvSintAckClb sint_ack_clb) + HvSintAckClb sint_ack_clb, + void *sint_ack_clb_data) { HvSintRoute *sint_route; EventNotifier *ack_notifier; @@ -116,6 +127,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint, } sint_route->gsi = gsi; sint_route->sint_ack_clb = sint_ack_clb; + sint_route->sint_ack_clb_data = sint_ack_clb_data; sint_route->vp_index = vp_index; sint_route->sint = sint;