]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoUpdate libucl to git version 8d3b186
Baptiste Daroussin [Mon, 2 Mar 2015 21:41:09 +0000 (21:41 +0000)]
Update libucl to git version 8d3b186

9 years agoReally update to 8d3b186
Baptiste Daroussin [Mon, 2 Mar 2015 21:36:45 +0000 (21:36 +0000)]
Really update to 8d3b186

9 years agoUpdate libucl to git version 8d3b186
Baptiste Daroussin [Mon, 2 Mar 2015 21:35:31 +0000 (21:35 +0000)]
Update libucl to git version 8d3b186

9 years agoAdd quirk to disable 64-bit XHCI DMA after r276717.
Hans Petter Selasky [Mon, 2 Mar 2015 20:42:06 +0000 (20:42 +0000)]
Add quirk to disable 64-bit XHCI DMA after r276717.

Requested by: Gary Jennejohn <gljennjohn@gmail.com>
MFC after: 3 days

9 years agoRevert r279338. The casts are apparently bogus, despite the fact that
Ian Lepore [Mon, 2 Mar 2015 20:40:25 +0000 (20:40 +0000)]
Revert r279338.  The casts are apparently bogus, despite the fact that
they've been working in i386 (where this change came from).

9 years agoUpdate Exynos5 XHCI attach code after r276717.
Hans Petter Selasky [Mon, 2 Mar 2015 20:38:17 +0000 (20:38 +0000)]
Update Exynos5 XHCI attach code after r276717.

MFC after: 3 days

9 years agoFix warnings/errors when building vmm.ko with gcc:
Neel Natu [Mon, 2 Mar 2015 20:13:49 +0000 (20:13 +0000)]
Fix warnings/errors when building vmm.ko with gcc:

- fix warning about comparison of 'uint8_t v_tpr >= 0' always being true.

- fix error triggered by an empty clobber list in the inline assembly for
  "clgi" and "stgi"

- fix error when compiling "vmload %rax", "vmrun %rax" and "vmsave %rax". The
  gcc assembler does not like the explicit operand "%rax" while the clang
  assembler requires specifying the operand "%rax". Fix this by encoding the
  instructions using the ".byte" directive.

Reported by: julian
MFC after: 1 week

9 years agogive others fair warning that _SPARE2 isn't just cxgb, but used by large
John-Mark Gurney [Mon, 2 Mar 2015 20:05:16 +0000 (20:05 +0000)]
give others fair warning that _SPARE2 isn't just cxgb, but used by large
number of other subsystems, so you probably don't want _SPARE2..

ktr needs an overhaul to really only compile in the ones you want,
we've long passed the 31 bits it provides..

Sponsored by: transip.nl

9 years agoFix group membership of cloned interfaces when one is moved by
Hiroki Sato [Mon, 2 Mar 2015 20:00:03 +0000 (20:00 +0000)]
Fix group membership of cloned interfaces when one is moved by
if_vmove().

In if_vmove(), if_detach_internal() and if_attach_internal() were
called in series to detach and reattach the interface.  When
detaching, if_delgroup() was called and the interface leaves all of
the group membership.  And then upon attachment, if_addgroup(ifp,
IFG_ALL) was called and it joined only "all" group again.

This had a problem. Normally, a cloned interface automatically joins
a group whose name is ifc_name of the cloner in addition to "all"
upon creation.  However, if_vmove() removed the membership and did
not restore upon attachment.

Differential Revision: https://reviews.freebsd.org/D1859

9 years agoFix white spaces.
Jung-uk Kim [Mon, 2 Mar 2015 19:14:58 +0000 (19:14 +0000)]
Fix white spaces.

9 years agoMake fuse(4) respect FOPEN_DIRECT_IO. This is required for correct
Edward Tomasz Napierala [Mon, 2 Mar 2015 19:04:27 +0000 (19:04 +0000)]
Make fuse(4) respect FOPEN_DIRECT_IO.  This is required for correct
operation of GlusterFS.

PR: 192701
Submitted by: harsha at harshavardhana.net
Reviewed by: kib@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoProperly evaluate XZ_CMD from the chroot.
Glen Barber [Mon, 2 Mar 2015 18:10:58 +0000 (18:10 +0000)]
Properly evaluate XZ_CMD from the chroot.

Sponsored by: The FreeBSD Foundation

9 years agoChange the sa(4) driver to check for long position support on
Kenneth D. Merry [Mon, 2 Mar 2015 18:09:49 +0000 (18:09 +0000)]
Change the sa(4) driver to check for long position support on
SCSI-2 devices.

Some older tape devices claim to be SCSI-2, but actually do support
long position information.  (Long position information includes
the current file mark.)  For example, the COMPAQ SuperDLT1.

So we now only disable the check on SCSI-1 and older devices.

sys/cam/scsi/scsi_sa.c:
In saregister(), only disable fetching long position
information on SCSI-1 and older drives.  Update the
comment to explain why.

Confirmed by: dvl
Sponsored by: Spectra Logic
MFC after: 3 weeks

