Commit Graph

102400 Commits

Author SHA1 Message Date
neel
79b96fdbcb MFC r282209:
Emulate the 'bit test' instruction.

MFC r282259:
Re-implement RTC current time calculation to eliminate the possibility of
losing time.

MFC r282281:
Advertise the MTRR feature via CPUID and emulate the minimal set of MTRR MSRs.

MFC r282284:
When an instruction cannot be decoded just return to userspace so bhyve(8)
can dump the instruction bytes.

MFC r282287:
Don't require <sys/cpuset.h> to be always included before <machine/vmm.h>.

MFC r282296:
Emulate MSR_SYSCFG which is accessed by Linux on AMD cpus when MTRRs are
enabled.

MFC r282301:
Relax limits when transitioning a vector from the IRR to the ISR and also
when extinguishing it from the ISR in response to an EOI.

MFC r282335:
Advertise an additional memory BAR in the "dummy" device emulation.

MFC r282336:
Emulate machine check related MSRs to allow guest OSes like Windows to boot.

MFC r282351:
Don't advertise the Intel SMX capability to the guest.

MFC r282407:
Emulate the 'CMP r/m8, imm8' instruction.

MFC r282519:
Add macros for AMD-specific bits in MSR_EFER: LMSLE, FFXSR and TCE.

MFC r282520:
Emulate guest writes to EFER_MSR properly.

MFC r282558:
Deprecate the 3-way return values from vm_gla2gpa() and vm_copy_setup().

MFC r282571:
Check 'td_owepreempt' and yield the vcpu thread if it is set.

MFC r282595:
Allow byte reads of AHCI registers.

MFC r282784:
Handling indirect descriptors is a capability of the host and not one that
needs to be negotiated. Use the host capabilities field and not the negotiated
field when verifying that indirect descriptors are supported.

MFC r282788:
Allow configuration of the sector size advertised to the guest.

MFC r282865:
Set the subvendor field in config space to the vendor ID. This is required
by the Windows virtio drivers to correctly match a device.

MFC r282922:
Bump the size of the blockif scatter-gather list to 67.

MFC r283075:
Fix off-by-one in array index bounds check. bhyveload would allow you to
create 33 entries on an array that only has 32 slots

MFC r283168:
Temporarily revert r282922 which bumped the max descriptors.

MFC r283255:
Emulate the "CMP r/m, reg" instruction (opcode 39H).

MFC r283256:
Add an option "--get-vmcs-exit-inst-length" to display the instruction length
of the instruction that caused the VM-exit.

MFC r283264:
Change the header type of the emulated host-bridge from type 1 to type 0.

MFC r283293:
Don't rely on the 'VM-exit instruction length' field in the VMCS to always
have an accurate length on an EPT violation.

MFC r283299:
Remove bogus verification of instruction length after instruction decode.

MFC r283308:
Exceptions don't deliver an error code in real mode.

MFC r283657:
Fix non-deterministic delays when accessing a vcpu that was in "running" or
"sleeping" state.

MFC r283973:
Use tunable 'hw.vmm.svm.features' to disable specific SVM features even
though they might be available in hardware. Use tunable 'hw.vmm.svm.num_asids'
to limit the number of ASIDs used by the hypervisor.

MFC r284046:
Fix regression in 'verify_gla()' with the RIP-relative addressing mode.

MFC r284174:
Support guest writes to the TSC by enabling the "use TSC offsetting"
execution control.
2015-06-28 03:22:26 +00:00
neel
c85aee0195 MFC r279444:
Allow passthrough devices to be hinted.

MFC r279683:
When ICW1 is issued the edge sense circuit is reset which means that
following an initialization a low-to-high transistion is necesary to
generate an interrupt.

MFC r279925:
Add -p parameter to list PCI device to pass through to the guest.

MFC r281559:
Fix handling of BUS_PROBE_NOWILDCARD in 'device_probe_child()'.

MFC r280447:
When fetching an instruction in non-64bit mode, consider the value of the
code segment base address.

MFC r280725:
Move legacy interrupt allocation for virtio devices to common code.

MFC r280775:
Fix the RTC device model to operate correctly in 12-hour mode.

MFC r280929:
Fix "MOVS" instruction memory to MMIO emulation.

MFC r280968:
Display instruction bytes and %rip prior to aborting due to an instruction
emulation error.

MFC r281145:
Enhance the support for Group 1 Extended opcodes for CMP, AND, OR instructions.

