svn commit: r357866 - in head/usr.sbin: bhyve bhyvectl

Konstantin Belousov kib at FreeBSD.org
Thu Feb 13 19:05:14 UTC 2020


Author: kib
Date: Thu Feb 13 19:05:14 2020
New Revision: 357866
URL: https://svnweb.freebsd.org/changeset/base/357866

Log:
  bhyve, bhyvectl: Add Hygon Dhyana support.
  
  Submitted by:	Pu Wen <puwen at hygon.cn>
  Reviewed by:	jhb
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D23554

Modified:
  head/usr.sbin/bhyve/xmsr.c
  head/usr.sbin/bhyvectl/bhyvectl.c

Modified: head/usr.sbin/bhyve/xmsr.c
==============================================================================
--- head/usr.sbin/bhyve/xmsr.c	Thu Feb 13 19:03:12 2020	(r357865)
+++ head/usr.sbin/bhyve/xmsr.c	Thu Feb 13 19:05:14 2020	(r357866)
@@ -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 nu
 		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 nu
 			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 {

Modified: head/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- head/usr.sbin/bhyvectl/bhyvectl.c	Thu Feb 13 19:03:12 2020	(r357865)
+++ head/usr.sbin/bhyvectl/bhyvectl.c	Thu Feb 13 19:05:14 2020	(r357866)
@@ -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 {


More information about the svn-src-all mailing list