Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2020 19:05:14 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357866 - in head/usr.sbin: bhyve bhyvectl
Message-ID:  <202002131905.01DJ5E4D044645@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002131905.01DJ5E4D044645>