9 years agoo Add more room for EFI boot blocks
Ruslan Bukin [Mon, 2 Mar 2015 18:08:39 +0000 (18:08 +0000)]
o Add more room for EFI boot blocks
o Specify the filename as argument

Differential Revision: https://reviews.freebsd.org/D1999
Reviewed by: emaste@

9 years agoUse xz(1) to compress FreeBSD/arm images.
Glen Barber [Mon, 2 Mar 2015 18:04:57 +0000 (18:04 +0000)]
Use xz(1) to compress FreeBSD/arm images.

Sponsored by: The FreeBSD Foundation

9 years agoImplement Enhanced DAD algorithm for IPv6 described in
Hiroki Sato [Mon, 2 Mar 2015 17:30:26 +0000 (17:30 +0000)]
Implement Enhanced DAD algorithm for IPv6 described in
draft-ietf-6man-enhanced-dad-13.

This basically adds a random nonce option (RFC 3971) to NS messages
for DAD probe to detect a looped back packet.  This looped back packet
prevented DAD on some pseudo-interfaces which aggregates multiple L2 links
such as lagg(4).

The length of the nonce is set to 6 bytes.  This algorithm can be disabled by
setting net.inet6.ip6.dad_enhanced sysctl to 0 in a per-vnet basis.

Reported by: hiren
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D1835

9 years agoRemove pregenerated text version of the texinfo documentation
Baptiste Daroussin [Mon, 2 Mar 2015 17:25:03 +0000 (17:25 +0000)]
Remove pregenerated text version of the texinfo documentation

9 years agoInstall manpage version of texinfo documentation for binutils
Baptiste Daroussin [Mon, 2 Mar 2015 17:24:04 +0000 (17:24 +0000)]
Install manpage version of texinfo documentation for binutils

9 years agoGenerate manpage out of the texinfo files using texi2mdoc
Baptiste Daroussin [Mon, 2 Mar 2015 17:20:34 +0000 (17:20 +0000)]
Generate manpage out of the texinfo files using texi2mdoc

9 years agoUpdate mandoc to cvs snaphot from 20150302
Baptiste Daroussin [Mon, 2 Mar 2015 16:58:57 +0000 (16:58 +0000)]
Update mandoc to cvs snaphot from 20150302

Use the new unsupp warning level to detect the unsupported manpages in man(1)

9 years agoRemove WIP code
Baptiste Daroussin [Mon, 2 Mar 2015 16:48:00 +0000 (16:48 +0000)]
Remove WIP code

9 years agoImport CVS snapshot of mandoc as of 20150302
Baptiste Daroussin [Mon, 2 Mar 2015 16:45:41 +0000 (16:45 +0000)]
Import CVS snapshot of mandoc as of 20150302

9 years agoInstall old texinfo pages in the form of mdoc(7) pages
Baptiste Daroussin [Mon, 2 Mar 2015 11:49:01 +0000 (11:49 +0000)]
Install old texinfo pages in the form of mdoc(7) pages

9 years agoConvert texinfo to mdoc(7) using texi2mdoc
Baptiste Daroussin [Mon, 2 Mar 2015 11:48:00 +0000 (11:48 +0000)]
Convert texinfo to mdoc(7) using texi2mdoc

9 years agoAdd support for the AP135 2.0 reference platform.
Adrian Chadd [Mon, 2 Mar 2015 02:27:25 +0000 (02:27 +0000)]
Add support for the AP135 2.0 reference platform.

This is a QCA9558 SoC (2ghz 3x3) with an atheros 11ac PCIe 5GHz 3x3
NIC and an AR8327 gigabit ethernet switch.

TODO:

* The AR8327 gigabit switch support bugfixes are forthcoming.
* 11ac support and 11ac NIC support

9 years agoBring over the initial QCA955x SoC support framework.
Adrian Chadd [Mon, 2 Mar 2015 02:24:46 +0000 (02:24 +0000)]
Bring over the initial QCA955x SoC support framework.

This is enough to bring up the basic SoC support.

What works thus far:

* The mips74k core, pll setup, and UART (or else well, stuff would
  be really difficult..)
* both USB 2.0 EHCI controllers
* on-board 2GHz 3x3 wifi (the other variant has 2GHz/5GHz wifi on-chip);
* arge0 - not yet sure why arge1 isn't firing off interrupts and thus
  handling traffic, but I will soon figure it out and fix it here.

Tested:

* AP135 reference design, QCA9558 SoC, pretending to be an 11n
  2GHz AP.

TODO:

* There's an interrupt mux hooking up devices to IP2 and IP3 - but it's
  not a read-and-clear or write-to-clear register.  So, trying to use it
  naively like I have been ends up with massive interrupt storms.
  For now the things that share those interrupts can just take them as
  shared interrupts and try to play nice.

* There's two PCIe root complexes /and/ one of them can actually be
  a PCIe device endpoint.  Yes, you heard right.  I have to teach the
  AR724x PCIe bridge code to handle multiple instances with multiple
  memory/irq regions, and then there'll be RC support, but EP support
  isn't on my TODO list.

