Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp253584pxb; Wed, 3 Feb 2021 04:55:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPU0uyh3bXiOCkwLiIWBKGuxkcZbF6VMG1mFPbqc6hgZMsli/k0JKG2+7CQ/2XQQl8U44H X-Received: by 2002:a05:6402:430c:: with SMTP id m12mr2844054edc.299.1612356926797; Wed, 03 Feb 2021 04:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612356926; cv=none; d=google.com; s=arc-20160816; b=NEKjPF0xXlScpd2jIdii0tpUoHVnkOEKBsryeERHMeWVrIj2R9pBfD5CuxmsWKBq52 iY4JdNBKuRlTrb4wHWg3jP0YgnzUn3g31zUoYm9eHBKLvRjUWZjU9G+GRWDGEI9W1bOL f771YTry7qQQRMZ2NdflKQJk3pz8ZpdUckQCtMd5rvE/v0X24GW5q2GIbOTQcW/EF3bC 6qXfDlJNgWm0CsHPRuOhLLaQecKMCTGzHje+6HIDjHVbsJNlqZph2Afz++yrJfWx0z/r VzqgIx5lYBr4vzpBaTYCwsy7zb0ez0f4lqBJkxuJl4SVXVWe8LVDQRFEDR8trfBxlPNl ycbA== 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:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=wnqOfKqgkXGbmRZ4zDM9GfdjZUAI2wnrgl4sbNrwnkM=; b=a0EIOAF1NDGnrZ1wgs4u2C+WiZ+8x538AEFT0rOjRDa1329EFvFVPBZ5M21thz+Fmg mEiGQLP1KsT6nea1rBrQzhdtaIySao+ZCswC66iEUklHdBRpoMB4QbytwjS+Oal1Tvr4 zC4KwelMWmece+DO0On+CCcMPDoxnQ5Rg5T7i4gVvP0/7wrBQqXhUyxQmMynhe6a8aWF 9emDKi+hjISG3gdttnjKeoyR/cxXO8NvhMZDUJu5wtIF5arf9av5juMdNKiCbKu+7LMK 5AddI4qeeghbQIpBrRS0XNGo/63OOSis+1/t1CU8zjdowFo9eGw/FDdiavni8LhPaT6v xxKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si1275600edm.154.2021.02.03.04.55.01; Wed, 03 Feb 2021 04:55:26 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231281AbhBCMxt (ORCPT + 99 others); Wed, 3 Feb 2021 07:53:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:33631 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbhBCMu0 (ORCPT ); Wed, 3 Feb 2021 07:50:26 -0500 IronPort-SDR: jgdJPqAAGT7tTGD4zNujWLHgLxcMQePUoqscyz13Zt/BSL0N3LRPM/9SemA6EoT0MLkf601u9E PDzEuZLg2TBg== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="181178569" X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="181178569" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2021 04:47:43 -0800 IronPort-SDR: YYjB9/fWl1Spvw0vurNKuTxblIOskCClI/mVkhs+e0697wKwLmDdCBq6GZNIe16MnyziV1CUvy 5Zy7YuwGA8Dw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="371436354" Received: from unknown (HELO localhost) ([10.239.159.166]) by fmsmga008.fm.intel.com with ESMTP; 03 Feb 2021 04:47:41 -0800 Date: Wed, 3 Feb 2021 20:59:57 +0800 From: Yang Weijiang To: Paolo Bonzini Cc: Yang Weijiang , seanjc@google.com, jmattson@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, yu.c.zhang@linux.intel.com Subject: Re: [PATCH v15 14/14] KVM: x86: Save/Restore GUEST_SSP to/from SMRAM Message-ID: <20210203125957.GB6080@local-michael-cet-test> References: <20210203113421.5759-1-weijiang.yang@intel.com> <20210203113421.5759-15-weijiang.yang@intel.com> <55e43685-f4a7-b068-8d4c-931b8789f031@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55e43685-f4a7-b068-8d4c-931b8789f031@redhat.com> User-Agent: Mutt/1.11.3 (2019-02-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 01:07:53PM +0100, Paolo Bonzini wrote: > On 03/02/21 12:34, Yang Weijiang wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 22eb6b8626a8..f63b713cd71f 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -8592,6 +8592,16 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, char *buf) > > for (i = 0; i < 6; i++) > > enter_smm_save_seg_64(vcpu, buf, i); > > + > > + if (kvm_cet_supported()) { > > + struct msr_data msr; > > + > > + msr.index = MSR_KVM_GUEST_SSP; > > + msr.host_initiated = true; > > + /* GUEST_SSP is stored in VMCS at vm-exit. */ > > + kvm_x86_ops.get_msr(vcpu, &msr); > > + put_smstate(u64, buf, 0x7ec8, msr.data); > > + } > > } > > #endif > > > > 0x7ec8 is used for I/O instruction restart and auto-halt restart. 0x7f08 is > a free spot. We should really document the KVM state save area format. Thanks for catching the documentation error! > > Paolo