summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2020-09-06 23:22:34 +0000
committerPatrick Mooney <pmooney@oxide.computer>2020-09-10 17:35:09 +0000
commitdb8733f5bbf6e1c41c482d70b2fe49470d1958de (patch)
tree40f0e524e7aeaa5ac67b03fb3cf828e0e156ee56
parent374fc6954a786a037fbb28b1cd6fd62d05d13a37 (diff)
downloadillumos-joyent-db8733f5bbf6e1c41c482d70b2fe49470d1958de.tar.gz
13110 clean up compiler gags in bhyve kernel
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/uts/i86pc/io/vmm/amd/svm.c8
-rw-r--r--usr/src/uts/i86pc/io/vmm/amd/svm.h48
-rw-r--r--usr/src/uts/i86pc/io/vmm/intel/vmx.c12
-rw-r--r--usr/src/uts/i86pc/io/vmm/intel/vmx.h66
-rw-r--r--usr/src/uts/i86pc/io/vmm/io/iommu.c34
-rw-r--r--usr/src/uts/i86pc/io/vmm/io/vlapic.c2
-rw-r--r--usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h2
-rw-r--r--usr/src/uts/i86pc/io/vmm/vmm.c2
-rw-r--r--usr/src/uts/i86pc/vmm/Makefile10
9 files changed, 67 insertions, 117 deletions
diff --git a/usr/src/uts/i86pc/io/vmm/amd/svm.c b/usr/src/uts/i86pc/io/vmm/amd/svm.c
index 46106e9094..41afc97cfd 100644
--- a/usr/src/uts/i86pc/io/vmm/amd/svm.c
+++ b/usr/src/uts/i86pc/io/vmm/amd/svm.c
@@ -1937,7 +1937,7 @@ svm_dr_leave_guest(struct svm_regctx *gctx)
* Start vcpu with specified RIP.
*/
static int
-svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t pmap,
+svm_vmrun(void *arg, int vcpu, uint64_t rip, pmap_t pmap,
struct vm_eventinfo *evinfo)
{
struct svm_regctx *gctx;
@@ -2121,7 +2121,7 @@ svm_vmcleanup(void *arg)
free(sc, M_SVM);
}
-static register_t *
+static uint64_t *
swctx_regptr(struct svm_regctx *regctx, int reg)
{
switch (reg) {
@@ -2171,7 +2171,7 @@ svm_getreg(void *arg, int vcpu, int ident, uint64_t *val)
{
struct svm_softc *sc;
struct vmcb *vmcb;
- register_t *regp;
+ uint64_t *regp;
uint64_t *fieldp;
struct vmcb_segment *seg;
@@ -2233,7 +2233,7 @@ svm_setreg(void *arg, int vcpu, int ident, uint64_t val)
{
struct svm_softc *sc;
struct vmcb *vmcb;
- register_t *regp;
+ uint64_t *regp;
uint64_t *fieldp;
uint32_t dirty;
struct vmcb_segment *seg;
diff --git a/usr/src/uts/i86pc/io/vmm/amd/svm.h b/usr/src/uts/i86pc/io/vmm/amd/svm.h
index c78f7eb067..19739884c2 100644
--- a/usr/src/uts/i86pc/io/vmm/amd/svm.h
+++ b/usr/src/uts/i86pc/io/vmm/amd/svm.h
@@ -35,31 +35,31 @@
* Guest register state that is saved outside the VMCB.
*/
struct svm_regctx {
- register_t sctx_rbp;
- register_t sctx_rbx;
- register_t sctx_rcx;
- register_t sctx_rdx;
- register_t sctx_rdi;
- register_t sctx_rsi;
- register_t sctx_r8;
- register_t sctx_r9;
- register_t sctx_r10;
- register_t sctx_r11;
- register_t sctx_r12;
- register_t sctx_r13;
- register_t sctx_r14;
- register_t sctx_r15;
- register_t sctx_dr0;
- register_t sctx_dr1;
- register_t sctx_dr2;
- register_t sctx_dr3;
+ uint64_t sctx_rbp;
+ uint64_t sctx_rbx;
+ uint64_t sctx_rcx;
+ uint64_t sctx_rdx;
+ uint64_t sctx_rdi;
+ uint64_t sctx_rsi;
+ uint64_t sctx_r8;
+ uint64_t sctx_r9;
+ uint64_t sctx_r10;
+ uint64_t sctx_r11;
+ uint64_t sctx_r12;
+ uint64_t sctx_r13;
+ uint64_t sctx_r14;
+ uint64_t sctx_r15;
+ uint64_t sctx_dr0;
+ uint64_t sctx_dr1;
+ uint64_t sctx_dr2;
+ uint64_t sctx_dr3;
- register_t host_dr0;
- register_t host_dr1;
- register_t host_dr2;
- register_t host_dr3;
- register_t host_dr6;
- register_t host_dr7;
+ uint64_t host_dr0;
+ uint64_t host_dr1;
+ uint64_t host_dr2;
+ uint64_t host_dr3;
+ uint64_t host_dr6;
+ uint64_t host_dr7;
uint64_t host_debugctl;
};
diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx.c b/usr/src/uts/i86pc/io/vmm/intel/vmx.c
index fdc3a99c4a..0f71687d11 100644
--- a/usr/src/uts/i86pc/io/vmm/intel/vmx.c
+++ b/usr/src/uts/i86pc/io/vmm/intel/vmx.c
@@ -2250,7 +2250,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
struct vie *vie;
struct vlapic *vlapic;
struct vm_task_switch *ts;
- uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info, inst_info;
+ uint32_t eax, ecx, edx, idtvec_info, idtvec_err, intr_info;
uint32_t intr_type, intr_vec, reason;
uint64_t exitintinfo, qual, gpa;
bool retu;
@@ -2795,7 +2795,7 @@ vmx_exit_handle_nmi(struct vmx *vmx, int vcpuid, struct vm_exit *vmexit)
static __inline void
vmx_dr_enter_guest(struct vmxctx *vmxctx)
{
- register_t rflags;
+ uint64_t rflags;
/* Save host control debug registers. */
vmxctx->host_dr7 = rdr7();
@@ -2860,7 +2860,7 @@ vmx_dr_leave_guest(struct vmxctx *vmxctx)
}
static int
-vmx_run(void *arg, int vcpu, register_t rip, pmap_t pmap,
+vmx_run(void *arg, int vcpu, uint64_t rip, pmap_t pmap,
struct vm_eventinfo *evinfo)
{
int rc, handled, launched;
@@ -3133,7 +3133,7 @@ vmx_vmcleanup(void *arg)
return;
}
-static register_t *
+static uint64_t *
vmxctx_regptr(struct vmxctx *vmxctx, int reg)
{
switch (reg) {
@@ -3190,7 +3190,7 @@ vmx_getreg(void *arg, int vcpu, int reg, uint64_t *retval)
{
int running, hostcpu, err;
struct vmx *vmx = arg;
- register_t *regp;
+ uint64_t *regp;
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
@@ -3233,7 +3233,7 @@ vmx_setreg(void *arg, int vcpu, int reg, uint64_t val)
{
int running, hostcpu, error;
struct vmx *vmx = arg;
- register_t *regp;
+ uint64_t *regp;
running = vcpu_is_running(vmx->vm, vcpu, &hostcpu);
if (running && hostcpu != curcpu)
diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx.h b/usr/src/uts/i86pc/io/vmm/intel/vmx.h
index a5647e0b87..7943c1fd0e 100644
--- a/usr/src/uts/i86pc/io/vmm/intel/vmx.h
+++ b/usr/src/uts/i86pc/io/vmm/intel/vmx.h
@@ -50,44 +50,34 @@
struct pmap;
struct vmxctx {
- register_t guest_rdi; /* Guest state */
- register_t guest_rsi;
- register_t guest_rdx;
- register_t guest_rcx;
- register_t guest_r8;
- register_t guest_r9;
- register_t guest_rax;
- register_t guest_rbx;
- register_t guest_rbp;
- register_t guest_r10;
- register_t guest_r11;
- register_t guest_r12;
- register_t guest_r13;
- register_t guest_r14;
- register_t guest_r15;
- register_t guest_cr2;
- register_t guest_dr0;
- register_t guest_dr1;
- register_t guest_dr2;
- register_t guest_dr3;
- register_t guest_dr6;
-
-#ifdef __FreeBSD__
- register_t host_r15; /* Host state */
- register_t host_r14;
- register_t host_r13;
- register_t host_r12;
- register_t host_rbp;
- register_t host_rsp;
- register_t host_rbx;
-#endif /* __FreeBSD__ */
-
- register_t host_dr0;
- register_t host_dr1;
- register_t host_dr2;
- register_t host_dr3;
- register_t host_dr6;
- register_t host_dr7;
+ uint64_t guest_rdi; /* Guest state */
+ uint64_t guest_rsi;
+ uint64_t guest_rdx;
+ uint64_t guest_rcx;
+ uint64_t guest_r8;
+ uint64_t guest_r9;
+ uint64_t guest_rax;
+ uint64_t guest_rbx;
+ uint64_t guest_rbp;
+ uint64_t guest_r10;
+ uint64_t guest_r11;
+ uint64_t guest_r12;
+ uint64_t guest_r13;
+ uint64_t guest_r14;
+ uint64_t guest_r15;
+ uint64_t guest_cr2;
+ uint64_t guest_dr0;
+ uint64_t guest_dr1;
+ uint64_t guest_dr2;
+ uint64_t guest_dr3;
+ uint64_t guest_dr6;
+
+ uint64_t host_dr0;
+ uint64_t host_dr1;
+ uint64_t host_dr2;
+ uint64_t host_dr3;
+ uint64_t host_dr6;
+ uint64_t host_dr7;
uint64_t host_debugctl;
int host_tf;
diff --git a/usr/src/uts/i86pc/io/vmm/io/iommu.c b/usr/src/uts/i86pc/io/vmm/io/iommu.c
index 918a9ec3e4..2e5fc9df32 100644
--- a/usr/src/uts/i86pc/io/vmm/io/iommu.c
+++ b/usr/src/uts/i86pc/io/vmm/io/iommu.c
@@ -204,12 +204,8 @@ iommu_find_device(dev_info_t *dip, void *arg)
static void
iommu_init(void)
{
- int error, bus, slot, func;
+ int error;
vm_paddr_t maxaddr;
-#ifdef __FreeBSD__
- devclass_t dc;
-#endif
- device_t dev;
if (!iommu_enable)
return;
@@ -246,35 +242,7 @@ iommu_init(void)
*/
iommu_create_mapping(host_domain, 0, 0, maxaddr);
-#ifdef __FreeBSD__
- add_tag = EVENTHANDLER_REGISTER(pci_add_device, iommu_pci_add, NULL, 0);
- delete_tag = EVENTHANDLER_REGISTER(pci_delete_device, iommu_pci_delete,
- NULL, 0);
- dc = devclass_find("ppt");
- for (bus = 0; bus <= PCI_BUSMAX; bus++) {
- for (slot = 0; slot <= PCI_SLOTMAX; slot++) {
- for (func = 0; func <= PCI_FUNCMAX; func++) {
- dev = pci_find_dbsf(0, bus, slot, func);
- if (dev == NULL)
- continue;
-
- /* Skip passthrough devices. */
- if (dc != NULL &&
- device_get_devclass(dev) == dc)
- continue;
-
- /*
- * Everything else belongs to the host
- * domain.
- */
- iommu_add_device(host_domain,
- pci_get_rid(dev));
- }
- }
- }
-#else
ddi_walk_devs(ddi_root_node(), iommu_find_device, (void *)B_TRUE);
-#endif
IOMMU_ENABLE();
}
diff --git a/usr/src/uts/i86pc/io/vmm/io/vlapic.c b/usr/src/uts/i86pc/io/vmm/io/vlapic.c
index 1288f69321..f7a05254ec 100644
--- a/usr/src/uts/i86pc/io/vmm/io/vlapic.c
+++ b/usr/src/uts/i86pc/io/vmm/io/vlapic.c
@@ -140,12 +140,14 @@ vlapic_dfr_write_handler(struct vlapic *vlapic)
lapic->dfr &= APIC_DFR_MODEL_MASK;
lapic->dfr |= APIC_DFR_RESERVED;
+#ifdef __FreeBSD__
if ((lapic->dfr & APIC_DFR_MODEL_MASK) == APIC_DFR_MODEL_FLAT)
VLAPIC_CTR0(vlapic, "vlapic DFR in Flat Model");
else if ((lapic->dfr & APIC_DFR_MODEL_MASK) == APIC_DFR_MODEL_CLUSTER)
VLAPIC_CTR0(vlapic, "vlapic DFR in Cluster Model");
else
VLAPIC_CTR1(vlapic, "DFR in Unknown Model %#x", lapic->dfr);
+#endif
}
void
diff --git a/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h b/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h
index fbd2884b84..9501850dfc 100644
--- a/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h
+++ b/usr/src/uts/i86pc/io/vmm/sys/vmm_kernel.h
@@ -74,7 +74,7 @@ typedef int (*vmm_init_func_t)(int ipinum);
typedef int (*vmm_cleanup_func_t)(void);
typedef void (*vmm_resume_func_t)(void);
typedef void * (*vmi_init_func_t)(struct vm *vm, struct pmap *pmap);
-typedef int (*vmi_run_func_t)(void *vmi, int vcpu, register_t rip,
+typedef int (*vmi_run_func_t)(void *vmi, int vcpu, uint64_t rip,
struct pmap *pmap, struct vm_eventinfo *info);
typedef void (*vmi_cleanup_func_t)(void *vmi);
typedef int (*vmi_get_register_t)(void *vmi, int vcpu, int num,
diff --git a/usr/src/uts/i86pc/io/vmm/vmm.c b/usr/src/uts/i86pc/io/vmm/vmm.c
index 302af0670e..4eb967fd89 100644
--- a/usr/src/uts/i86pc/io/vmm/vmm.c
+++ b/usr/src/uts/i86pc/io/vmm/vmm.c
@@ -1915,7 +1915,7 @@ vm_suspend(struct vm *vm, enum vm_suspend_how how)
if (how <= VM_SUSPEND_NONE || how >= VM_SUSPEND_LAST)
return (EINVAL);
- if (atomic_cmpset_int(&vm->suspend, 0, how) == 0) {
+ if (atomic_cmpset_int((uint_t *)&vm->suspend, 0, how) == 0) {
VM_CTR2(vm, "virtual machine already suspended %d/%d",
vm->suspend, how);
return (EALREADY);
diff --git a/usr/src/uts/i86pc/vmm/Makefile b/usr/src/uts/i86pc/vmm/Makefile
index 4b426361ae..0106dd0a0f 100644
--- a/usr/src/uts/i86pc/vmm/Makefile
+++ b/usr/src/uts/i86pc/vmm/Makefile
@@ -43,7 +43,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
# Overrides and additions
#
-CERRWARN += -_gcc=-Wno-empty-body
# 3rd party code
SMOFF += all_func_returns
@@ -51,9 +50,6 @@ SMOFF += all_func_returns
# needs work
$(OBJS_DIR)/vmm_sol_dev.o := SMOFF += signed_integer_overflow_check
-# a can't happen: vmx_setcap() warn: variable dereferenced before check 'pptr'
-$(OBJS_DIR)/vmx.o := SMOFF += deref_check
-
ALL_BUILDS = $(ALL_BUILDSONLY64)
DEF_BUILDS = $(DEF_BUILDSONLY64)
PRE_INC_PATH = -I$(COMPAT)/bhyve -I$(COMPAT)/bhyve/amd64 \
@@ -61,15 +57,9 @@ PRE_INC_PATH = -I$(COMPAT)/bhyve -I$(COMPAT)/bhyve/amd64 \
INC_PATH += -I$(UTSBASE)/i86pc/io/vmm -I$(UTSBASE)/i86pc/io/vmm/io
AS_INC_PATH += -I$(UTSBASE)/i86pc/io/vmm -I$(OBJS_DIR)
-CFLAGS += -_gcc=-Wimplicit-function-declaration
# enable collection of VMM statistics
CFLAGS += -DVMM_KEEP_STATS
-$(OBJS_DIR)/vmm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits
-$(OBJS_DIR)/svm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits
-$(OBJS_DIR)/vmx.o := CERRWARN += -_gcc=-Wno-unused-variable
-$(OBJS_DIR)/iommu.o := CERRWARN += -_gcc=-Wno-unused-variable
-
LDFLAGS += -N misc/acpica -N misc/pcie -N fs/dev
LDFLAGS += -z type=kmod -M $(MAPFILE)