* I'm not sure why arge1 isn't up and running.  I'll go figure that
  out soon and fix it here.

Thankyou to Qualcomm Atheros for providing me with hardware and
an abundance of documentation about these things.

9 years agoLay some groundwork for having this stuff hang off of AHB rather than
Adrian Chadd [Mon, 2 Mar 2015 02:14:44 +0000 (02:14 +0000)]
Lay some groundwork for having this stuff hang off of AHB rather than
the CPU nexus.

* Add ahb as a possible bus attachment
* Lay a comment down to remind me or whoever else ends up trying
  to debug why the EEPROM isn't mapped in as to what's going on.

9 years ago[QCA955x] make the USB EHCI interrupts shareable.
Adrian Chadd [Mon, 2 Mar 2015 02:08:43 +0000 (02:08 +0000)]
[QCA955x] make the USB EHCI interrupts shareable.

There's two EHCI controllers in the QCA955x SoCs - they have different
interrupts available via various demux registers, but they both tie to
IP3.

So for now, allow them to be sharable so they can hang off of IP3.

9 years agoAdd initial QCA955x support to if_arge.c.
Adrian Chadd [Mon, 2 Mar 2015 01:53:47 +0000 (01:53 +0000)]
Add initial QCA955x support to if_arge.c.

Tested:

* AP135 development board, QCA9558 SoC.

9 years agoAdd a MII mode for SGMII.
Adrian Chadd [Mon, 2 Mar 2015 01:23:59 +0000 (01:23 +0000)]
Add a MII mode for SGMII.

This appears on the AR934x and later chips, although it's not
something that's programmed via the arge0/arge1 register space.
It's just cosmetic.

9 years agosh: Fix more compiler warnings.
Jilles Tjoelker [Sun, 1 Mar 2015 22:32:23 +0000 (22:32 +0000)]
sh: Fix more compiler warnings.

9 years agoMissed local diff.
Nathan Whitehorn [Sun, 1 Mar 2015 21:47:38 +0000 (21:47 +0000)]
Missed local diff.

9 years agosh: Fix compiler warnings related to duplicate or missing declarations.
Jilles Tjoelker [Sun, 1 Mar 2015 21:46:55 +0000 (21:46 +0000)]
sh: Fix compiler warnings related to duplicate or missing declarations.

9 years agonandfs_meta_bread() calls bread() which can set bp to NULL in some
Warner Losh [Sun, 1 Mar 2015 21:41:37 +0000 (21:41 +0000)]
nandfs_meta_bread() calls bread() which can set bp to NULL in some
error cases. Calling brelse() with a NULL pointer is not allowed,
so only call brelse() when the bp is non-NULL.

Reported by: Maxime Villard (reported as uninitialized variable)

9 years agoDon't leak 'used' in a few error cases.
Warner Losh [Sun, 1 Mar 2015 21:41:35 +0000 (21:41 +0000)]
Don't leak 'used' in a few error cases.

Reported by: Maxime Villard

9 years agoUnlock the main lock before returning rather than after to eliminate
Warner Losh [Sun, 1 Mar 2015 21:41:33 +0000 (21:41 +0000)]
Unlock the main lock before returning rather than after to eliminate
dead code that shouldn't have been dead.

Reported by: Maxime Villard

9 years agoInitialize NX stack capabilities and direct map status in pmap like on AIM.
Nathan Whitehorn [Sun, 1 Mar 2015 21:23:23 +0000 (21:23 +0000)]
Initialize NX stack capabilities and direct map status in pmap like on AIM.

9 years agoMerge r278429 from ppc64:
Nathan Whitehorn [Sun, 1 Mar 2015 21:20:18 +0000 (21:20 +0000)]
Merge r278429 from ppc64:

Fix an extremely subtle concurrency bug triggered by running on 32-thread
POWER8 systems. During thread switch, there was a very small window when
the stack pointer was set to the stack pointer of the outgoing thread, but
after the lock on that thread had already been released.

If, during that window, the outgoing thread were rescheduled on another CPU
and begin execution and an exception were taken on the original CPU, the
trap handler and the outgoing thread would simultaneously execute on the same
stack, causing memory corruption. Fix this by making sure to release the
old thread only after cpu_switch() is done with its stack.

MFC after: 2 weeks

9 years agoRecord the dependency to x86bios in vga_pci
Jean-Sébastien Pédron [Sun, 1 Mar 2015 20:54:29 +0000 (20:54 +0000)]
Record the dependency to x86bios in vga_pci

This fixes the build of XEN and XBOX kernels on i386, which was broken
in r279487.

While here, do not build vga_pci_repost() on PC98.

Reported by: bz@

9 years agoGive compilers a stronger hint to inline the functions
Steve Kargl [Sun, 1 Mar 2015 20:32:47 +0000 (20:32 +0000)]
Give compilers a stronger hint to inline the functions
pzero[f], qzero[f], pone[f], and qone[f].  While here
fix the function declarations in accordance with style(9).

