summaryrefslogtreecommitdiffstats
path: root/lib/libvmmapi
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-08-04 22:46:29 +0000
committerneel <neel@FreeBSD.org>2012-08-04 22:46:29 +0000
commitac88464d24af550cd19d2c9aefd2f431e6ae89ed (patch)
treeb08927969c4f03ffa459bf474f91b2cc522117f4 /lib/libvmmapi
parent66c8120152f661ab4690b86ac87beeb00cc887e5 (diff)
downloadFreeBSD-src-ac88464d24af550cd19d2c9aefd2f431e6ae89ed.zip
FreeBSD-src-ac88464d24af550cd19d2c9aefd2f431e6ae89ed.tar.gz
Allow the 'bhyve' process to control whether or not the virtual machine sees an
ioapic. Obtained from: NetApp
Diffstat (limited to 'lib/libvmmapi')
-rw-r--r--lib/libvmmapi/mptable.c26
-rw-r--r--lib/libvmmapi/mptable.h3
-rw-r--r--lib/libvmmapi/vmmapi.c5
-rw-r--r--lib/libvmmapi/vmmapi.h4
4 files changed, 21 insertions, 17 deletions
diff --git a/lib/libvmmapi/mptable.c b/lib/libvmmapi/mptable.c
index fe84f35..048ea2d 100644
--- a/lib/libvmmapi/mptable.c
+++ b/lib/libvmmapi/mptable.c
@@ -118,20 +118,20 @@ mp_build_bus_entries(struct mpe_bus *mpeb)
}
-#ifdef notyet
static void
-mp_build_ioapic_entries(struct mpe_ioapic *mpei)
+mp_build_ioapic_entries(struct mpe_ioapic *mpei, int id)
{
memset(mpei, 0, sizeof(*mpei));
mpei->entry_type = MP_ENTRY_IOAPIC;
- mpei->ioapic_id = MPE_IOAPIC_ID;
+ mpei->ioapic_id = id;
mpei->ioapic_version = IOAPIC_VERSION;
mpei->ioapic_flags = MPE_IOAPIC_FLAG_EN;
mpei->ioapic_paddr = IOAPIC_PADDR;
}
+#ifdef notyet
static void
-mp_build_ioint_entries(struct mpe_ioint *mpeii, int num_pins)
+mp_build_ioint_entries(struct mpe_ioint *mpeii, int num_pins, int id)
{
int pin;
@@ -147,7 +147,7 @@ mp_build_ioint_entries(struct mpe_ioint *mpeii, int num_pins)
memset(mpeii, 0, sizeof(*mpeii));
mpeii->entry_type = MP_ENTRY_IOINT;
mpeii->src_bus_id = MPE_BUSID_ISA;
- mpeii->dst_apic_id = MPE_IOAPIC_ID;
+ mpeii->dst_apic_id = id;
/*
* All default configs route IRQs from bus 0 to the first 16 pins
@@ -285,7 +285,7 @@ mptable_dump(struct mp_floating_pointer *mpfp, struct mp_config_hdr *mpch)
int
vm_build_mptable(struct vmctx *ctx, vm_paddr_t gpa, int len, int ncpu,
- void *oemp, int oemsz)
+ int ioapic, void *oemp, int oemsz)
{
struct mp_config_hdr *mpch;
char *mapaddr;
@@ -313,12 +313,16 @@ vm_build_mptable(struct vmctx *ctx, vm_paddr_t gpa, int len, int ncpu,
mp_build_bus_entries((struct mpe_bus*)mapaddr);
mapaddr += (sizeof(struct mpe_bus)*MPE_NUM_BUSES);
mpch->nr_entries += MPE_NUM_BUSES;
-#if 0
- mp_build_ioapic_entries((struct mpe_ioapic*)mapaddr);
- mapaddr += sizeof(struct mpe_ioapic);
- mpch->nr_entries++;
- mp_build_ioint_entries((struct mpe_ioint*)mapaddr, MPEII_MAX_IRQ);
+ if (ioapic) {
+ mp_build_ioapic_entries((struct mpe_ioapic*)mapaddr, ncpu + 1);
+ mapaddr += sizeof(struct mpe_ioapic);
+ mpch->nr_entries++;
+ }
+
+#ifdef notyet
+ mp_build_ioint_entries((struct mpe_ioint*)mapaddr, MPEII_MAX_IRQ,
+ ncpu + 1);
mapaddr += sizeof(struct mpe_ioint)*MPEII_MAX_IRQ;
mpch->nr_entries += MPEII_MAX_IRQ;
diff --git a/lib/libvmmapi/mptable.h b/lib/libvmmapi/mptable.h
index cad8834..51c7bc1 100644
--- a/lib/libvmmapi/mptable.h
+++ b/lib/libvmmapi/mptable.h
@@ -128,7 +128,6 @@ struct mpe_bus {
/*
* MP IO APIC Entry
*/
-#define MPE_IOAPIC_ID (2)
#define MPE_IOAPIC_FLAG_EN (1)
struct mpe_ioapic {
uint8_t entry_type;
@@ -167,5 +166,5 @@ struct mpe_lint {
};
int vm_build_mptable(struct vmctx *ctxt, vm_paddr_t gpa, int len,
- int ncpu, void *oemp, int oemsz);
+ int ncpu, int ioapic, void *oemp, int oemsz);
#endif /* _MPTABLE_h_ */
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index d88b694..5882bd2 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -306,11 +306,12 @@ vm_inject_event2(struct vmctx *ctx, int vcpu, enum vm_event_type type,
}
int
-vm_build_tables(struct vmctx *ctxt, int ncpu, void *oemtbl, int oemtblsz)
+vm_build_tables(struct vmctx *ctxt, int ncpu, int ioapic,
+ void *oemtbl, int oemtblsz)
{
return (vm_build_mptable(ctxt, BIOS_ROM_BASE, BIOS_ROM_SIZE, ncpu,
- oemtbl, oemtblsz));
+ ioapic, oemtbl, oemtblsz));
}
int
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index a216319..de3d4b7 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -58,8 +58,8 @@ int vm_get_pinning(struct vmctx *ctx, int vcpu, int *host_cpuid);
int vm_set_pinning(struct vmctx *ctx, int vcpu, int host_cpuid);
int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip,
struct vm_exit *ret_vmexit);
-int vm_build_tables(struct vmctx *ctxt, int ncpus, void *oemtbl,
- int oemtblsz);
+int vm_build_tables(struct vmctx *ctxt, int ncpus, int ioapic,
+ void *oemtbl, int oemtblsz);
int vm_apicid2vcpu(struct vmctx *ctx, int apicid);
int vm_inject_event(struct vmctx *ctx, int vcpu, enum vm_event_type type,
int vector);
OpenPOWER on IntegriCloud