From patchwork Tue Feb 6 20:30:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10204109 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 4739860327 for ; Tue, 6 Feb 2018 21:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BF4728B2D for ; Tue, 6 Feb 2018 21:03:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3085928D1D; Tue, 6 Feb 2018 21:03:11 +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 7143328B2D for ; Tue, 6 Feb 2018 21:03:10 +0000 (UTC) Received: from localhost ([::1]:33791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejAOT-0007au-HF for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Feb 2018 16:03:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9te-0000XG-F3 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9tb-00032G-Mk for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:18 -0500 Received: from mail-eopbgr00114.outbound.protection.outlook.com ([40.107.0.114]:60650 helo=EUR02-AM5-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 1ej9tb-00031Z-C7 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:15 -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=1DsAFYpDFSn/e2wJWNLoahv0S81zvouErA7sJqKMOF0=; b=J+W+NzbO018X63ZmEb9YPB4IZBdXcZgbuLsMgA28jXvHkWc/AqBkcAd5jh8KfoDMAql82WqknoQpD1TwMay5eSSHumZMZAWmIMnGPxF35uBqUfsGbzBnd2l/pssnO4vdB0EwrI8KD7ZByl6yleNwVjQtODnF6hCurpBwQ37TTg0= 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:12 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 23:30:19 +0300 Message-Id: <20180206203048.11096-6-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: 8d7b253a-6e6e-4484-b04c-08d56da090fc 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:UMXwCY7p4SL02CKkKR4xs6Hd4c4dkubAyiJ92LLX65X6nTp+9/s7S3n8oa/3DIY1h4rorr3cM931/ZTF4fygaZH+JmSzyNyHJ4Rn80b4Qe8+Es6L65ocTu3ya53r2Qfk5YJ5PGY2xB9QWO9HxhqyExeJf7XLYDFpJZ+IX7W/wUw+zRT8n5HR8GD9Peqlr7Nf8PGg6PkrIZGy+g2e1OAwRj9S+OawX9uh+hlQuN4hp86nZDxpWZalNDwLMUeHBBWf; 25:+CEGCE84AeFgRZxMt4f/6YpV64c0FhGd2fshqxpVQLdumW9vPKuO34bEpcD8QG1V+nzSqbKopz1bboP0+jUae7zq8i3xFVih/10uVZSjE8eAFQ4dNoRkpl3yEU3lOrn0IfIlWpmlLDHP1IlcYDyowIz4RZLg2yU4M/kovgMuAfn0uIgIZgBG7wTHlsO0nJp6cCQFQnCMad1EpHX4j4mXm45M6iXexZ2mG/99CLHcO8ZWZ5X4E+sn4fMu9I4tahaMtCAUHNM+TjZ3ZSSZcOYWFumk8O0ZbdvbRQcld46iGxfw5kiN78qyMs5vMx7M5/JR0bUSWZqSCWYBTGxrFsKYuQ==; 31:9b0bMqwzebgCDDPMLpGuSyMO7Hi0AnNBcZmRnq2dAGMSpVvm42Gllb/wN01W3gmAJB7IHvSRJshPaJsOG+uhu22kqm54q8lPdT/34VV/Nlq1k4O2JMfOZVDC0zI9/axXcNc+AKgTfIybNGipwvGJv4ip3ACunEBiPO9e/q6mrnpe/Yhdj8h84EQAwiMQBlsaNY0y4198oJ4LH81zeHpOMvml7Q3+CCXKgmVbqoNJS1k= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1983: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:50Ns3Yci2SZVIWSZ8lHP9y4OJVNf9+6KlZHwFBTm+GUE8ZL0p9HTAxQgoV5uTkDionzVryJE2ed1iqx9tb9HWXuEXcnfe0B0TCkKr6kASuTpn/YgF709aupn3tfRmba0D5byweBRd1c+g5NulyRKq1oCkvDEV+YE7uryhA4dMRBBeTpSEjfB7mZeondn1CaiDwV1ZOYp69ebGRAyfe7DWOK+yE5hdGF2ZUhn2NpZhynzebtElpCNN2us1Qn5cvTMtPD1yWXhUcsI6bQ/lTeWefGwgEpUfYWPwjutCj5sKlvGlQlUzNxORsDLBncuo8//2RVjWb5aBjODdhDP6Iay9blEDO+8oa38z96A1xU8mtMNnj7QLVhZWH/panKhwcLV4U9OVchyEDoUKNk4KW+Mytkro2DK5HWK+bXlT55OPyk=; 4:ynWhCZR3OSZ9XGtt4bVcft/zw0kZip+9In/df8yVs1eldNaYlL5ZN0po6CndD0sJ09Ya1nkHkEX8ukGSG9U41cV/uDOftyxcZbSnLyBrL2mFQbAF6X/804JM2rMVKHug4E+yB0rhxeZWroVClUytiCuj40L9qN8RF6aCQC4O+cmfHrJk1SqR7Kl7u1GzgwYb7A6n+NSmC8w9J7qdeeqGutT6paF/7qvkUhaS0Vt7w87q5oeDoxwOnbqTWsbeAZKb4kf+rGMNXQ4gl0sINlygyw== 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)(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:WbUKxv64I5oLm215mDxQ6kZqkh0bYV2lYgnF/vU?= =?us-ascii?Q?08LBTmA+grkFwZdd+tN9+4QBfJtwrih0ldMe/khEmx2/v7lZMNjAUkYgRdB4?= =?us-ascii?Q?DxqWZzsqATzWrBueuKn1XsEU+VthEcwwzR802v8kqzi6KaxpJ6xKZacx1ngP?= =?us-ascii?Q?vSUp6pJ/4XYtS162gpin3BYQHt0VHkNsxFY9MlROHZf+vokgYY+dRrI72IMY?= =?us-ascii?Q?USJIHiBIrry++lQpWQWQIjX5YTMEuo4ZXVHWRE5gvJ3l4zUmnHJVFTUNHV90?= =?us-ascii?Q?WeXHV8BGtypws7lmK4dvL8m96ARPV/PUSW4jal85nx5LwSf6hMQ3FJwg5ksz?= =?us-ascii?Q?PfpAmZCI/VtDKO+wIS55qOBsfGjcEzmNVXhc4e5/H83qNrXNegh9tIzZZY3O?= =?us-ascii?Q?kEXF15ACmnGLd2o+ldn8UtX+NAPJUkzknmBbvRV8NsEa1ST8DaWokCeGT45O?= =?us-ascii?Q?HoZrTvhVZmuSy0MwJY9h/gqTJ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W0j2c580tU4Kih3X623CkpJfXRATSzPs8CTTkH745o7HfJsYje1H4fY7l7H/d2cd6adqX1PO/EGWcXedENCBxNnPC6Ge+733ew5Q51oN0ioN/zLeHBVr67C22IKugwlrmjX0giZzVB223rIHzoM7eGHKPkIktxC6Ap5MsLLn9XAAIVFnf9LnLcUHYmMVHz4qgIpV5g7YsN89JF5AmaWXI5qFngSizPktWbOkcU0q9TbV/XO0HBdu3I+o117tPImVI1E2hWbf6E2325A+kkBFo8OoaglxXr4u6yVq0UfwcbzbuI5ScDXE5k=; 5:wyMLgoqXGQiXzAEWLCe+FpqNVRVUxDVlz/0xyjrPwIbrgzHeEmAH6pqmXJw2AtppfYBv3sdEcykH0oOZgualRqUEcjnT5A5mHFhvrv7iUnKA53dWa7HExBTaw29D09zGU5uvCUuOEQsmwhZ/6C8ig5/LMvxCb4wGt701ll+nW2U=; 24:DuyOVWzdExrk8o42JhMw6nDv+epjBxNUXdvw9en7MLQpNyQktsiykd1z3T5NXpsvm3fhFUScRUDUhvsexb5gpidSah+DhIin+PB6bSsYcmg=; 7:rsPG1OQDxQuVKW5jMGRqDEKVj06dfTUI2imwRnJBifsAyU9LvmZsWqdwtB6oEWWqIBMpDcz0fShtUy4xO480UV5ViXkTA5pbGdM/3nnevAqjN2NbnYDCCghWlhw8yvM63ljZ5EmWBz0OYzOYmolRwns0Yp60dunDiTXChRfiAJRZR/8+WmukulcKl1ld/n3RR0QAVxysLausGw7zHEOfVjGfi3i3Sfi04ULhpso+zo2aJU3EXGnRcDwZRJwsiZYP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:BMdXeRqBk5SxJVVi8I3hYRTfDEbCOMr3yDXg9PAS+iOoCdp5lCNRHo1Uf7DqNVl+r92lYso6NShOnpUPgDBZkarhTorTIPiuov9lbAZ1si+CSzrweWX6tKcL+Nf5T0IhsJoJCCsLIZUJ5M0VqmLQxYcVCbvs0STXbJl7atcP99w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2018 20:31:12.8092 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d7b253a-6e6e-4484-b04c-08d56da090fc 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: 40.107.0.114 Subject: [Qemu-devel] [RFC PATCH 05/34] 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: 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 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 82f4757975..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 vcpu_id; - 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 b47af477cb..827a8b1d82 100644 --- a/hw/misc/hyperv_testdev.c +++ b/hw/misc/hyperv_testdev.c @@ -55,7 +55,7 @@ static void sint_route_create(HypervTestDev *dev, uint8_t vpidx, uint8_t sint) sint_route->vpidx = vpidx; sint_route->sint = sint; - sint_route->sint_route = kvm_hv_sint_route_create(vpidx, sint, NULL); + sint_route->sint_route = kvm_hv_sint_route_create(vpidx, 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 f3ffafa4e9..b2416f9a5b 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 vcpu_id; + 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->vcpu_id = vp_index; sint_route->sint = sint;