From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F596C54EBD for ; Mon, 9 Jan 2023 18:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234922AbjAISXG (ORCPT ); Mon, 9 Jan 2023 13:23:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237399AbjAISWl (ORCPT ); Mon, 9 Jan 2023 13:22:41 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472CC1C925 for ; Mon, 9 Jan 2023 10:21:04 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id e10so6458906pgc.9 for ; Mon, 09 Jan 2023 10:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TkS2qBI0dPZQnMdkME3l6hJQoHppmeAwetW1iOaX8Co=; b=LffKF0uSUV5ZGDd/s4y0yatOiYa77VSJRn8yhrQnwLIA0k1ivjED1LKDPHLMWOFF8G jm/0rQXfEBHpIegKAqLXyxk50UFweQI9fSGzpg6/9KN/RGIik4kPJk0QO1K8g/Q2Jh8o 08hOjpjnPUYprOEirByqVRrdXT8ZsSGxoMO8sUuJON9ECKwhXT0FwB3YbQNyUeGgTJtB adt2WRSOfm41/BtO9jtNJZ712KQakOx6bkjURsURpDvjBj6gUta8Z2FaMRcjP6QxBMtP v8zPDzbsnTqv/D12BkVNpklTWs4VOgx9Ru76PQgxuw6lFJKzsAb1nJACV8Mr3Ifbl98z 865w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TkS2qBI0dPZQnMdkME3l6hJQoHppmeAwetW1iOaX8Co=; b=UrPKNSUKVroohPUaTWt8st1GKlw9fJi0Y7M+VXWL8Ifi93QwcdA0jcmj65dQJZBoUs EQSDrjxXeSoLCMFel907/DtJdH1kD1gLHJVqP3xNnoqoI4fVhe7IR6r3XF4m32f+M64b TBqC6b3Z1NcPlto8FPfijX9CsAVDD+il7FB9deP1Vzc5Ci3J5boEIWSodbfmgk+Rf1Sa NRiLutdQU31ZUY2gPFLqwlArORinDaPrC+E4PaZJJ44iAFcZOT3tUbQwSemef+F0aO5z XSChNJYGoFe9fSyyEkzWn7VGOFPKeZlAnm0d/o2r1EruSTSNWexh//dgKr6v+zqq9WF5 tUVQ== X-Gm-Message-State: AFqh2kojyxw+X+B0B2lbRCu4ryCAiZC9j4TvoRwunPPIrVighPH5vRN1 aoUzA8SudlRifcML0eHmAos5fQ== X-Google-Smtp-Source: AMrXdXul7Y8Jh0boCRot2sqQHcG57lN6uNJsmvgpsrZXnnvp9Wda6tvdyU4i9IHlP+euhRZa1qwedA== X-Received: by 2002:aa7:8f2d:0:b0:582:13b5:d735 with SMTP id y13-20020aa78f2d000000b0058213b5d735mr761256pfr.0.1673288463680; Mon, 09 Jan 2023 10:21:03 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id e2-20020aa798c2000000b005829c60a838sm6345515pfm.183.2023.01.09.10.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 10:21:03 -0800 (PST) Date: Mon, 9 Jan 2023 18:20:59 +0000 From: Sean Christopherson To: Vishal Annapurve Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, pbonzini@redhat.com, shuah@kernel.org, bgardon@google.com, oupton@google.com, peterx@redhat.com, vkuznets@redhat.com, dmatlack@google.com Subject: Re: [V4 PATCH 4/4] KVM: selftests: x86: Invoke kvm hypercall as per host cpu Message-ID: References: <20221228192438.2835203-1-vannapurve@google.com> <20221228192438.2835203-5-vannapurve@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221228192438.2835203-5-vannapurve@google.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org KVM: selftests: Use host's native hypercall instruction in kvm_hypercall() On Wed, Dec 28, 2022, Vishal Annapurve wrote: > Invoke vmcall/vmmcall instructions from kvm_hypercall as per host CPU () for functions, i.e. kvm_hypercall(). > type. s/type/vendor, "type" is too generic. > CVMs and current kvm_hyerpcall callers need to execute hypercall CVM isn't a not ubiquitous acronym. I would avoid it entirely because "CVM" doesn't strictly imply memory encryption, e.g. KVM could still patch the guest in a pKVM-like implementation. Use the host CPU's native hypercall instruction, i.e. VMCALL vs. VMMCALL, in kvm_hypercall(), as relying on KVM to patch in the native hypercall on a #UD for the "wrong" hypercall requires KVM_X86_QUIRK_FIX_HYPERCALL_INSN to be enabled and flat out doesn't work if guest memory is encrypted with a private key, e.g. for SEV VMs.