From patchwork Mon Jan 22 21:07:49 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: 10179343 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 56CEC60224 for ; Mon, 22 Jan 2018 21:13:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 460B628173 for ; Mon, 22 Jan 2018 21:13:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A91A2842E; Mon, 22 Jan 2018 21:13:35 +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 ECF9128173 for ; Mon, 22 Jan 2018 21:13:33 +0000 (UTC) Received: from localhost ([::1]:38385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edjPJ-0008KY-79 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 22 Jan 2018 16:13:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edjKC-0004eY-L2 for qemu-devel@nongnu.org; Mon, 22 Jan 2018 16:08:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edjK9-00028g-Eu for qemu-devel@nongnu.org; Mon, 22 Jan 2018 16:08:16 -0500 Received: from mail-sn1nam02on0105.outbound.protection.outlook.com ([104.47.36.105]:2346 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 1edjK9-00028M-7O for qemu-devel@nongnu.org; Mon, 22 Jan 2018 16:08:13 -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=IL5M6+LZQ5LXxzx7P5Je4hRgUq3Nfxi8veP7IxUzGgo=; b=AxA8uh1aYB60YXm97CLHZ2wfMM9G/1rn1ZKW+kPBaKnoZU/cacu31ygCYSMzR67VtNULq+Y0rwyIyUXYgLqqkj4oO6b2/tlP2xPMkj2maaXUUWH3J1hefbt8qJI3DmbsGj2VrREqnjev4bX8rr64WvHNOQEHnzIdkfg/I6IYH7w= Received: from JUTERRY-DEV2.corp.microsoft.com (2001:4898:80e8:3::64) by SN4PR2101MB0878.namprd21.prod.outlook.com (2603:10b6:803:51::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.0; Mon, 22 Jan 2018 21:08:04 +0000 To: qemu-devel@nongnu.org Date: Mon, 22 Jan 2018 13:07:49 -0800 Message-Id: <1516655269-1785-5-git-send-email-juterry@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516655269-1785-1-git-send-email-juterry@microsoft.com> References: <1516655269-1785-1-git-send-email-juterry@microsoft.com> MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:3::64] X-ClientProxiedBy: DM5PR21CA0002.namprd21.prod.outlook.com (2603:10b6:3:ac::12) To SN4PR2101MB0878.namprd21.prod.outlook.com (2603:10b6:803:51::31) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dca84ec-dc45-431e-a694-08d561dc3b03 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020); SRVR:SN4PR2101MB0878; X-Microsoft-Exchange-Diagnostics: 1; SN4PR2101MB0878; 3:FrYYWncIgTKaHp3PxPihD+lX3SaoXLr5VvODEhL9SzIVqFPi0/Bt73SivSC2baKOXpejVe14SDKCzDO64ENQ1Jq7hOPCJv647+NxcArZT0/W2S3SMRX88fMfQLNQ2szF4mrzJmhYdT59J8JkEnSakUXFEe6u9h0xS9AFSmAgKp0rUOiOb3yUfp/OIneKNubmhOZnehvoI+QFUdwBfBVI7hMeHqkPDAxx6+dbFtB2+qwhY1pu+4HzrXchfh2jwPNI; 25:oHqkhvwdHYA969Sbq+ppsk6uCmd8xNAbXc7fcdETDWs7gl6/RtxmPQ8/9Uxskc0pcmQ9TxQJZmMcGheeIw3nsGV3n4yYfY5lNSb++ntdL/wvYx6MBx/3uxO9i2IEBJA/iHdY+cQO3gEkRgjn3uqUdTJtqHhLhwyDHnuTFheMrpHE0C+QUD6pCB9t/62LW4CEj5YwgJ8Vty3u8pVIWlWXx5zdAXFJNtTM2qW+tbyF9EGRI9JVQ8hRPJqsYi+AXXDoVMceJST92AzHO4Hr7/759sB7Ag33D5/c8ZDy5YIqKxsSPFI6VyuVDewv2Nyr1E+CdVfiwozO1saXCAf7r166RQ==; 31:2VVjP+6KkOE6z1vdvGXWDTLCBJlP7oss7j5g6Tpkez+p19lJRDmskHyg2cQa2BSHSMUnna/rdAFceEQ92sFfQs8WgarE9ub1m52umoJvfQRNkmQbp2Zo4UGuyN1HFf87BPJ1vysDToq0w1scZmQ6B3Gw3DeDOnTraYQI/Pa9LIQzzAnQ0RXilNsLBLAdFfCRWzsch9imJHblHspmEJlw7CVa6Wnwp3rA9e0XoI4hJOg= X-MS-TrafficTypeDiagnostic: SN4PR2101MB0878: X-Microsoft-Exchange-Diagnostics: 1; SN4PR2101MB0878; 20:9dikOSjBl3al5xeNSrQeBQJshPp5XU68mM4UO1uADyPmDq/eXPjKxEJeK2Z2qWd9GFtsw6FUF9x2crAIA3KWWPmhmGgXcKi4BQ8LZ2WGtuTW6Yqi7qGsWF9GbEeUHSGGaRvhqhN6SgD0o6gd5kh81SYMFEA0RnhJhlH4U8eQu4yyRqvOb++QJGTRosGfYNzW0n3b9fa6aHtFaUQHqTKzY1GRxZU6KcTyBXJJXDe2MyiC1YTjaK9q/VSjjpr7P/PhXupyrWI/fsCsXZ7Sns0xM5cSGJafdIiFqgGrnFcAxqDAEHj4LRA74Cs0/spvRjcyorRQb1Ceyfg+RdqB69W/itR2OITXHIvT3qqwxI+P7O7yK/LH/wJh1GJIfHDd73rHgCDywI87w48pUAGjQL07JQW73HGc908XgICblqjMdbZel+NtlR1hiZZkDyu2wvyzooKpYX7S2WQDIflXj1EvZ1z1ltj/EQkloUP9SQ+dVRGCQgOFbLR1gdJ0f3M8Cx35; 4:QQ9z32D/B7fE+QDuy44dHFn95rooTeHD+mOHG/RMY8pKASykYZeiAkHCbPmffXOz8qd+KJ2PVWZloRw6gMi/NgJ7LsqwQSuG2RteIgt7CGdoFFFYJBmc5MGbEwrD9AVE/Sz/+F3V8+MDQW+ZIN5virk2Q4YNV0urwDad2Z1uGTrJQJzGDruuoGDNUkRd/5LqDkQAuKyryXbX91iRakEhpwrwKL4iypNayK5Vo9gucXb2acjSrBeowKPytSFdI7K+QQ77bEULUtrWgdlc1uMDeqEbfyrvHu3j+OqlkZtUM1TZEAmXaz1ATb04DEbsVROczNfd0EPpn833gabDnSs3yw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(28532068793085)(89211679590171); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231046)(2400081)(944501161)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:SN4PR2101MB0878; BCL:0; PCL:0; RULEID:(100000803126)(100110400120); SRVR:SN4PR2101MB0878; X-Forefront-PRVS: 0560A2214D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(39860400002)(396003)(366004)(39380400002)(376002)(199004)(189003)(10090500001)(52396003)(76176011)(48376002)(4326008)(7696005)(51416003)(52116002)(50466002)(39060400002)(107886003)(10290500003)(47776003)(305945005)(7736002)(6666003)(2351001)(6116002)(36756003)(2361001)(2950100002)(8676002)(6916009)(81156014)(386003)(81166006)(5660300001)(25786009)(8936002)(59450400001)(105586002)(478600001)(68736007)(50226002)(2906002)(86362001)(22452003)(575784001)(106356001)(86612001)(6486002)(53936002)(97736004)(6346003)(316002)(16586007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN4PR2101MB0878; H:JUTERRY-DEV2.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; SN4PR2101MB0878; 23:ulV03LlUjKSPBk669wRUa+m0lipKMvDpa8RlNj0?= =?us-ascii?Q?ull5bcgTqQtrqxQmhcoldFU9JypdaLUPWADZOyGd1XzYDKRJYceVwxqa7DV7?= =?us-ascii?Q?5Qtod8jVHntTriR6adNN96UmjMTOfWM6wn++sx4UeFHJETwnqUUGK8/TqXc6?= =?us-ascii?Q?XtCK9JKlwMVilYcBRJhgLZ9DfnmjCOdq4bu/1dNCWjePnnfK8Lv3ha+1UZL2?= =?us-ascii?Q?BMSo/wwlnwwd5hwTIAnJpynspV9TgCLXpSy+ItoeXps9PZUFCtFbba8xryHQ?= =?us-ascii?Q?1m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pVXNrFnJniA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 21:08:04.8423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dca84ec-dc45-431e-a694-08d561dc3b03 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR2101MB0878 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.105 Subject: [Qemu-devel] [PATCH v2 4/4] Add the WHPX acceleration enlightenments 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: "Justin Terry \(VM\)" , pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, crosthwaite.peter@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implements the WHPX accelerator cpu enlightenments to actually use the whpx-all accelerator on Windows platforms. Signed-off-by: Justin Terry (VM) --- cpus.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++- include/sysemu/hw_accel.h | 13 ++++++++++ target/i386/helper.c | 2 +- 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index 2cb0af9..1495ed5 100644 --- a/cpus.c +++ b/cpus.c @@ -38,6 +38,7 @@ #include "sysemu/kvm.h" #include "sysemu/hax.h" #include "sysemu/hvf.h" +#include "sysemu/whpx.h" #include "qmp-commands.h" #include "exec/exec-all.h" @@ -1539,6 +1540,46 @@ static void *qemu_hvf_cpu_thread_fn(void *arg) return NULL; } +static void *qemu_whpx_cpu_thread_fn(void *arg) +{ + CPUState *cpu = arg; + int r; + + qemu_mutex_lock_iothread(); + qemu_thread_get_self(cpu->thread); + cpu->thread_id = qemu_get_thread_id(); + current_cpu = cpu; + + r = whpx_init_vcpu(cpu); + if (r < 0) { + fprintf(stderr, "whpx_init_vcpu failed: %s\n", strerror(-r)); + exit(1); + } + + /* signal CPU creation */ + cpu->created = true; + qemu_cond_signal(&qemu_cpu_cond); + + do { + if (cpu_can_run(cpu)) { + r = whpx_vcpu_exec(cpu); + if (r == EXCP_DEBUG) { + cpu_handle_guest_debug(cpu); + } + } + while (cpu_thread_is_idle(cpu)) { + qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + } + qemu_wait_io_event_common(cpu); + } while (!cpu->unplug || cpu_can_run(cpu)); + + whpx_destroy_vcpu(cpu); + cpu->created = false; + qemu_cond_signal(&qemu_cpu_cond); + qemu_mutex_unlock_iothread(); + return NULL; +} + #ifdef _WIN32 static void CALLBACK dummy_apc_func(ULONG_PTR unused) { @@ -1630,7 +1671,9 @@ static void qemu_cpu_kick_thread(CPUState *cpu) } #else /* _WIN32 */ if (!qemu_cpu_is_self(cpu)) { - if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) { + if (whpx_enabled()) { + whpx_vcpu_kick(cpu); + } else if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) { fprintf(stderr, "%s: QueueUserAPC failed with error %lu\n", __func__, GetLastError()); exit(1); @@ -1877,6 +1920,25 @@ static void qemu_hvf_start_vcpu(CPUState *cpu) } } +static void qemu_whpx_start_vcpu(CPUState *cpu) +{ + char thread_name[VCPU_THREAD_NAME_SIZE]; + + cpu->thread = g_malloc0(sizeof(QemuThread)); + cpu->halt_cond = g_malloc0(sizeof(QemuCond)); + qemu_cond_init(cpu->halt_cond); + snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/WHPX", + cpu->cpu_index); + qemu_thread_create(cpu->thread, thread_name, qemu_whpx_cpu_thread_fn, + cpu, QEMU_THREAD_JOINABLE); +#ifdef _WIN32 + cpu->hThread = qemu_thread_get_handle(cpu->thread); +#endif + while (!cpu->created) { + qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); + } +} + static void qemu_dummy_start_vcpu(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; @@ -1915,6 +1977,8 @@ void qemu_init_vcpu(CPUState *cpu) qemu_hvf_start_vcpu(cpu); } else if (tcg_enabled()) { qemu_tcg_init_vcpu(cpu); + } else if (whpx_enabled()) { + qemu_whpx_start_vcpu(cpu); } else { qemu_dummy_start_vcpu(cpu); } diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h index 469ffda..d2ddfb5 100644 --- a/include/sysemu/hw_accel.h +++ b/include/sysemu/hw_accel.h @@ -14,6 +14,7 @@ #include "qom/cpu.h" #include "sysemu/hax.h" #include "sysemu/kvm.h" +#include "sysemu/whpx.h" static inline void cpu_synchronize_state(CPUState *cpu) { @@ -23,6 +24,9 @@ static inline void cpu_synchronize_state(CPUState *cpu) if (hax_enabled()) { hax_cpu_synchronize_state(cpu); } + if (whpx_enabled()) { + whpx_cpu_synchronize_state(cpu); + } } static inline void cpu_synchronize_post_reset(CPUState *cpu) @@ -33,6 +37,9 @@ static inline void cpu_synchronize_post_reset(CPUState *cpu) if (hax_enabled()) { hax_cpu_synchronize_post_reset(cpu); } + if (whpx_enabled()) { + whpx_cpu_synchronize_post_reset(cpu); + } } static inline void cpu_synchronize_post_init(CPUState *cpu) @@ -43,6 +50,9 @@ static inline void cpu_synchronize_post_init(CPUState *cpu) if (hax_enabled()) { hax_cpu_synchronize_post_init(cpu); } + if (whpx_enabled()) { + whpx_cpu_synchronize_post_init(cpu); + } } static inline void cpu_synchronize_pre_loadvm(CPUState *cpu) @@ -53,6 +63,9 @@ static inline void cpu_synchronize_pre_loadvm(CPUState *cpu) if (hax_enabled()) { hax_cpu_synchronize_pre_loadvm(cpu); } + if (whpx_enabled()) { + whpx_cpu_synchronize_pre_loadvm(cpu); + } } #endif /* QEMU_HW_ACCEL_H */ diff --git a/target/i386/helper.c b/target/i386/helper.c index f63eb3d..9fba146 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -986,7 +986,7 @@ void cpu_report_tpr_access(CPUX86State *env, TPRAccess access) X86CPU *cpu = x86_env_get_cpu(env); CPUState *cs = CPU(cpu); - if (kvm_enabled()) { + if (kvm_enabled() || whpx_enabled()) { env->tpr_access_type = access; cpu_interrupt(cs, CPU_INTERRUPT_TPR);