src/hotspot/cpu/aarch64/vm_version_aarch64.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 47216 71c04702a3d5
child 53989 247f1a85d736
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     3
 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     5
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     8
 * published by the Free Software Foundation.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
     9
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    14
 * accompanied this code).
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    15
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    19
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    22
 * questions.
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    23
 *
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    24
 */
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#ifndef CPU_AARCH64_VM_VERSION_AARCH64_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    27
#define CPU_AARCH64_VM_VERSION_AARCH64_HPP
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    28
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    29
#include "runtime/globals_extension.hpp"
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    30
#include "runtime/vm_version.hpp"
40655
9f644073d3a0 8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents: 38714
diff changeset
    31
#include "utilities/sizes.hpp"
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    32
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    33
class VM_Version : public Abstract_VM_Version {
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    34
  friend class JVMCIVMStructs;
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    35
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    36
protected:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    37
  static int _cpu;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    38
  static int _model;
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    39
  static int _model2;
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    40
  static int _variant;
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    41
  static int _revision;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    42
  static int _stepping;
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    43
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
    44
  struct PsrInfo {
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
    45
    uint32_t dczid_el0;
38714
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
    46
    uint32_t ctr_el0;
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
    47
  };
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
    48
  static PsrInfo _psr_info;
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    49
  static void get_processor_features();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    50
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    51
public:
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    52
  // Initialization
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    53
  static void initialize();
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    54
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    55
  // Asserts
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    56
  static void assert_is_initialized() {
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    57
  }
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
    58
46954
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    59
  static bool expensive_load(int ld_size, int scale) {
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    60
    if (cpu_family() == CPU_ARM) {
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    61
      // Half-word load with index shift by 1 (aka scale is 2) has
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    62
      // extra cycle latency, e.g. ldrsh w0, [x1,w2,sxtw #1].
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    63
      if (ld_size == 2 && scale == 2) {
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    64
        return true;
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    65
      }
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    66
    }
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    67
    return false;
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    68
  }
6ad56f307810 8185786: AArch64: disable some address reshapings.
njian
parents: 40655
diff changeset
    69
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    70
  enum Family {
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    71
    CPU_ARM       = 'A',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    72
    CPU_BROADCOM  = 'B',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    73
    CPU_CAVIUM    = 'C',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    74
    CPU_DEC       = 'D',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    75
    CPU_INFINEON  = 'I',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    76
    CPU_MOTOROLA  = 'M',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    77
    CPU_NVIDIA    = 'N',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    78
    CPU_AMCC      = 'P',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    79
    CPU_QUALCOM   = 'Q',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    80
    CPU_MARVELL   = 'V',
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    81
    CPU_INTEL     = 'i',
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    82
  };
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    83
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    84
  enum Feature_Flag {
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    85
    CPU_FP           = (1<<0),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    86
    CPU_ASIMD        = (1<<1),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    87
    CPU_EVTSTRM      = (1<<2),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    88
    CPU_AES          = (1<<3),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    89
    CPU_PMULL        = (1<<4),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    90
    CPU_SHA1         = (1<<5),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    91
    CPU_SHA2         = (1<<6),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    92
    CPU_CRC32        = (1<<7),
37269
5c2c4e5bb067 8151775: aarch64: add support for 8.1 LSE atomic operations
enevill
parents: 35148
diff changeset
    93
    CPU_LSE          = (1<<8),
38714
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
    94
    CPU_STXR_PREFETCH= (1 << 29),
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    95
    CPU_A53MAC       = (1 << 30),
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    96
    CPU_DMB_ATOMICS  = (1 << 31),
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 30429
diff changeset
    97
  };
30429
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    98
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
    99
  static int cpu_family()                     { return _cpu; }
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
   100
  static int cpu_model()                      { return _model; }
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
   101
  static int cpu_model2()                     { return _model2; }
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
   102
  static int cpu_variant()                    { return _variant; }
c980154ed1a3 8079203: AARCH64: Need to cater for different partner implementations
enevill
parents: 29183
diff changeset
   103
  static int cpu_revision()                   { return _revision; }
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   104
  static ByteSize dczid_el0_offset() { return byte_offset_of(PsrInfo, dczid_el0); }
38714
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   105
  static ByteSize ctr_el0_offset()   { return byte_offset_of(PsrInfo, ctr_el0); }
38143
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   106
  static bool is_zva_enabled() {
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   107
    // Check the DZP bit (bit 4) of dczid_el0 is zero
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   108
    // and block size (bit 0~3) is not zero.
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   109
    return ((_psr_info.dczid_el0 & 0x10) == 0 &&
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   110
            (_psr_info.dczid_el0 & 0xf) != 0);
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   111
  }
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   112
  static int zva_length() {
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   113
    assert(is_zva_enabled(), "ZVA not available");
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   114
    return 4 << (_psr_info.dczid_el0 & 0xf);
3b732f17ea7d 8155617: aarch64: ClearArray does not use DC ZVA
enevill
parents: 37269
diff changeset
   115
  }
38714
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   116
  static int icache_line_size() {
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   117
    return (1 << (_psr_info.ctr_el0 & 0x0f)) * 4;
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   118
  }
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   119
  static int dcache_line_size() {
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   120
    return (1 << ((_psr_info.ctr_el0 >> 16) & 0x0f)) * 4;
170464570e45 8157841: aarch64: prefetch ignores cache line size
enevill
parents: 38143
diff changeset
   121
  }
29183
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   122
};
0cc8699f7372 8068054: AARCH64: Assembler interpreter, shared runtime
aph
parents:
diff changeset
   123
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
   124
#endif // CPU_AARCH64_VM_VERSION_AARCH64_HPP