Skip to content

Commit

Permalink
bhyve, bhyvectl: Add Hygon Dhyana support.
Browse files Browse the repository at this point in the history
Submitted by:	Pu Wen <[email protected]>
Reviewed by:	jhb
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23554
  • Loading branch information
kostikbel committed Feb 13, 2020
1 parent caab504 commit 5a6d45d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions usr.sbin/bhyve/xmsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions usr.sbin/bhyvectl/bhyvectl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5a6d45d

Please sign in to comment.