x86/hvm: Expose Automatic IBRS to guests

Expose AutoIBRS to HVM guests. EFER is swapped by VMRUN, so Xen only has to
make sure writes to EFER.AIBRSE are gated on the feature being exposed.

Hide EFER.AIBRSE from PV guests.  Xen currently has no concept of per-PV-guest
EFER settings.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Alejandro Vallejo authored and Andrew Cooper committed 2023-05-30 18:24:07 +01:00
1 parent 8347d6bb29
commit defaf65163
4 files changed
+8 -4

No files matched your search

+3
View File
@@ -936,6 +936,9 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
if ( (value & EFER_FFXSE) && !p->extd.ffxsr )
return "FFXSE without feature";
if ( (value & EFER_AIBRSE) && !p->extd.auto_ibrs )
return "AutoIBRS without feature";
return NULL;
}
+2 -1
View File
@@ -178,7 +178,8 @@
#define EFER_AIBRSE (_AC(1, ULL) << 21) /* Automatic IBRS Enable */
#define EFER_KNOWN_MASK \
(EFER_SCE | EFER_LME | EFER_LMA | EFER_NXE | EFER_SVME | EFER_FFXSE)
(EFER_SCE | EFER_LME | EFER_LMA | EFER_NXE | EFER_SVME | EFER_FFXSE | \
EFER_AIBRSE)
#define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target */
#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */
+2 -2
View File
@@ -853,8 +853,8 @@ static uint64_t guest_efer(const struct domain *d)
{
uint64_t val;
/* Hide unknown bits, and unconditionally hide SVME from guests. */
val = read_efer() & EFER_KNOWN_MASK & ~EFER_SVME;
/* Hide unknown bits, and unconditionally hide SVME and AIBRSE from guests. */
val = read_efer() & EFER_KNOWN_MASK & ~(EFER_SVME | EFER_AIBRSE);
/*
* Hide the 64-bit features from 32-bit guests. SCE has
* vendor-dependent behaviour.
+1 -1
View File
@@ -287,7 +287,7 @@ XEN_CPUFEATURE(AVX_IFMA, 10*32+23) /*A AVX-IFMA Instructions */
/* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
XEN_CPUFEATURE(LFENCE_DISPATCH, 11*32+ 2) /*A LFENCE always serializing */
XEN_CPUFEATURE(NSCB, 11*32+ 6) /*A Null Selector Clears Base (and limit too) */
XEN_CPUFEATURE(AUTO_IBRS, 11*32+ 8) /* Automatic IBRS */
XEN_CPUFEATURE(AUTO_IBRS, 11*32+ 8) /*S Automatic IBRS */
XEN_CPUFEATURE(CPUID_USER_DIS, 11*32+17) /* CPUID disable for CPL > 0 software */
/* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.