Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp201540pxb; Wed, 3 Feb 2021 03:28:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7aAtm41law8NgrTVnZKxXS/mGMq1Jyf8GiOzrGUyA9UOVaauWRRwj/REiuCeOhcY/75iB X-Received: by 2002:a17:906:2ccb:: with SMTP id r11mr2809585ejr.39.1612351736442; Wed, 03 Feb 2021 03:28:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612351736; cv=none; d=google.com; s=arc-20160816; b=gfJKJdxrqCXAaZjIwngT9gYttN9WnYcJqmIg07pXCeSPVKdeucETuQFHbMBOl8Zbxx uOWricPee4ohuya5j2tNU6K7muR0KV6GAzmLGDoK9kIqDOWX7yFs9jHHLlCNZZ7JIfep ty6mGQG7cYm8j6Ie/7b0bn/yIFDNo7xqe79FFYVUpU3x78CP2enE71xoYPPAoRBXq05D xOQvOMbpm6cm8EM6CbgfKjihZ+Ec34IGUfCzrRR4jALA3nbjUtX5JmTHWHhMdo4KAqfN 0xNdE8mj9P3aAJMq/j531ZtY3oKGt8f/rStmodpfvbEkCryGWMhJpYONxaF42xND5Qjk CHjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=4Nc5FOXwNIHC+9h5CgHqSWyljLEvFO84wrLN0OAAzV0=; b=PnrN708AOCgQPfEZRl8QElIDXs8KwKSp4dlM7x6RIDaWYuAxDuk6OZZiGKl4hAw317 tQh+im2+J+ikJ3SLYf6PvUgQwx3S/i3b0Ym0gmYC2nwCblF8igOZY9fR1hQC1sBo7dQ3 +/aXuefVn3ncs6rzO+qGP0SI+HOin4NRSVRx8aaBdL5OuQYfzLNLHo1/uY5ZULYloahb lYR9EZmwX94xixrNKgWdOGtXDtGEimGx0hbX5sgIJpb9kt2qLwB2Qc+tpxnz63F6ybMb YEQxcAaUwXBZU0cBNbRWqvB8BmaZEoS2NH2srC+LUBuDWVTMQf02/koeZP9lgK3JmLeQ 74Dw== 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 p12si218381ejb.496.2021.02.03.03.28.26; Wed, 03 Feb 2021 03:28:56 -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 S234304AbhBCLYt (ORCPT + 99 others); Wed, 3 Feb 2021 06:24:49 -0500 Received: from mga01.intel.com ([192.55.52.88]:28325 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234061AbhBCLXq (ORCPT ); Wed, 3 Feb 2021 06:23:46 -0500 IronPort-SDR: rsSUxF52B9HMG+JOyjOQ3K4dadTJO37uyAnZ3rGuKS2RENEVy+JUDEe9JrZ0TWt967yWynRB7I 2ZrMDj2FVe8Q== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="199981301" X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="199981301" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2021 03:22:23 -0800 IronPort-SDR: dSvR5vZAT9li05iwPSRw5mO523CIBKg59w0CFqjZqIiGlDfIkEZXgXZQ/cAkf2KNE915pDAQ0G HA9iiqumxcdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="480311179" Received: from unknown (HELO local-michael-cet-test.sh.intel.com) ([10.239.159.166]) by fmsmga001.fm.intel.com with ESMTP; 03 Feb 2021 03:22:21 -0800 From: Yang Weijiang To: pbonzini@redhat.com, seanjc@google.com, jmattson@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yu.c.zhang@linux.intel.com, Yang Weijiang Subject: [PATCH v15 09/14] KVM: x86: Report CET MSRs as to-be-saved if CET is supported Date: Wed, 3 Feb 2021 19:34:16 +0800 Message-Id: <20210203113421.5759-10-weijiang.yang@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20210203113421.5759-1-weijiang.yang@intel.com> References: <20210203113421.5759-1-weijiang.yang@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Report all CET MSRs, including the synthetic GUEST_SSP MSR, as to-be-saved, e.g. for migration, if CET is supported by KVM. Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Yang Weijiang --- arch/x86/kvm/x86.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6af240d87a33..059e101daf94 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1266,6 +1266,8 @@ static const u32 msrs_to_save_all[] = { MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, MSR_IA32_XSS, + MSR_IA32_U_CET, MSR_IA32_S_CET, MSR_IA32_INT_SSP_TAB, MSR_KVM_GUEST_SSP, + MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP, MSR_IA32_PL3_SSP, }; static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)]; @@ -5828,6 +5830,14 @@ static void kvm_init_msr_list(void) if (!supported_xss) continue; break; + case MSR_KVM_GUEST_SSP: + case MSR_IA32_U_CET: + case MSR_IA32_S_CET: + case MSR_IA32_INT_SSP_TAB: + case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP: + if (!kvm_cet_supported()) + continue; + break; default: break; } -- 2.26.2