From: Martin Möhrmann Date: Fri, 26 Oct 2018 16:09:42 +0000 (+0200) Subject: internal/cpu: remove unused and not required ppc64(le) feature detection X-Git-Tag: go1.12beta1~598 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8fc99d20f3377c7c5c1dba51b1be865ff61483b0;p=gostls13.git internal/cpu: remove unused and not required ppc64(le) feature detection Minimum Go requirement for ppc64(le) architecture support is POWER8. https://github.com/golang/go/wiki/MinimumRequirements#ppc64-big-endian Reduce CPU features supported in internal/cpu to those needed to test minimum requirements and cpu feature kernel support for ppc64(le). Currently no internal/cpu feature variables are used to guard code from using unsupported instructions. The IsPower9 feature variable and detection is kept as it will soon be used to guard code execution. Reducing the set of detected CPU features for ppc64(le) makes implementing Go support for new operating systems easier as CPU feature detection for ppc64(le) needs operating system support (e.g. hwcap on Linux and getsystemcfg syscall on AIX). Change-Id: Ic4c17b31610970e481cd139c657da46507391d1d Reviewed-on: https://go-review.googlesource.com/c/145117 Run-TryBot: Martin Möhrmann TryBot-Result: Gobot Gobot Reviewed-by: Carlos Eduardo Seo Reviewed-by: Brad Fitzpatrick --- diff --git a/src/internal/cpu/cpu.go b/src/internal/cpu/cpu.go index 5e38ff7703..e210a6db9e 100644 --- a/src/internal/cpu/cpu.go +++ b/src/internal/cpu/cpu.go @@ -47,27 +47,18 @@ type x86 struct { var PPC64 ppc64 -// For ppc64x, it is safe to check only for ISA level starting on ISA v3.00, +// For ppc64(le), it is safe to check only for ISA level starting on ISA v3.00, // since there are no optional categories. There are some exceptions that also // require kernel support to work (darn, scv), so there are feature bits for -// those as well. The minimum processor requirement is POWER8 (ISA 2.07), so we -// maintain some of the old feature checks for optional categories for -// safety. +// those as well. The minimum processor requirement is POWER8 (ISA 2.07). // The struct is padded to avoid false sharing. type ppc64 struct { - _ CacheLinePad - HasVMX bool // Vector unit (Altivec) - HasDFP bool // Decimal Floating Point unit - HasVSX bool // Vector-scalar unit - HasHTM bool // Hardware Transactional Memory - HasISEL bool // Integer select - HasVCRYPTO bool // Vector cryptography - HasHTMNOSC bool // HTM: kernel-aborted transaction in syscalls - HasDARN bool // Hardware random number generator (requires kernel enablement) - HasSCV bool // Syscall vectored (requires kernel enablement) - IsPOWER8 bool // ISA v2.07 (POWER8) - IsPOWER9 bool // ISA v3.00 (POWER9) - _ CacheLinePad + _ CacheLinePad + HasDARN bool // Hardware random number generator (requires kernel enablement) + HasSCV bool // Syscall vectored (requires kernel enablement) + IsPOWER8 bool // ISA v2.07 (POWER8) + IsPOWER9 bool // ISA v3.00 (POWER9) + _ CacheLinePad } var ARM arm diff --git a/src/internal/cpu/cpu_ppc64x.go b/src/internal/cpu/cpu_ppc64x.go index 6bb83bb667..1e7959b306 100644 --- a/src/internal/cpu/cpu_ppc64x.go +++ b/src/internal/cpu/cpu_ppc64x.go @@ -21,44 +21,22 @@ const ( _PPC_FEATURE2_ARCH_3_00 = 0x00800000 // CPU features - _PPC_FEATURE_HAS_ALTIVEC = 0x10000000 - _PPC_FEATURE_HAS_DFP = 0x00000400 - _PPC_FEATURE_HAS_VSX = 0x00000080 - _PPC_FEATURE2_HAS_HTM = 0x40000000 - _PPC_FEATURE2_HAS_ISEL = 0x08000000 - _PPC_FEATURE2_HAS_VEC_CRYPTO = 0x02000000 - _PPC_FEATURE2_HTM_NOSC = 0x01000000 - _PPC_FEATURE2_DARN = 0x00200000 - _PPC_FEATURE2_SCV = 0x00100000 + _PPC_FEATURE2_DARN = 0x00200000 + _PPC_FEATURE2_SCV = 0x00100000 ) func doinit() { options = []option{ - {Name: "htm", Feature: &PPC64.HasHTM}, - {Name: "htmnosc", Feature: &PPC64.HasHTMNOSC}, {Name: "darn", Feature: &PPC64.HasDARN}, {Name: "scv", Feature: &PPC64.HasSCV}, + {Name: "power9", Feature: &PPC64.IsPOWER9}, // These capabilities should always be enabled on ppc64 and ppc64le: {Name: "power8", Feature: &PPC64.IsPOWER8, Required: true}, - {Name: "vmx", Feature: &PPC64.HasVMX, Required: true}, - {Name: "dfp", Feature: &PPC64.HasDFP, Required: true}, - {Name: "vsx", Feature: &PPC64.HasVSX, Required: true}, - {Name: "isel", Feature: &PPC64.HasISEL, Required: true}, - {Name: "vcrypto", Feature: &PPC64.HasVCRYPTO, Required: true}, } - // HWCAP feature bits - PPC64.HasVMX = isSet(HWCap, _PPC_FEATURE_HAS_ALTIVEC) - PPC64.HasDFP = isSet(HWCap, _PPC_FEATURE_HAS_DFP) - PPC64.HasVSX = isSet(HWCap, _PPC_FEATURE_HAS_VSX) - // HWCAP2 feature bits PPC64.IsPOWER8 = isSet(HWCap2, _PPC_FEATURE2_ARCH_2_07) - PPC64.HasHTM = isSet(HWCap2, _PPC_FEATURE2_HAS_HTM) - PPC64.HasISEL = isSet(HWCap2, _PPC_FEATURE2_HAS_ISEL) - PPC64.HasVCRYPTO = isSet(HWCap2, _PPC_FEATURE2_HAS_VEC_CRYPTO) - PPC64.HasHTMNOSC = isSet(HWCap2, _PPC_FEATURE2_HTM_NOSC) PPC64.IsPOWER9 = isSet(HWCap2, _PPC_FEATURE2_ARCH_3_00) PPC64.HasDARN = isSet(HWCap2, _PPC_FEATURE2_DARN) PPC64.HasSCV = isSet(HWCap2, _PPC_FEATURE2_SCV)