socsvn commit: r289535 - in soc2015/mihai/bhyve-on-arm-head/sys/arm: include vmm
mihai at FreeBSD.org
mihai at FreeBSD.org
Mon Aug 10 18:44:10 UTC 2015
Author: mihai
Date: Mon Aug 10 18:44:08 2015
New Revision: 289535
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289535
Log:
sys: arm: vmm: vmm.c: added a new ioctl VM_ATTACH_VGIC
Modified:
soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h
soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h
soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c
soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c
Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h Mon Aug 10 18:43:02 2015 (r289534)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm.h Mon Aug 10 18:44:08 2015 (r289535)
@@ -128,6 +128,7 @@
int vm_get_capability(struct vm *vm, int vcpu, int type, int *val);
int vm_set_capability(struct vm *vm, int vcpu, int type, int val);
int vm_activate_cpu(struct vm *vm, int vcpu);
+int vm_attach_vgic(struct vm *vm, uint64_t distributor_paddr, uint64_t cpu_int_paddr);
struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid);
void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip);
void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip);
Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h Mon Aug 10 18:43:02 2015 (r289534)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/include/vmm_dev.h Mon Aug 10 18:44:08 2015 (r289535)
@@ -97,6 +97,11 @@
int vcpuid;
};
+struct vm_attach_vgic {
+ uint64_t distributor_paddr;
+ uint64_t cpu_int_paddr;
+};
+
#define VM_ACTIVE_CPUS 0
#define VM_SUSPENDED_CPUS 1
@@ -126,6 +131,9 @@
/* vm_cpuset */
IOCNUM_ACTIVATE_CPU = 90,
IOCNUM_GET_CPUSET = 91,
+
+ /* vm_attach_vgic */
+ IOCNUM_ATTACH_VGIC = 110,
};
#define VM_RUN \
@@ -156,4 +164,7 @@
_IOW('v', IOCNUM_ACTIVATE_CPU, struct vm_activate_cpu)
#define VM_GET_CPUS \
_IOW('v', IOCNUM_GET_CPUSET, struct vm_cpuset)
+#define VM_ATTACH_VGIC \
+ _IOW('v', IOCNUM_ATTACH_VGIC, struct vm_attach_vgic)
+
#endif
Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c Mon Aug 10 18:43:02 2015 (r289534)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c Mon Aug 10 18:44:08 2015 (r289535)
@@ -37,6 +37,7 @@
#include "vmm_stat.h"
#include "vmm_mem.h"
#include "mmu.h"
+#include "vgic.h"
struct vcpu {
int flags;
@@ -235,6 +236,10 @@
strcpy(vm->name, name);
vm->cookie = VMINIT(vm);
+ /* TEMP - PL804 timer mapping */
+ VMMMAP_SET(vm->cookie, 0x1c110000, 0x1c110000, PAGE_SIZE,
+ VM_PROT_ALL);
+
for (i = 0; i < VM_MAXCPU; i++) {
vcpu_init(vm, i);
}
@@ -301,14 +306,17 @@
if (error == 0) {
switch (vme->exitcode) {
case VM_EXITCODE_INST_EMUL:
- /* TODO there is no in-kernel emulation yet */
+ /* Check fi we need to do in-kernel emulation */
+
+ pc = vme->pc + vme->inst_length;
retu = true;
+ error = vgic_emulate_distributor(vm->cookie, vcpuid, vme, &retu);
break;
default:
retu = true; /* handled in userland */
break;
}
- }
+ }
if (error == 0 && retu == false)
goto restart;
@@ -625,4 +633,8 @@
return (0);
}
-
+int
+vm_attach_vgic(struct vm *vm, uint64_t distributor_paddr, uint64_t cpu_int_paddr)
+{
+ return vgic_attach(vm->cookie, distributor_paddr, cpu_int_paddr);
+}
Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c Mon Aug 10 18:43:02 2015 (r289534)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c Mon Aug 10 18:44:08 2015 (r289535)
@@ -22,7 +22,6 @@
#include <machine/vmm.h>
#include <machine/vmm_dev.h>
-
struct vmmdev_softc {
struct vm *vm; /* vm instance cookie */
struct cdev *cdev;
@@ -81,6 +80,7 @@
struct vm_memory_segment *seg;
struct vm_register *vmreg;
struct vm_activate_cpu *vac;
+ struct vm_attach_vgic *vav;
sc = vmmdev_lookup2(cdev);
if (sc == NULL)
@@ -115,6 +115,7 @@
break;
case VM_MAP_MEMORY:
+ case VM_ATTACH_VGIC:
/*
* ioctls that operate on the entire virtual machine must
* prevent all vcpus from running.
@@ -166,7 +167,10 @@
case VM_ACTIVATE_CPU:
vac = (struct vm_activate_cpu *)data;
error = vm_activate_cpu(sc->vm, vac->vcpuid);
-
+ case VM_ATTACH_VGIC:
+ vav = (struct vm_attach_vgic *)data;
+ error = vm_attach_vgic(sc->vm, vav->distributor_paddr,
+ vav->cpu_int_paddr);
default:
error = ENOTTY;
break;
More information about the svn-soc-all
mailing list