Date: Sat, 4 Aug 2012 22:46:30 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r239042 - projects/bhyve/lib/libvmmapi Message-ID: <201208042246.q74MkUZP005026@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Sat Aug 4 22:46:29 2012 New Revision: 239042 URL: http://svn.freebsd.org/changeset/base/239042 Log: Allow the 'bhyve' process to control whether or not the virtual machine sees an ioapic. Obtained from: NetApp Modified: projects/bhyve/lib/libvmmapi/mptable.c projects/bhyve/lib/libvmmapi/mptable.h projects/bhyve/lib/libvmmapi/vmmapi.c projects/bhyve/lib/libvmmapi/vmmapi.h Modified: projects/bhyve/lib/libvmmapi/mptable.c ============================================================================== --- projects/bhyve/lib/libvmmapi/mptable.c Sat Aug 4 20:40:36 2012 (r239041) +++ projects/bhyve/lib/libvmmapi/mptable.c Sat Aug 4 22:46:29 2012 (r239042) @@ -118,20 +118,20 @@ mp_build_bus_entries(struct mpe_bus *mpe } -#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 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 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_p 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; Modified: projects/bhyve/lib/libvmmapi/mptable.h ============================================================================== --- projects/bhyve/lib/libvmmapi/mptable.h Sat Aug 4 20:40:36 2012 (r239041) +++ projects/bhyve/lib/libvmmapi/mptable.h Sat Aug 4 22:46:29 2012 (r239042) @@ -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_ */ Modified: projects/bhyve/lib/libvmmapi/vmmapi.c ============================================================================== --- projects/bhyve/lib/libvmmapi/vmmapi.c Sat Aug 4 20:40:36 2012 (r239041) +++ projects/bhyve/lib/libvmmapi/vmmapi.c Sat Aug 4 22:46:29 2012 (r239042) @@ -306,11 +306,12 @@ vm_inject_event2(struct vmctx *ctx, int } 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 Modified: projects/bhyve/lib/libvmmapi/vmmapi.h ============================================================================== --- projects/bhyve/lib/libvmmapi/vmmapi.h Sat Aug 4 20:40:36 2012 (r239041) +++ projects/bhyve/lib/libvmmapi/vmmapi.h Sat Aug 4 22:46:29 2012 (r239042) @@ -58,8 +58,8 @@ int vm_get_pinning(struct vmctx *ctx, in 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208042246.q74MkUZP005026>