Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1176592rdb; Fri, 1 Dec 2023 08:51:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1bdMg3pD5LnIwpnr7kHDB7+mG3vPGHkb0Ovlze+4fZl/GOXXKKtb+55zvQD+e9wg9QeeK X-Received: by 2002:a05:6358:27aa:b0:16d:bbb3:69c6 with SMTP id l42-20020a05635827aa00b0016dbbb369c6mr24068139rwb.13.1701449490849; Fri, 01 Dec 2023 08:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701449490; cv=none; d=google.com; s=arc-20160816; b=M6TWvyDinOL5K1MGnjf6n+drQx4AbyPfPlhho4hNuzmNR1GtsF+k05NFACKQHzN0CV jCXW8uqOM6PNzDywJoIV+icPdXmDyCyShPVWLHYQg8Hk9sIAs1ls0EGNkdKQcpO1MLt5 HpIMkzbQysiqcojjjrrl+7gQAZc3bdVKY3x59OMYfPufucDXEoXReXGaSJBmuaYyOgtS BwDM/i7/AmhhbB+g5eJ2lDfKHrtPwUZMTJ1NzyxlLfJL1ESye3cycrS9R/astn2Bx6zm 6zwJNNoagVE826FfEsSMCcvbkvZ4mE9UmJMfYu/lj3NpCHy7L6u1PAtfjC6oXvfW4LV3 nTxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:cc:message-id :date:content-transfer-encoding:mime-version:subject:dkim-signature; bh=jzcYp1+G+LJEnQ/Nf3Fzjvbwr6w5g4s4GfO6LThiCsM=; fh=HvBRCvqge+/p8gpQI8VSHClUsZyCluhLtTcu0xUdu6A=; b=XbGn5l/C+DGwJu5yiXLU9SZfhntgQKXhjA2e6CgGtIADY8r08wfiFoH3DVxn7osBZZ nUBc0QsGzNy3kjUT68iGXqZHxwnm7vrPAhBI4knO6l9Gd62PxD9cnkSDPfN6ng8iA/e6 bBxXgiU3SXvjvfXFV4teeUrdI8oKVx9FU3Br6fAAoDh9IeQhSoQ/xDuMD5YCY/VfBOnc u/52v+AmQYZm/0zaJBDItGYl63KFpCdX6ZIWa6mesoHDRXLa+X1x6sbUI8oFZK3sAFpn 6nV4a5TcHFgUeqM9Crcpc5Dnhg5UL0jE8Xl4enc3mXtkS+OOaq1bxViGHBUzJEDaf4NH m+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=YGd1sdhU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id v12-20020a655c4c000000b005bddee56e49si3486650pgr.72.2023.12.01.08.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:51:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=YGd1sdhU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6460581CA3D9; Fri, 1 Dec 2023 08:51:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbjLAQut (ORCPT + 99 others); Fri, 1 Dec 2023 11:50:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbjLAQus (ORCPT ); Fri, 1 Dec 2023 11:50:48 -0500 Received: from smtp-fw-9105.amazon.com (smtp-fw-9105.amazon.com [207.171.188.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D4DCF; Fri, 1 Dec 2023 08:50:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1701449456; x=1732985456; h=mime-version:content-transfer-encoding:date:message-id: cc:from:to:references:in-reply-to:subject; bh=jzcYp1+G+LJEnQ/Nf3Fzjvbwr6w5g4s4GfO6LThiCsM=; b=YGd1sdhUJvsAsu+ui9H2wz6mzVWzUx+6XYufrcCwuMNs4l9CyHhCZ1+2 g4FIpKbc2GULZYhOhaq6mYNjODdsJdO6FFeIWuadHyDHATzQFghR+GOWa CNCv4TH9Q5ZhS5RAPbVuZqRvzgQPbpj6lonoivQSEMN1DNbOMT0/3bo2H k=; X-IronPort-AV: E=Sophos;i="6.04,242,1695686400"; d="scan'208";a="688377607" Subject: Re: [RFC 05/33] KVM: x86: hyper-v: Introduce VTL call/return prologues in hypercall page Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-pdx-2c-m6i4x-f7c754c9.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-9105.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2023 16:50:50 +0000 Received: from smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev (pdx2-ws-svc-p26-lb5-vlan3.pdx.amazon.com [10.39.38.70]) by email-inbound-relay-pdx-2c-m6i4x-f7c754c9.us-west-2.amazon.com (Postfix) with ESMTPS id D414C40DA8; Fri, 1 Dec 2023 16:50:47 +0000 (UTC) Received: from EX19MTAEUC002.ant.amazon.com [10.0.17.79:43089] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.14.81:2525] with esmtp (Farcaster) id 82517984-b528-4c7f-9edc-388069a39df6; Fri, 1 Dec 2023 16:50:46 +0000 (UTC) X-Farcaster-Flow-ID: 82517984-b528-4c7f-9edc-388069a39df6 Received: from EX19D004EUC001.ant.amazon.com (10.252.51.190) by EX19MTAEUC002.ant.amazon.com (10.252.51.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Dec 2023 16:50:41 +0000 Received: from localhost (10.13.235.138) by EX19D004EUC001.ant.amazon.com (10.252.51.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Dec 2023 16:50:37 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Date: Fri, 1 Dec 2023 16:50:33 +0000 Message-ID: CC: Maxim Levitsky , , , , , , , , , , , , , , From: Nicolas Saenz Julienne To: Sean Christopherson X-Mailer: aerc 0.15.2-182-g389d89a9362e-dirty References: <20231108111806.92604-1-nsaenz@amazon.com> <20231108111806.92604-6-nsaenz@amazon.com> In-Reply-To: X-Originating-IP: [10.13.235.138] X-ClientProxiedBy: EX19D032UWB004.ant.amazon.com (10.13.139.136) To EX19D004EUC001.ant.amazon.com (10.252.51.190) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:51:05 -0800 (PST) On Fri Dec 1, 2023 at 4:32 PM UTC, Sean Christopherson wrote: > On Fri, Dec 01, 2023, Nicolas Saenz Julienne wrote: > > > To support this I think that we can add a userspace msr filter on the= HV_X64_MSR_HYPERCALL, > > > although I am not 100% sure if a userspace msr filter overrides the i= n-kernel msr handling. > > > > I thought about it at the time. It's not that simple though, we should > > still let KVM set the hypercall bytecode, and other quirks like the Xen > > one. > > Yeah, that Xen quirk is quite the killer. > > Can you provide pseudo-assembly for what the final page is supposed to lo= ok like? > I'm struggling mightily to understand what this is actually trying to do. I'll make it as simple as possible (diregard 32bit support and that xen exists): vmcall <- Offset 0, regular Hyper-V hypercalls enter here ret mov rax,rcx <- VTL call hypercall enters here mov rcx,0x11 vmcall ret mov rax,rcx <- VTL return hypercall enters here mov rcx,0x12 vmcall ret rcx needs to be saved as it contains a "VTL call control input to the hypervisor" (TLFS 15.6.1). I don't remember seeing it being used in practice. Then, KVM expects the hypercall code in rcx, hence the 0x11/0x12 mov. Nicolas