Make the virtual ioapic available unconditionally in a bhyve virtual machine.

This is in preparation for moving the ioapic device model from userspace to
vmm.ko.

Reviewed by:	grehan
This commit is contained in:
Neel Natu 2013-10-31 05:44:45 +00:00
parent 513c8d338d
commit a1a4cbea58
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257423
6 changed files with 20 additions and 24 deletions

View File

@ -173,7 +173,7 @@ while [ 1 ]; do
break break
fi fi
${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -AI -H -P \ ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \
-g ${gdbport} \ -g ${gdbport} \
-s 0:0,hostbridge \ -s 0:0,hostbridge \
-s 1:0,lpc \ -s 1:0,lpc \

View File

@ -806,7 +806,7 @@ static struct {
}; };
int int
acpi_build(struct vmctx *ctx, int ncpu, int ioapic) acpi_build(struct vmctx *ctx, int ncpu)
{ {
int err; int err;
int i; int i;
@ -814,11 +814,6 @@ acpi_build(struct vmctx *ctx, int ncpu, int ioapic)
err = 0; err = 0;
basl_ncpu = ncpu; basl_ncpu = ncpu;
if (!ioapic) {
fprintf(stderr, "ACPI tables require an ioapic\n");
return (EINVAL);
}
/* /*
* For debug, allow the user to have iasl compiler output sent * For debug, allow the user to have iasl compiler output sent
* to stdout rather than /dev/null * to stdout rather than /dev/null

View File

@ -29,6 +29,6 @@
#ifndef _ACPI_H_ #ifndef _ACPI_H_
#define _ACPI_H_ #define _ACPI_H_
int acpi_build(struct vmctx *ctx, int ncpu, int ioapic); int acpi_build(struct vmctx *ctx, int ncpu);
#endif /* _ACPI_H_ */ #endif /* _ACPI_H_ */

View File

@ -132,7 +132,6 @@ usage(int code)
" -c: # cpus (default 1)\n" " -c: # cpus (default 1)\n"
" -p: pin vcpu 'n' to host cpu 'pincpu + n'\n" " -p: pin vcpu 'n' to host cpu 'pincpu + n'\n"
" -H: vmexit from the guest on hlt\n" " -H: vmexit from the guest on hlt\n"
" -I: present an ioapic to the guest\n"
" -P: vmexit from the guest on pause\n" " -P: vmexit from the guest on pause\n"
" -W: force virtio to use single-vector MSI\n" " -W: force virtio to use single-vector MSI\n"
" -e: exit on unhandled I/O access\n" " -e: exit on unhandled I/O access\n"
@ -543,7 +542,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int c, error, gdb_port, err, ioapic, bvmcons; int c, error, gdb_port, err, bvmcons;
int max_vcpus; int max_vcpus;
struct vmctx *ctx; struct vmctx *ctx;
uint64_t rip; uint64_t rip;
@ -553,7 +552,6 @@ main(int argc, char *argv[])
progname = basename(argv[0]); progname = basename(argv[0]);
gdb_port = 0; gdb_port = 0;
guest_ncpus = 1; guest_ncpus = 1;
ioapic = 0;
memsize = 256 * MB; memsize = 256 * MB;
while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:l:")) != -1) { while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:l:")) != -1) {
@ -601,7 +599,13 @@ main(int argc, char *argv[])
guest_vmexit_on_hlt = 1; guest_vmexit_on_hlt = 1;
break; break;
case 'I': case 'I':
ioapic = 1; /*
* The "-I" option was used to add an ioapic to the
* virtual machine.
*
* An ioapic is now provided unconditionally for each
* virtual machine and this option is now deprecated.
*/
break; break;
case 'P': case 'P':
guest_vmexit_on_pause = 1; guest_vmexit_on_pause = 1;
@ -659,8 +663,7 @@ main(int argc, char *argv[])
if (init_pci(ctx) != 0) if (init_pci(ctx) != 0)
exit(1); exit(1);
if (ioapic) ioapic_init(0);
ioapic_init(0);
if (gdb_port != 0) if (gdb_port != 0)
init_dbgport(gdb_port); init_dbgport(gdb_port);
@ -674,10 +677,10 @@ main(int argc, char *argv[])
/* /*
* build the guest tables, MP etc. * build the guest tables, MP etc.
*/ */
mptable_build(ctx, guest_ncpus, ioapic); mptable_build(ctx, guest_ncpus);
if (acpi) { if (acpi) {
error = acpi_build(ctx, guest_ncpus, ioapic); error = acpi_build(ctx, guest_ncpus);
assert(error == 0); assert(error == 0);
} }

View File

@ -242,7 +242,7 @@ mptable_add_oemtbl(void *tbl, int tblsz)
} }
int int
mptable_build(struct vmctx *ctx, int ncpu, int ioapic) mptable_build(struct vmctx *ctx, int ncpu)
{ {
mpcth_t mpch; mpcth_t mpch;
bus_entry_ptr mpeb; bus_entry_ptr mpeb;
@ -278,12 +278,10 @@ mptable_build(struct vmctx *ctx, int ncpu, int ioapic)
curraddr += sizeof(*mpeb) * MPE_NUM_BUSES; curraddr += sizeof(*mpeb) * MPE_NUM_BUSES;
mpch->entry_count += MPE_NUM_BUSES; mpch->entry_count += MPE_NUM_BUSES;
if (ioapic) { mpei = (io_apic_entry_ptr)curraddr;
mpei = (io_apic_entry_ptr)curraddr; mpt_build_ioapic_entries(mpei, ncpu + 1);
mpt_build_ioapic_entries(mpei, ncpu + 1); curraddr += sizeof(*mpei);
curraddr += sizeof(*mpei); mpch->entry_count++;
mpch->entry_count++;
}
mpie = (int_entry_ptr) curraddr; mpie = (int_entry_ptr) curraddr;
mpt_build_ioint_entries(mpie, MPEII_MAX_IRQ, ncpu + 1); mpt_build_ioint_entries(mpie, MPEII_MAX_IRQ, ncpu + 1);

View File

@ -29,7 +29,7 @@
#ifndef _MPTBL_H_ #ifndef _MPTBL_H_
#define _MPTBL_H_ #define _MPTBL_H_
int mptable_build(struct vmctx *ctx, int ncpu, int ioapic); int mptable_build(struct vmctx *ctx, int ncpu);
void mptable_add_oemtbl(void *tbl, int tblsz); void mptable_add_oemtbl(void *tbl, int tblsz);
#endif /* _MPTBL_H_ */ #endif /* _MPTBL_H_ */