bhyve, bhyvectl: Add Hygon Dhyana support.

Submitted by:	Pu Wen <puwen@hygon.cn>
Reviewed by:	jhb
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23554
This commit is contained in:
kib 2020-02-13 19:05:14 +00:00
parent c159666d2f
commit bc38ef44cf
2 changed files with 7 additions and 3 deletions

View File

@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include "debug.h"
#include "xmsr.h"
static int cpu_vendor_intel, cpu_vendor_amd;
static int cpu_vendor_intel, cpu_vendor_amd, cpu_vendor_hygon;
int
emulate_wrmsr(struct vmctx *ctx, int vcpu, uint32_t num, uint64_t val)
@ -64,7 +64,7 @@ emulate_wrmsr(struct vmctx *ctx, int vcpu, uint32_t num, uint64_t val)
default:
break;
}
} else if (cpu_vendor_amd) {
} else if (cpu_vendor_amd || cpu_vendor_hygon) {
switch (num) {
case MSR_HWCR:
/*
@ -128,7 +128,7 @@ emulate_rdmsr(struct vmctx *ctx, int vcpu, uint32_t num, uint64_t *val)
error = -1;
break;
}
} else if (cpu_vendor_amd) {
} else if (cpu_vendor_amd || cpu_vendor_hygon) {
switch (num) {
case MSR_BIOS_SIGN:
*val = 0;
@ -225,6 +225,8 @@ init_msr(void)
error = 0;
if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
cpu_vendor_amd = 1;
} else if (strcmp(cpu_vendor, "HygonGenuine") == 0) {
cpu_vendor_hygon = 1;
} else if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
cpu_vendor_intel = 1;
} else {

View File

@ -657,6 +657,8 @@ cpu_vendor_intel(void)
if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
return (false);
} else if (strcmp(cpu_vendor, "HygonGenuine") == 0) {
return (false);
} else if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
return (true);
} else {