]> Cypherpunks repositories - gostls13.git/commitdiff
internal/cpu: remove unused and not required ppc64(le) feature detection
authorMartin Möhrmann <moehrmann@google.com>
Fri, 26 Oct 2018 16:09:42 +0000 (18:09 +0200)
committerMartin Möhrmann <martisch@uos.de>
Mon, 29 Oct 2018 19:23:48 +0000 (19:23 +0000)
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 <martisch@uos.de>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/internal/cpu/cpu.go
src/internal/cpu/cpu_ppc64x.go

index 5e38ff7703b577bf3b00fe4713cfd0202d957d2e..e210a6db9ec0bda6f113fb697dacf3771e829207 100644 (file)
@@ -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
index 6bb83bb66715ae015f66699c5f40313d799be3b1..1e7959b30658b887ab62d4a7bed4605240d71802 100644 (file)
@@ -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)