Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1577519pxb; Mon, 12 Apr 2021 01:13:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqVgbrG4ObzjSXJzrOHDX4k5zIT1Zr3jrdTO+LY8kq9dVf25JEfK+sXBbxi6RSArHRfEe7 X-Received: by 2002:a17:906:b28c:: with SMTP id q12mr11868776ejz.284.1618215185488; Mon, 12 Apr 2021 01:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618215185; cv=none; d=google.com; s=arc-20160816; b=xOgNxgPDVGvpBVsL91pxQnUaLKzzjxmGD2OKbPfAHE5bDo1bdc/iecZBYtwXAFXayY APV3da+E2weRTI91azOpXXzsnAWU3h9VQ97BGtcugQSzmBxSAhq174NX4Tkq/PMSy/Lv wsFNXisNCNbMLfRrVNgrlbjqTJHiXh1Ah7RUYR3daErulrIAQ9PrbPuphkqTJNEjZF96 ZenJAwoDA6u7IQRw4AfBnE35gJQM3w47xMEb8vBUz35Hbgw/tHftMShLGcO9gyyk+nhw 8b15MO4+Fo1u3DH3ftwSuLp78e9VvT/sadyKqDvQJlVEqI8PEksP4qKuUh0Tq1qsrWEB FIcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:cc:to:from:date:subject :dkim-signature; bh=Ag0UTwjEcsAkBUOr08LFu5cgXurDxKREvmhQ+cYG28Q=; b=IlWoF4tK3D5IgSNtjdOIb5IQofRmArohSNqu8KP3l1lDYDVO8zpWEEvDcvcIDYegtr iU7iwx9tPZ3Iz8HL0nj9klY4RV8DehTQmp99DJ58lW4h36+Z7vBdJmunSognbE5EdDin +GUVmOWrZOvCHNIrD3T7qCN91PWgh0BUPwy9TpEBNrvO4q6cuoUrSWOOW6XLG61W76mo Y+NH7GHFJVzk0ggU3uE5t1DnKYc+iRmT1Ya0gnSI1BSSEKgn9Xi5F96q1sKM1cCH+Bbq PutcOohvtqSJTGv4dv++h1QzQZ5dPCHBj7S5x1jE7vuPUZVCVMx5s3/jdp2L0eMBxe29 pYHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=J0irtF7w; 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 nd11si7247367ejc.470.2021.04.12.01.12.42; Mon, 12 Apr 2021 01:13:05 -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=J0irtF7w; 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 S237263AbhDLIME (ORCPT + 99 others); Mon, 12 Apr 2021 04:12:04 -0400 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]:1123 "EHLO smtp-fw-9103.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237081AbhDLIMD (ORCPT ); Mon, 12 Apr 2021 04:12:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1618215106; x=1649751106; h=date:from:to:cc:message-id:references:mime-version: in-reply-to:subject; bh=Ag0UTwjEcsAkBUOr08LFu5cgXurDxKREvmhQ+cYG28Q=; b=J0irtF7w0kTufWJ9MT2Y3JIxzpN3NIC75GvIVwJ2FddpKMpyHnph1zXh +hanShNJE86f1/JwmeT5CVIVBwEEr2l89VgbvRAc9prLJQpB6p/uq+QAC yoiuZc9C1zvpEKUKhah815ShvUX/CV2kZqMOhy0Igl3uy6jZWR4FPIIFf s=; X-IronPort-AV: E=Sophos;i="5.82,214,1613433600"; d="scan'208";a="925220198" Subject: Re: [PATCH 4/4] KVM: hyper-v: Advertise support for fast XMM hypercalls Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-out-9103.sea19.amazon.com with ESMTP; 12 Apr 2021 08:11:25 +0000 Received: from EX13D28EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 1623E1A07F2; Mon, 12 Apr 2021 08:11:23 +0000 (UTC) Received: from uc8bbc9586ea454.ant.amazon.com (10.43.162.207) by EX13D28EUC003.ant.amazon.com (10.43.164.43) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 08:11:15 +0000 Date: Mon, 12 Apr 2021 10:11:11 +0200 From: Siddharth Chandrasekaran To: Vitaly Kuznetsov CC: Alexander Graf , Evgeny Iakovlev , , , , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H. Peter Anvin" , Paolo Bonzini , "Sean Christopherson" , Wanpeng Li , "Jim Mattson" , Joerg Roedel Message-ID: <20210412081110.GA16796@uc8bbc9586ea454.ant.amazon.com> References: <20210407211954.32755-1-sidcha@amazon.de> <20210407211954.32755-5-sidcha@amazon.de> <87blap7zha.fsf@vitty.brq.redhat.com> <20210408142053.GA10636@u366d62d47e3651.ant.amazon.com> <8735w096pk.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <8735w096pk.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.43.162.207] X-ClientProxiedBy: EX13D20UWA001.ant.amazon.com (10.43.160.34) To EX13D28EUC003.ant.amazon.com (10.43.164.43) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 08, 2021 at 04:44:23PM +0200, Vitaly Kuznetsov wrote: > Siddharth Chandrasekaran writes: > > On Thu, Apr 08, 2021 at 02:05:53PM +0200, Vitaly Kuznetsov wrote: > >> Siddharth Chandrasekaran writes: > >> > Now that all extant hypercalls that can use XMM registers (based on > >> > spec) for input/outputs are patched to support them, we can start > >> > advertising this feature to guests. > >> > > >> > Cc: Alexander Graf > >> > Cc: Evgeny Iakovlev > >> > Signed-off-by: Siddharth Chandrasekaran > >> > --- > >> > arch/x86/include/asm/hyperv-tlfs.h | 4 ++-- > >> > arch/x86/kvm/hyperv.c | 1 + > >> > 2 files changed, 3 insertions(+), 2 deletions(-) > >> > > >> > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h > >> > index e6cd3fee562b..1f160ef60509 100644 > >> > --- a/arch/x86/include/asm/hyperv-tlfs.h > >> > +++ b/arch/x86/include/asm/hyperv-tlfs.h > >> > @@ -49,10 +49,10 @@ > >> > /* Support for physical CPU dynamic partitioning events is available*/ > >> > #define HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE BIT(3) > >> > /* > >> > - * Support for passing hypercall input parameter block via XMM > >> > + * Support for passing hypercall input and output parameter block via XMM > >> > * registers is available > >> > */ > >> > -#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE BIT(4) > >> > +#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE BIT(4) | BIT(15) > >> > >> TLFS 6.0b states that there are two distinct bits for input and output: > >> > >> CPUID Leaf 0x40000003.EDX: > >> Bit 4: support for passing hypercall input via XMM registers is available. > >> Bit 15: support for returning hypercall output via XMM registers is available. > >> > >> and HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE is not currently used > >> anywhere, I'd suggest we just rename > >> > >> HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE to HV_X64_HYPERCALL_XMM_INPUT_AVAILABLE > >> and add HV_X64_HYPERCALL_XMM_OUTPUT_AVAILABLE (bit 15). > > > > That is how I had it initially; but then noticed that we would never > > need to use either of them separately. So it seemed like a reasonable > > abstraction to put them together. > > > > Actually, we may. In theory, KVM userspace may decide to expose just > one of these two to the guest as it is not obliged to copy everything > from KVM_GET_SUPPORTED_HV_CPUID so we will need separate > guest_cpuid_has() checks. Looks like guest_cpuid_has() check is for x86 CPU features only (if I'm not mistaken) and I don't see a suitable alternative that looks into vcpu->arch.cpuid_entries[]. So I plan to add a new method hv_guest_cpuid_has() in hyperv.c to have this check; does that sound right to you? If you can give a quick go-ahead, I'll make the changes requested so far and send v2 this series. Thanks. ~ Sid. 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