Commit Graph

197903 Commits

Author SHA1 Message Date
Steve Kargl
8192c85cb3 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
2015-03-01 20:26:03 +00:00
Adrian Chadd
7190a55c3e 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.
2015-03-01 20:22:28 +00:00
Edward Tomasz Napierala
5e252f6402 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
2015-03-01 18:26:26 +00:00
Jean-Sébastien Pédron
76e2f97656 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
2015-03-01 12:54:22 +00:00
Jean-Sébastien Pédron
be440d689d 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
2015-03-01 12:47:36 +00:00
Andrew Turner
2b6af94bc8 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
2015-03-01 10:04:14 +00:00
Adrian Chadd
ae750c192b 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.
2015-03-01 07:00:34 +00:00
Adrian Chadd
ebac3fdb1c Flesh out some more QCA955x ethernet PLL setup. 2015-03-01 06:59:32 +00:00
Adrian Chadd
5c8bc6bba2 Add Ethernet PLL values for the QCA955x.
These are the same as the AR934x.

Obtained from:	Linux openwrt
2015-03-01 06:54:59 +00:00
Adrian Chadd
b69448850b Make QCA955X_GMAC_REG_ETH_CFG defined like most other registers like this. 2015-03-01 06:52:23 +00:00
Adrian Chadd
e7730c87a8 Add QCA955x support to the EHCI setup path.
Tested:

* QCA AP135 development board, USB rootfs.
2015-03-01 06:05:01 +00:00
Alan Cox
777a36c5e3 Use RW_NEW rather than calling bzero(). 2015-03-01 05:18:02 +00:00
Ryan Stone
9f8dca7d57 Correct a typo.
X-MFC-With:	r279458
2015-03-01 02:45:46 +00:00
Neel Natu
847383d090 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
2015-03-01 02:31:27 +00:00
Ryan Stone
7fdbba5e46 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.
2015-03-01 00:59:35 +00:00
Ryan Stone
bdc48af264 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.
2015-03-01 00:59:28 +00:00
Ryan Stone
1fe9f6f6a7 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.
2015-03-01 00:59:21 +00:00
Ryan Stone
6888132b53 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.
2015-03-01 00:58:23 +00:00
Ryan Stone
1905e4a3fd 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.
2015-03-01 00:52:41 +00:00
Ryan Stone
d9266cbaef 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.
2015-03-01 00:52:34 +00:00
Ryan Stone
dba9ec3462 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.
2015-03-01 00:52:28 +00:00
Ryan Stone
b3c0355681 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.
2015-03-01 00:52:21 +00:00
Ryan Stone
8129906902 Add a manpage for iovctl(8)
Differential Revision:	https://reviews.freebsd.org/D83
Reviewed by:		wblock
MFC after: 		1 month
Sponsored by:		Sandvine Inc.
2015-03-01 00:52:15 +00:00
Ryan Stone
8625a33ea1 Revert r279454. The new directory didn't get added to svn properly.
Pointy hat to: rstone
2015-03-01 00:44:15 +00:00
Ryan Stone
b431478e05 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.
2015-03-01 00:41:17 +00:00
Ryan Stone
5cc26e6342 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.
2015-03-01 00:40:57 +00:00
Ryan Stone
3c22f2153c 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.
2015-03-01 00:40:51 +00:00
Ryan Stone
1191f7156f Add infrastructure for exporting config schema from PF drivers
Differential Revision:	https://reviews.freebsd.org/D80
MFC after: 		1 month
Sponsored by:		Sandvine Inc.
2015-03-01 00:40:42 +00:00
Ryan Stone
6c3162c4df 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.
2015-03-01 00:40:34 +00:00
Ryan Stone
e9309eac19 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.
2015-03-01 00:40:26 +00:00
Ryan Stone
5060ec97d4 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.
2015-03-01 00:40:19 +00:00
Ryan Stone
9bfb1e36d9 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.
2015-03-01 00:40:09 +00:00
Ryan Stone
e1de57232c 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.
2015-03-01 00:40:01 +00:00
Ryan Stone
7d971e363e 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.
2015-03-01 00:39:55 +00:00
Ryan Stone
a15f820a27 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.
2015-03-01 00:39:48 +00:00
Ryan Stone
2397d2d817 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.
2015-03-01 00:39:40 +00:00
Ryan Stone
5ce88dc6da 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.
2015-03-01 00:39:33 +00:00
Ryan Stone
2f5055a9b0 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.
2015-03-01 00:39:26 +00:00
Ryan Stone
081abde45c 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
2015-03-01 00:37:23 +00:00
Ryan Stone
4d6a976e37 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.
2015-03-01 00:34:27 +00:00
Ryan Stone
814f9a1824 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
2015-03-01 00:22:53 +00:00
Ryan Stone
296a8144aa 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
2015-03-01 00:22:45 +00:00
Ryan Stone
19a4afb3e6 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
2015-03-01 00:22:38 +00:00
Ryan Stone
ed007c94ba 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.
2015-03-01 00:22:31 +00:00
Ryan Stone
a87e516267 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.
2015-03-01 00:22:23 +00:00
Ryan Stone
3cd4533107 Implement asprintf in libkern
Differential Revision:		https://reviews.freebsd.org/D1877
Reviewed by:			pjd, jfv
MFC After:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:16 +00:00
Ryan Stone
2dfd9979d8 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.
2015-03-01 00:22:09 +00:00
Ryan Stone
7e15db629c Add tests for dnvlist_take_*
Differential Revision:		https://reviews.freebsd.org/D1876
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:03 +00:00
Ryan Stone
3d1b7ccbd3 Add tests for dnv_get_*
Differential Revision:		https://reviews.freebsd.org/D1875
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:56 +00:00
Ryan Stone
339bcfc7f8 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.
2015-03-01 00:21:50 +00:00