MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_svm_features

Function check_svm_features

freebsd/amd64/vmm/amd/svm.c:176–206  ·  view source on GitHub ↗

* Verify that all the features required by bhyve are available. */

Source from the content-addressed store, hash-verified

174 * Verify that all the features required by bhyve are available.
175 */
176static int
177check_svm_features(void)
178{
179 u_int regs[4];
180
181 /* CPUID Fn8000_000A is for SVM */
182 do_cpuid(0x8000000A, regs);
183 svm_feature &= regs[3];
184
185 /*
186 * The number of ASIDs can be configured to be less than what is
187 * supported by the hardware but not more.
188 */
189 if (nasid == 0 || nasid > regs[1])
190 nasid = regs[1];
191 KASSERT(nasid > 1, ("Insufficient ASIDs for guests: %#x", nasid));
192
193 /* bhyve requires the Nested Paging feature */
194 if (!(svm_feature & AMD_CPUID_SVM_NP)) {
195 printf("SVM: Nested Paging feature not available.\n");
196 return (ENXIO);
197 }
198
199 /* bhyve requires the NRIP Save feature */
200 if (!(svm_feature & AMD_CPUID_SVM_NRIP_SAVE)) {
201 printf("SVM: NRIP Save feature not available.\n");
202 return (ENXIO);
203 }
204
205 return (0);
206}
207
208static void
209svm_enable(void *arg __unused)

Callers 1

svm_modinitFunction · 0.85

Calls 2

do_cpuidFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected