From patchwork Tue Jun 6 18:19:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 9769525 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 2298260364 for ; Tue, 6 Jun 2017 18:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F40F223C7 for ; Tue, 6 Jun 2017 18:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1426727FB8; Tue, 6 Jun 2017 18:21:30 +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 A0243223C7 for ; Tue, 6 Jun 2017 18:21:29 +0000 (UTC) Received: from localhost ([::1]:39625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJ6e-0005ox-Lt for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 14:21:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJ5L-0005kf-Qu for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIJ5H-0007Gq-4w for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:07 -0400 Received: from mail-eopbgr30138.outbound.protection.outlook.com ([40.107.3.138]:64275 helo=EUR03-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 1dIJ5G-0007Ep-QH for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:20:03 -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; bh=ds3SoJrNAWnJrf2ga2ewwHoRXMxUcyui6AbDHTyEMdI=; b=Kkju8eaM1N+8fmk5w52hsnAXE3LpAlPsge16zvlThV4qqAMyghPN3fHhzhO4vjafOM8JcGEjRUrxp0f2m7CbPjjRCUn8oZIzc7qvCRQwDtLXrOZAf6xk1dw3z0oGqst9Bja/YJB/IvabIm9JQZyaDGMIp7diLAaFXo2XqU12SYo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Tue, 6 Jun 2017 18:19:59 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 21:19:31 +0300 Message-Id: <20170606181948.16238-7-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170606181948.16238-1-rkagan@virtuozzo.com> References: <20170606181948.16238-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0042.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::28) To VI1PR08MB0847.eurprd08.prod.outlook.com (2a01:111:e400:5a05::17) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR08MB0847: X-MS-Office365-Filtering-Correlation-Id: dd3ac041-39a9-4998-4592-08d4ad08a4a8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 3:1OYBLBgDYNSoJW56okumWhw4DsJ9N7kOpoSDr7gU5nBNrf4o1mwuu3eQ1oVFLnXa3raBIq2MrVTzE4tm/APmC5GPyW/q47TW2kie8fXay4AcAu2Faa9CPuyORJj8h/eqSoOnAuuduPno2OMG42cCNxGBKhQuhrHuWZNUYEmqtahgsWC0hzR/1wNwNSV0dz7dwl3g27bb0iirsh1ueC10segqDy7EUIgRoUjz7J8lGAvdZrQLFjshIsgXH9ZMOS11r+wo9c4N4LM5XndlZic+FKELeySS5oGsa9KHJyfz5grUlOQLctOnqJMPUF5BFJWnGQZy82+X9tLB3MFC1fY4wQ==; 25:ApB2wchXoHYUE4h0YIAvzHU2xdQOBcJs8PLt9kjCJXxYH1OpH7rUr2OmSdvJMbZiZqCVjQcYZZVfs6UZIO4HuHIKKnE6WElTbIHuVLRwnJJLjklb0D1iVsq24SOTjYAWd/LIxPy6WgMnGC6o7bZJEf57Q0fE6xfv6a44ztxwAK3//XL8lH3M7jQ3Jg9rjEwte+0Ow2FFiOO0Wfz8iGtooY4qVUw9apyNMs/CYmWQnAsmh01kbYEmF9AhHuLh+JS+6031/aKzjz+89STNmoeCgog/gJDhLP5Dp5wq753txLptdZcZzdNwLMN9tuGAO9+6lozwiHgKkdcK1OFt5MPdxeSYw6diJvxz+q7sjPxx5hfUis2ONy3ZurUoWiKQbadVxkRAkwqnxTHAOFDSXZ0e3iaqkv3ZtkTAs2JFMfPsYpONCIWBgxi5ehP9+LC0I+RRE2NePXHCfp9k53quAQDnTb7qwyzZ8UjgM5UFzqhIsqk= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 31:P0dTY28DOpPCxVARG2bBGBHmoRNnnANDkJDE18GOJEZR3i/UWA6Yy146eeosWDJjEX4IyBuUXjtAhnaBW5rTjMvq7kKcoiMHO9udYXgdGZsfWNB9RIJ2KUCRr2hRPKhW2ex8jbdgolgYpitFGIQJwQ/O+7yvUpYHI2ILNmeBhDhLBuTakEM4fMojT/HTOWgn/vVP9Q7oAzpit6H+rlKRjaM+mZVM5BzQPBzTXqXKCM8=; 20:nIPIv3LsBruqpiK8pkcK6dTZPdz/V635rIkN7RLOlFsZyhFwBx8vms1+/SgBEG9O3qvpXCzoc1GK5/RncbKNTDsy9iagFITTBWYu1wMeUBvBgkj+RzE2gDH+/I3BrNnMxHEVQxRXL6DCFjoTlzqM0FGL+HMcJPrwDnmTNEOiSjM/aB/z2mUpBRQQr/h7PSFDzEjs0EMdzj+V8kEKkZE6sGldNBsj9eK1Ms+BHQ2rgXL9VMwkjAQe5+QmrQFzkJ8XOfyg+vN3TlbJSHw+fvApzRUy3kahL2FYgnWZqprhg03yEP1SBof3Y+8TaPmRS2sGZPdkDhtN7oCYlpKFEBZosg58hYUBTk1v3GsjOgiVWoZzvQKbmija+Rmg/PYZwggMajWKffgj/bnMbmQdRpkPF31M3+w0Uwt1bBH7ZoYaeIQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123555025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR08MB0847; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR08MB0847; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB0847; 4:HsgAyPYnXQm02JRVcm8akKlgmB1fDxvdV6vuGaamx3?= =?us-ascii?Q?WWjs5S5cwVRIWOVyR+pz5BHkNhWkjDLOpdiYOOx0U0JGJPSI/tVve71ZX63W?= =?us-ascii?Q?sbLV3O1aVI3Ft/KL58ULibJhN7+VN+JiXNjmKeQdLU69C05eTxR+GN5dXJhy?= =?us-ascii?Q?QZZcQ46VELGL72AViYS8NtdTOG7Hd2mzTRyLuWUy7kJ6YRua/GON5H4e6lZp?= =?us-ascii?Q?wxLfEIN8mkS6ROD8GNYWQdhGRiLqP5i3hZ0wTVtGqdBSm4GfDCO1wfFHacip?= =?us-ascii?Q?fvN0/up8929qtrWOOBzoY/JHGkR6YQJKQLkpFJ0EpaGQ1x7DlAHuhtWKVyU2?= =?us-ascii?Q?i3B6x0qPK9K/EoINelEAWrG/QnldKYkK53jtq/lKU7kgWR+tbk45o3ncghpK?= =?us-ascii?Q?edvDDjGYakeRXhJRY8VxvwIBs91etAOCOqezg9voOlPt/cMVLIeL1/2CFWfT?= =?us-ascii?Q?PHd46LlweY3te2b0JF3BWDI9n44ccmhOXER+KSrVYXPzRRhz087Y5X2gm7dE?= =?us-ascii?Q?eWPJ28RYrPtraKEJmLEgKamp0XEH7FCXXhE7x//mtHEbqGVZ5Tn1/6NclGu8?= =?us-ascii?Q?dYPP8ZswKxRHxH7wQGV2rWV62QcGVMkdZFxoSryftzGkYQSh8jikKEV+GOwG?= =?us-ascii?Q?OglyrjoClHW0vm402XOleexTY4b89+/AM9fh4xNbIgXXr0w1CZXjYJNHveNy?= =?us-ascii?Q?eoAHGSWR8ZzVKvAvTjOextBvLaqbo/88gwvmG2Y2dhfj+upA41qtHGijMhjO?= =?us-ascii?Q?sS+Hf5qtIgl5khWZJpQePW/meIJbXt44gviCjbYhIxC+F2IikNwqkSrj9iyz?= =?us-ascii?Q?u9xxqcNSeK1S5/hfVRUsiQi4FCd7RwifV4UGIa1utX7cBrxl7sa1yjChVpy+?= =?us-ascii?Q?ihkOAunwKIjb6900G7w3WACVDqXaa0xYilf0UnSYIFjFYeUBJKKun6sa/bc5?= =?us-ascii?Q?ppNT+aDi0Vqq3/kxHQhjoSIAWlpx9A0d++CV8OsrYyFAzxbGoZ15PKGytR+8?= =?us-ascii?Q?ScaJiiSEFderboHIHPuLxnECyPivEaIig0O1vr3vkXZtRvB/+u+9NmuKJ6m3?= =?us-ascii?Q?2ZHHrgxGa/8tziB8FcC9XJN0vcGWkKjDmhjfWIxOt69vECtMsUj1AYh1deUL?= =?us-ascii?Q?tUEHu2UY+I19t3iU4HIRXVygI5BV0h?= X-Forefront-PRVS: 033054F29A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(979002)(6009001)(39410400002)(39400400002)(39840400002)(39450400003)(47760400001)(48376002)(33646002)(36756003)(47776003)(50466002)(6486002)(478600001)(66066001)(5003940100001)(2361001)(2906002)(5660300001)(2351001)(50226002)(81166006)(8676002)(25786009)(1076002)(6512007)(6916009)(53416004)(76176999)(42186005)(189998001)(38730400002)(53936002)(4326008)(50986999)(107886003)(7736002)(110136004)(6666003)(6116002)(3846002)(54906002)(2950100002)(86362001)(6506006)(575784001)(305945005)(37363001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB0847; H:rkaganb.sw.ru; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB0847; 23:2QlJFy5S0x8IdrFLT9Lmp5UEaiOVDW00NnP/84kir?= =?us-ascii?Q?fEHDovr3ywPmCBm8xPx8BLxQ17ZWIrthkkfjcbEW8NrkdJus9frC7E/oeCPD?= =?us-ascii?Q?AD5tNqmu71Qud+yNwcohoVtd6Nb02nI4F7l9/XEeXELEALU5bcXQFOcd3l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CZ3SQuKNsh40WBP74cYIixrZdbl7QbxYq+qwEhtgt+V?= =?us-ascii?Q?PSOxJRuope69pbrlO+8VDoHViS6oq92uW/7KHxjImATL1gkWSDj0NKhiu+4d?= =?us-ascii?Q?jOz8nyJdRnxNIDXWNCgvzQrXFd50v9bw997AA2FnLS+mvz8AzC8WrOoTs16Y?= =?us-ascii?Q?3Yz0JM2ZEEcy5DcPWNXFrlDMqhvOZOlpmYo7kn8nh85Yse8yJLk65fdo+Bt9?= =?us-ascii?Q?kAj67X25ISqJ0u9w2IGj+EGm7jWujLEyBqW8sWAHBy/Z4y8KG92CA6zCXusH?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 6:TUJ51iwiws+5bAjfK06oPcns2ok7kHUyO/Z9Xr+LHZJvSth23cxb+9CoXRiOzslaEhMwOIe1IYCrc27EFDwnRNijzmZTAKQy+sSTsrRntFSBLmql181duNbvmctVJzyCNVCA7b6i7d+adqKUAkQQUi0jQVzws2LpyBI35FFtozlh/jjHD36XzIxPyfZn43VnjAAwqGpVv7eatarGavyQgJUPv6NOCqNy49bKBaTCPZCoTjK7psClNCUJkUZBuxwLUZiAi6BfmZ1xEc+1Rz/TUj76MGTlNygu9ynfT4b6On+8J+Nn212QG0iVbCJZcvvjt+1qkrOsDRRj9dGA9xZXYiAsziKPm928kVsZBIuM8kOBE388cs5bvr643c5NNpyWGNfhZrxUwl4IM1FSomLVd+N74xNdQCj9tr8lHg/kzBIS3G+NoEeScy3yJ6iVKOvY+QUzv5IkwJtAtk+5UuOb+XqB7N2b0T+bbaBt3KEaoQW+LbZvSKVIA6gc4bFKqS5hmEp7eg8u39qy2wns+H8ARQ== X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 5:0ksvYbLIi+00+0gbGszLfJBxEYhu+wKuCFdDVDCCKnGiDPiv9huB+ctS7wF+bRej+XcRmseSWIozyi/VBX4JsaFpT4c4zTz9p77hx84VDzrOHe7KzVRhwHo0vBomaNJmwSiWYttdDSk3eVtdV78Y5OnVvifCWSQoK5FZS1ZGIKB4U7PLHv4+AH4u3wkLpzfbyR0CQscHmUzNSsL3rkQjmgEk12FEZSMl6kQJ9DONt+gmX+x5aASCvCWkTitMvdyAxKyVipNg3b9NDlZpy7PCNaK+nXC3n/psF8o814rzg0exDF6i4qlJ5YbM/0r7z6rlaikff9vEwkhAP4y4QNZVOdMz9eBISSy48lgRIARSCW+gx20n1Vlx//OHRKdN/NvGRTBgtM044ECKxB5i+befuuL5i2zvH9sQ9AuAi2HEJe17n6BBdIp71T9T3j6NB7r2esNFGubLwjn2P9OfW8B5T/zz4oBu+lJJWckGVdu/v9hCcPJ0Yey6WwIG/6vO1zVM; 24:RNbDWGFzaMYRp2x31yHya91A2NRQFf3nezJtpRgu5Ieuil9gAPc0N/cmOFlILLDpgeO7LDQN5mWe4Bj8e75f5HHIDQzjSFLSlrAmbw1nuJY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0847; 7:J0r0U2VbXSodZ6nBP1yOpaGSqndTGThIoahVHVETXleE7He0ouxerMRAHkm0JeQhUllOZp525tRe8veYALH/DOZoZdthCeWDs1K3wGryJ+nEYCxCFAwbYZ0eXGMDKTBGpWQixnfJD0VWBGv5rdKgbjO/FKJQQqgYphRj9ixm6nodz7RUkTPgJxO9KTGx9Fj1SrgLtft/ZSEkH7aUm7RZLPUIWA6uCVjCsdb2X9HvF6u4fApymZ6Bu5eT4S2K4gEyeadoE+a//qBX1PnRbyisCu0B/Mlq+I5hGt0rECw+F68Er6W4PxXib0uMRPqv0qjuPndsOyMJE2+cKeMFqb7T2w==; 20:L5xHl24JtDMEvdHLf+9PmF4bxT3ei7lXUNHpoQaQUJP4iyePmol3I8MF001DqqzMveETBCDu/+8vdbPe89JJrryeQeY9k1vmBaKtlifsQcRE6obv62PIm17+hHTvBxTOr4k0QKltFjuKKJRYXs6ECiP2bdikviAFdsUP+FklEGM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2017 18:19:59.2573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0847 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.3.138 Subject: [Qemu-devel] [PATCH 06/23] hyperv: helper to find vcpu by VP index 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: Paolo Bonzini , Evgeny Yakovlev , Eduardo Habkost , "Denis V . Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Locate the vcpu by its VP index (equal to QEMU cpu_index). Signed-off-by: Roman Kagan --- target/i386/hyperv.h | 1 + target/i386/hyperv.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h index 35da0b1..c5843c9 100644 --- a/target/i386/hyperv.h +++ b/target/i386/hyperv.h @@ -40,5 +40,6 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route); int kvm_hv_sint_route_set_sint(HvSintRoute *sint_route); uint32_t hyperv_vp_index(X86CPU *cpu); +X86CPU *hyperv_find_vcpu(uint32_t vcpu_id); #endif diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c index 27de5bc..480bdfe 100644 --- a/target/i386/hyperv.c +++ b/target/i386/hyperv.c @@ -21,6 +21,11 @@ uint32_t hyperv_vp_index(X86CPU *cpu) return CPU(cpu)->cpu_index; } +X86CPU *hyperv_find_vcpu(uint32_t vp_index) +{ + return X86_CPU(qemu_get_cpu(vp_index)); +} + int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) { CPUX86State *env = &cpu->env;