Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2936234pxj; Mon, 10 May 2021 14:20:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjys379oVHRLNP0fh32zq6mD9HiTQ1d8qGQ6GppfTpJURg3bkpied9h3n11ZJzP0x601Ek X-Received: by 2002:a17:906:d8d7:: with SMTP id re23mr27740546ejb.467.1620681657067; Mon, 10 May 2021 14:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620681657; cv=none; d=google.com; s=arc-20160816; b=k9izUUUeulaOXwYnKMhogoDr4hJ2L8q1mIGVVHf1KL5sUlJ9WFJBuHt8XS3XupdH8A vF/kyXCN00BtjXbNehT+dJHuGcw+pG5iX/SDHcNZ81L1MqYjApk7y5fL0QhMWQfbpPaC 3T/nJQKECQda+HtsdfI8eDTnm9kT6ypzxUqGoZfqpdlTwh31r0UDMZvxZvCfqKfeTMpv ncACdAy43W36U4ORYV6eUS3jsuoBEaH+yGIStttEHKcFTqUsM07MQ1s5JSW3uIo5iljo jMhstImL84OamHHGnA2fW9ZDZjgItCO+7uzrpLo4qz4DjMTIBgvA3iaJ1CjVq5lewUmO WBgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0n88KguwK4u1Tl40XFeYJoKeAxPDsastf87y73L4zpU=; b=cNQygDnT3eYN1y0sDbcIcC+ahDQc7Fsbatd/xeVqr6xdLUec4dKV1XIGxBBzD5wOO5 fVGTxNxSvm+fTgK/2+RZsPyBDzCuX9+AFJwlETINuWzWyjZnDy7q8zk8XUXFyD0zRIkA i6e0QaqABiaJpEa+HxMybos1U5v62tBOiZWIMXOXdBlM59WLvfPTIYej/S4K4IJ+wbb6 jGeTQ/X/5YQgZXBDFv40qxZtIzTrHBMPsRbenPtNlDD2qpa1XdLUym4vdMjGzKBG1YXm KC+LI2aK9Z5Gyr7rAoYIWjzfwiLFudlF9WaIzz3uBpG+yfyWvMELvysBzQQj+N6DvNoV cnaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bA4rMWnN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si13919123edp.399.2021.05.10.14.20.33; Mon, 10 May 2021 14:20:57 -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=@google.com header.s=20161025 header.b=bA4rMWnN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbhEJVTO (ORCPT + 99 others); Mon, 10 May 2021 17:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbhEJVTD (ORCPT ); Mon, 10 May 2021 17:19:03 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884C4C061574 for ; Mon, 10 May 2021 14:17:58 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id c13so1095530pfv.4 for ; Mon, 10 May 2021 14:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0n88KguwK4u1Tl40XFeYJoKeAxPDsastf87y73L4zpU=; b=bA4rMWnN7wm4v/a7EQ9UE5EfJewP1uei2YncP5LVPTIMrZHcbxqJTZncdbPvGuag7M SOn9d1m9ir1oUtIaL396Jk2zcmZlgzzq22MqPdrxU23iqWuBUx5SpGG+rh6VhtJlEe9x SK0i13IrBunc1t1JqsrmeTCpt4zZ+QcJ2UVDvDleEU2hQnTrVLtNvG2cpk1HELkBlPqn ZAHNnrOsx2PtVO7s4UtUPGMTvf+DtBtSLqnXAuSvCewRDTFvlvfWjlPkvVL1nfNqpZFs oF3RER3pvNMy08u0Mx+VljVqvnzwL9W7E1OfL4AJPSjdYkWS8STTkmIDTAkgzye8tPHt 3FTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0n88KguwK4u1Tl40XFeYJoKeAxPDsastf87y73L4zpU=; b=qaZsgDaJgQZGClSnTSAY5MEfpnMODWjCN6TMa9xTwI1vltqMuolhJOmJmerMpQl6Eq U7yexnSf/BJkegI51xGqtqaJ/2P+Fi9239+My7O78kNZqPYhsCdQo1NVzgVHrvKXoFCG NmkXSA2DXedB+6pqP69O53bif4WVL/ArEXpUxwkdvmh9u15ry8pezRmN6stGwiBDEdrm 4irOj7jd74diFbTGpZA1SNKy/d8XUc1qhzilGS8cWaqD0LGvZGLAYDKPGhp2nl5nh4Ku hOE1712gwh6Ufs0Ioa/xyCGFRzt2lWJm99LoQMLaAhThdY841oRhBIR+J034Q5c8vp22 6z4Q== X-Gm-Message-State: AOAM530JYvemog7zOZY7Hy4Hg8whnL34s0YZnd8vtP9PJYLJ5VU9FUvZ 8JxOcC7Lk9WOul5UXVaijHELXA== X-Received: by 2002:a63:9d48:: with SMTP id i69mr27113197pgd.297.1620681477999; Mon, 10 May 2021 14:17:57 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id n30sm11679056pfv.52.2021.05.10.14.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 14:17:57 -0700 (PDT) Date: Mon, 10 May 2021 21:17:53 +0000 From: Sean Christopherson To: Brijesh Singh Cc: Peter Gonda , x86@kernel.org, linux-kernel@vger.kernel.org, kvm list , Thomas Gleixner , Borislav Petkov , jroedel@suse.de, "Lendacky, Thomas" , Paolo Bonzini , Ingo Molnar , Dave Hansen , David Rientjes , peterz@infradead.org, "H. Peter Anvin" , tony.luck@intel.com Subject: Re: [PATCH Part2 RFC v2 36/37] KVM: SVM: Provide support for SNP_GUEST_REQUEST NAE event Message-ID: References: <20210430123822.13825-1-brijesh.singh@amd.com> <20210430123822.13825-37-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021, Brijesh Singh wrote: > > On 5/10/21 1:57 PM, Peter Gonda wrote: > >> +e_fail: > >> + ghcb_set_sw_exit_info_2(ghcb, rc); > >> + return; > >> + > >> +e_term: > >> + ghcb_set_sw_exit_info_1(ghcb, 1); > >> + ghcb_set_sw_exit_info_2(ghcb, > >> + X86_TRAP_GP | > >> + SVM_EVTINJ_TYPE_EXEPT | > >> + SVM_EVTINJ_VALID); > >> +} > > I am probably missing something in the spec but I don't see any > > references to #GP in the '4.1.7 SNP Guest Request' section. Why is > > this different from e_fail? > > The spec does not say to inject the #GP, I chose this because guest is > not adhering to the spec and there was a not a good error code in the > GHCB spec to communicate this condition. Per the spec, both the request > and response page must be a valid GPA. If we detect that guest is not > following the spec then its a guest BUG. IIRC, other places in the KVM > does something similar when guest is trying invalid operation. The GHCB spec should be updated to define an error code, even if it's a blanket statement for all VMGEXITs that fail to adhere to the spec. Arbitrarily choosing an error code and/or exception number makes the information useless to the guest because the guest can't take specific action for those failures. E.g. if there is a return code specifically for GHCB spec violation, then the guest can panic, WARN, etc... knowing that it done messed up. "Injecting" an exception is particularly bad, because if the guest kernel takes that request literally and emulates a #GP, then we can end up in a situation where someone files a bug report because VMGEXIT is hitting a #GP and confusion ensues.