From nobody Sat Oct 25 09:08:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520343377893320.8417718146245; Tue, 6 Mar 2018 05:36:17 -0800 (PST) Received: from localhost ([::1]:55788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etClM-0003yc-P1 for importer@patchew.org; Tue, 06 Mar 2018 08:36:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etCVl-0005RV-32 for qemu-devel@nongnu.org; Tue, 06 Mar 2018 08:20:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etCVi-0006Xy-Cf for qemu-devel@nongnu.org; Tue, 06 Mar 2018 08:20:09 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:40144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etCVi-0006XO-5s for qemu-devel@nongnu.org; Tue, 06 Mar 2018 08:20:06 -0500 Received: by mail-wm0-x244.google.com with SMTP id t6so22235844wmt.5 for ; Tue, 06 Mar 2018 05:20:06 -0800 (PST) Received: from 640k.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id l38sm25652538wrc.96.2018.03.06.05.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 05:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0am+7a+KVRHdqnld2lf+MnvSqKx9p6qAd6Als13tS1w=; b=lgIWRAznjjtP6vkkbMr8AWha2uzjwLOCkXDnMNfynBp3X3m5U/GPLsgmgP4npG5ZRo g+YjM4voF1ufWVoaKzssIz4L/WuWlZ0l/CcSHY3X2S1k4u3EYVo8NxBDeD9EUeuNGMYT ioCO7gwy2EuW8AX0QB4Mxl8TfjDT4X36yjfzLqCYL+tWlBc7a3doopW15LtGUgFlXTS9 +DovJWWnk81xh1uLezZdgckJPIeERXaax6+tKg9L6S4rXSN213REGmFwqjkXnx1tR2se 7bWkeRBIenFkYa5imPm5/hH+rUywtdESU71LG5c++9DdxzfCcaDF7ULln1E0rbQRo+d/ hn9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=0am+7a+KVRHdqnld2lf+MnvSqKx9p6qAd6Als13tS1w=; b=A1etfGifXT2WPZsi4jZRiCkYDPoPFudGpbflBARYC/7+iHI9qfJwRLWr5ubpqBfkVk /RR7vTMFdD1SHhjIlkRpABrRr4XKEQIx0KLZTtA5i5I/aZr/PTecMyOUKIRylJy8Rn8g RQi4iSwadvWZiD2HPar0RCI1jhgsY4h8kUBViAzbg42vAzOnH+Om8RKpzLUaLCJQNQfu HFitP/e0ergqSABvSOKQE/9RgB59B+DzQYQJcKYh+r06tOnJpBOSVywjjfZwdSuvzb+N FKcOiT8aaMpe/Ipbdy5MH6fHZbDaS1jB/NP1Byyay003SzeJIdlBVZlXAvrT/WNPaimy +AYw== X-Gm-Message-State: AElRT7G6b8i+lrhFmiNkkoN8JA0YMBrVEVqv1j1mbZ4FgF8qhTDwtamx jEXHhojSJyq0WxvTQRZABgP9D4ys X-Google-Smtp-Source: AG47ELt/A70OnkTvVZ4aK+56R8FIBHqRcAgd4JRJGD/eud/ZurDNaj6p7O51iwx1t8S6ejjOrv2czw== X-Received: by 10.28.197.205 with SMTP id v196mr10622100wmf.141.1520342404843; Tue, 06 Mar 2018 05:20:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 6 Mar 2018 14:19:22 +0100 Message-Id: <1520342370-123606-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1520342370-123606-1-git-send-email-pbonzini@redhat.com> References: <1520342370-123606-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 26/34] 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: , Cc: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Justin Terry (VM) via Qemu-devel" 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) Message-Id: <1519665216-1078-3-git-send-email-juterry@microsoft.com> Signed-off-by: Paolo Bonzini Signed-off-by: Justin Terry (VM) via Qemu-devel --- 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 eeee43e..969c2f5 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -613,6 +613,7 @@ static HRESULT CALLBACK whpx_emu_translate_callback( } =20 static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks =3D { + .Size =3D sizeof(WHV_EMULATOR_CALLBACKS), .WHvEmulatorIoPortCallback =3D whpx_emu_ioport_callback, .WHvEmulatorMemoryCallback =3D whpx_emu_memio_callback, .WHvEmulatorGetVirtualProcessorRegisters =3D whpx_emu_getreg_callback, @@ -626,7 +627,9 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_A= CCESS_CONTEXT *ctx) struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; =20 - hr =3D WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu, ctx, &emu_stat= us); + hr =3D WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu, + &vcpu->exit_ctx.VpContext, ctx, + &emu_status); if (FAILED(hr)) { __debugbreak(); error_report("WHPX: Failed to parse MMIO access, hr=3D%08lx", hr); @@ -649,7 +652,9 @@ static int whpx_handle_portio(CPUState *cpu, struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); WHV_EMULATOR_STATUS emu_status; =20 - hr =3D WHvEmulatorTryIoEmulation(vcpu->emulator, cpu, ctx, &emu_status= ); + hr =3D WHvEmulatorTryIoEmulation(vcpu->emulator, cpu, + &vcpu->exit_ctx.VpContext, ctx, + &emu_status); if (FAILED(hr)) { __debugbreak(); error_report("WHPX: Failed to parse PortIO access, hr=3D%08lx", hr= ); @@ -905,18 +910,8 @@ static int whpx_vcpu_run(CPUState *cpu) whpx_vcpu_kick(cpu); } =20 - for (;;) { - hr =3D WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index, - &vcpu->exit_ctx, whpx->exit_ctx_si= ze); - - if (SUCCEEDED(hr) && (vcpu->exit_ctx.ExitReason =3D=3D - WHvRunVpExitReasonAlerted)) { - WHvCancelRunVirtualProcessor(whpx->partition, cpu->cpu_ind= ex, - 0); - } else { - break; - } - } + hr =3D WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index, + &vcpu->exit_ctx, whpx->exit_ctx_size); =20 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; } =20 - hr =3D WHvEmulatorCreateEmulator(whpx_emu_callbacks, &vcpu->emulator); + hr =3D WHvEmulatorCreateEmulator(&whpx_emu_callbacks, &vcpu->emulator); if (FAILED(hr)) { error_report("WHPX: Failed to setup instruction completion support= ," " hr=3D%08lx", hr); --=20 1.8.3.1