Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5183309pxj; Wed, 26 May 2021 05:01:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoIzgksqfHunwUSrUE8zTGin6W7IR+zTUoUkOpYfiNR/0MwM85uvsayCMzyvM9+h2Ev59Q X-Received: by 2002:a17:906:318b:: with SMTP id 11mr32522212ejy.395.1622030476687; Wed, 26 May 2021 05:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622030476; cv=none; d=google.com; s=arc-20160816; b=yoNwCMrFqB/Soc22k8ISChZxA1Ds+93W52BSYX1fyL2gYiVA9dP3gD367P7erF8VWd zISxQMNueus1ih50hWziG3Mkoo8dbpvD+iep/91ALLUPGm8v1YhuYn71Kelga6X5hqT5 N5kTNHG/raHmmvrPerA5vIfkrtl3RKaRznRKHq2SxD8e/BIBnkMMsdDg8TSC8+Q/Y0ee 2ls9oYBnZvNaTkOyAMaKiYcmsON2bB6b0hHRneXTWhbt26Gd/s6GCONppEUe9crEk07E 8k4MEb0sjeDuOcrvrhttHheVvwK03pwrVfYJwsZTbgS7UO7iNcG8KEWrkRDkARSZfpQD oEsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=NiiybY9pJbKggcwpnUusmuYGMawbxUPAkBWGqcaKsJs=; b=IdhXTviBFVQv8lCCcSR9JHIEo8F7aSHGebUPOGw+AULouArDQB58yoquFKTsUBo9zI h1QKaKxn9wtBsQzMx5T74ez084T38ZkC6IJw3KRuM6D8dtj1sDIpYu3Du6PoAxaxnZKg feI1c5rYZRyCoCLGrbRg6GxYRJVHPEVJPq6xdHk8A1fayb+ttosW8vEg2SGS6rth7PHT BO3N6r/j2idpyRKqCDNQxWzdxLaFeMeaTeyYbOvkGHpLkJegeEJ2Dzfw0/M1xx2Uzpjr 2J94iZ8ip3R96fbuaqRpAChd2P6jrhUyowTJ/RQ6eaklKDvYSkI/Mgd3oEbGFo7i0Y3w YX/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=V2RZDzzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si18266561edq.452.2021.05.26.05.00.52; Wed, 26 May 2021 05:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=V2RZDzzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233422AbhEZI60 (ORCPT + 99 others); Wed, 26 May 2021 04:58:26 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:18814 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbhEZI60 (ORCPT ); Wed, 26 May 2021 04:58:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1622019416; x=1653555416; h=from:to:cc:subject:date:message-id:mime-version; bh=NiiybY9pJbKggcwpnUusmuYGMawbxUPAkBWGqcaKsJs=; b=V2RZDzzvFUkQR/iI0xeq/ubBraUNEqxMbLg2v4ERBRtIIj0u0BjzediU nyNu0Fl5QbF2aikrcy7ZxBHPQyDLwOmdTVg7jkbvSd6g9hyFzTQGjZRAt 65DyOFNZJzyYF0c9rCOoiXJxy7I1KKpGBd3MbXsZG1JA5ZjuGoC0v81IF c=; X-IronPort-AV: E=Sophos;i="5.82,331,1613433600"; d="scan'208";a="114700068" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-859fe132.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 26 May 2021 08:56:45 +0000 Received: from EX13D28EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-859fe132.us-west-2.amazon.com (Postfix) with ESMTPS id E64F6220081; Wed, 26 May 2021 08:56:42 +0000 (UTC) Received: from uc8bbc9586ea454.ant.amazon.com (10.43.161.97) by EX13D28EUC003.ant.amazon.com (10.43.164.43) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 26 May 2021 08:56:34 +0000 From: Siddharth Chandrasekaran To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H. Peter Anvin" , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel CC: Siddharth Chandrasekaran , Siddharth Chandrasekaran , Alexander Graf , Evgeny Iakovlev , Liran Alon , Ioannis Aslanidis , , , Subject: [PATCH v4 0/4] Add support for XMM fast hypercalls Date: Wed, 26 May 2021 10:56:07 +0200 Message-ID: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.97] X-ClientProxiedBy: EX13D34UWA003.ant.amazon.com (10.43.160.69) To EX13D28EUC003.ant.amazon.com (10.43.164.43) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. v3 -> v4: - Rebase to latest master - Remove unused loop variable j v2 -> v3: - Remove inline for kvm_hv_hypercall_{read,write}_xmm() - Fix typo: s/ouput/output/ - Remove sse128_t from kvm_emulate.h - Reword comment to match TLFS wording - Move num XMM registers macro to hyperv-tlfs.h - Stop advertising HV_X64_HYPERCALL_XMM_OUTPUT_AVAILABLE v1 -> 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 | 10 +- arch/x86/kvm/emulate.c | 137 +++--------------- arch/x86/kvm/fpu.h | 140 ++++++++++++++++++ arch/x86/kvm/hyperv.c | 222 +++++++++++++++++++---------- arch/x86/kvm/kvm_emulate.h | 3 +- 5 files changed, 310 insertions(+), 202 deletions(-) create mode 100644 arch/x86/kvm/fpu.h -- 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879