Allow the 'bhyve' process to control whether or not the virtual machine sees an

ioapic.

Obtained from: NetApp
This commit is contained in:
Neel Natu 2012-08-04 22:46:29 +00:00
parent 8124debe13
commit 1ff856dbd7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=239042
4 changed files with 21 additions and 17 deletions

View File

@ -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;

View File

@ -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_ */

View File

@ -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

View File

@ -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);