socsvn commit: r290379 - soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm
mihai at FreeBSD.org
mihai at FreeBSD.org
Mon Aug 31 10:29:19 UTC 2015
Author: mihai
Date: Mon Aug 31 10:29:17 2015
New Revision: 290379
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=290379
Log:
sys: arm: vmm: vgic.c: discover maintenance interrupts for the vGIC
Modified:
soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c
Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c Mon Aug 31 09:39:16 2015 (r290378)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vgic.c Mon Aug 31 10:29:17 2015 (r290379)
@@ -34,6 +34,13 @@
static uint32_t lr_num;
+static struct resource_spec arm_vgic_maintenance_intr_spec[] = {
+ { SYS_RES_IRQ, 0, RF_ACTIVE }, /* vGIC maintenance interrupt */
+ { -1, 0 }
+};
+static struct resource *arm_vgic_maintenance_intr_res[1];
+static void *arm_vgic_maintenance_intr_ihl[1];
+
static int
vgic_dist_mmio_read(void *vm, int vcpuid, uint64_t gpa, uint64_t *rval, int size,
void *arg)
@@ -110,9 +117,24 @@
return (0);
}
+static int
+vgic_maintenance_intr(void *arg)
+{
+
+ static struct arm_gic_softc *sc;
+
+ sc = (struct arm_gic_softc *)arg;
+
+ printf("%s\n",__func__);
+
+ return (FILTER_HANDLED);
+}
+
int
vgic_hyp_init(void)
{
+ int error;
+
if (!(gic_sc = get_arm_gic_sc())) {
printf("vgic_hyp_init: GIC no present\n");
return (ENXIO);
@@ -136,6 +158,20 @@
lr_num = (gic_h_read_4(gic_sc, GICH_VTR) & 0x3f) + 1;
+ if (bus_alloc_resources(gic_sc->gic_dev, arm_vgic_maintenance_intr_spec, arm_vgic_maintenance_intr_res)) {
+ printf("vgic_hyp_init: Could not allocate maintenance IRQ resource\n");
+
+ return (ENXIO);
+ }
+
+ /* Register the vGIC maintenance interrupt */
+ error = bus_setup_intr(gic_sc->gic_dev, arm_vgic_maintenance_intr_res[0], INTR_TYPE_CLK,
+ vgic_maintenance_intr, NULL, gic_sc, &arm_vgic_maintenance_intr_ihl[0]);
+ if (error) {
+ printf("vgic_hyp_init: Unable to setup maintenance interrupt\n");
+ return (ENXIO);
+ }
+
lpae_vmmmap_set(NULL,
(lpae_vm_vaddr_t)virtual_int_ctrl_vaddr,
(lpae_vm_paddr_t)virtual_int_ctrl_paddr,
More information about the svn-soc-all
mailing list