aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/cpufreq/est.c10
-rw-r--r--sys/x86/cpufreq/hwpstate_amd.c5
-rw-r--r--sys/x86/cpufreq/hwpstate_intel.c2
-rw-r--r--sys/x86/cpufreq/p4tcc.c2
-rw-r--r--sys/x86/cpufreq/powernow.c5
-rw-r--r--sys/x86/cpufreq/smist.c8
-rw-r--r--sys/x86/include/apicreg.h2
-rw-r--r--sys/x86/include/bus.h2
-rw-r--r--sys/x86/include/dump.h8
-rw-r--r--sys/x86/include/frame.h1
-rw-r--r--sys/x86/include/metadata.h11
-rw-r--r--sys/x86/include/ptrace.h2
-rw-r--r--sys/x86/include/sysarch.h4
-rw-r--r--sys/x86/include/tls.h14
-rw-r--r--sys/x86/include/ucode.h2
-rw-r--r--sys/x86/include/ucontext.h8
-rw-r--r--sys/x86/include/x86_var.h1
-rw-r--r--sys/x86/iommu/amd_idpgtbl.c5
-rw-r--r--sys/x86/iommu/amd_intrmap.c14
-rw-r--r--sys/x86/iommu/intel_idpgtbl.c10
-rw-r--r--sys/x86/iommu/intel_intrmap.c8
-rw-r--r--sys/x86/linux/linux_dummy_x86.c2
-rw-r--r--sys/x86/pci/qpi.c2
-rw-r--r--sys/x86/x86/busdma_bounce.c1
-rw-r--r--sys/x86/x86/dump_machdep.c26
-rw-r--r--sys/x86/x86/identcpu.c25
-rw-r--r--sys/x86/x86/ucode.c5
-rw-r--r--sys/x86/x86/ucode_subr.c10
28 files changed, 151 insertions, 44 deletions
diff --git a/sys/x86/cpufreq/est.c b/sys/x86/cpufreq/est.c
index 19448ff127ef..82f35934aa99 100644
--- a/sys/x86/cpufreq/est.c
+++ b/sys/x86/cpufreq/est.c
@@ -920,11 +920,11 @@ est_identify(driver_t *driver, device_t parent)
* future.
*/
intel_hwpstate_identify(NULL, parent);
- if (device_find_child(parent, "hwpstate_intel", -1) != NULL)
+ if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != NULL)
return;
/* Make sure we're not being doubly invoked. */
- if (device_find_child(parent, "est", -1) != NULL)
+ if (device_find_child(parent, "est", DEVICE_UNIT_ANY) != NULL)
return;
/* Check that CPUID is supported and the vendor is Intel.*/
@@ -961,7 +961,8 @@ est_probe(device_t dev)
* If the ACPI perf driver has attached and is not just offering
* info, let it manage things.
*/
- perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
+ perf_dev = device_find_child(device_get_parent(dev), "acpi_perf",
+ DEVICE_UNIT_ANY);
if (perf_dev && device_is_attached(perf_dev)) {
error = CPUFREQ_DRV_TYPE(perf_dev, &type);
if (error == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0)
@@ -1064,7 +1065,8 @@ est_acpi_info(device_t dev, freq_info **freqs, size_t *freqslen)
int count, error, i, j;
uint16_t saved_id16;
- perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
+ perf_dev = device_find_child(device_get_parent(dev), "acpi_perf",
+ DEVICE_UNIT_ANY);
if (perf_dev == NULL || !device_is_attached(perf_dev))
return (ENXIO);
diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c
index a9305e571ece..fc948dc90a15 100644
--- a/sys/x86/cpufreq/hwpstate_amd.c
+++ b/sys/x86/cpufreq/hwpstate_amd.c
@@ -342,7 +342,7 @@ static void
hwpstate_identify(driver_t *driver, device_t parent)
{
- if (device_find_child(parent, "hwpstate", -1) != NULL)
+ if (device_find_child(parent, "hwpstate", DEVICE_UNIT_ANY) != NULL)
return;
if ((cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10) &&
@@ -386,7 +386,8 @@ hwpstate_probe(device_t dev)
/*
* Check if acpi_perf has INFO only flag.
*/
- perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
+ perf_dev = device_find_child(device_get_parent(dev), "acpi_perf",
+ DEVICE_UNIT_ANY);
error = TRUE;
if (perf_dev && device_is_attached(perf_dev)) {
error = CPUFREQ_DRV_TYPE(perf_dev, &type);
diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c
index b4378154c408..259aeac399c8 100644
--- a/sys/x86/cpufreq/hwpstate_intel.c
+++ b/sys/x86/cpufreq/hwpstate_intel.c
@@ -328,7 +328,7 @@ out:
void
intel_hwpstate_identify(driver_t *driver, device_t parent)
{
- if (device_find_child(parent, "hwpstate_intel", -1) != NULL)
+ if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != NULL)
return;
if (cpu_vendor_id != CPU_VENDOR_INTEL)
diff --git a/sys/x86/cpufreq/p4tcc.c b/sys/x86/cpufreq/p4tcc.c
index 22e9cad25d4a..c3c35dee832b 100644
--- a/sys/x86/cpufreq/p4tcc.c
+++ b/sys/x86/cpufreq/p4tcc.c
@@ -122,7 +122,7 @@ p4tcc_identify(driver_t *driver, device_t parent)
return;
/* Make sure we're not being doubly invoked. */
- if (device_find_child(parent, "p4tcc", -1) != NULL)
+ if (device_find_child(parent, "p4tcc", DEVICE_UNIT_ANY) != NULL)
return;
/*
diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c
index 93b1386c754d..2f3044d6077a 100644
--- a/sys/x86/cpufreq/powernow.c
+++ b/sys/x86/cpufreq/powernow.c
@@ -870,7 +870,7 @@ pn_identify(driver_t *driver, device_t parent)
default:
return;
}
- if (device_find_child(parent, "powernow", -1) != NULL)
+ if (device_find_child(parent, "powernow", DEVICE_UNIT_ANY) != NULL)
return;
if (BUS_ADD_CHILD(parent, 10, "powernow", device_get_unit(parent))
== NULL)
@@ -944,7 +944,8 @@ pn_attach(device_t dev)
int rv;
device_t child;
- child = device_find_child(device_get_parent(dev), "acpi_perf", -1);
+ child = device_find_child(device_get_parent(dev), "acpi_perf",
+ DEVICE_UNIT_ANY);
if (child) {
rv = pn_decode_acpi(dev, child);
if (rv)
diff --git a/sys/x86/cpufreq/smist.c b/sys/x86/cpufreq/smist.c
index 291c3b9af605..b84a4ba72a56 100644
--- a/sys/x86/cpufreq/smist.c
+++ b/sys/x86/cpufreq/smist.c
@@ -305,7 +305,7 @@ smist_identify(driver_t *driver, device_t parent)
if (bootverbose)
printf("smist: found supported isa bridge %s\n", id->desc);
- if (device_find_child(parent, "smist", -1) != NULL)
+ if (device_find_child(parent, "smist", DEVICE_UNIT_ANY) != NULL)
return;
if (BUS_ADD_CHILD(parent, 30, "smist", device_get_unit(parent))
== NULL)
@@ -330,13 +330,15 @@ smist_probe(device_t dev)
* If the ACPI perf or ICH SpeedStep drivers have attached and not
* just offering info, let them manage things.
*/
- perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
+ perf_dev = device_find_child(device_get_parent(dev), "acpi_perf",
+ DEVICE_UNIT_ANY);
if (perf_dev && device_is_attached(perf_dev)) {
rv = CPUFREQ_DRV_TYPE(perf_dev, &type);
if (rv == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0)
return (ENXIO);
}
- ichss_dev = device_find_child(device_get_parent(dev), "ichss", -1);
+ ichss_dev = device_find_child(device_get_parent(dev), "ichss",
+ DEVICE_UNIT_ANY);
if (ichss_dev && device_is_attached(ichss_dev))
return (ENXIO);
diff --git a/sys/x86/include/apicreg.h b/sys/x86/include/apicreg.h
index d610d7f11a1c..1252647fbab3 100644
--- a/sys/x86/include/apicreg.h
+++ b/sys/x86/include/apicreg.h
@@ -296,6 +296,8 @@ typedef struct IOAPIC ioapic_t;
/* constants relating to APIC ID registers */
#define APIC_ID_MASK 0xff000000
#define APIC_ID_SHIFT 24
+#define APIC_EXT_ID_MASK 0x00fe0000
+#define APIC_EXT_ID_SHIFT 17
#define APIC_ID_CLUSTER 0xf0
#define APIC_ID_CLUSTER_ID 0x0f
#define APIC_MAX_CLUSTER 0xe
diff --git a/sys/x86/include/bus.h b/sys/x86/include/bus.h
index 8f9f48b67157..5e9f11ad4f95 100644
--- a/sys/x86/include/bus.h
+++ b/sys/x86/include/bus.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-ClauseE
+ * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-Clause
*
* Copyright (c) KATO Takenori, 1999.
*
diff --git a/sys/x86/include/dump.h b/sys/x86/include/dump.h
index 7f4caf9e8292..cdd07f32703c 100644
--- a/sys/x86/include/dump.h
+++ b/sys/x86/include/dump.h
@@ -38,7 +38,11 @@
/* 20 phys_avail entry pairs correspond to 10 pa's */
#define DUMPSYS_MD_PA_NPAIRS 10
+#ifdef __amd64__
+#define DUMPSYS_NUM_AUX_HDRS 1
+#else
#define DUMPSYS_NUM_AUX_HDRS 0
+#endif
/* How often to check the dump progress bar? */
#define DUMPSYS_PB_CHECK_BITS 24 /* Every 16MB */
@@ -71,12 +75,16 @@ dumpsys_unmap_chunk(vm_paddr_t pa, size_t s, void *va)
dumpsys_gen_unmap_chunk(pa, s, va);
}
+#ifdef __amd64__
+int dumpsys_write_aux_headers(struct dumperinfo *di);
+#else
static inline int
dumpsys_write_aux_headers(struct dumperinfo *di)
{
return (dumpsys_gen_write_aux_headers(di));
}
+#endif
static inline int
dumpsys(struct dumperinfo *di)
diff --git a/sys/x86/include/frame.h b/sys/x86/include/frame.h
index 9574e8c0ed02..994e19b979fc 100644
--- a/sys/x86/include/frame.h
+++ b/sys/x86/include/frame.h
@@ -152,6 +152,7 @@ struct trapframe {
#define TF_HASSEGS 0x1
#define TF_HASBASES 0x2
#define TF_HASFPXSTATE 0x4
+#define TF_RESERV0 0x8 /* no tlsbase in the trapframe */
#endif /* __amd64__ */
#endif /* _MACHINE_FRAME_H_ */
diff --git a/sys/x86/include/metadata.h b/sys/x86/include/metadata.h
index b3eb4b16c1ba..dd8a8ef6c73d 100644
--- a/sys/x86/include/metadata.h
+++ b/sys/x86/include/metadata.h
@@ -36,10 +36,15 @@
#define MODINFOMD_VBE_FB 0x1007
#define MODINFOMD_EFI_ARCH 0x1008
+/*
+ * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though
+ * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table
+ * starting at a 16-byte alignment.
+ */
struct efi_map_header {
- uint64_t memory_size;
- uint64_t descriptor_size;
- uint32_t descriptor_version;
+ uint64_t memory_size; /* Numnber of bytes that follow */
+ uint64_t descriptor_size; /* Size of each EFI_MEMORY_DESCRIPTOR */
+ uint32_t descriptor_version; /* Currently '1' */
};
struct efi_fb {
diff --git a/sys/x86/include/ptrace.h b/sys/x86/include/ptrace.h
index f477094bdd14..d4fa1fe45a3c 100644
--- a/sys/x86/include/ptrace.h
+++ b/sys/x86/include/ptrace.h
@@ -54,6 +54,8 @@
#define PT_SETFSBASE (PT_FIRSTMACH + 8)
#define PT_GETGSBASE (PT_FIRSTMACH + 9)
#define PT_SETGSBASE (PT_FIRSTMACH + 10)
+#define PT_GETTLSBASE (PT_FIRSTMACH + 11)
+#define PT_SETTLSBASE (PT_FIRSTMACH + 12)
/* Argument structure for PT_GETXSTATE_INFO. */
struct ptrace_xstate_info {
diff --git a/sys/x86/include/sysarch.h b/sys/x86/include/sysarch.h
index 3226f3b9d93a..cf7ee9ee5518 100644
--- a/sys/x86/include/sysarch.h
+++ b/sys/x86/include/sysarch.h
@@ -61,6 +61,9 @@
#define AMD64_GET_XFPUSTATE 132
#define AMD64_SET_PKRU 133
#define AMD64_CLEAR_PKRU 134
+#define AMD64_GET_TLSBASE 135
+#define AMD64_SET_TLSBASE 136
+#define AMD64_DISABLE_TLSBASE 137
/* Flags for AMD64_SET_PKRU */
#define AMD64_PKRU_EXCL 0x0001
@@ -140,6 +143,7 @@ int amd64_get_fsbase(void **);
int amd64_get_gsbase(void **);
int amd64_set_fsbase(void *);
int amd64_set_gsbase(void *);
+int amd64_set_tlsbase(void *);
int x86_pkru_get_perm(unsigned int keyidx, int *access, int *modify);
int x86_pkru_set_perm(unsigned int keyidx, int access, int modify);
int x86_pkru_protect_range(void *addr, unsigned long len, unsigned int keyidx,
diff --git a/sys/x86/include/tls.h b/sys/x86/include/tls.h
index 4b6b58b4a5e3..1ed47bf01938 100644
--- a/sys/x86/include/tls.h
+++ b/sys/x86/include/tls.h
@@ -36,13 +36,23 @@
struct pthread;
+struct dtv_slot {
+ char *dtvs_tls;
+};
+
+struct dtv {
+ uintptr_t dtv_gen;
+ uintptr_t dtv_size;
+ struct dtv_slot dtv_slots[];
+};
+
/*
* Variant II tcb, first two members are required by rtld,
* %fs (amd64) / %gs (i386) points to the structure.
*/
struct tcb {
struct tcb *tcb_self; /* required by rtld */
- uintptr_t *tcb_dtv; /* required by rtld */
+ struct dtv *tcb_dtv; /* required by rtld */
struct pthread *tcb_thread;
};
@@ -59,7 +69,7 @@ static __inline void
_tcb_set(struct tcb *tcb)
{
#ifdef __amd64__
- amd64_set_fsbase(tcb);
+ amd64_set_tlsbase(tcb);
#else
i386_set_gsbase(tcb);
#endif
diff --git a/sys/x86/include/ucode.h b/sys/x86/include/ucode.h
index 0338d48a0832..75b9ff3afbd0 100644
--- a/sys/x86/include/ucode.h
+++ b/sys/x86/include/ucode.h
@@ -63,7 +63,7 @@ struct ucode_intel_extsig_table {
};
const void *ucode_amd_find(const char *path, uint32_t signature,
- uint32_t revision, const uint8_t *fw_data, size_t fw_size,
+ uint32_t *revision, const uint8_t *fw_data, size_t fw_size,
size_t *selected_sizep);
int ucode_intel_load(const void *data, bool unsafe,
uint64_t *nrevp, uint64_t *orevp);
diff --git a/sys/x86/include/ucontext.h b/sys/x86/include/ucontext.h
index b7964e8c7141..00edc8c16bce 100644
--- a/sys/x86/include/ucontext.h
+++ b/sys/x86/include/ucontext.h
@@ -99,7 +99,9 @@ typedef struct __mcontext {
#define _MC_HASSEGS 0x1
#define _MC_HASBASES 0x2
#define _MC_HASFPXSTATE 0x4
-#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
+#define _MC_HASTLSBASE 0x8
+#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE | \
+ _MC_HASTLSBASE)
typedef struct __mcontext {
/*
@@ -158,7 +160,9 @@ typedef struct __mcontext {
__register_t mc_xfpustate;
__register_t mc_xfpustate_len;
- long mc_spare[4];
+ __register_t mc_tlsbase;
+
+ long mc_spare[3];
} mcontext_t;
#endif /* __amd64__ */
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index dbb4e9557ed0..701b982e6afb 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -50,6 +50,7 @@ extern u_int cpu_clflush_line_size;
extern u_int cpu_stdext_feature;
extern u_int cpu_stdext_feature2;
extern u_int cpu_stdext_feature3;
+extern u_int cpu_stdext_feature4;
extern uint64_t cpu_ia32_arch_caps;
extern u_int cpu_high;
extern u_int cpu_id;
diff --git a/sys/x86/iommu/amd_idpgtbl.c b/sys/x86/iommu/amd_idpgtbl.c
index 7809a4d57926..4ed73675bd41 100644
--- a/sys/x86/iommu/amd_idpgtbl.c
+++ b/sys/x86/iommu/amd_idpgtbl.c
@@ -54,6 +54,7 @@
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
+#include <vm/vm_radix.h>
#include <vm/vm_map.h>
#include <dev/pci/pcireg.h>
#include <machine/atomic.h>
@@ -103,6 +104,7 @@ amdiommu_domain_alloc_pgtbl(struct amdiommu_domain *domain)
void
amdiommu_domain_free_pgtbl(struct amdiommu_domain *domain)
{
+ struct pctrie_iter pages;
vm_object_t obj;
vm_page_t m;
@@ -118,7 +120,8 @@ amdiommu_domain_free_pgtbl(struct amdiommu_domain *domain)
/* Obliterate ref_counts */
VM_OBJECT_ASSERT_WLOCKED(obj);
- for (m = vm_page_lookup(obj, 0); m != NULL; m = vm_page_next(m))
+ vm_page_iter_init(&pages, obj);
+ VM_RADIX_FORALL(m, &pages)
vm_page_clearref(m);
VM_OBJECT_WUNLOCK(obj);
vm_object_deallocate(obj);
diff --git a/sys/x86/iommu/amd_intrmap.c b/sys/x86/iommu/amd_intrmap.c
index a4c1a7836268..f8900fe0561f 100644
--- a/sys/x86/iommu/amd_intrmap.c
+++ b/sys/x86/iommu/amd_intrmap.c
@@ -112,6 +112,8 @@ amdiommu_map_msi_intr(device_t src, u_int cpu, u_int vector,
{
struct amdiommu_ctx *ctx;
struct amdiommu_unit *unit;
+ device_t requester;
+ int error __diagused;
uint16_t rid;
bool is_iommu;
@@ -180,7 +182,8 @@ amdiommu_map_msi_intr(device_t src, u_int cpu, u_int vector,
*addr |= ((uint64_t)cpu & 0xffffff00) << 32;
}
- iommu_get_requester(src, &rid);
+ error = iommu_get_requester(src, &requester, &rid);
+ MPASS(error == 0);
AMDIOMMU_LOCK(unit);
amdiommu_qi_invalidate_ir_locked(unit, rid);
AMDIOMMU_UNLOCK(unit);
@@ -220,6 +223,7 @@ static struct amdiommu_ctx *
amdiommu_ir_find(device_t src, uint16_t *ridp, bool *is_iommu)
{
devclass_t src_class;
+ device_t requester;
struct amdiommu_unit *unit;
struct amdiommu_ctx *ctx;
uint32_t edte;
@@ -251,7 +255,8 @@ amdiommu_ir_find(device_t src, uint16_t *ridp, bool *is_iommu)
error = amdiommu_find_unit(src, &unit, &rid, &dte, &edte,
bootverbose);
if (error == 0) {
- iommu_get_requester(src, &rid);
+ error = iommu_get_requester(src, &requester, &rid);
+ MPASS(error == 0);
ctx = amdiommu_get_ctx_for_dev(unit, src,
rid, 0, false /* XXXKIB */, false, dte, edte);
}
@@ -266,6 +271,8 @@ amdiommu_ir_free_irte(struct amdiommu_ctx *ctx, device_t src,
u_int cookie)
{
struct amdiommu_unit *unit;
+ device_t requester;
+ int error __diagused;
uint16_t rid;
MPASS(ctx != NULL);
@@ -291,7 +298,8 @@ amdiommu_ir_free_irte(struct amdiommu_ctx *ctx, device_t src,
atomic_thread_fence_rel();
bzero(irte, sizeof(*irte));
}
- iommu_get_requester(src, &rid);
+ error = iommu_get_requester(src, &requester, &rid);
+ MPASS(error == 0);
AMDIOMMU_LOCK(unit);
amdiommu_qi_invalidate_ir_locked(unit, rid);
AMDIOMMU_UNLOCK(unit);
diff --git a/sys/x86/iommu/intel_idpgtbl.c b/sys/x86/iommu/intel_idpgtbl.c
index b133dc875515..e13555cdaaba 100644
--- a/sys/x86/iommu/intel_idpgtbl.c
+++ b/sys/x86/iommu/intel_idpgtbl.c
@@ -56,6 +56,7 @@
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
#include <vm/vm_map.h>
+#include <vm/vm_radix.h>
#include <dev/pci/pcireg.h>
#include <machine/atomic.h>
#include <machine/bus.h>
@@ -165,6 +166,7 @@ dmar_idmap_nextlvl(struct idpgtbl *tbl, int lvl, vm_pindex_t idx,
vm_object_t
dmar_get_idmap_pgtbl(struct dmar_domain *domain, iommu_gaddr_t maxaddr)
{
+ struct pctrie_iter pages;
struct dmar_unit *unit;
struct idpgtbl *tbl;
vm_object_t res;
@@ -260,9 +262,9 @@ end:
*/
unit = domain->dmar;
if (!DMAR_IS_COHERENT(unit)) {
+ vm_page_iter_init(&pages, res);
VM_OBJECT_WLOCK(res);
- for (m = vm_page_lookup(res, 0); m != NULL;
- m = vm_page_next(m))
+ VM_RADIX_FORALL(m, &pages)
pmap_invalidate_cache_pages(&m, 1);
VM_OBJECT_WUNLOCK(res);
}
@@ -707,6 +709,7 @@ dmar_domain_alloc_pgtbl(struct dmar_domain *domain)
void
dmar_domain_free_pgtbl(struct dmar_domain *domain)
{
+ struct pctrie_iter pages;
vm_object_t obj;
vm_page_t m;
@@ -728,7 +731,8 @@ dmar_domain_free_pgtbl(struct dmar_domain *domain)
/* Obliterate ref_counts */
VM_OBJECT_ASSERT_WLOCKED(obj);
- for (m = vm_page_lookup(obj, 0); m != NULL; m = vm_page_next(m)) {
+ vm_page_iter_init(&pages, obj);
+ VM_RADIX_FORALL(m, &pages) {
vm_page_clearref(m);
vm_wire_sub(1);
}
diff --git a/sys/x86/iommu/intel_intrmap.c b/sys/x86/iommu/intel_intrmap.c
index 06e41523624b..f12a0c9bae9b 100644
--- a/sys/x86/iommu/intel_intrmap.c
+++ b/sys/x86/iommu/intel_intrmap.c
@@ -234,6 +234,8 @@ dmar_ir_find(device_t src, uint16_t *rid, int *is_dmar)
{
devclass_t src_class;
struct dmar_unit *unit;
+ device_t requester;
+ int error __diagused;
/*
* We need to determine if the interrupt source generates FSB
@@ -253,8 +255,10 @@ dmar_ir_find(device_t src, uint16_t *rid, int *is_dmar)
unit = dmar_find_hpet(src, rid);
} else {
unit = dmar_find(src, bootverbose);
- if (unit != NULL && rid != NULL)
- iommu_get_requester(src, rid);
+ if (unit != NULL && rid != NULL) {
+ error = iommu_get_requester(src, &requester, rid);
+ MPASS(error == 0);
+ }
}
return (unit);
}
diff --git a/sys/x86/linux/linux_dummy_x86.c b/sys/x86/linux/linux_dummy_x86.c
index ae1d23e811e7..221f5dbf5ba3 100644
--- a/sys/x86/linux/linux_dummy_x86.c
+++ b/sys/x86/linux/linux_dummy_x86.c
@@ -46,7 +46,5 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
DUMMY(sysfs);
DUMMY(quotactl);
-/* Linux 2.6.13: */
-DUMMY(inotify_init);
/* Linux 2.6.22: */
DUMMY(signalfd);
diff --git a/sys/x86/pci/qpi.c b/sys/x86/pci/qpi.c
index 94dd46d26a92..21bf1b6738bc 100644
--- a/sys/x86/pci/qpi.c
+++ b/sys/x86/pci/qpi.c
@@ -80,7 +80,7 @@ qpi_identify(driver_t *driver, device_t parent)
return;
/* Add a qpi bus device. */
- if (BUS_ADD_CHILD(parent, 20, "qpi", -1) == NULL)
+ if (BUS_ADD_CHILD(parent, 20, "qpi", DEVICE_UNIT_ANY) == NULL)
panic("Failed to add qpi bus");
}
diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index 040174113104..e86279aa9c98 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -726,6 +726,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
map->pagesneeded != 0 &&
must_bounce(dmat, curaddr)) {
sgsize = roundup2(sgsize, dmat->common.alignment);
+ sgsize = MIN(sgsize, buflen);
curaddr = add_bounce_page(dmat, map, kvaddr, curaddr, 0,
sgsize);
}
diff --git a/sys/x86/x86/dump_machdep.c b/sys/x86/x86/dump_machdep.c
index 866247610c07..71598e2c9808 100644
--- a/sys/x86/x86/dump_machdep.c
+++ b/sys/x86/x86/dump_machdep.c
@@ -37,6 +37,13 @@
#include <vm/vm.h>
#include <vm/pmap.h>
+#ifdef __amd64__
+#include <machine/elf.h>
+#include <machine/vmparam.h>
+#include <machine/md_var.h>
+#include <machine/dump.h>
+#endif
+
int do_minidump = 1;
SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &do_minidump, 0,
"Enable mini crash dumps");
@@ -52,3 +59,22 @@ dumpsys_map_chunk(vm_paddr_t pa, size_t chunk, void **va)
*va = pmap_kenter_temporary(trunc_page(a), i);
}
}
+
+#ifdef __amd64__
+int
+dumpsys_write_aux_headers(struct dumperinfo *di)
+{
+ Elf_Phdr phdr;
+
+ phdr.p_type = PT_DUMP_DELTA;
+ phdr.p_flags = PF_R;
+ phdr.p_offset = 0;
+ phdr.p_vaddr = KERNBASE;
+ phdr.p_paddr = kernphys;
+ phdr.p_filesz = 0;
+ phdr.p_memsz = 0;
+ phdr.p_align = KERNLOAD;
+
+ return (dumpsys_buf_write(di, (char *)&phdr, sizeof(phdr)));
+}
+#endif
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 3f8f11fda011..7661c82f4394 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -111,9 +111,12 @@ char cpu_vendor[20]; /* CPU Origin code */
u_int cpu_vendor_id; /* CPU vendor ID */
u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */
u_int cpu_clflush_line_size = 32;
+/* leaf 7 %ecx = 0 */
u_int cpu_stdext_feature; /* %ebx */
u_int cpu_stdext_feature2; /* %ecx */
u_int cpu_stdext_feature3; /* %edx */
+/* leaf 7 %ecx = 1 */
+u_int cpu_stdext_feature4; /* %eax */
uint64_t cpu_ia32_arch_caps;
u_int cpu_max_ext_state_size;
u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */
@@ -1043,6 +1046,16 @@ printcpuinfo(void)
"\040SSBD"
);
}
+#define STDEXT4_MASK (CPUID_STDEXT4_LASS | CPUID_STDEXT4_LAM)
+ if ((cpu_stdext_feature4 & STDEXT4_MASK) != 0) {
+ printf("\n Structured Extended Features4=0x%b",
+ cpu_stdext_feature4 & STDEXT4_MASK,
+ "\020"
+ "\007LASS"
+ "\033LAM"
+ );
+ }
+#undef STDEXT4_MASK
if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
cpuid_count(0xd, 0x1, regs);
@@ -1562,7 +1575,7 @@ identify_cpu1(void)
void
identify_cpu2(void)
{
- u_int regs[4], cpu_stdext_disable;
+ u_int regs[4], cpu_stdext_disable, max_eax_l7;
if (cpu_high >= 6) {
cpuid_count(6, 0, regs);
@@ -1575,6 +1588,7 @@ identify_cpu2(void)
if (cpu_high >= 7) {
cpuid_count(7, 0, regs);
cpu_stdext_feature = regs[1];
+ max_eax_l7 = regs[0];
/*
* Some hypervisors failed to filter out unsupported
@@ -1591,6 +1605,11 @@ identify_cpu2(void)
if ((cpu_stdext_feature3 & CPUID_STDEXT3_ARCH_CAP) != 0)
cpu_ia32_arch_caps = rdmsr(MSR_IA32_ARCH_CAP);
+
+ if (max_eax_l7 >= 1) {
+ cpuid_count(7, 1, regs);
+ cpu_stdext_feature4 = regs[0];
+ }
}
}
@@ -2594,7 +2613,7 @@ print_vmx_info(void)
"\020EPT#VE" /* EPT-violation #VE */
"\021XSAVES" /* Enable XSAVES/XRSTORS */
);
- printf("\n Exit Controls=0x%b", mask,
+ printf("\n Exit Controls=0x%b", exit,
"\020"
"\003DR" /* Save debug controls */
/* Ignore Host address-space size */
@@ -2606,7 +2625,7 @@ print_vmx_info(void)
"\026EFER-LD" /* Load MSR_EFER */
"\027PTMR-SV" /* Save VMX-preemption timer value */
);
- printf("\n Entry Controls=0x%b", mask,
+ printf("\n Entry Controls=0x%b", entry,
"\020"
"\003DR" /* Save debug controls */
/* Ignore IA-32e mode guest */
diff --git a/sys/x86/x86/ucode.c b/sys/x86/x86/ucode.c
index 923d9e31b44e..1973047fafd1 100644
--- a/sys/x86/x86/ucode.c
+++ b/sys/x86/x86/ucode.c
@@ -35,12 +35,12 @@
#include <sys/malloc.h>
#include <sys/pcpu.h>
#include <sys/smp.h>
+#include <sys/stdarg.h>
#include <sys/systm.h>
#include <machine/atomic.h>
#include <machine/cpufunc.h>
#include <x86/specialreg.h>
-#include <machine/stdarg.h>
#include <x86/ucode.h>
#include <x86/x86_smp.h>
@@ -277,7 +277,8 @@ ucode_amd_match(const uint8_t *data, size_t *len)
signature = regs[0];
revision = rdmsr(MSR_BIOS_SIGN);
- return (ucode_amd_find("loader blob", signature, revision, data, *len, len));
+ return (ucode_amd_find("loader blob", signature, &revision, data, *len,
+ len));
}
/*
diff --git a/sys/x86/x86/ucode_subr.c b/sys/x86/x86/ucode_subr.c
index 9e128ad2bf04..53d7cfc06769 100644
--- a/sys/x86/x86/ucode_subr.c
+++ b/sys/x86/x86/ucode_subr.c
@@ -94,7 +94,7 @@ typedef struct container_header {
* source code.
*/
const void *
-ucode_amd_find(const char *path, uint32_t signature, uint32_t revision,
+ucode_amd_find(const char *path, uint32_t signature, uint32_t *revision,
const uint8_t *fw_data, size_t fw_size, size_t *selected_sizep)
{
const amd_10h_fw_header_t *fw_header;
@@ -112,7 +112,7 @@ ucode_amd_find(const char *path, uint32_t signature, uint32_t revision,
(signature >> 4) & 0x0f,
(signature >> 0) & 0x0f, (signature >> 20) & 0xff,
(signature >> 16) & 0x0f);
- WARNX(1, "microcode revision %#x", revision);
+ WARNX(1, "microcode revision %#x", *revision);
nextfile:
WARNX(1, "checking %s for update.", path);
@@ -212,9 +212,9 @@ nextfile:
fw_header->processor_rev_id, equiv_id);
continue; /* different cpu */
}
- if (fw_header->patch_id <= revision) {
+ if (fw_header->patch_id <= *revision) {
WARNX(1, "patch_id %x, revision %x",
- fw_header->patch_id, revision);
+ fw_header->patch_id, *revision);
continue; /* not newer revision */
}
if (fw_header->nb_dev_id != 0 || fw_header->sb_dev_id != 0) {
@@ -222,7 +222,7 @@ nextfile:
}
WARNX(3, "selecting revision: %x", fw_header->patch_id);
- revision = fw_header->patch_id;
+ *revision = fw_header->patch_id;
selected_fw = fw_header;
selected_size = section_header->size;
}