From patchwork Fri Jan 12 20:22:28 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: 10161737 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 22C42602B3 for ; Fri, 12 Jan 2018 21:30:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 125FD28ABC for ; Fri, 12 Jan 2018 21:30:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04DA928ABE; Fri, 12 Jan 2018 21:30:08 +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 5019128ABC for ; Fri, 12 Jan 2018 21:30:06 +0000 (UTC) Received: from localhost ([::1]:40221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea6tq-0003Lr-81 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Jan 2018 16:30:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea5r1-00035j-0b for qemu-devel@nongnu.org; Fri, 12 Jan 2018 15:23:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ea5qz-0001ot-RK for qemu-devel@nongnu.org; Fri, 12 Jan 2018 15:23:07 -0500 Received: from mail-dm3nam03on070e.outbound.protection.outlook.com ([2a01:111:f400:fe49::70e]:54637 helo=NAM03-DM3-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 1ea5qz-0001nM-MR for qemu-devel@nongnu.org; Fri, 12 Jan 2018 15:23:05 -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=MRjqHAQKOZVTLXpYbuGwQTK1wo7hHhF99EoyrhexR1Q=; b=hKtGnzwxfg0EfessIE1uaAtA1p9fFWyZxRmMqgOupunEnNkORkYDguChPEGxFDXUdnbN9gzZ5651w30P1s3m2f7BckgfXJPJZShg7DikA5ECpIdMGvAIBk4PH6PhLplrPS4bKFvEoHmQGaHdf+hmhW04l2lP5hNF9u5YtcvPnwg= Received: from JUTERRY-DEV2.corp.microsoft.com (2001:4898:80e8:f::4b) by SN4PR2101MB0879.namprd21.prod.outlook.com (2603:10b6:803:51::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.428.4; Fri, 12 Jan 2018 20:23:01 +0000 To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 12:22:28 -0800 Message-Id: <1515788548-3570-5-git-send-email-juterry@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515788548-3570-1-git-send-email-juterry@microsoft.com> References: <1515788548-3570-1-git-send-email-juterry@microsoft.com> MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:f::4b] X-ClientProxiedBy: DM5PR1401CA0003.namprd14.prod.outlook.com (2603:10b6:4:4a::13) To SN4PR2101MB0879.namprd21.prod.outlook.com (2603:10b6:803:51::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55d03940-33c9-4a0b-25b3-08d559fa479e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020086)(4652020)(5600026)(4604075)(4534117)(4602075)(4627213)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020); SRVR:SN4PR2101MB0879; X-Microsoft-Exchange-Diagnostics: 1; SN4PR2101MB0879; 3:14cLfqtYIFyXM2Eh3BPVT4Fdw45Mgx5HEhD2eVY73POTQ3bhmbKE1JGEqajXhsfcwgdQBoh4jgr1CjjEPINz0uF5Muhpl8mpRvYfJm+KyPEDd+mlvLsl5XZsJ+TKWgUpMJhNdj5j6DpS62xK1tVirwliJNryeHszurN5sFr52knNTymj5bADS5SPDBgKedNxXW6gV5Dg3YADZYIh0qQ33Ma2/en9BK+ymGIFR+w9Ud+YfPsjj/OJC2Sn4ZNyYiK5; 25:hsWI9PsZGeorRqgh8pgGVq6XSa8Pcbe7u2fXojheXIKXe5HjJ+Wxi2xjDgCuYdgfV75xL3BA3ohmP9kq/+S+wWadJVM4sSPbKOP2YFM7IcsmUcENmm/AFeKyepzfvVXNX6fpD1Cwnvdw0anSrRkVgmlGJalXb1j4rpu0YjmNMC64oIqSNXsJJryOY7pR1bQaGRgrWzvUoDyUvW0wskgtPRWO+313lMUCLgozzX2pqXpsTTNPo3iSn2Z2dP4U1Kx0FXTBhenB8Of7VWtbaHcMBSzcDaypHOWhSmgFVzfpSJrf8M3K7TIEzSFDzA7A/sazc0prEONOvTmBUk8PF1CtBQ==; 31:AOh3Y9/I7RLffALHYngRNL1YQYejQ7/xfHiPKqLKgSs0MjolaD8W94HIW21BZEYwxYHqh7sLz1rPjED119Z9z7lw7G3O4Se0GbuDVNngucS2BbvTjHsztKH5Th/xJpfWYB6cTTsqqVLq2bJ8sDBqtEg4+rrZrxzuj7JPn1sFXWosCTDm2QRldqZ7xU+3kTuzbiX5yAmpy1txOzD/dGU/CKJitxQ3PGuiJl3rHGZb4qo= X-MS-TrafficTypeDiagnostic: SN4PR2101MB0879: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=juterry@microsoft.com; X-Microsoft-Exchange-Diagnostics: 1; SN4PR2101MB0879; 20:9pbFc1yTrKxzQBzaASlgeSKSUK7WpwSRQnfeo8g1tuoJVyEwKtwoNHOGz5SrysVApdXhNGsP3ldx6QomC5/xCu3zg/WjW7p0Zl8J5cPMWWztA4X7DzHfhCQBb1e4PWOp4ZgCAsbBSzEM+0RwmBjmupVlJFyXun6H/NqSF7fbhyXh6BS3pyKKpq3e9u/5Eo0shTVtUDS2sxOvZcBt5QpyZ8aBdZibgp09nj3B3Ilq8SypaqeM3VEsqftl2W5B3qCsMpfs7+DZFp88uE1+JvJU6GxlMsg8roK5R5p8gUQv1b4A1M7JKyqckg/fsx5yBQQBZAT1LrpsIwInqx/nzRadsCqMWp+IdhDz1oPIiFPSGccPatYgHhq0GQiRdRb3MyaC9feVuK+41137dQPAowhe6shgqmH0fs5gCI4T9v4eSprN4tcfCryyJEXp68f3mkbX4NyZqXUUqCvnQKDBZ+ZRsvPESzE7kjWHxdkUux/jQq4N8aBjwyhHQREFRQsj4Z1a; 4:0gK9QaMAz3EltjUp2kXSBuzLP3RiGqNbSlsxX3vVcBeqaJ7KFavON/cZFuh1zlYmwyIAV7ZEQsxPosv2lbfH2E22rB3XBtYashLjtpXx2nqHQdIvFNVTOBkDY9HwM/zjl1x4E84adbvwvfM5YIVJGni8BUjUliSp49UU5Cos1S6T2Aq1S8z5uBc3roCkmPu5byrQL3yPlfUAO+ejwPxBEh3pYHmA4pbyIlEt2L7iJswhJsH/OqHgRew5IIXYUUkFXHWo0kTaYy/yFpivxOXIn6/nvL18tJUo9cCALbZtsMpvLT/+sElMmjbiug25UeOcrBs/uByIvyG8kXrvhVjZHQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(28532068793085)(89211679590171); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(61425038)(6040470)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231023)(944501147)(6055026)(61426038)(61427038)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:SN4PR2101MB0879; BCL:0; PCL:0; RULEID:(100000803126)(100110400120); SRVR:SN4PR2101MB0879; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39380400002)(39860400002)(366004)(346002)(376002)(199004)(189003)(39060400002)(106356001)(6116002)(316002)(105586002)(22452003)(2351001)(97736004)(25786009)(16586007)(86362001)(5660300001)(53936002)(6916009)(2361001)(6486002)(2950100002)(6666003)(86612001)(51416003)(7696005)(52116002)(52396003)(10290500003)(50466002)(478600001)(305945005)(10090500001)(48376002)(47776003)(386003)(68736007)(81166006)(8676002)(107886003)(81156014)(59450400001)(2906002)(4326008)(8936002)(50226002)(7736002)(36756003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:SN4PR2101MB0879; 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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR2101MB0879; 23:LcrCWXEnLGkF0oiPiTK20amn7U37gypdHVIyR9A?= =?us-ascii?Q?yhNdvYSZguz0Zh5EMW6JtdXVLqEyQ7xpG4LU8B5PXQVUL+gyurXsh7mE8e1W?= =?us-ascii?Q?GwT3fIcV9UqsDViGvv/fqF10EoOvX0BgKcBEbU+uhp8VAQFCLrnNsDT29q3f?= =?us-ascii?Q?q+FWMKOZk8koFcRqgSf6vrl8qs4tc+m9S9qpDckF7g/lUa5rygVUZ9w3S5eG?= =?us-ascii?Q?sMNEfJkZcCxW5hysp94hUjNcK9BPBYeMksz9HeqU9Ck6zCzIarespIKT/wKj?= =?us-ascii?Q?VDv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ticMetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 20:23:01.5879 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55d03940-33c9-4a0b-25b3-08d559fa479e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR2101MB0879 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe49::70e X-Mailman-Approved-At: Fri, 12 Jan 2018 16:25:15 -0500 Subject: [Qemu-devel] [PATCH 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 e8139de..48df958 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" @@ -1507,6 +1508,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) { @@ -1598,7 +1639,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); @@ -1845,6 +1888,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]; @@ -1883,6 +1945,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);