9 years agoAR8327: Disable energy-efficient ethernet support in the PHYs.
Adrian Chadd [Sun, 1 Mar 2015 20:32:35 +0000 (20:32 +0000)]
AR8327: Disable energy-efficient ethernet support in the PHYs.

I noticed that openwrt/linux does this, citing "instability", so
until they figure out why I'm going to disable it here as well.

Tested:

* QCA AP135 - QCA955x SoC + AR8327 switch.

9 years agoWhen j0() and j1() were converted to j0f() and j1f(), the threshold
Steve Kargl [Sun, 1 Mar 2015 20:26:03 +0000 (20:26 +0000)]
When j0() and j1() were converted to j0f() and j1f(), the threshold
values for the different invervals were not converted correctly.
Adjust the threshold values to values, which should agree with the
comments.

Reported by: cognet (j1f only)
Discussed with: pfg, bde
Reviewed by: bde

9 years agoBump the port mask on the AR8327 ethernet switch from 0x3f to 0x7f.
Adrian Chadd [Sun, 1 Mar 2015 20:22:28 +0000 (20:22 +0000)]
Bump the port mask on the AR8327 ethernet switch from 0x3f to 0x7f.

So, it turns out that the AR8327 has 7 ports internally:

* GMAC0 / external (CPU) MAC0
* GMAC1 / port1 -> GMAC5 / port5: external switch port PHYs
* GMAC6 / external (CPU) MAC1

Now, depending upon how things are wired up, the second CPU port (MAC1)
can be wired to either the switch (port6), or through port5's PHY, bypassing
the GMAC+switch entirely.  Ie, it can pretend to be a boring PHY, saving
system designers from having to include a separate PHY for a "WAN" port.

