summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/sys
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/intel/sys')
-rw-r--r--usr/src/uts/intel/sys/archsystm.h16
-rw-r--r--usr/src/uts/intel/sys/controlregs.h34
-rw-r--r--usr/src/uts/intel/sys/cpu_module.h5
-rw-r--r--usr/src/uts/intel/sys/debugreg.h7
-rw-r--r--usr/src/uts/intel/sys/machbrand.h12
-rw-r--r--usr/src/uts/intel/sys/mc.h27
-rw-r--r--usr/src/uts/intel/sys/mc_intel.h58
-rw-r--r--usr/src/uts/intel/sys/segments.h4
-rw-r--r--usr/src/uts/intel/sys/ucontext.h15
-rw-r--r--usr/src/uts/intel/sys/x86_archext.h37
10 files changed, 191 insertions, 24 deletions
diff --git a/usr/src/uts/intel/sys/archsystm.h b/usr/src/uts/intel/sys/archsystm.h
index 4c210f024f..55c387f9b1 100644
--- a/usr/src/uts/intel/sys/archsystm.h
+++ b/usr/src/uts/intel/sys/archsystm.h
@@ -183,13 +183,17 @@ extern void fakesoftint(void);
extern void *plat_traceback(void *);
/*
- * The following two macros are the four byte instruction sequence of stac, ret
- * and clac, ret. These are used in startup_smap() as a part of properly setting
- * up the valid instructions. For more information on SMAP, see
- * uts/intel/ia32/ml/copy.s.
+ * The following two macros are the four byte instruction sequence of stac, nop
+ * and clac, nop. These are used in startup_smap() and hotinline_smap() as a
+ * part of properly setting up the valid instructions. For more information on
+ * SMAP, see uts/intel/ia32/ml/copy.s, uts/i86pc/os/machdep.c and
+ * uts/common/os/modctl.c.
+ *
+ * Note that smap_disable and smap_enable are resolved to stubs at compile time,
+ * but inlined at runtime by do_hotinlines() in uts/i86pc/os/machdep.c.
*/
-#define SMAP_CLAC_INSTR 0xc3ca010f
-#define SMAP_STAC_INSTR 0xc3cb010f
+#define SMAP_CLAC_INSTR 0x90ca010f
+#define SMAP_STAC_INSTR 0x90cb010f
extern void smap_disable(void);
extern void smap_enable(void);
diff --git a/usr/src/uts/intel/sys/controlregs.h b/usr/src/uts/intel/sys/controlregs.h
index fe0cf687b4..0be7b3b650 100644
--- a/usr/src/uts/intel/sys/controlregs.h
+++ b/usr/src/uts/intel/sys/controlregs.h
@@ -86,8 +86,8 @@ extern "C" {
/* CR3 Register */
-#define CR3_PCD 0x00000010 /* cache disable */
-#define CR3_PWT 0x00000008 /* write through */
+#define CR3_PCD 0x00000010 /* cache disable */
+#define CR3_PWT 0x00000008 /* write through */
#if defined(_ASM)
#define CR3_NOINVL_BIT 0x8000000000000000
#else
@@ -110,18 +110,22 @@ extern "C" {
#define CR4_PCE 0x0100 /* perf-monitoring counter enable */
#define CR4_OSFXSR 0x0200 /* OS fxsave/fxrstor support */
#define CR4_OSXMMEXCPT 0x0400 /* OS unmasked exception support */
- /* 0x0800 reserved */
+#define CR4_UMIP 0x0800 /* user-mode instruction prevention */
/* 0x1000 reserved */
-#define CR4_VMXE 0x2000
-#define CR4_SMXE 0x4000
+#define CR4_VMXE 0x2000 /* VMX enable */
+#define CR4_SMXE 0x4000 /* SMX enable */
+ /* 0x8000 reserved */
+#define CR4_FSGSBASE 0x10000 /* FSGSBASE enable */
#define CR4_PCIDE 0x20000 /* PCID enable */
#define CR4_OSXSAVE 0x40000 /* OS xsave/xrestore support */
#define CR4_SMEP 0x100000 /* NX for user pages in kernel */
#define CR4_SMAP 0x200000 /* kernel can't access user pages */
+#define CR4_PKE 0x400000 /* protection key enable */
#define FMT_CR4 \
- "\20\26smap\25smep\23osxsav\22pcide" \
- "\17smxe\16vmxe\13xmme\12fxsr\11pce\10pge" \
+ "\20\27pke\26smap\25smep\23osxsav" \
+ "\22pcide\20fsgsbase\17smxe\16vmxe" \
+ "\14umip\13xmme\12fxsr\11pce\10pge" \
"\7mce\6pae\5pse\4de\3tsd\2pvi\1vme"
/*
@@ -158,7 +162,9 @@ extern "C" {
#define MSR_AMD_EFER 0xc0000080 /* extended feature enable MSR */
+#define AMD_EFER_TCE 0x8000 /* translation cache extension */
#define AMD_EFER_FFXSR 0x4000 /* fast fxsave/fxrstor */
+#define AMD_EFER_LMSLE 0x2000 /* long mode segment limit enable */
#define AMD_EFER_SVME 0x1000 /* svm enable */
#define AMD_EFER_NXE 0x0800 /* no-execute enable */
#define AMD_EFER_LMA 0x0400 /* long mode active (read-only) */
@@ -166,7 +172,7 @@ extern "C" {
#define AMD_EFER_SCE 0x0001 /* system call extensions */
#define FMT_AMD_EFER \
- "\20\17ffxsr\15svme\14nxe\13lma\11lme\1sce"
+ "\20\20tce\17ffxsr\16lmsle\15svme\14nxe\13lma\11lme\1sce"
/* AMD's SYSCFG register */
@@ -194,6 +200,18 @@ extern "C" {
#define MSR_AMD_KGSBASE 0xc0000102 /* swapgs swaps this with gsbase */
#define MSR_AMD_TSCAUX 0xc0000103 /* %ecx value on rdtscp insn */
+
+/* AMD's SVM MSRs */
+
+#define MSR_AMD_VM_CR 0xc0010114 /* SVM global control */
+#define MSR_AMD_VM_HSAVE_PA 0xc0010117 /* SVM host save area address */
+
+#define AMD_VM_CR_DPD (1 << 0)
+#define AMD_VM_CR_R_INIT (1 << 1)
+#define AMD_VM_CR_DIS_A20M (1 << 2)
+#define AMD_VM_CR_LOCK (1 << 3)
+#define AMD_VM_CR_SVMDIS (1 << 4)
+
/* AMD's configuration MSRs, weakly documented in the revision guide */
#define MSR_AMD_DC_CFG 0xc0011022
diff --git a/usr/src/uts/intel/sys/cpu_module.h b/usr/src/uts/intel/sys/cpu_module.h
index c227acacd2..ad5308d28a 100644
--- a/usr/src/uts/intel/sys/cpu_module.h
+++ b/usr/src/uts/intel/sys/cpu_module.h
@@ -22,7 +22,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
*/
#ifndef _SYS_CPU_MODULE_H
@@ -67,7 +67,8 @@ typedef enum cmi_errno {
CMIERR_MC_RSRCNOTPRESENT, /* Resource not present in system */
CMIERR_MC_ADDRBITS, /* Too few valid addr bits */
CMIERR_MC_INVALUNUM, /* Invalid input unum */
- CMIERR_MC_PARTIALUNUMTOPA /* unum to pa reflected physaddr */
+ CMIERR_MC_PARTIALUNUMTOPA, /* unum to pa reflected physaddr */
+ CMIERR_MC_NOTDIMMADDR /* Address not backed by DRAM */
} cmi_errno_t;
/*
diff --git a/usr/src/uts/intel/sys/debugreg.h b/usr/src/uts/intel/sys/debugreg.h
index b537076d26..8528a293ab 100644
--- a/usr/src/uts/intel/sys/debugreg.h
+++ b/usr/src/uts/intel/sys/debugreg.h
@@ -26,6 +26,9 @@
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright (c) 2018, Joyent, Inc. All rights reserved.
+ */
#ifndef _SYS_DEBUGREG_H
#define _SYS_DEBUGREG_H
@@ -57,6 +60,7 @@ extern "C" {
#define DR_ICEALSO 0x2000 /* Flag bit reserved for in-circuit-emulator */
#define DR_SINGLESTEP 0x4000 /* Trap resulting from the single-step flag */
#define DR_TASKSWITCH 0x8000 /* Trap resulting from a task-switch */
+#define DR_IN_RTM 0x10000 /* Trap inside an RTM region */
/*
* dr7 controls the rest of the debug registers.
@@ -73,6 +77,8 @@ extern "C" {
#define DR_CONTROL_RESERVED 0xFC00 /* Bits reserved by Intel */
#define DR_LOCAL_SLOWDOWN 0x100 /* Slow the pipeline for ldt addrs */
#define DR_GLOBAL_SLOWDOWN 0x200 /* Slow the pipeline for gdt addrs */
+#define DR_RTM 0x800 /* Restricted Transactional Memory */
+#define DR_GENERAL_DETECT 0x2000 /* General Detect Enable */
#define DR_LOCAL_ENABLE_SHIFT 0 /* Additional shift: local enable */
#define DR_GLOBAL_ENABLE_SHIFT 1 /* Additional shift: global enable */
@@ -95,6 +101,7 @@ extern "C" {
#define DR_LEN_1 0x0 /* Settings for data length */
#define DR_LEN_2 0x4
#define DR_LEN_4 0xC
+#define DR_LEN_8 0x8
#ifdef __cplusplus
}
diff --git a/usr/src/uts/intel/sys/machbrand.h b/usr/src/uts/intel/sys/machbrand.h
index 3f9ebdb6b7..ad7f631649 100644
--- a/usr/src/uts/intel/sys/machbrand.h
+++ b/usr/src/uts/intel/sys/machbrand.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2016 Joyent, Inc.
*/
#ifndef _SYS_MACHBRAND_H
@@ -32,20 +33,25 @@ extern "C" {
#ifndef _ASM
#include <sys/model.h>
+#include <sys/thread.h>
struct brand_mach_ops {
void (*b_sysenter)(void);
+ void (*b_int80)(void);
void (*b_int91)(void);
void (*b_syscall)(void);
void (*b_syscall32)(void);
+ greg_t (*b_fixsegreg)(greg_t, model_t);
+ uintptr_t (*b_fsbase)(klwp_t *, uintptr_t);
};
#endif /* _ASM */
#define BRAND_CB_SYSENTER 0
-#define BRAND_CB_INT91 1
-#define BRAND_CB_SYSCALL 2
-#define BRAND_CB_SYSCALL32 3
+#define BRAND_CB_INT80 1
+#define BRAND_CB_INT91 2
+#define BRAND_CB_SYSCALL 3
+#define BRAND_CB_SYSCALL32 4
#ifdef __cplusplus
}
diff --git a/usr/src/uts/intel/sys/mc.h b/usr/src/uts/intel/sys/mc.h
index 27ef52684d..d4815b515f 100644
--- a/usr/src/uts/intel/sys/mc.h
+++ b/usr/src/uts/intel/sys/mc.h
@@ -21,12 +21,13 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2019 Joyent, Inc.
+ */
#ifndef _SYS_MC_H
#define _SYS_MC_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Public interfaces exposed by the memory controller driver
*/
@@ -63,6 +64,9 @@ typedef struct mc_unum {
#define MC_IOC_SNAPSHOT_INFO (MC_IOC | 1)
#define MC_IOC_SNAPSHOT (MC_IOC | 2)
#define MC_IOC_ONLINESPARE_EN (MC_IOC | 4)
+#define MC_IOC_DECODE_PA (MC_IOC | 5)
+#define MC_IOC_DECODE_SNAPSHOT_INFO (MC_IOC | 6)
+#define MC_IOC_DECODE_SNAPSHOT (MC_IOC | 7)
/*
* Prior to requesting a copy of the snapshot, consumers are advised to request
@@ -81,6 +85,25 @@ typedef struct mc_snapshot_info {
uint_t mcs_gen; /* snapshot generation number */
} mc_snapshot_info_t;
+/*
+ * Data used to simulate encoding or decoding of a physical / DIMM address.
+ */
+typedef struct mc_encode_ioc {
+ uint64_t mcei_pa;
+ uint64_t mcei_errdata;
+ uint32_t mcei_err;
+ uint32_t mcei_board;
+ uint32_t mcei_chip;
+ uint32_t mcei_mc;
+ uint32_t mcei_chan;
+ uint32_t mcei_dimm;
+ uint64_t mcei_rank_addr;
+ uint32_t mcei_rank;
+ uint32_t mcei_row;
+ uint32_t mcei_column;
+ uint32_t mcei_pad;
+} mc_encode_ioc_t;
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/uts/intel/sys/mc_intel.h b/usr/src/uts/intel/sys/mc_intel.h
index f0c83b1d8b..4c43d3d695 100644
--- a/usr/src/uts/intel/sys/mc_intel.h
+++ b/usr/src/uts/intel/sys/mc_intel.h
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2019 Joyent, Inc.
*/
#ifndef _MC_INTEL_H
@@ -35,6 +36,7 @@ extern "C" {
#define MCINTEL_NVLIST_VERSTR "mcintel-nvlist-version"
#define MCINTEL_NVLIST_VERS0 0
+#define MCINTEL_NVLIST_VERS1 1
#define MCINTEL_NVLIST_VERS MCINTEL_NVLIST_VERS0
@@ -60,6 +62,62 @@ extern "C" {
#define MCINTEL_NVLIST_PARTNO "dimm-part-number"
#define MCINTEL_NVLIST_REV "dimm-part-rev"
+/*
+ * Version 1 payload. Whereas the version 0 payload uses a flat name space, we
+ * instead opt to use a hierarchical name space. This means that we can know how
+ * many devices there are at any level, as each level has this. Effectively,
+ * this means that we have an nvlist structure, for a socket that looks like:
+ *
+ * socket
+ * string version
+ * uint8_t num-memory-controllers
+ * nvlist array memory-controller[]
+ * uint8_t num-channels
+ * boolean ecc
+ * string page policy
+ * string lockstep || independent
+ * nvlist array channel[]
+ * uint8_t dpc
+ * nvlist array dimm[]
+ * boolean_t present;
+ * uint32_t ncolumns
+ * uint32_t nrows
+ * uint64_t density (in bytes)
+ * uint32_t width
+ * uint32_t ranks
+ * uint32_t banks
+ * boolean_t array ranks_disabled
+ * boolean_t hdrl-enabled
+ * boolean_t hdrl-parity
+ * uint32_t 3dnumranks
+ */
+
+#define MCINTEL_NVLIST_V1_NMC "num-memory-controllers"
+#define MCINTEL_NVLIST_V1_MCS "memory-controllers"
+#define MCINTEL_NVLIST_V1_MC_NCHAN "num-memory-channels"
+#define MCINTEL_NVLIST_V1_MC_CHANNELS "memory-controller-channels"
+#define MCINTEL_NVLIST_V1_MC_ECC "memory-controller-ecc"
+#define MCINTEL_NVLIST_V1_MC_POLICY "memory-controller-page-policy"
+#define MCINTEL_NVLIST_V1_MC_POLICY_OPEN "open-page"
+#define MCINTEL_NVLIST_V1_MC_POLICY_CLOSED "closed-page"
+#define MCINTEL_NVLIST_V1_MC_CHAN_MODE "memory-controller-channel-mode"
+#define MCINTEL_NVLIST_V1_MC_CHAN_MODE_LOCK "lockstep"
+#define MCINTEL_NVLIST_V1_MC_CHAN_MODE_INDEP "independent"
+#define MCINTEL_NVLIST_V1_CHAN_NDPC "memory-channel-dimms-per-channel"
+#define MCINTEL_NVLIST_V1_CHAN_DIMMS "memory-channel-dimms"
+#define MCINTEL_NVLIST_V1_DIMM_PRESENT "dimm-present"
+#define MCINTEL_NVLIST_V1_DIMM_SIZE "dimm-size"
+#define MCINTEL_NVLIST_V1_DIMM_NCOLS "dimm-num-columns"
+#define MCINTEL_NVLIST_V1_DIMM_NROWS "dimm-num-rows"
+#define MCINTEL_NVLIST_V1_DIMM_DENSITY "dimm-density"
+#define MCINTEL_NVLIST_V1_DIMM_WIDTH "dimm-width"
+#define MCINTEL_NVLIST_V1_DIMM_RANKS "dimm-ranks"
+#define MCINTEL_NVLIST_V1_DIMM_BANKS "dimm-banks"
+#define MCINTEL_NVLIST_V1_DIMM_RDIS "dimm-ranks-disabled"
+#define MCINTEL_NVLIST_V1_DIMM_HDRL "dimm-hdrl-enabled"
+#define MCINTEL_NVLIST_V1_DIMM_HDRLP "dimm-hdrl-parity-enabled"
+#define MCINTEL_NVLIST_V1_DIMM_3DRANK "dimm-3dranks"
+
#define FM_EREPORT_PAYLOAD_NAME_FERR_GLOBAL "ferr_global"
#define FM_EREPORT_PAYLOAD_NAME_NERR_GLOBAL "nerr_global"
#define FM_EREPORT_PAYLOAD_NAME_FSB "fsb"
diff --git a/usr/src/uts/intel/sys/segments.h b/usr/src/uts/intel/sys/segments.h
index 596666c7bd..52831c9d87 100644
--- a/usr/src/uts/intel/sys/segments.h
+++ b/usr/src/uts/intel/sys/segments.h
@@ -694,6 +694,8 @@ extern void _start(), cmnint();
extern void achktrap(), mcetrap();
extern void xmtrap();
extern void fasttrap();
+extern void sys_int80();
+extern void brand_sys_int80();
extern void dtrace_ret();
/* KPTI trampolines */
@@ -709,6 +711,8 @@ extern void tr_overrun(), tr_resvtrap();
extern void tr_achktrap(), tr_mcetrap();
extern void tr_xmtrap();
extern void tr_fasttrap();
+extern void tr_sys_int80();
+extern void tr_brand_sys_int80();
extern void tr_dtrace_ret();
#if !defined(__amd64)
diff --git a/usr/src/uts/intel/sys/ucontext.h b/usr/src/uts/intel/sys/ucontext.h
index 66300e71a1..2d4e39b3e8 100644
--- a/usr/src/uts/intel/sys/ucontext.h
+++ b/usr/src/uts/intel/sys/ucontext.h
@@ -20,6 +20,7 @@
*/
/*
+ * Copyright 2015 Joyent, Inc.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
@@ -84,9 +85,16 @@ struct __ucontext {
sigset_t uc_sigmask;
stack_t uc_stack;
mcontext_t uc_mcontext;
- long uc_filler[5]; /* see ABI spec for Intel386 */
+ /*
+ * The Intel386 ABI specification includes a 5-element array of longs
+ * called "uc_filler", padding the size of the struct to 512 bytes. To
+ * allow zone brands to communicate extra data right the way through
+ * the signal handling process, from sigacthandler to setcontext, we
+ * steal the first three of these longs as a brand-private member.
+ */
+ void *uc_brand_data[3];
+ long uc_filler[2];
};
-
#if defined(_SYSCALL32)
/* Kernel view of user ILP32 ucontext structure */
@@ -97,7 +105,8 @@ typedef struct ucontext32 {
sigset_t uc_sigmask;
stack32_t uc_stack;
mcontext32_t uc_mcontext;
- int32_t uc_filler[5];
+ caddr32_t uc_brand_data[3];
+ int32_t uc_filler[2];
} ucontext32_t;
#if defined(_KERNEL)
diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h
index 6c8e2d22bb..bbf8ed2c57 100644
--- a/usr/src/uts/intel/sys/x86_archext.h
+++ b/usr/src/uts/intel/sys/x86_archext.h
@@ -214,6 +214,18 @@ extern "C" {
#define CPUID_AMD_EBX_SSB_NO 0x004000000 /* AMD: SSB Fixed */
/*
+ * AMD SVM features (extended function 0x8000000A).
+ */
+#define CPUID_AMD_EDX_NESTED_PAGING 0x000000001 /* AMD: SVM NP */
+#define CPUID_AMD_EDX_LBR_VIRT 0x000000002 /* AMD: LBR virt. */
+#define CPUID_AMD_EDX_SVML 0x000000004 /* AMD: SVM lock */
+#define CPUID_AMD_EDX_NRIPS 0x000000008 /* AMD: NRIP save */
+#define CPUID_AMD_EDX_TSC_RATE_MSR 0x000000010 /* AMD: MSR TSC ctrl */
+#define CPUID_AMD_EDX_VMCB_CLEAN 0x000000020 /* AMD: VMCB clean bits */
+#define CPUID_AMD_EDX_FLUSH_ASID 0x000000040 /* AMD: flush by ASID */
+#define CPUID_AMD_EDX_DECODE_ASSISTS 0x000000080 /* AMD: decode assists */
+
+/*
* Intel now seems to have claimed part of the "extended" function
* space that we previously for non-Intel implementors to use.
* More excitingly still, they've claimed bit 20 to mean LAHF/SAHF
@@ -483,6 +495,31 @@ extern "C" {
#define IA32_FLUSH_CMD_L1D 0x01
/*
+ * Intel VMX related MSRs
+ */
+#define MSR_IA32_FEAT_CTRL 0x03a
+#define IA32_FEAT_CTRL_LOCK 0x1
+#define IA32_FEAT_CTRL_SMX_EN 0x2
+#define IA32_FEAT_CTRL_VMX_EN 0x4
+
+#define MSR_IA32_VMX_BASIC 0x480
+#define IA32_VMX_BASIC_INS_OUTS (1UL << 54)
+#define IA32_VMX_BASIC_TRUE_CTRLS (1UL << 55)
+
+#define MSR_IA32_VMX_PROCBASED_CTLS 0x482
+#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x48e
+#define IA32_VMX_PROCBASED_2ND_CTLS (1UL << 31)
+
+#define MSR_IA32_VMX_PROCBASED2_CTLS 0x48b
+#define IA32_VMX_PROCBASED2_EPT (1UL << 1)
+#define IA32_VMX_PROCBASED2_VPID (1UL << 5)
+
+#define MSR_IA32_VMX_EPT_VPID_CAP 0x48c
+#define IA32_VMX_EPT_VPID_INVEPT (1UL << 20)
+#define IA32_VMX_EPT_VPID_INVEPT_SINGLE (1UL << 25)
+#define IA32_VMX_EPT_VPID_INVEPT_ALL (1UL << 26)
+
+/*
* Intel TSX Control MSRs
*/
#define MSR_IA32_TSX_CTRL 0x122