* Verify that all the features required by bhyve are available. */
| 174 | * Verify that all the features required by bhyve are available. |
| 175 | */ |
| 176 | static int |
| 177 | check_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 | |
| 208 | static void |
| 209 | svm_enable(void *arg __unused) |
no test coverage detected