Here's the rub - the AP135 board (QCA955x SoC) hooks up arge0 to
the second CPU port on the AR8327, but it's hooked up as RGMII.
So, in order to hook it up to the rest of the switch, it isn't configured
as a separate PHY - OpenWRT has it setup as connected via RGMII to
GMAC6 and (I'm guessing) it's set to be a WAN port by configuring up
port-based VLANs or something.

Thus, with a port mask of 0x3f, GMAC6 was never allowed to receive traffic
from any other port.  It could transmit fine, but not receive anything.

So, now it works enough for me to continue doing board bootstrapping.
Note, this isn't enough to make the QCA955x + AR8327 work - there's
a bunch of uncommitted work to both the platform SoC (interrupt handling,
ethernet, etc) and the ethernet switch (register access space, setup, etc)
that needs to happen.  However, this particular change is also relevant to
other SoCs, like the AR934x and AR7161, both of which can be glued to
this switch.

Tested:

* AP135 development board

TODO:

* Figure out whether I can somehow abuse another port mode to have this
  be a pass-through PHY, or whether I should just create some more boot
  time hints to explicitly set up port-based isolation so this works
  in a more useful way by default.

9 years agoMake the "automounted" flag work for FUSE filesystems.
Edward Tomasz Napierala [Sun, 1 Mar 2015 18:26:26 +0000 (18:26 +0000)]
Make the "automounted" flag work for FUSE filesystems.

PR: 192852
Submitted by: taku at tackymt.homeip.net (earlier version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agovt(4): Add support to "downgrade" from eg. vt_fb to vt_vga
Jean-Sébastien Pédron [Sun, 1 Mar 2015 12:54:22 +0000 (12:54 +0000)]
vt(4): Add support to "downgrade" from eg. vt_fb to vt_vga

The main purpose of this feature is to be able to unload a KMS driver.

When going back from the current vt(4) backend to the previous backend,
the previous backend is reinitialized with the special VDF_DOWNGRADE
flag set. Then the current driver is terminated with the new "vd_fini"
callback.

In the case of vt_fb and vt_vga, this allows the former to pass the
vgapci device vt_fb used to vt_vga so the device can be rePOSTed.

Differential Revision: https://reviews.freebsd.org/D687

9 years agovgapci: New vga_pci_repost() function
Jean-Sébastien Pédron [Sun, 1 Mar 2015 12:47:36 +0000 (12:47 +0000)]
vgapci: New vga_pci_repost() function

This can be used to restore the VGA mode after a KMS driver is unloaded.

Differential Revision: https://reviews.freebsd.org/D687

9 years agoFix the dtrace ARM atomic compare-and-set functions. These functions are
Andrew Turner [Sun, 1 Mar 2015 10:04:14 +0000 (10:04 +0000)]
Fix the dtrace ARM atomic compare-and-set functions. These functions are
expected to return the data in the memory location pointed at by target
after the operation. The FreeBSD atomic functions previously used return
either 0 or 1 to indicate if the comparison succeeded or not respectively.

With this change these functions only support ARMv6 and later are supported
by these functions.

Sponsored by: ABT Systems Ltd

9 years agoAdd very initial QCA955x awareness to the GPIO code.
Adrian Chadd [Sun, 1 Mar 2015 07:00:34 +0000 (07:00 +0000)]
Add very initial QCA955x awareness to the GPIO code.

There's a lot more to come - the QCA955x has a bunch more GPIO MUX
configuration, reminiscent of what the ARM chips let you do - but
it'll have to come later.

9 years agoFlesh out some more QCA955x ethernet PLL setup.
Adrian Chadd [Sun, 1 Mar 2015 06:59:32 +0000 (06:59 +0000)]
Flesh out some more QCA955x ethernet PLL setup.

9 years agoAdd Ethernet PLL values for the QCA955x.
Adrian Chadd [Sun, 1 Mar 2015 06:54:59 +0000 (06:54 +0000)]
Add Ethernet PLL values for the QCA955x.

These are the same as the AR934x.

Obtained from: Linux openwrt

9 years agoMake QCA955X_GMAC_REG_ETH_CFG defined like most other registers like this.
Adrian Chadd [Sun, 1 Mar 2015 06:52:23 +0000 (06:52 +0000)]
Make QCA955X_GMAC_REG_ETH_CFG defined like most other registers like this.

9 years agoAdd QCA955x support to the EHCI setup path.
Adrian Chadd [Sun, 1 Mar 2015 06:05:01 +0000 (06:05 +0000)]
Add QCA955x support to the EHCI setup path.

Tested:

* QCA AP135 development board, USB rootfs.

9 years agoUse RW_NEW rather than calling bzero().
Alan Cox [Sun, 1 Mar 2015 05:18:02 +0000 (05:18 +0000)]
Use RW_NEW rather than calling bzero().

9 years agoCorrect a typo.
Ryan Stone [Sun, 1 Mar 2015 02:45:46 +0000 (02:45 +0000)]
Correct a typo.

X-MFC-With: r279458

9 years agoFree up the IPI slot used by IPI_STOP_HARD.
Neel Natu [Sun, 1 Mar 2015 02:31:27 +0000 (02:31 +0000)]
Free up the IPI slot used by IPI_STOP_HARD.

Change the numeric value of IPI_STOP_HARD so it doesn't occupy a valid IPI
slot. This can be done because IPI_STOP_HARD is actually delivered via NMI.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D1983

9 years agoTeach pciconf how to dump out SR-IOV capability
Ryan Stone [Sun, 1 Mar 2015 00:59:35 +0000 (00:59 +0000)]
Teach pciconf how to dump out SR-IOV capability

Differential Revision: https://reviews.freebsd.org/D1639
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoValidate the schema that the PF driver passed to us
Ryan Stone [Sun, 1 Mar 2015 00:59:28 +0000 (00:59 +0000)]
Validate the schema that the PF driver passed to us

Differential Revision: https://reviews.freebsd.org/D90
Reviewed by: emaste
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoDocument the interface for defining a configuration schema
Ryan Stone [Sun, 1 Mar 2015 00:59:21 +0000 (00:59 +0000)]
Document the interface for defining a configuration schema

Differential Revision: https://reviews.freebsd.org/D89
Reviewed by: wblock, emaste, allanjude
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd an rc.d script to invoke iovctl(8) during boot
Ryan Stone [Sun, 1 Mar 2015 00:58:23 +0000 (00:58 +0000)]
Add an rc.d script to invoke iovctl(8) during boot

Differential Revision: https://reviews.freebsd.org/D88
Reviewed by: wblock, emaste, allanjude
MFC after: 1 month
Relnotes: yes
Sponsored by: Sandvine Inc.

9 years agoAdd main() for iovctl and hook iovctl into build
Ryan Stone [Sun, 1 Mar 2015 00:52:41 +0000 (00:52 +0000)]
Add main() for iovctl and hook iovctl into build

Differential Revision: https://reviews.freebsd.org/D87
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd functions for parsing the iovctl config file
Ryan Stone [Sun, 1 Mar 2015 00:52:34 +0000 (00:52 +0000)]
Add functions for parsing the iovctl config file

Add two functions for parsing the iovctl config file.  The config
file is parsed using libucl[1], which accepts most YAML files and
a superset of JSON.  The first function is an ad-hoc parser that
searches the file for the PF.DEVICE configuration value.  We need
to know that value in order to fetch the schema from the kernel,
and we need the schema in order to be able to fully parse the file.

The second function parses the config file and validates it
against a schema.  This function will exit with an error message
if any validation error occurs.  If it succeeds, the configuration
is returned as an nvlist suitable for passing to the kernel.

[1] https://github.com/vstakhov/libucl

Differential Revision: https://reviews.freebsd.org/D86
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd iovctl functions for validating config
Ryan Stone [Sun, 1 Mar 2015 00:52:28 +0000 (00:52 +0000)]
Add iovctl functions for validating config

Add an function to iovctl that validates the configuration against
a schema.  This function is able to assume that the parser has
done most of the validation already and it's only responsible for
applying default VF values specified in the config file, confirming
that all required parameters have been set and that no invalid VF
numbers have been specified.

Differential Revision: https://reviews.freebsd.org/D85
Reviewed by: bcr
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd manpage documenting iovctl config file format.
Ryan Stone [Sun, 1 Mar 2015 00:52:21 +0000 (00:52 +0000)]
Add manpage documenting iovctl config file format.

Differential Revision: https://reviews.freebsd.org/D84
Reviewed by: emaste, bcr, wblock
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd a manpage for iovctl(8)
Ryan Stone [Sun, 1 Mar 2015 00:52:15 +0000 (00:52 +0000)]
Add a manpage for iovctl(8)

Differential Revision: https://reviews.freebsd.org/D83
Reviewed by: wblock
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoRevert r279454. The new directory didn't get added to svn properly.
Ryan Stone [Sun, 1 Mar 2015 00:44:15 +0000 (00:44 +0000)]
Revert r279454.  The new directory didn't get added to svn properly.

Pointy hat to: rstone

9 years agoAdd main() for iovctl and hook iovctl into build
Ryan Stone [Sun, 1 Mar 2015 00:41:17 +0000 (00:41 +0000)]
Add main() for iovctl and hook iovctl into build

Differential Revision: https://reviews.freebsd.org/D87
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoPass SR-IOV configuration to kernel using an nvlist
Ryan Stone [Sun, 1 Mar 2015 00:40:57 +0000 (00:40 +0000)]
Pass SR-IOV configuration to kernel using an nvlist

Pass all SR-IOV configuration to the kernel using an nvlist.  The
main benefit that this offers is flexibility.  It allows a driver
to accept any number of parameters of any type supported by the
SR-IOV configuration infrastructure with having to make any
changes outside of the driver.

It also offers the user very fine-grained control over the
configuration of the VFs -- if they want, they can have different
configuration applied to every VF.

Differential Revision: https://reviews.freebsd.org/D82
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd function to validate the consistency of SR-IOV config
Ryan Stone [Sun, 1 Mar 2015 00:40:51 +0000 (00:40 +0000)]
Add function to validate the consistency of SR-IOV config

Add a function that validates that the user-provided SR-IOV
configuration is valid.  This includes basic checks that the
structure of the configuration is correct (e.g. all required
configuration nodes are present) as well as validating against
a configuration schema.

The schema validation consists of:
 - Ensuring that all required config parameters are present.
 - If the schema defines a default value for a parameter,
   adding the default value if the parameter is not set.
 - Ensuring that no parameters are specified in the config
   that are not defined in the schema.
 - Ensuring that have the correct type defined in the schema.
 - Ensuring that no configuration nodes are present for devices
   that do not exist.  For example, if 2 VFs are configured,
   then we validate that a node called VF-5 does not exist.

Differential Revision: https://reviews.freebsd.org/D81
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd infrastructure for exporting config schema from PF drivers
Ryan Stone [Sun, 1 Mar 2015 00:40:42 +0000 (00:40 +0000)]
Add infrastructure for exporting config schema from PF drivers

Differential Revision: https://reviews.freebsd.org/D80
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd interface to destroy SR-IOV VFs
Ryan Stone [Sun, 1 Mar 2015 00:40:34 +0000 (00:40 +0000)]
Add interface to destroy SR-IOV VFs

Differential Revision: https://reviews.freebsd.org/D79
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAllocate PCI I/O memory spaces for VFs
Ryan Stone [Sun, 1 Mar 2015 00:40:26 +0000 (00:40 +0000)]
Allocate PCI I/O memory spaces for VFs

When creating VFs, we must size each SR-IOV BAR on the PF and
allocate a configuous I/O memory window large enough for every VF.
However, the window only needs to be aligned to a boundary equal
to the size of the window for a single VF.

When a VF attempts to allocate an I/O memory resource, we must
intercept the request in the pci driver and pass it off to the
SR-IOV code, which will allocate the correct window from the
pre-allocated memory space for the PF.

Inform the pci driver about the size and address of the BARs on
the VF when the VF is created.  This is required by pciconf -b and
bhyve.

Differential Revision: https://reviews.freebsd.org/D78
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoEmulate the Device ID and Vendor ID registers for VFs
Ryan Stone [Sun, 1 Mar 2015 00:40:19 +0000 (00:40 +0000)]
Emulate the Device ID and Vendor ID registers for VFs

The SR-IOV standard requires VFs to read all-ones when the VID
and DID registers are read.  The VMM (hypervisor) is required to
emulate them instead.  Make pci_read_config() do this emulation.

Change pci_user.c to use pci_read_config() to read config space
registers instead of going directly to the pcib so that the
emulated VID/DID registers work correctly on VFs.  This is
required both for pciconf and bhyve PCI passthrough.

Differential Revision: https://reviews.freebsd.org/D77
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoImplement interface to create SR-IOV Virtual Functions
Ryan Stone [Sun, 1 Mar 2015 00:40:09 +0000 (00:40 +0000)]
Implement interface to create SR-IOV Virtual Functions

Implement the interace to create SR-IOV Virtual Functions (VFs).
When a driver registers that they support SR-IOV by calling
pci_setup_iov(), the SR-IOV code creates a new node in /dev/iov
for that device.  An ioctl can be invoked on that device to
create VFs and have the driver initialize them.

At this point, allocating memory I/O windows (BARs) is not
supported.

Differential Revision: https://reviews.freebsd.org/D76
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd manpages for SR-IOV enable/disable driver interface
Ryan Stone [Sun, 1 Mar 2015 00:40:01 +0000 (00:40 +0000)]
Add manpages for SR-IOV enable/disable driver interface

Differential Revision: https://reviews.freebsd.org/D75
Reviewed by: wblock
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoDocument pci_iov_attach/detach in pci.9
Ryan Stone [Sun, 1 Mar 2015 00:39:55 +0000 (00:39 +0000)]
Document pci_iov_attach/detach in pci.9

Differential Revision: https://reviews.freebsd.org/D74
Reviewed by: bcr, wblock, emaste
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAllow passthrough devices to be hinted.
Ryan Stone [Sun, 1 Mar 2015 00:39:48 +0000 (00:39 +0000)]
Allow passthrough devices to be hinted.

Allow the ppt driver to attach to devices that were hinted to be
passthrough devices by the PCI code creating them with a driver
name of "ppt".

Add a tunable that allows the IOMMU to be forced to be used.  With
SR-IOV passthrough devices the VFs may be created after vmm.ko is
loaded.  The current code will not initialize the IOMMU in that
case, meaning that the passthrough devices can't actually be used.

Differential Revision: https://reviews.freebsd.org/D73
Reviewed by: neel
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoAdd some pcib methods to get ARI-related information
Ryan Stone [Sun, 1 Mar 2015 00:39:40 +0000 (00:39 +0000)]
Add some pcib methods to get ARI-related information

Differential Revision: https://reviews.freebsd.org/D72
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoRefactor PCI resource allocation
Ryan Stone [Sun, 1 Mar 2015 00:39:33 +0000 (00:39 +0000)]
Refactor PCI resource allocation

Refactor PCI resource allocation code to allow a request for a
memory-mapped I/O window that is a multiple of a requested size.
This is needed by the SR-IOV code because the VF BARs are all
allocated contiguously.  We can't just allocate a resource that is
a multiple of a single VF BAR because the size of an allocation
implies its alignment requirement.

Differential Revision: https://reviews.freebsd.org/D71
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoRefactor PCI device creation
Ryan Stone [Sun, 1 Mar 2015 00:39:26 +0000 (00:39 +0000)]
Refactor PCI device creation

Refactor creation of PCI devices into helper methods that can be
used by the VF creation code.

Differential Revision: https://reviews.freebsd.org/D67
Reviewed by: jhb
MFC after:  1 month
Sponsored by: Sandvine Inc.

9 years agoFix build of nv_tests.cc
Ryan Stone [Sun, 1 Mar 2015 00:37:23 +0000 (00:37 +0000)]
Fix build of nv_tests.cc

nv_tests.cc managed to get two copies of several functions due to me
applying a patch in an unclean working tree.  My kingdom for an
"svn clean" command.

MFC after: 1 month
X-MFC-With: r279424

9 years agoMove libnv into the kernel and hook it into the kernel build
Ryan Stone [Sun, 1 Mar 2015 00:34:27 +0000 (00:34 +0000)]
Move libnv into the kernel and hook it into the kernel build

Differential Revision: https://reviews.freebsd.org/D1883
Reviewed by: jfv
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd macros to make code compile in kernel
Ryan Stone [Sun, 1 Mar 2015 00:22:53 +0000 (00:22 +0000)]
Add macros to make code compile in kernel

Make it possible to compile libnv in the kernel.  Mostly this
involves wrapping functions that have a different signature in
the kernel and in userland (e.g. malloc()) in a macro that will
conditionally expand to the right API depending on whether the
code is being compiled for the kernel or not.

I have also #ifdef'ed out all of file descriptor-handling code,
as well as the unsafe varargs functions.

Differential Revision: https://reviews.freebsd.org/D1882
Reviewed by: jfv
MFC after: 1 month
Sponsored by: Sandvine Inc

9 years agoAllow Illumos code to co-exist with nv(9)
Ryan Stone [Sun, 1 Mar 2015 00:22:45 +0000 (00:22 +0000)]
Allow Illumos code to co-exist with nv(9)

Differential Revision: https://reviews.freebsd.org/D1881
Reviewed by: jfv, will
Suggested by: pjd
MFC after: 1 month
Sponsored by: Sandvine Inc

9 years agoPrevent creation of an invalid nvlist
Ryan Stone [Sun, 1 Mar 2015 00:22:38 +0000 (00:22 +0000)]
Prevent creation of an invalid nvlist

If an nvlist is set as a child of another nvlist with
nvlist_move_nvlist then fail the operation and set the parent
nvlist to the error state.

Differential Revision: https://reviews.freebsd.org/D1880
Reviewers: jfv
MFC after: 1 month
Sponsored by: Sandvine Inc

9 years agoDon't allocate memory for operations that do not insert
Ryan Stone [Sun, 1 Mar 2015 00:22:31 +0000 (00:22 +0000)]
Don't allocate memory for operations that do not insert

Almost every operation performed on an nvlist was allocating a
new string to hold the key name.  The nvlist_exists* family of
functions would always return false if they failed to allocate
the string.  The rest of the functions would outright abort().
Fix the non-varargs variants of the functions to perform the
requested operations directly and the varargs versions to
allocate the string and call into the non-varargs versions.
The varargs versions are still broken and really can't be fixed,
so we might consider axing them entirely.  However, now the non-
varargs functions are always safe to call.

Differential Revision: https://reviews.freebsd.org/D1879
Reviewed by: pjd, jfv
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd function to force an nvlist into the error state
Ryan Stone [Sun, 1 Mar 2015 00:22:23 +0000 (00:22 +0000)]
Add function to force an nvlist into the error state

Add an nvlist_set_error() function that can be used to force an
nvlist into the error state.  This is useful both for writing
tests and for writing APIs that use nvlists internally.

Differential Revision: https://reviews.freebsd.org/D1878
Reviewed by: pjd, jfv
MFC After: 1 month
Sponsored by: Sandvine Inc.

9 years agoImplement asprintf in libkern
Ryan Stone [Sun, 1 Mar 2015 00:22:16 +0000 (00:22 +0000)]
Implement asprintf in libkern

Differential Revision: https://reviews.freebsd.org/D1877
Reviewed by: pjd, jfv
MFC After: 1 month
Sponsored by: Sandvine Inc.

9 years agoExtend the unit test to fix the bug caught in r277925
Ryan Stone [Sun, 1 Mar 2015 00:22:09 +0000 (00:22 +0000)]
Extend the unit test to fix the bug caught in r277925

Differential Revision: https://reviews.freebsd.org/D1888
MFC After: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for dnvlist_take_*
Ryan Stone [Sun, 1 Mar 2015 00:22:03 +0000 (00:22 +0000)]
Add tests for dnvlist_take_*

Differential Revision: https://reviews.freebsd.org/D1876
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for dnv_get_*
Ryan Stone [Sun, 1 Mar 2015 00:21:56 +0000 (00:21 +0000)]
Add tests for dnv_get_*

Differential Revision: https://reviews.freebsd.org/D1875
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for nvlist_free* functions
Ryan Stone [Sun, 1 Mar 2015 00:21:50 +0000 (00:21 +0000)]
Add tests for nvlist_free* functions

Differential Revision: https://reviews.freebsd.org/D1874
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for nvlist_take_*
Ryan Stone [Sun, 1 Mar 2015 00:21:43 +0000 (00:21 +0000)]
Add tests for nvlist_take_*

Differential Revision: https://reviews.freebsd.org/D1873
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd test cases for nvlist_move_*
Ryan Stone [Sun, 1 Mar 2015 00:21:37 +0000 (00:21 +0000)]
Add test cases for nvlist_move_*

Differential Revision: https://reviews.freebsd.org/D1872
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for nvlist_pack/unpack
Ryan Stone [Sun, 1 Mar 2015 00:21:30 +0000 (00:21 +0000)]
Add tests for nvlist_pack/unpack

Differential Revision: https://reviews.freebsd.org/D1871
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd tests for nvlist_clone
Ryan Stone [Sun, 1 Mar 2015 00:21:24 +0000 (00:21 +0000)]
Add tests for nvlist_clone

Differential Revision: https://reviews.freebsd.org/D1870
Reviewed by: pjd, jfv
MFC after: 1 month
Sponsored by: Sandvine Inc

9 years agoTests of basic nvlist add functions
Ryan Stone [Sun, 1 Mar 2015 00:20:57 +0000 (00:20 +0000)]
Tests of basic nvlist add functions

Differential Revision: https://reviews.freebsd.org/D1869
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoRevert r279422. My "apply patch and commit" script wasn't adding
Ryan Stone [Sun, 1 Mar 2015 00:05:45 +0000 (00:05 +0000)]
Revert r279422.  My "apply patch and commit" script wasn't adding
new files properly.

Pointy hat to: rstone

9 years agoTests of basic nvlist add functions
Ryan Stone [Sun, 1 Mar 2015 00:01:44 +0000 (00:01 +0000)]
Tests of basic nvlist add functions

Differential Revision: https://reviews.freebsd.org/D1869
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoMake libnv headers includable from C++
Ryan Stone [Sun, 1 Mar 2015 00:01:36 +0000 (00:01 +0000)]
Make libnv headers includable from C++

Differential Revision: https://reviews.freebsd.org/D1868
Reviewed by: jfv, pjd
MFC after: 1 month
Sponsored by: Sandvine Inc.

9 years agoAdd another register definition for the AR8327.
Adrian Chadd [Sat, 28 Feb 2015 23:59:29 +0000 (23:59 +0000)]
Add another register definition for the AR8327.

Obtained from: OpenWRT