MFC r281542:
Initialize 'error' before use (Coverity IDs 1249748, 1249747, 1249751, 1249749)

MFC r281561:
Prior to aborting due to an ioport error, it is always interesting to see what
the guest's %rip is.

MFC r281611:
If the number of guest vcpus is less than '1' then flag it as an error.

MFC r281612:
Prefer 'vcpu_should_yield()' over checking 'curthread->td_flags' directly.

MFC r281630:
Relax the check on which vectors can be delivered through the APIC. According
to the Intel SDM vectors 16 through 255 are allowed to be delivered via the
local APIC.

MFC r281879:
Missing break in switch case (Coverity ID 1292499)

MFC r281946:
Don't allow guest to modify readonly bits in the PCI config 'status' register.

MFC r281987:
STOS/STOSB/STOSW/STOSD/STOSQ instruction emulation.

MFC r282206:
Implement the century byte in the RTC.
2015-06-28 01:21:55 +00:00
neel
115742fae3 MFC r276428:
Replace bhyve's minimal RTC emulation with a fully featured one in vmm.ko.

MFC r276432:
Initialize all fields of 'struct vm_exception exception' before passing it
to vm_inject_exception().

MFC r276763:
Clear blocking due to STI or MOV SS in the hypervisor when an instruction is
emulated or when the vcpu incurs an exception.

MFC r277149:
Clean up usage of 'struct vm_exception' to only to communicate information
from userspace to vmm.ko when injecting an exception.

MFC r277168:
Fix typo (missing comma).

MFC r277309:
Make the error message explicit instead of just printing the usage if the
virtual machine name is not specified.

MFC r277310:
Simplify instruction restart logic in bhyve.

MFC r277359:
Fix a bug in libvmmapi 'vm_copy_setup()' where it would return success even
if the 'gpa' was in the guest MMIO region.

MFC r277360:
MOVS instruction emulation.

MFC r277626:
Add macro to identify AVIC capability (advanced virtual interrupt controller)
in AMD processors.

MFC r279220:
Don't close a block context if it couldn't be opened avoiding a null deref.

MFC r279225:
Add "-u" option to bhyve(8) to indicate that the RTC should maintain UTC time.

MFC r279227:
Emulate MSR 0xC0011024 when running on AMD processors.

MFC r279228:
Always emulate MSR_PAT on Intel processors and don't rely on PAT save/restore
capability of VT-x. This lets bhyve run nested in older VMware versions that
don't support the PAT save/restore capability.

MFC r279540:
Fix warnings/errors when building vmm.ko with gcc.
2015-06-27 22:48:22 +00:00
hselasky
45502dd8d1 MFC r284743:
Rename __weak to __weak_symbol to avoid language conflict with objective-C.

PR:		200972 (exp-run)
Suggested by:	theraven@
2015-06-26 21:35:36 +00:00
delphij
5a956cd60a MFC r267386,269611,284730:
Update vendor driver to 1.2.7.  This update improves driver reliability and
adds support of 4Kn drives and report LUNs command.

Many thanks to HighPoint for providing this driver update.
2015-06-26 19:55:01 +00:00
erj
36ff8dde86 Limit the number of autoconfigured queues to 8.
This limit was in a previous version of the driver, but it is being re-
added to match the behavior of previous versions of 10. It prevents the
driver from using too many MSI-X vectors on systems with a large number of
logical CPU cores.

Thanks to <jwd@slowblink.com> for bringing up this issue.

Approved by:	jfv (mentor)
2015-06-26 17:13:23 +00:00
kib
575dc6a9d5 MFC r284594:
Restore the td_cookie value upon detach.
2015-06-26 06:25:14 +00:00
arybchik
ebdd57af7d MFC: r284747
sfxge: skip VPD info population if access is denied

The patch allows to run on unprivileged PF (PFIOV) passed to
a virtual machine.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
2015-06-26 06:08:52 +00:00
mav
d99396f96d MFC r284698: Dump additional config bytes for INIT_FIRMWARE_MULTI_ID. 2015-06-25 07:25:40 +00:00
mav
5c47554b55 MFC r284697: Add logging of executed mailbox command names.
Previously those commands were logged only as part of register dump,
that is not very readable.
2015-06-25 07:24:47 +00:00
mav
77eb863bb6 MFC r284540:
In case of target mode disable at least ISP2532 return invalid zero
ct_rxid value on CTIO completion.  Try to workaround that using tag_id
from the CCB, pointed by still valid ct_syshandle.

