Page MenuHomeFreeBSD

D61642.1794944974.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61642.1794944974.diff

diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -1180,9 +1180,14 @@
newval &= ~0xFE; /* clear the Read-As-Zero (RAZ) bits */
changed = oldval ^ newval;
- if (newval & EFER_MBZ_BITS)
+ if (newval & EFER_MBZ_BITS & ~EFER_AIBRSE)
goto gpf;
+ if (newval & EFER_AIBRSE) {
+ if ((amd_extended_feature2 & AMDFE2_AUTOIBRS) == 0)
+ goto gpf;
+ }
+
/* APMv2 Table 14-5 "Long-Mode Consistency Checks" */
if (changed & EFER_LME) {
if (state->cr0 & CR0_PG)
diff --git a/sys/amd64/vmm/x86.h b/sys/amd64/vmm/x86.h
--- a/sys/amd64/vmm/x86.h
+++ b/sys/amd64/vmm/x86.h
@@ -53,6 +53,7 @@
#define CPUID_8000_0008 (0x80000008)
#define CPUID_8000_001D (0x8000001D)
#define CPUID_8000_001E (0x8000001E)
+#define CPUID_8000_0021 (0x80000021)
#define CPUID_8000_0022 (0x80000022)
/*
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -299,6 +299,24 @@
regs[3] = 0;
break;
+ case CPUID_8000_0021:
+ /*
+ * Pass through only features that need no support
+ * from vmm, plus Automatic IBRS, which svm_write_efer()
+ * accepts.
+ */
+ cpuid_count(func, param, regs);
+ regs[0] &= AMDFE2_NO_NESTED_DATA_BP |
+ AMDFE2_FSGSKGSBASE_NS | AMDFE2_LFENCE_SERIALIZE |
+ AMDFE2_VERW_CLEAR | AMDFE2_NULL_SEL_CLR_BASE |
+ AMDFE2_AUTOIBRS | AMDFE2_PREFETCHI |
+ AMDFE2_SRSO_NO | AMDFE2_SRSO_USER_KERNEL_NO;
+ regs[1] = 0;
+ regs[2] &= AMDFE2_ECX_TSA_SQ_NO |
+ AMDFE2_ECX_TSA_L1_NO | AMDFE2_ECX_TSA_FILL_NO;
+ regs[3] = 0;
+ break;
+
case CPUID_8000_0022:
/*
* AMD uses this leaf to advertise performance

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 17, 7:49 PM (22 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41806222
Default Alt Text
D61642.1794944974.diff (1 KB)

Event Timeline