diff options
Diffstat (limited to 'vendor/github.com/klauspost/cpuid')
-rw-r--r-- | vendor/github.com/klauspost/cpuid/README.md | 2 | ||||
-rw-r--r-- | vendor/github.com/klauspost/cpuid/cpuid.go | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/vendor/github.com/klauspost/cpuid/README.md b/vendor/github.com/klauspost/cpuid/README.md index b2b6bee87..a7fb41fbe 100644 --- a/vendor/github.com/klauspost/cpuid/README.md +++ b/vendor/github.com/klauspost/cpuid/README.md @@ -83,6 +83,8 @@ Package home: https://github.com/klauspost/cpuid * **MSVM** (Microsoft Hyper-V or Windows Virtual PC) * **VMware** * **XenHVM** +* **Bhyve** +* **Hygon** # installing diff --git a/vendor/github.com/klauspost/cpuid/cpuid.go b/vendor/github.com/klauspost/cpuid/cpuid.go index 60c681bed..db9591321 100644 --- a/vendor/github.com/klauspost/cpuid/cpuid.go +++ b/vendor/github.com/klauspost/cpuid/cpuid.go @@ -26,6 +26,8 @@ const ( MSVM // Microsoft Hyper-V or Windows Virtual PC VMware XenHVM + Bhyve + Hygon ) const ( @@ -472,6 +474,11 @@ func (c CPUInfo) AMD() bool { return c.VendorID == AMD } +// Hygon returns true if vendor is recognized as Hygon +func (c CPUInfo) Hygon() bool { + return c.VendorID == Hygon +} + // Transmeta returns true if vendor is recognized as Transmeta func (c CPUInfo) Transmeta() bool { return c.VendorID == Transmeta @@ -527,7 +534,7 @@ func (c CPUInfo) LogicalCPU() int { // have many false negatives. func (c CPUInfo) VM() bool { switch c.VendorID { - case MSVM, KVM, VMware, XenHVM: + case MSVM, KVM, VMware, XenHVM, Bhyve: return true } return false @@ -625,7 +632,7 @@ func logicalCores() int { } _, b, _, _ := cpuidex(0xb, 1) return int(b & 0xffff) - case AMD: + case AMD, Hygon: _, b, _, _ := cpuid(1) return int((b >> 16) & 0xff) default: @@ -647,7 +654,7 @@ func physicalCores() int { switch vendorID() { case Intel: return logicalCores() / threadsPerCore() - case AMD: + case AMD, Hygon: if maxExtendedFunction() >= 0x80000008 { _, _, c, _ := cpuid(0x80000008) return int(c&0xff) + 1 @@ -670,6 +677,8 @@ var vendorMapping = map[string]Vendor{ "Microsoft Hv": MSVM, "VMwareVMware": VMware, "XenVMMXenVMM": XenHVM, + "bhyve bhyve ": Bhyve, + "HygonGenuine": Hygon, } func vendorID() Vendor { @@ -742,7 +751,7 @@ func (c *CPUInfo) cacheSize() { c.Cache.L3 = size } } - case AMD: + case AMD, Hygon: // Untested. if maxExtendedFunction() < 0x80000005 { return |