From patchwork Fri Sep 21 08:18:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10609271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57350112B for ; Fri, 21 Sep 2018 08:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 469022DAC8 for ; Fri, 21 Sep 2018 08:24:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AEBC2DACA; Fri, 21 Sep 2018 08:24:39 +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 E70A82DAC8 for ; Fri, 21 Sep 2018 08:24:37 +0000 (UTC) Received: from localhost ([::1]:54379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3Gjt-0000K1-5h for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 04:24:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3GeT-0003cr-Nb for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3GeP-0001I8-TT for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:19:00 -0400 Received: from mail-eopbgr60095.outbound.protection.outlook.com ([40.107.6.95]:38256 helo=EUR04-DB3-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 1g3GeP-00012c-Ip for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:18:57 -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=knKmy0Nd+HZdvg5w/Bl6VB0hAm025ycs7XHsvbHmCIM=; b=LlcKyfgImYZCR6VkO4kvZIIKpl9bL19BkwO7/zPANgydmS1kZxiKQIP+1PAxsYpWLeGIWiOjT/R2kcbO4Bj1VU2jla5bxJ4Rb+KIQN7iI/mEiGkMJ1t83zf8M9KrxerKHBOtqQJhltbZbzw9HGFXaiTDqWq1sWyH7Mz4r3wsy7o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3586.eurprd08.prod.outlook.com (2603:10a6:208:e1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 08:18:54 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:18:33 +0300 Message-Id: <20180921081836.29230-6-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921081836.29230-1-rkagan@virtuozzo.com> References: <20180921081836.29230-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To AM0PR08MB3586.eurprd08.prod.outlook.com (2603:10a6:208:e1::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b23f8c3-6337-4a4f-8091-08d61f9adf77 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3586; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 3:FnjOQK4MgwU0QRhu4o2I/D1Pk++zxqyMHhkwTWOoPY0Wmi7B8cyT2cna1hrg7P7Nooix2K4d92v4IHzOT69Mqo5QqXlyJru7mApFVMyTlIUBVnwIkuEpuZjF69gU/5UI4VqbEwedQtIKm8ADrB78FegaY3tQZFaDrD96LHCgzwP9olD28nLoe+r+MllnRkk6RP2n6dgh85CVbi4/yZwJw0Go8J1OXf5U/GD0a+kNUXYWxGedI4eLZr2u53+0bLKf; 25:ClSB76O4izAUghjLjzhUaX1FtlDYju4Lhax10p7mKQXM4JSRfRrwGBGohmzdWQxNUhQlLERv2ZU8g/HHzShWfZGXfWr8rGoRMjwQ05zwv5QZfLYf1Pyq6JMikK0Wti+h/1TtcNPPb5zCfl0zkV2XEaf7I2kIbIF3kiW7vXKXnkH+6w4Bxu87Ju+NJZ7qHxp6RfJqz9kyH39NZiliSpW9xwA8qStftmriZQZ53e4H2x09DkDlWxVhhgYFoKuUUOgEZslpz6eRYTv7rTQh2QwyMDJKlgymwrERC6aMY1zY6N69BrU8ujX2SC03LEBwqA3APSkDmWpqvywPr1ysqIdtHA==; 31:DKnjjBrNzQxzEnF1PLUzoEuE1KkbLuPYiRGKgiZajFYIlGU+s3LEnSB298m6iooVFMmVxd1meSo9+eZZFBDDJB8C/LCPARtTTNoaytUlEtaZFol6FZrMK7gV0GbNdzvxSxp00gWSUlt3bbTFRiNZKlkaOe5791liPtr4Uqd4briq9924yWQT2xxMFwfq5xTkjUITRycvt78hevqBTIQ9YNcLON12kOts+Zh3vyux1Ww= X-MS-TrafficTypeDiagnostic: AM0PR08MB3586: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 20:dLjxrh9nKXYd69PE1j5pKaXiOFw2NwUhdN+ED9waQuHQHT46HuitEufsBuCDtqybixAMNnWuHztMSnKPKuGI44V/9sV+gWFP1YeBEzNhS2q/+ZOTG3NuUqcKAFisxyTO6jAhkUitI/RN3dBG11weNEyqDKgg5n9xAUnx/zQi3l6iPpreA2zqrFzFcHK/TnOqcwAcxweRrHgEbVsOTlzvLjIvIPAYOaWdPRRIRgXi0/BaLREk1rOS5GJ2bZ7g0mcH1XwOOBMfXJxYvnqmsjAT7ALiWTtrtuQsuMTBTskxoeysOshHdgyx4boOZu8g/1mRC5bFiblmlN4PejJMpcn578a6LbmoAgH08i92pcmsu+5TwyBPkzzE/xnMq/TV8YhMsnkEAv7BXdSbRjvhnkPhdi7nPZv9qo07yM3X/Yrw9CJooMEszxemjuPbhcGdBLzqgl0feb0gZ+i6Cyam10GVogvxi1H6zs51Q0gO01BALjXw7FSfXMovqBFYkugZ5ISj; 4:3Qp3cVDWG6ZPV8VGbsr3DQGeXct92PUpBePshd1IjE9cyKOFiqbMWqaNtNdoLlZ2ewDrYy8scvWW2N7MkdKdF93R9nZr8zd8XmIJjJ4nGQcu4U4ZUXXflJR1t2igULwQZtussPwho5TtDUtzjeNdLNq6a5h3IHHrdVDd8SMFfjL+cORTPCPcKMgNlCOzrfUHGUYIybFB2bBRSqUPWbMNj2YEIauGO8BaRmDAQbOLAMy6OYMeNSSynkxD1B3AkI2Fumql6G/pySxkbQeIZN8ApQ== 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)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:AM0PR08MB3586; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3586; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(136003)(39840400004)(376002)(366004)(346002)(189003)(199004)(2906002)(81156014)(50466002)(51416003)(305945005)(575784001)(25786009)(2361001)(478600001)(316002)(7416002)(54906003)(86362001)(16586007)(26005)(52116002)(48376002)(8936002)(36756003)(76176011)(186003)(50226002)(386003)(69596002)(2351001)(53416004)(106356001)(6486002)(11346002)(476003)(446003)(8676002)(16526019)(5660300001)(2616005)(956004)(6506007)(81166006)(68736007)(6116002)(1076002)(6666003)(486006)(105586002)(97736004)(4326008)(7736002)(3846002)(47776003)(6512007)(66066001)(6916009)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3586; 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; AM0PR08MB3586; 23:llQ/1GKzHn9D8YTX06KwYZ3c4EDK8vWZfVQqsAWDS?= U4wq/+irydPZK2ixbJz6SGL11iuhGb2wWiZRHig9oGYV3PGOmsr2g6wOH57Djx/+xzHyMa/ErgYx+Rg2u9D0OLT+WVXZA5uNra9oVODG2M6o9QEooQZ648xqTT+3ZEUUlA1M60wrfYJlo13xzVdxnD+9DpMq3Hwuus9PUQ00SbDx12ZRtCJVSMhC6sZhuFRS5BIbRDC+X2CQG9F7xxAuGvuKgQvA5p6Hiq/MRtN3STdc33q8HXc6inHJZU5aUhLijKOx+Pe32bboxNsBGykKCq+R8EvUcExJIrsTEYhHJn//Jdo7tsJpv6XzoEJDpk0vex5fLiYGIl6h/0JPlYYqnLNSgn8s/HM8ClKOdX5S1PW5+38tczhGq10aLQAwaz3k4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02c9m5EAsWt2saD/sVTqFzdHI7H6fJ43qsk2vZqUoHoSs9Fj5AQ9jTvxYUCcLCZZ1WqU23dVfU2zj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3586; 20:qjh+mtoP4ETRymNATD6mK9wDhQRXVmN0eJG8lhEhOsq2qUW17UetYuI/hZeqlaRr37qFf9YT/+cgJnYrOxmKD0J+o8QCTbzcdGCoQDJGSql06usZQ7SxoQfLNIbV3HJT645gYuojSYHI0wAqZ5bZMDjnEGk3ItWYCmNk/ew+XCg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:18:54.2985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b23f8c3-6337-4a4f-8091-08d61f9adf77 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3586 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.95 Subject: [Qemu-devel] [PATCH v2 5/8] 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 , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Igor Mammedov , Boris Ostrovsky , Karl Heubaum 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 | 15 +++------------ hw/misc/hyperv_testdev.c | 2 +- target/i386/hyperv.c | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h index 00c9b454bb..ab99047bf8 100644 --- a/target/i386/hyperv.h +++ b/target/i386/hyperv.h @@ -16,24 +16,15 @@ #include "cpu.h" #include "sysemu/kvm.h" -#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 e1e9ad7dda..6f4fa2ab91 100644 --- a/hw/misc/hyperv_testdev.c +++ b/hw/misc/hyperv_testdev.c @@ -52,7 +52,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;