From patchwork Mon Apr 12 17:00:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Chandrasekaran X-Patchwork-Id: 12198533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 029EFC43460 for ; Mon, 12 Apr 2021 17:02:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C962E6023C for ; Mon, 12 Apr 2021 17:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244410AbhDLRCs (ORCPT ); Mon, 12 Apr 2021 13:02:48 -0400 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:16009 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243659AbhDLRBo (ORCPT ); Mon, 12 Apr 2021 13:01:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1618246887; x=1649782887; h=from:to:cc:subject:date:message-id:mime-version; bh=rqIXEoKr8J06sdj1H8DHbETKlNN7iSR0KNAHaBFZ++A=; b=SclBWRXYus0mkGCeRdXZ3YXtUZKaVogr37JxIqMhkU7N5Q3U5crEECus nXf5iWOcFJ5lLp4StAidEcagIlSPpXAX6Y2VbKDCFSA4cLk/CPD2zhUeZ c1u2t/ZcO8wERxbilT720jcyOH30NtYWNFI8GrP5ldWYPY8TUDmwDOA2L 8=; X-IronPort-AV: E=Sophos;i="5.82,216,1613433600"; d="scan'208";a="126988018" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-1e-42f764a0.us-east-1.amazon.com) ([10.25.36.214]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 12 Apr 2021 17:00:59 +0000 Received: from EX13D28EUC003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-1e-42f764a0.us-east-1.amazon.com (Postfix) with ESMTPS id D3C0DC03BD; Mon, 12 Apr 2021 17:00:52 +0000 (UTC) Received: from uc8bbc9586ea454.ant.amazon.com (10.43.161.253) by EX13D28EUC003.ant.amazon.com (10.43.164.43) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 17:00:44 +0000 From: Siddharth Chandrasekaran To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H. Peter Anvin" , Paolo Bonzini , "Sean Christopherson" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , "Joerg Roedel" CC: Siddharth Chandrasekaran , Alexander Graf , Evgeny Iakovlev , Liran Alon , Ioannis Aslanidis , , , Subject: [PATCH v2 0/4] Add support for XMM fast hypercalls Date: Mon, 12 Apr 2021 19:00:13 +0200 Message-ID: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.43.161.253] X-ClientProxiedBy: EX13D16UWB001.ant.amazon.com (10.43.161.17) To EX13D28EUC003.ant.amazon.com (10.43.164.43) Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hyper-V supports the use of XMM registers to perform fast hypercalls. This allows guests to take advantage of the improved performance of the fast hypercall interface even though a hypercall may require more than (the current maximum of) two general purpose registers. The XMM fast hypercall interface uses an additional six XMM registers (XMM0 to XMM5) to allow the caller to pass an input parameter block of up to 112 bytes. Hyper-V can also return data back to the guest in the remaining XMM registers that are not used by the current hypercall. Although the Hyper-v TLFS mentions that a guest cannot use this feature unless the hypervisor advertises support for it, some hypercalls which we plan on upstreaming in future uses them anyway. This patchset adds necessary infrastructure for handling input/output via XMM registers and patches kvm_hv_flush_tlb() to use xmm input arguments. ~ Sid. v2: - Add hc.fast to is_xmm_fast_hypercall() check - Split CPUID feature bits for input and output Siddharth Chandrasekaran (4): KVM: x86: Move FPU register accessors into fpu.h KVM: hyper-v: Collect hypercall params into struct KVM: x86: kvm_hv_flush_tlb use inputs from XMM registers KVM: hyper-v: Advertise support for fast XMM hypercalls arch/x86/include/asm/hyperv-tlfs.h | 7 +- arch/x86/kvm/emulate.c | 138 +++------------- arch/x86/kvm/fpu.h | 140 +++++++++++++++++ arch/x86/kvm/hyperv.c | 242 +++++++++++++++++++---------- 4 files changed, 327 insertions(+), 200 deletions(-) create mode 100644 arch/x86/kvm/fpu.h