From patchwork Mon Feb 26 17:13:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10242841 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 848C7602A0 for ; Mon, 26 Feb 2018 17:17:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AB1E295E2 for ; Mon, 26 Feb 2018 17:17:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F55D29F6A; Mon, 26 Feb 2018 17:17:58 +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 D1C43295E2 for ; Mon, 26 Feb 2018 17:17:47 +0000 (UTC) Received: from localhost ([::1]:60477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqMPL-0001lS-1O for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Feb 2018 12:17:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqMLr-0007IO-Qz for qemu-devel@nongnu.org; Mon, 26 Feb 2018 12:14:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqMLo-0004dK-Bx for qemu-devel@nongnu.org; Mon, 26 Feb 2018 12:14:11 -0500 Received: from mail-sn1nam02on0115.outbound.protection.outlook.com ([104.47.36.115]:20112 helo=NAM02-SN1-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 1eqMLo-0004c7-54 for qemu-devel@nongnu.org; Mon, 26 Feb 2018 12:14:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3Hat/5eEXr+s6Yr/JEl7m2EFaLLFQ1YCT+4JfWT/AA0=; b=CZdHcP6VVjawj03fDHFmfvqCvnP/MatSTpxTNGGNS+vUPJvWZ7c33NJi/pyZXrWI4ic8olJtbfe/++21qclIvGOjpbI9O97tt5gVr7Mh4BVn3eEatA5pFBoqb16ZEoUBIYy4dvofKQTMLZfiG2BH8pg5Z/BVrv7Tluyg/TL6OhM= Received: from DESKTOP-CS4P60I.corp.microsoft.com (2001:4898:80e8:9::75b) by CY4PR21MB0168.namprd21.prod.outlook.com (2603:10b6:903:b9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Mon, 26 Feb 2018 17:14:06 +0000 To: qemu-devel@nongnu.org Date: Mon, 26 Feb 2018 09:13:30 -0800 Message-Id: <1519665216-1078-3-git-send-email-juterry@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519665216-1078-1-git-send-email-juterry@microsoft.com> References: <1519665216-1078-1-git-send-email-juterry@microsoft.com> MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:9::75b] X-ClientProxiedBy: DM5PR1401CA0003.namprd14.prod.outlook.com (2603:10b6:4:4a::13) To CY4PR21MB0168.namprd21.prod.outlook.com (2603:10b6:903:b9::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d288e803-303b-4b3c-e05d-08d57d3c57c8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7193020); SRVR:CY4PR21MB0168; X-Microsoft-Exchange-Diagnostics: 1; CY4PR21MB0168; 3:gjspjOkBEIxg48M6XS3IzomG3zVt85+uDnGzwO+wyoBfbXu0hyfV/3/fnK5L3DAwT10tQXYj5NXN6gs6+6/HJRD2U+7soGhGCyz2/9d5IDmBe9D3kphIj/lsJfo7VGpTJ7UJV4kzqnHF8HmmRpctabJuA/+nUsjbtFU2hgfEMqMC9nMqEEUXBVxfFuIGEH4PyXvdo2xkFjpOhIdsbEmDRoMe8WOzVbdnQ9ZrNwZFdVSmjAQZpecaINsTuFNL4a55; 25:vfxG/3CFYTcnpP2c4JNQ9G9BkEOdDO/+yv1lVxqNPPcrC85hPYxHkAqHQUGBtAmamwU9c+5vY2S2ZwKwVdyN5Sre/ZLqQfwYU0gMsCINpydf7ztX3CRn+dcdA94XNBILNZc8xfwQrf8ZpFbiLfTfmeFmAJsrWBeE29iezDJCTAsVoZ4qiU+bvQB9mCcei+Wg5av788AToi+XRwCz0SZwB8wEoXruBDebAinrxF6W5wx58zCms9iUah+c0xFqvjIhaIH0k6c6nbxBHqz9rGFB/j4rxTURu+xfCI72eQAGi0VZqaU3DVcb/wiQJL6ExAU/7ZJ0pAcRTuno6X3cwjUeyg==; 31:3tqCFyXZZMgf8aB5VkFvluAomOwEnoO5ieRkqVIkQsoVg6qN9m3jrmcBUaf/RWQ0M/FSPDklOsIopuB+pfBfV9UQmWLEJ232MlKMDXdBRvLqTdmUB9eEQr8diw7TzrRqxYMr8Cq/2YrHaUObwV2nnTN3yf/AvWZECNQyjVBjHwjNNR+jHUKs9QFrT6xUiJVLp9cZlMP+3CrY+9PBeW2GK6uWz1+psrZnupzGkebblsg= X-MS-TrafficTypeDiagnostic: CY4PR21MB0168: X-Microsoft-Exchange-Diagnostics: 1; CY4PR21MB0168; 20:q2QzX3EH9FlfsrfWD+gJ6vnX0HjVqeQKw5O9vxmiv8OedbCdXIeRkRzi9jyy9O+mtFb9f9TiOwXuqEo9aSq+S7zNvkLSy2TWTAZ3Uo+o2C1tdIDhQwbVtOi3gpKgkOMV3TrC+PV9KAfe/NNNJuD9IEMpTZSIl1f31wvqYWfxGJkLVSdS4CpSJx7hnOtoEQevUvGbYUb3bEOeJW1giuJwhHgeOO/ZAX1umj80MPULzwea2ZdAUlLT24cKm6I+WV/J279YZBwyylVxxVqFlcDngTK15ZMfChIX0uJxgnmlwlD9l+ED4IrTZBPkaV0b4y8lBT5WSkL5HdDtYZ0A8+B1GQdgWQQWdl/4aQFfNLIYeIOSng+R8JZ7nz0XtaBC1rieXGdeo4Qhr898d8SZjlDwSY40xxjLDOnoN62E+bZNu8fReXNjSf1iRc+pS1jqAViiusfhQ0NhNXiri4g4qEomdCzwumYH4vhwjjGXwEttvPdFaTtjlZpD0eK0wR/3NjkM; 4:MBKa92OHpPBBqXOKnGQT91niO2kKqM4UFioluEhAWDiELbWb+cDlb907e0OMbx7OrrFBsf2kI0JxKsLks/Q4oJqr7PrbVGHKrJqLhl7pTtwaq4qGEZ90jt7Dj7HUQQB7rwI6wDSwXnba3DQYdJ0SN9y9t3jGYB/IDJzIWp4VIHb/G0nL879EBHzRxUFp+aQX0LkAE78hhlXykU2ShFLODOaeAmtw8ngfuu7mzUMlhKnknB8A1wCrb5Lzz52hhz+k2/3auMdZy+N8KvfIqwJnq7HFxIjZ9nXevswE7U0fZtTxx8p6Zr71yQcFFLQa96BOeqwtwlYvXQ8vMjTBPJqQmDHCW2NYCX937KEWCXDGTdA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(28532068793085)(89211679590171); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231220)(944501187)(52105095)(3002001)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:CY4PR21MB0168; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0168; X-Forefront-PRVS: 05954A7C45 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(396003)(39860400002)(366004)(346002)(39380400002)(189003)(199004)(5660300001)(36756003)(53936002)(10290500003)(7736002)(6116002)(105586002)(478600001)(6666003)(8936002)(8676002)(81166006)(47776003)(2950100002)(81156014)(50226002)(10090500001)(6916009)(106356001)(2906002)(52396003)(50466002)(51416003)(6486002)(48376002)(52116002)(7696005)(97736004)(76176011)(68736007)(86612001)(6346003)(107886003)(386003)(25786009)(86362001)(22452003)(2351001)(2361001)(316002)(305945005)(16526019)(59450400001)(4326008)(186003)(16586007); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0168; H:DESKTOP-CS4P60I.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=juterry@microsoft.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR21MB0168; 23:fQ4sreisQcuYH5LL4wgQqrv5ZvfSaMa5wazQ9VSX5?= =?us-ascii?Q?QhT3R1ZncxHAib753C/ZMFKnjPy4GpS3Z8uBTJgtexUEiLhRelWMmSXow8HT?= =?us-ascii?Q?xo5mAVoQwN+877JEWsAyJMsGpDog5PaopAfuq90vQzZ8m2hfZoOpXF5bSkZ0?= =?us-ascii?Q?2Kkyhys/9zT6ftg/k8TbY3v2icvy+irLLE5NoCIdL/6g4LCmWYoD4U+KBXND?= =?us-ascii?Q?EwemWxxRAYqcvLXeMxfa2+ryTqKImw7Wbnz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xPmp+jRQtVy7pY9ht08FJgDhRVv2i8yTXdnlOU88NllUl2fwIAgf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2018 17:14:06.2041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d288e803-303b-4b3c-e05d-08d57d3c57c8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0168 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.115 Subject: [Qemu-devel] [PATCH 2/8] Resolves WHPX breaking changes in SDK 17095 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: , X-Patchwork-Original-From: "Justin Terry \(VM\) via Qemu-devel" From: "Denis V. Lunev\" via" Reply-To: "Justin Terry \(VM\)" Cc: pbonzini@redhat.com, "Justin Terry \(VM\)" , ehabkost@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 1. Fixes the changes required to the WHvTryMmioEmulation, WHvTryIoEmulation, and WHvEmulatorCreateEmulator based on the new VpContext forwarding. 2. Removes the WHvRunVpExitReasonAlerted case. Signed-off-by: Justin Terry (VM) --- target/i386/whpx-all.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index eeee43e187..969c2f5f93 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -613,6 +613,7 @@ static HRESULT CALLBACK whpx_emu_translate_callback( } static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = { + .Size = sizeof(WHV_EMULATOR_CALLBACKS), .WHvEmulatorIoPortCallback = whpx_emu_ioport_callback, .WHvEmulatorMemoryCallback = whpx_emu_memio_callback, .WHvEmulatorGetVirtualProcessorRegisters = whpx_emu_getreg_callback, @@ -626,7 +627,9 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; - hr = WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu, ctx, &emu_status); + hr = WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu, + &vcpu->exit_ctx.VpContext, ctx, + &emu_status); if (FAILED(hr)) { __debugbreak(); error_report("WHPX: Failed to parse MMIO access, hr=%08lx", hr); @@ -649,7 +652,9 @@ static int whpx_handle_portio(CPUState *cpu, struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; - hr = WHvEmulatorTryIoEmulation(vcpu->emulator, cpu, ctx, &emu_status); + hr = WHvEmulatorTryIoEmulation(vcpu->emulator, cpu, + &vcpu->exit_ctx.VpContext, ctx, + &emu_status); if (FAILED(hr)) { __debugbreak(); error_report("WHPX: Failed to parse PortIO access, hr=%08lx", hr); @@ -905,18 +910,8 @@ static int whpx_vcpu_run(CPUState *cpu) whpx_vcpu_kick(cpu); } - for (;;) { - hr = WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index, - &vcpu->exit_ctx, whpx->exit_ctx_size); - - if (SUCCEEDED(hr) && (vcpu->exit_ctx.ExitReason == - WHvRunVpExitReasonAlerted)) { - WHvCancelRunVirtualProcessor(whpx->partition, cpu->cpu_index, - 0); - } else { - break; - } - } + hr = WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index, + &vcpu->exit_ctx, whpx->exit_ctx_size); if (FAILED(hr)) { error_report("WHPX: Failed to exec a virtual processor," @@ -956,7 +951,6 @@ static int whpx_vcpu_run(CPUState *cpu) case WHvRunVpExitReasonX64MsrAccess: case WHvRunVpExitReasonX64Cpuid: case WHvRunVpExitReasonException: - case WHvRunVpExitReasonAlerted: default: error_report("WHPX: Unexpected VP exit code %d", vcpu->exit_ctx.ExitReason); @@ -1068,7 +1062,7 @@ int whpx_init_vcpu(CPUState *cpu) return -ENOMEM; } - hr = WHvEmulatorCreateEmulator(whpx_emu_callbacks, &vcpu->emulator); + hr = WHvEmulatorCreateEmulator(&whpx_emu_callbacks, &vcpu->emulator); if (FAILED(hr)) { error_report("WHPX: Failed to setup instruction completion support," " hr=%08lx", hr);