[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 27 Apr 2022 12:47:15 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WUWhJgu0Yz9j8XsfOkeyy6+r8LNCGTJ8eRrnaODXvM4=; b=c/jtEPESyU2Q6WNvleloo+iXGZSwmuofPQhe2WM6AOYigBT+7MaKSnvqkZtDjLIxy+IdVH0QZ6RYNlnJW9wEXqNPCqMuunXEUr1xrZsT75jHs/vuND9miIAhvBEiCRyuWc/M3DcTNJ9DGWNJ3Ffz9LeOBZpBSG/4SpPKMoSMNdB0uZRrgazAMYrcLb01ODcIPthQn87kEfIdYv+j4c1nnx1UyRA7tNBRvpBzzjBE4vCifpm4XlSsVl/kYO82SfM2ydJCse5t5VDOwmVAOtOHD7RrT7USqYU5Y/vqzxQT+gea/c51G3tsum5ygTI+r4d6Odq9BTRdPD1u9i7XmItiPQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HNCXDRJ94QlKXBC371x6IIINfAmsfqD9zwGmVQvwWO+LBAqIPMdIgwg32bYP/oekand++FuLWuTikjSaX4jr4gvodzxm4OIZNPOmw9L4HVx6p5u4vM7aVVWVhJEx3JKEj74bUux62p0TxqsfQwCxRHo7bJN08n5M8N64+h5hKDsiE52NhDU5mqpD1bfWDlbekfFKcHTm8zl0tGBV8HxQ8lh6pwrOOaGylrDVAPLtYBqGFAwWElqG0NCn053OS5Tfs3xya9/GYRHJ9cNWFlJBs/Bys6zzPhWBsfWCAnjJy/3Z3dFFXvIPGnRx0D7CS6oqmhISgZ4x5nmMKLupgWnBCQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 10:47:50 +0000
  • Ironport-data: A9a23:UdSpYamd0Ji+hsEmi9FeWB/o5gz1J0RdPkR7XQ2eYbSJt1+Wr1Gzt xJKWz+Abv2KN2bwet5xb4S3/EhXv5bdzYNhSlc4r3hhEiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EoLd9IR2NYy24DlWV3V4 rsenuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYYlwHYPzBnsokQQREAWJxDIpj/JmAPi3q2SCT5xWun3rE5dxLVBtzBqtBv+F9DCdJ6 OASLy0LYlabneWqzbmnS+5qwMM+MM3sO4BZsXZlpd3bJa9+HdafHOOXupkEhl/chegXdRraT 9AeZjd1KgzJfjVEO0sNCYJ4l+Ct7pX6W2MJ+QvM+fdui4TV5FNXyLXgM9jTQcDJY8hKhUO7q jnZ42usV3n2M/Tak1Jp6EmEluLJ2C/2Ro8WPLm57eJxxk2ewHQJDx8bXkf9puO24ma8Ud9CL 00f+gI1sLM/skesS7HVQBmQsHOC+BkGVLJt//YS7QiMzu/P5V+QAGEBFmRFcIZ+6JVwQiE23 FiUmd+vHSZorLCeVXOa8PGTsC+2Pi8Wa2QFYEfoUDc43jUqm6lr5jqnczqpOPfdYgHdcd0o/ w23kQ==
  • Ironport-hdrordr: A9a23:mY40faBRdgzysPLlHehKsceALOsnbusQ8zAXPh9KJCC9I/bzqy nxpp8mPH/P5wr5lktQ++xoX5PwOU80lKQFmLX5WI3PYOCIghrNEGgP1+vfKl7balDDH5BmpM BdmsFFYbWfbGSS5fyKmjVQeOxQpeVvnprY5ts3mBxWPHpXguxbnnBEIzfeNnczaBhNBJI/Gp bZzs1bpwC4cXBSSsigHHEKU8XKutWOzfvdEFc7Li9izDPLoSKj6bb8HRTd9hACUwlXybNn1W TeiQT26oiqrvn+4B7B0G346YhQhbLau61+Lf3JrvJQBiTniw6uaogkc7qevAotqOXq01oumM mkmWZTA+1Dr1fqOk2lqxrk3AftlBw07WX59FOeiXz/5eTkWTMTEaN69M9kWyqcz3BlkMB30a pN0W7cnYFQFwn8kCP04MWNfw12l3CzvWEpnYco/jZiuLMlGfBsRLEkjQ1o+M9qJlO61GlnKp gkMCjk3ocbTbvABEqp/lWGw7SXLwcO91m9Mws/U/euokdrdUBCvjclLfMk7wk9HeoGOv95Ds T/Q9FVfeJ1P7srhZwUPpZxfeKHTkrwfDnrDEW+ZXzaKYBvAQO8l3ew2sR82N2X
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

The following series implements support for MSR_VIRT_SPEC_CTRL
(VIRT_SSBD) on different AMD CPU families.

Note that the support is added backwards, starting with the newer CPUs
that support MSR_SPEC_CTRL and moving to the older ones either using
MSR_VIRT_SPEC_CTRL or the SSBD bit in LS_CFG.

Xen is still free to use it's own SSBD setting, as the selection is
context switched on vm{entry,exit}.

On Zen2 and later, SPEC_CTRL.SSBD should exist and should be used in
preference to VIRT_SPEC_CTRL.SSBD.  However, for migration
compatibility, Xen offers VIRT_SSBD to guests (in the max cpuid policy,
not default) implemented in terms of SPEC_CTRL.SSBD.

On Fam15h thru Zen1, Xen exposes VIRT_SSBD to guests by default to
abstract away the model and/or hypervisor specific differences in
MSR_LS_CFG/MSR_VIRT_SPEC_CTRL.

So the implementation of VIRT_SSBD exposed to HVM guests will use one of
the following underlying mechanisms, in the preference order listed
below:

 * SPEC_CTRL.SSBD: patch 1
 * VIRT_SPEC_CTRL.SSBD: patch 2.
 * Non-architectural way using LS_CFG: patch 3.

Roger Pau Monne (3):
  amd/msr: implement VIRT_SPEC_CTRL for HVM guests on top of SPEC_CTRL
  amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
  amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD

 xen/arch/x86/cpu/amd.c                      | 119 +++++++++++++++++---
 xen/arch/x86/cpuid.c                        |  28 +++++
 xen/arch/x86/hvm/hvm.c                      |   1 +
 xen/arch/x86/hvm/svm/entry.S                |   8 ++
 xen/arch/x86/hvm/svm/svm.c                  |  40 +++++++
 xen/arch/x86/include/asm/amd.h              |   4 +
 xen/arch/x86/include/asm/cpufeatures.h      |   1 +
 xen/arch/x86/include/asm/msr.h              |  14 +++
 xen/arch/x86/msr.c                          |  26 +++++
 xen/arch/x86/spec_ctrl.c                    |  12 +-
 xen/include/public/arch-x86/cpufeatureset.h |   2 +-
 11 files changed, 236 insertions(+), 19 deletions(-)

-- 
2.35.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.