I don't know whether this is valid fix or dirty hack, but considering that
alternative is indefinitely stuck command -- it worth trying.
2015-06-25 07:23:35 +00:00
mav
9451fd94b7 MFC r274675 (by jhb), r274708:
Convert the refire_notify_ack timer from timeout(9) to callout(9).
2015-06-25 07:22:37 +00:00
mav
6646999316 MFC r284640: Bring per-port LUN enable/disable code up to date:
- remove last remnants of never implemented multiple targets support;
 - implement missing support for LUN mapping in this area.

Due to existing locking constraints LUN mapping code is practically
unlocked at this point.  Hopefully it is not racy enough to live until
somebody get idea how to call sleeping fronend methods under lock also
taken by the same frontend in non-sleepable context. :(
2015-06-25 07:11:48 +00:00
mav
0aff133da5 MFC r284627: Remove some dead and duplicate LUN enabling code. 2015-06-25 07:10:51 +00:00
mav
701d4d43cb MFC r284639: Introduce separate lock for tokens to reduce ctl_lock scope. 2015-06-25 07:09:39 +00:00
mav
3bd447f679 MFC r284641:
Fix REPORT LUNS command output for the case when same LUN mapped to same
port several times.  While it is unusual configuration, it is not illegal.
2015-06-25 07:08:46 +00:00
mav
912011aeb8 MFC r284622: Remove device queue freeze handling and replace it with dummy.
At this point CTL has no known use case for device queue freezes.
Same time existing (considered to be broken) code was found to cause
modify-after-free issues.
2015-06-25 07:07:32 +00:00
mav
fc8d3d0aa2 MFC r284541:
Change ATIO/INOT counting to prevent periph destruction while requests
are still running inside CTL.
2015-06-25 07:06:24 +00:00
eri
5d11dcc720 MFC r284512: Properly handle locking on the ARP protocol request sending. 2015-06-24 19:06:54 +00:00
avg
f8c30d3e15 MFC r284306: MFV r284036: 5961 Fix stack overflow in zfs_create_fs 2015-06-24 14:41:54 +00:00
avg
d3f01929a8 MFC r284303: MFV r283534: 5515 dataset user hold doesn't reject empty tags 2015-06-24 14:39:26 +00:00
avg
f0758faa12 MFC r284301: MFV r284040: check that datasets are snapshots 2015-06-24 14:37:55 +00:00
gallatin
00b69b27e8 Fix r284612: As pointed out by jhb, in stable branches, if_baudrate
is 32b on 32b platforms.  So rather than a simple MFC of r284612,
we need to use if_initbaudrate() to properly express a 40Gb speed.

Spotted by: jhb
Sponsored by: Netflix
2015-06-23 22:31:04 +00:00
kib
ae7c0e0461 Revert part of the r283303 (by jhb):
Revert MFC of r270223, which bumped MAXCPU on amd64 from 64 to 256.
The cpuset_getaffinity(2) and cpuset_setaffinity(2) check minimum set
size, which now fails for binaries compiled on 10.0 with MAXCPU == 64.

Submitted by:	jhb
PR:	  200802
2015-06-23 06:30:36 +00:00
dteske
3822c7142e MFC r284672 (antoine):
Install version.4th.8 again
It was disconnected from installation in r281081, but was never removed
from the tree or added to ObsoleteFiles.inc
2015-06-23 03:56:05 +00:00
gallatin
a152d5e40f MFC r284612: Fix a typo
Sponsored by:	Netflix
2015-06-22 19:37:04 +00:00
tuexen
7e040df666 When using KTRACE, set a variable to the appropriate value and don't
leave it initialized at NULL.
Since the affected functions where moved from sys/kern/uipc_syscalls.c
to sys/netinet/sctp_syscalls.c it was not possible to MFC r284613.
Therefore, this is a direct commit with the corresponding changes of r284613.

Reported by:	Coverity
CID:		1018058, 1018060
2015-06-22 06:06:38 +00:00
tuexen
b52cec9e00 MFC r284596:
When setting the primary address, return an error whenever it fails.
2015-06-22 05:34:13 +00:00
trasz
e1055c772b MFC r282213:
Add kern.racct.enable tunable and RACCT_DISABLED config option.
The point of this is to be able to add RACCT (with RACCT_DISABLED)
to GENERIC, to avoid having to rebuild the kernel to use rctl(8).

MFC r282901:

Build GENERIC with RACCT/RCTL support by default.  Note that it still
needs to be enabled by adding "kern.racct.enable=1" to /boot/loader.conf.

Note those two are MFC-ed together, because the latter one changes the
name of RACCT_DISABLED option to RACCT_DEFAULT_TO_DISABLED.  Should have
committed the renaming separately...

Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-06-21 06:28:26 +00:00
markj
93e43c433d MFC r284127:
witness: don't warn about matrix inconsistencies without holding the mutex

Lock order checking is done without the witness mutex held, so multiple
threads that are racing to establish a new lock order may read matrix
entries that are in an inconsistent state. Don't print a warning in this
case, but instead just redo the check after taking the witness lock.
2015-06-21 00:36:02 +00:00
dim
f96f7b3d8f MFC r284167:
Merge r283870 from amd64:

Remove unneeded NULL checks in trap_fatal().

Since td_name is an array member of struct thread, it can never be NULL,
so the check can be removed.  In addition, curproc can never be NULL,
so remove the if statement, and splice the two printfs() together.

While here, remove the u_long cast, and use the correct printf format
specifier for curproc->p_pid.

Requested by:	jhb
2015-06-20 13:25:28 +00:00
tuexen
094ec02dc8 MFC r284526:
Fix a bug related to flow assignment I introduced in
https://svnweb.freebsd.org/base?view=revision&revision=275483
2015-06-20 08:28:47 +00:00
tuexen
103d48d60e MFC r284515:
Add FIB support for SCTP.
This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200379

PR:	200379
2015-06-20 08:25:27 +00:00
hiren
4aefd42d20 MFC r266420 (by adrian)
Ensure that the flowid hashtype is assigned to the inp if the flowid
is also assigned.

Spotted by:	gallatin
Tested by:	gallatin
2015-06-19 19:36:21 +00:00
mav
82356d356a MFC r284013: Allow setting only WWNN or only WWPN. 2015-06-19 00:53:15 +00:00
gjb
1ce80feefb Update stable/10 from 10.1-STABLE to 10.2-PRERELEASE,
marking the official start of the code slush.

Set the default mdoc(7) version to 10.2, and update the
clang(1) TARGET_TRIPLE and BUILD_TRIPLE to reflect 10.2.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2015-06-19 00:00:32 +00:00
kp
0b6ab54e54 Merge r284280
pf: Remove frc_direction

We don't use the direction of the fragments for anything. The frc_direction
field is assigned, but never read.
Just remove it.

Differential Revision:	https://reviews.freebsd.org/D2825
Reviewed by:	gnn
2015-06-18 21:25:07 +00:00
kp
32fc55692f Merge r284222, r284260
pf: address family must be set when creating a pf_fragment

Fix a panic when handling fragmented ip4 packets with 'drop-ovl' set.
In that scenario we take a different branch in pf_normalize_ip(), taking us to
pf_fragcache() (rather than pf_reassemble()). In pf_fragcache() we create a
pf_fragment, but do not set the address family. This leads to a panic when we
try to insert that into pf_frag_tree because pf_addr_cmp(), which is used to
compare the pf_fragments doesn't know what to do if the address family is not
set.

Simply ensure that the address family is set correctly (always AF_INET in this
path).

When we try to look up a pf_fragment with pf_find_fragment() we compare (see
pf_frag_compare()) addresses (and family), but also protocol.  We failed to
save the protocol to the pf_fragment in pf_fragcache(), resulting in failing
reassembly.

PR:		200330
Differential Revision:	https://reviews.freebsd.org/D2824
Reviewed by:	gnn
2015-06-18 21:23:41 +00:00
kp
7d05cb134c Merge r278874, r278925, r278868
- Improve INET/INET6 scope.
- style(9) declarations.
- Make couple of local functions static.
- Even more fixes to !INET and !INET6 kernels.
  In collaboration with pluknet
- Toss declarations to fix regular build and NO_INET6 build.

Differential Revision:	https://reviews.freebsd.org/D2823
Reviewed by:	gnn
2015-06-18 21:21:52 +00:00
kp
7602db847b Merge r281536
pf: Fix forwarding detection

If the direction is not PF_OUT we can never be forwarding. Some input packets
have rcvif != ifp (looped back packets), which lead us to ip6_forward() inbound
packets, causing panics.

Equally, we need to ensure that packets were really received and not locally
generated before trying to ip6_forward() them.

Differential Revision:	https://reviews.freebsd.org/D2822
Reviewed by:	gnn
2015-06-18 20:59:48 +00:00
kp
1af840c38e Merge r281234
Evaluate packet size after the firewall had its chance

Defer the packet size check until after the firewall has had a look at it. This
means that the firewall now has the opportunity to (re-)fragment an oversized
packet.

Differential Revision:	https://reviews.freebsd.org/D2821
Reviewed by:	gnn
2015-06-18 20:57:21 +00:00
kp
801d5721d1 Merge r281165
Remove duplicate code

We'll just fall into the same local delivery block under the
'if (m->m_flags & M_FASTFWD_OURS)'.

Suggested by:       ae
Differential Revision:	https://reviews.freebsd.org/D2820
Reviewed by:	gnn
2015-06-18 20:45:37 +00:00
kp
99baa6b1d1 Merge r281164
pf: Skip firewall for refragmented ip6 packets

In cases where we scrub (fragment reassemble) on both input and output
we risk ending up in infinite loops when forwarding packets.

Fragmented packets come in and get collected until we can defragment. At
that point the defragmented packet is handed back to the ip stack (at
the pfil point in ip6_input(). Normal processing continues.

Eventually we figure out that the packet has to be forwarded and we end
up at the pfil hook in ip6_forward(). After doing the inspection on the
defragmented packet we see that the packet has been defragmented and
because we're forwarding we have to refragment it.

In pf_refragment6() we split the packet up again and then ip6_forward()
the individual fragments.  Those fragments hit the pfil hook on the way
out, so they're collected until we can reconstruct the full packet, at
which point we're right back where we left off and things continue until
we run out of stack.

Break that loop by marking the fragments generated by pf_refragment6()
as M_SKIP_FIREWALL. There's no point in processing those packets in the
firewall anyway. We've already filtered on the full packet.

Differential Revision:	https://reviews.freebsd.org/D2819
Reviewed by:	gnn
2015-06-18 20:43:16 +00:00
kp
6ba0797920 Merge r280956
pf: Deal with runt packets

On Ethernet packets have a minimal length, so very short packets get padding
appended to them. This padding is not stripped off in ip6_input() (due to
support for IPv6 Jumbograms, RFC2675).
That means PF needs to be careful when reassembling fragmented packets to not
include the padding in the reassembled packet.

While here also remove the 'Magic from ip_input.' bits. Splitting up and
re-joining an mbuf chain here doesn't make any sense.

Differential Revision:	https://reviews.freebsd.org/D2818
Reviewed by:	gnn
2015-06-18 20:41:55 +00:00
kp
ad9eb0c77b Merge r280955
Preserve IPv6 fragment IDs accross reassembly and refragmentation

When forwarding fragmented IPv6 packets and filtering with PF we
reassemble and refragment. That means we generate new fragment headers
and a new fragment ID.

We already save the fragment IDs so we can do the reassembly so it's
straightforward to apply the incoming fragment ID on the refragmented
packets.

Differential Revision:	https://reviews.freebsd.org/D2817
Reviewed by:	gnn
2015-06-18 20:40:36 +00:00
kp
83b6287db4 Merge r278843, r278858
In the forwarding case refragment the reassembled packets with the same
size as they arrived in. This allows the sender to determine the optimal
fragment size by Path MTU Discovery.

Roughly based on the OpenBSD work by Alexander Bluhm.

Differential Revision:	https://reviews.freebsd.org/D2816
Reviewed by:	gnn
2015-06-18 20:34:39 +00:00
kp
80d7588d81 Merge r278842
Factor out ip6_fragment() function, to be used in IPv6 stack and pf(4).

Differential Revision:	https://reviews.freebsd.org/D2815
Reviewed by:	gnn
2015-06-18 20:32:53 +00:00
kp
de79c168eb Merge r278831, r278834
Update the pf fragment handling code to closer match recent OpenBSD.
That partially fixes IPv6 fragment handling.

Differential Revision:	https://reviews.freebsd.org/D2814
Reviewed by:	gnn
2015-06-18 20:28:52 +00:00
kp
37f96b7312 Merge r278828, r278832
- Factor out ip6_deletefraghdr() function, to be shared between IPv6 stack and pf(4).
 - Move ip6_deletefraghdr() to frag6.c. (Suggested by bz)

Differential Revision:	https://reviews.freebsd.org/D2813
Reviewed by:	gnn
2015-06-18 20:21:02 +00:00
ae
383d953540 MFC r284151:
Teach G_PART_GPT class handle g_resize_provider event.
2015-06-18 17:42:24 +00:00