Commit Graph

14703 Commits

Author SHA1 Message Date
Peter Grehan
cf087c12c2 ZFS boot support for bhyveload.
Modelled after the i386 zfsloader. However, with no
2nd stage zfsboot to search for a bootable dataset,
attempt a ZFS boot if there is more than one ZFS
dataset found during the disk probe.

sys/boot/userboot/zfs
 - build the ZFS boot library

sys/boot/userboot/userboot/
 conf.c
  - Add the ZFS pool and filesystem tables
 devicename.c
  - correctly format ZFS devices
 main.c
  - increase the size of the libstand malloc pool
  to account for the increased usage from ZFS buffers
  - probe for a ZFS dataset, and if one is
  found, attempt to boot from it.

usr.sbin/bhyveload/bhyveload.c
 - allow multiple invocations of the '-d' option
 to specify multiple disks e.g. a raidz set.
 Up to 32 disks are supported.

Tested with various combinations of GPT, MBR, single
and multiple disks, RAID-Z, mirrors.

Reviewed by:	neel
Discussed with:	avg
Tested by:	Michael Dexter and others
MFC after:	3 weeks
2014-02-22 07:18:06 +00:00
Peter Grehan
4258c52e29 Fix virtio spec URL.
Submitted by:	lwhsu
MFC after:	1 week
2014-02-21 22:45:35 +00:00
Tycho Nightingale
182d7debb9 Avoid clobbering the counter mode when issuing a latch command.
Approved by:	grehan (co-mentor)
2014-02-21 01:15:26 +00:00
Neel Natu
52e5c8a2ec Simplify APIC mode switching from MMIO to x2APIC. In part this is done to
simplify the implementation of the x2APIC virtualization assist in VT-x.

Prior to this change the vlapic allowed the guest to change its mode from
xAPIC to x2APIC. We don't allow that any more and the vlapic mode is locked
when the virtual machine is created. This is not very constraining because
operating systems already have to deal with BIOS setting up the APIC in
x2APIC mode at boot.

Fix a bug in the CPUID emulation where the x2APIC capability was leaking
from the host to the guest.

Ignore MMIO reads and writes to the vlapic in x2APIC mode. Similarly, ignore
MSR accesses to the vlapic when it is in xAPIC mode.

The default configuration of the vlapic is xAPIC. The "-x" option to bhyve(8)
can be used to change the mode to x2APIC instead.

Discussed with:	grehan@
2014-02-20 01:48:25 +00:00
Neel Natu
7a902ec0ec Add a check to validate that memory BARs of passthru devices are 4KB aligned.
Also, the MSI-x table offset is not required to be 4KB aligned so take this
into account when computing the pages occupied by the MSI-x tables.
2014-02-18 19:00:15 +00:00
John Baldwin
a96b8b801a Tweak the handling of PCI capabilities in emulated devices to remove
the non-standard zero capability list terminator.   Instead, track
the start and end of the most recently added capability and use that
to adjust the previous capability's next pointer when a capability is
added and to determine the range of config registers belonging to
PCI capability registers.

Reviewed by:	neel
2014-02-18 03:00:20 +00:00
Devin Teske
c7684efd3a Add zfsboot to the scripted interface of bsdinstall(8); oops!
NB: If the zfsboot variables ($ZFSBOOT_*) are set, a script is
assumed to want zfsboot module instead of scriptedpart module.

Submitted by:	Loïc Brarda <loic.brarda@cern.ch>
Reviewed by:	nwhitehorn@
MFC after:	3 days
2014-02-16 06:56:44 +00:00
Neel Natu
06db1b4a59 Update bhyve(8) man page to describe the usage of the "-s" option to assign
bus numbers to emulated devices. Also add the restriction that the LPC bridge
emulation can only be configured on bus 0.

Reviewed by:	grehan@
2014-02-14 21:46:04 +00:00
Neel Natu
d84882ca8f Allow PCI devices to be configured on all valid bus numbers from 0 to 255.
This is done by representing each bus as root PCI device in ACPI. The device
implements the _BBN method to return the PCI bus number to the guest OS.

Each PCI bus keeps track of the resources that is decodes for devices
configured on the bus: i/o, mmio (32-bit) and mmio (64-bit). These windows
are advertised to the guest via the _CRS object of the root device.

Bus 0 is treated specially since it consumes the I/O ports to access the
PCI config space [0xcf8-0xcff]. It also decodes the legacy I/O ports that
are consumed by devices on the LPC bus. For this reason the LPC bridge can
be configured only on bus 0.

The bus number can be specified using the following command line option
to bhyve(8): "-s <bus>:<slot>:<func>,<emul>[,<config>]"

