Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp227225pxb; Wed, 3 Feb 2021 04:10:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRbaYfzpV99f0H5E06uPUAW0LmfED94gDdMnaP4CaFBS2b4C9DA+bKMpU5V/RwOSb/gq/3 X-Received: by 2002:a17:906:68d0:: with SMTP id y16mr3007580ejr.128.1612354255571; Wed, 03 Feb 2021 04:10:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612354255; cv=none; d=google.com; s=arc-20160816; b=yk6Dquf/SBHxfksZYhAV2A+Yj41nqZBmy+De4Zs/RnG1V3Sy+CvoDTAIgTESWFHIbx wSq7eiDZPFj4InjTg1jxggazmzZzHTxh6ueUcAX8x9hVSMyU7YRfQ328qTubBEWt89lf QNDeygMhyy67CvlYay4ZkhdG3uozdYwSsuGjjAo1FqPTUYu0QI5atjFRYlYZQgkYL/yo pbLOlKqSh4QiKwwNcHrk4QbNqv2rp007qYfanAB2gEwLvL6WWfs8SkZuSju8EddyohYP D3G9rfdhLeEj54kuzDjqpLX6iKcB8M0iI1LuJKD0botNhZQBFF430h6FFDSO9AbZbCGg D/Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=SrvxDfDLxZDeRFfsO00vBgZ9Ba/y5cDui2XTUBzZ7SE=; b=ftZ3PEOxl0TX4neeK4IDKqEHlfyrNwLOBZQfoc4WbwOEOQfWmllk2g0vIeaBBOo2P0 Bicsnftp6uJMJdBW/DunHY43IlpQn29Ag/WEOh950MfqP9IxAlS8PndIyPFt2+zliVwB HOIFiUEUWiByL2MMKmrB/JniyAzDoUaLHvEVfCT704cUwPVkOzxwMfEgLOIPmLc66bu+ 2QGqoGE9s2tvcjlKAQvHbtHW0FY0SowWP94xuX3arWzOb3Jxk+0hqCniRzo8KkGyTMpk txm14fOj/MN3/MGYOXJxJOobTWwEcqb0pkhwnLRF29y0zLTJmwyJoFJyScnTQQL8eJft EHgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="dH/17FQZ"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si687506eju.170.2021.02.03.04.10.30; Wed, 03 Feb 2021 04:10:55 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="dH/17FQZ"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234415AbhBCMJe (ORCPT + 99 others); Wed, 3 Feb 2021 07:09:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31751 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234238AbhBCMJY (ORCPT ); Wed, 3 Feb 2021 07:09:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612354078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SrvxDfDLxZDeRFfsO00vBgZ9Ba/y5cDui2XTUBzZ7SE=; b=dH/17FQZZeYw4aufQK6MQt2XlufsdQEkUU06zbYYNJQX9LPu9VmXOG3bfA3f7wkZ7r9B+K FIOYPlSaZCksWotNccD+L85RQZNcp57zBDSwz5vVqEWxycJT8qQBZippMjBes019sdbgq1 UtAHx24YuqivH5wu0xSIBGGwGuGwkoI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-SyjUe-29NcKZ8Te3gp8_6Q-1; Wed, 03 Feb 2021 07:07:56 -0500 X-MC-Unique: SyjUe-29NcKZ8Te3gp8_6Q-1 Received: by mail-ed1-f70.google.com with SMTP id m18so11337948edp.13 for ; Wed, 03 Feb 2021 04:07:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SrvxDfDLxZDeRFfsO00vBgZ9Ba/y5cDui2XTUBzZ7SE=; b=Eb81VUUYWoUL455PcJukipGZWVMU2cfD2q4SLgGMb6blFyDz9Amw1XaV9lspK5Tlfh F/Y6PUzPCnE7uk586gmn4ugGvYkCsSyRIEW5jMiCdaNrVM+CHp12XHuqF93/IYwyMvMB 1zsUJrSlXGMvfrhtgg0nL67xM+cqmRw/ZtU+T/lRqcJsR/+v5rSiuZQFg99AlyX6CRqZ Uk6twVA+KiEOy8P/sNXwuj+inGY50RaOQHp63ZNvEPyJgt7ydYwmiD+I0bcLwMl3gk81 l9p/gEhmbWqQmA8QzhNpzHkxgZVu6CkQsHCcBLPVSsO9qhEP0lKctSivQC/ZVpp9vmQw WNbw== X-Gm-Message-State: AOAM533ecFiTDYQZzxJLlyWopUovK25r28K1E0kT/TKoi3CBVtxw1Ox0 2rA1aksgv3H5gV1rv1z/oYNJuO23MKQD20Yy3Y021daN63cSIK2pOWe3zBwqJ+mmsGcPT5BawkC iQ+qby5CtKx+mAwW01MIIh2E3 X-Received: by 2002:aa7:c682:: with SMTP id n2mr2626964edq.27.1612354075322; Wed, 03 Feb 2021 04:07:55 -0800 (PST) X-Received: by 2002:aa7:c682:: with SMTP id n2mr2626934edq.27.1612354075090; Wed, 03 Feb 2021 04:07:55 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id b17sm763438edv.56.2021.02.03.04.07.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Feb 2021 04:07:54 -0800 (PST) Subject: Re: [PATCH v15 14/14] KVM: x86: Save/Restore GUEST_SSP to/from SMRAM To: Yang Weijiang , seanjc@google.com, jmattson@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yu.c.zhang@linux.intel.com References: <20210203113421.5759-1-weijiang.yang@intel.com> <20210203113421.5759-15-weijiang.yang@intel.com> From: Paolo Bonzini Message-ID: <55e43685-f4a7-b068-8d4c-931b8789f031@redhat.com> Date: Wed, 3 Feb 2021 13:07:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210203113421.5759-15-weijiang.yang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Paolo