Discussed with:	grehan@
Reviewed by:	jhb@
2014-02-14 21:34:08 +00:00
Christian Brueffer
2df958167e In chat_UpdateSet(), initialize the input buffer to prevent stale data
from previous timed out commands.

PR:		186530
Submitted by:	Alexander Zagrebin <alexz at visp.ru>
Reviewed by:	brian
MFC after:	1 week
2014-02-14 20:34:24 +00:00
Niclas Zeising
d4f5f0007e Bump .Dd forgotten in r261832.
MFC after:	2 weeks
2014-02-13 13:11:34 +00:00
Niclas Zeising
22e9d10a7f Add commas (,) to the list in the SEE ALSO section, to match most other
manuals.

MFC after:	2 weeks
2014-02-13 12:53:57 +00:00
Niclas Zeising
a074a227fa Add cross references between rc.conf(5) and jail.conf(5).
MFC after:	2 weeks
2014-02-13 12:52:26 +00:00
Gleb Smirnoff
9968f056d6 Fix world build WITHOUT_PF.
Sponsored by:	Nginx, Inc.
2014-02-12 09:59:48 +00:00
Tycho Nightingale
2a261121af Provide an indication a "PIO Setup Device to Host FIS" occurred while executing
the IDENTIFY DEVICE and IDENTIFY PACKET DEVICE commands.

Also, provide an indication a "D2H Register FIS" occurred during a SET FEATURES
command.

Approved by:	grehan (co-mentor)
2014-02-12 00:32:14 +00:00
Christian Brueffer
a051bcb130 In acline_init(), initialize ac_line to SRC_UNKNOWN. Previously
this could lead to the -n option effectively being ignored (in case
ac_line happened to be 0 aka SRC_AC), or other undefined behaviour.

PR:		169779
Submitted by:	Alex Gonzalez <loox at e-shell.net>
Reviewed by:	jhb
MFC after:	2 weeks
2014-02-11 15:16:49 +00:00
Edward Tomasz Napierala
cadf3831b3 Make the debug messages during ctld(8) shutdown less confusing.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:38:44 +00:00
Edward Tomasz Napierala
6dc3a9f496 Show proper configuration file line numbers in error messages.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:37:49 +00:00
Edward Tomasz Napierala
e0fccc9806 Make ctld error out on invalid characters in ctl.conf.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:36:15 +00:00
Edward Tomasz Napierala
b3361aabc8 Improve error reporting.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:35:26 +00:00
Edward Tomasz Napierala
70b939ecd3 So, it turns out SIGCHLD is discarded by default, so we have to set up
a dummy handler to make it interrupt an ioctl(2) or select(2).

This makes those short-lived ctld(8) zombies disappear.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:33:44 +00:00
Edward Tomasz Napierala
e76ce4484d Use new auth-type "deny" instead of using "chap" with no chap entries;
it's cleaner this way, and gives better feedback to the user.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:32:36 +00:00
Edward Tomasz Napierala
ccb1f04d95 Use "default" as default discovery-auth-group, instead of "no-access".
It doesn't change visible behaviour, as previously auth-group "default"
wasn't redefinable, so by default access was always denied.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:31:08 +00:00
Edward Tomasz Napierala
affb88f5a2 Update manual page to match recent auth-group "default" changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:58 +00:00
Edward Tomasz Napierala
e7977549f7 Add a new auth-group "default", defaulting to deny, and make it possible
to redefine it.  From now on, assigning auth-group to a target is no longer
mandatory.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:05 +00:00
Edward Tomasz Napierala
252d941cc3 Make it possible to redefine portal-group "default".
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:27:25 +00:00
Edward Tomasz Napierala
df9900fb5b Add auth-type.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:26:05 +00:00
Edward Tomasz Napierala
f7ae5bf8de Rename a variable, no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:14:50 +00:00
Edward Tomasz Napierala
e1c0d0d8a3 Yacc cleanup; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:11:37 +00:00
Edward Tomasz Napierala
1658628dc6 Make function ordering slightly more logical; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:10:01 +00:00
Edward Tomasz Napierala
8cb2e95863 Implement initiator-name and initiator-portal restrictions.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:08:04 +00:00
Edward Tomasz Napierala
5d5a95f138 Daemonize after applying configuration, not before, so that
any problems - including "daemon already running" - are visible
on the terminal and not just in logs.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:59:57 +00:00
Edward Tomasz Napierala
017cbe4aaa Empty data segment during Login Phase is rather unlikely, but it's
not, by itself, a protocol error.  This fixes interoperability with
OpenBSD initiator.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:58:32 +00:00
Edward Tomasz Napierala
1885dba7b1 The log_whatever() routines don't accept NULL for format strings,
so mark them as __printflike instead of__printf0like.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:56:43 +00:00
Edward Tomasz Napierala
a19eebb1b7 Improve check for duplicated paths. It shows the warning twice for
every path (once for each duplicate found), but it should do for now.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:55:32 +00:00
Edward Tomasz Napierala
2fabfaa504 Refactor.
Sponsored by:	The FreeBSD Foundation
2014-02-11 10:53:08 +00:00
Edward Tomasz Napierala
1ecb3c5857 So, it turns out SIGCHLD is discarded by default, so we have to set up
a dummy handler to make it interrupt an ioctl(2) or select(2).

This makes those short-lived iscsid(8) zombies disappear.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:47:28 +00:00
Edward Tomasz Napierala
022b237d47 Empty data segment during Login Phase is rather unlikely, but it's not
a protocol error.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:45:20 +00:00
Edward Tomasz Napierala
3fa953a071 The log_whatever() routines don't accept NULL for format strings,
so mark them as __printflike instead of __printf0like.

Sponsored by:	The FreeBSD Foundation
2014-02-10 15:12:59 +00:00
Joel Dahl
7e700c30d2 mdoc: minor paragraph fixes. 2014-02-08 13:37:02 +00:00
John Baldwin
1f82944f35 Mark the I/O ports used by the bhyve console and debug devices as system
resources.

MFC after:	1 week
2014-02-07 20:53:41 +00:00
Dag-Erling Smørgrav
b7e6051a78 Add -p to the example (why isn't this the default?)
MFC after:	1 week
2014-02-06 09:57:27 +00:00
Dag-Erling Smørgrav
b81e945b9b Add an example of the most common use case.
MFC after:	1 week
2014-02-05 09:28:02 +00:00
John Baldwin
00f3efe1bd Add support for FreeBSD/i386 guests under bhyve.
- Similar to the hack for bootinfo32.c in userboot, define
  _MACHINE_ELF_WANT_32BIT in the load_elf32 file handlers in userboot.
  This allows userboot to load 32-bit kernels and modules.
- Copy the SMAP generation code out of bootinfo64.c and into its own
  file so it can be shared with bootinfo32.c to pass an SMAP to the i386
  kernel.
- Use uint32_t instead of u_long when aligning module metadata in
  bootinfo32.c in userboot, as otherwise the metadata used 64-bit
  alignment which corrupted the layout.
- Populate the basemem and extmem members of the bootinfo struct passed
  to 32-bit kernels.
- Fix the 32-bit stack in userboot to start at the top of the stack
  instead of the bottom so that there is room to grow before the
  kernel switches to its own stack.
- Push a fake return address onto the 32-bit stack in addition to the
  arguments normally passed to exec() in the loader.  This return
  address is needed to convince recover_bootinfo() in the 32-bit
  locore code that it is being invoked from a "new" boot block.
- Add a routine to libvmmapi to setup a 32-bit flat mode register state
  including a GDT and TSS that is able to start the i386 kernel and
  update bhyveload to use it when booting an i386 kernel.
- Use the guest register state to determine the CPU's current instruction
  mode (32-bit vs 64-bit) and paging mode (flat, 32-bit, PAE, or long
  mode) in the instruction emulation code.  Update the gla2gpa() routine
  used when fetching instructions to handle flat mode, 32-bit paging, and
  PAE paging in addition to long mode paging.  Don't look for a REX
  prefix when the CPU is in 32-bit mode, and use the detected mode to
  enable the existing 32-bit mode code when decoding the mod r/m byte.

Reviewed by:	grehan, neel
MFC after:	1 month
2014-02-05 04:39:03 +00:00
Warner Losh
2c32ed5e40 Fix ! by not clearing not at the bottom of the loop.
Add a blank line

Submitted by:	bde (blank line)
2014-02-05 00:26:11 +00:00
Warner Losh
ff9aeb4c47 Implement the '!' operator for files* files. It means 'include this
only if the specified option is NOT specified.' Bump version because
old config won't be able to cope with files* files that have this
construct in them.
2014-02-04 18:28:58 +00:00
Warner Losh
3de7c987c7 Convert the loop by gotos into a for loop to improve readability. I
did this only with the inner loop for the token parsing, and not the
outer loop which was understandable enough when the extra layers of
looping went away...
2014-02-03 19:14:36 +00:00
Warner Losh
6554680b51 Fix a bug introduced in r261437 that failed to honor "optional
profiling-routine" to work, since profiling-routine is not really an
option or a device, but a special case elsewhere in the code.
2014-02-03 19:10:33 +00:00
Warner Losh
2ae93551bd Slight cleanup to the error messaging to compress code vertically... 2014-02-03 18:56:41 +00:00
Warner Losh
87fbb90b99 Better error messages when EOF is hit in the middle of a phrase. 2014-02-03 18:31:51 +00:00