Commit Graph

38426 Commits

Author SHA1 Message Date
Matt Macy
ac042c65ae wireguard: fix zfs_ copy pasta in module init macro
Reported by: Jessica Clarke
2020-11-30 20:58:42 +00:00
Matt Macy
d0c96ffc59 Remove (dead) GPL copyright code from wireguard sources 2020-11-30 20:54:44 +00:00
Mark Johnston
e4b675c929 qat: Initialize the crypto device ID to -1 instead of 0
Otherwise qat_detach() may attempt to deregister an unrelated crypto
driver if an error occurs in qat_attach() before crypto_get_driverid()
is called, since 0 is a valid driver ID.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:45 +00:00
Mark Johnston
7695ced633 qat: Fix firmware module autoloading
If firmware_get() fails to find a loaded firmware image, it searches for
candidate KLDs to load.  It will search for a KLD containing a module
with the same name as the requested image, and failing that, will load a
KLD with the same basename as the requested image.

The module name given by fw_stub.awk is simply "<mangled KLD name>_fw".

QAT firmware modules contain two images, neither of which match either
of the names used during lookup, so automatic loading of firmware images
after mountroot does not work.  Work around this by using the same
string for the first image name and for the KLD basename.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:25 +00:00
Michal Meloun
b2e9e573a3 Unbreak r368167 in userland. Decorate unused arguments.
Reported by:	kp, tuexen, jenkins, and many others
MFC with:	r368167
2020-11-30 14:51:48 +00:00
Toomas Soome
93b18e3730 vt: if loader did pass the font via metadata, use it
The built in 8x16 font may be way too small with large framebuffer
resolutions, to improve readability, use loader provied font.
2020-11-30 11:45:47 +00:00
Toomas Soome
cb79418266 fix vmbus_fb_mmio_res after r368168
mixed efifb versus vbefb struct use did slip in by mistake.
2020-11-30 08:31:41 +00:00
Toomas Soome
a4a10b37d4 Add VT driver for VBE framebuffer device
Implement vt_vbefb to support Vesa Bios Extensions (VBE) framebuffer with VT.
vt_vbefb is built based on vt_efifb and is assuming similar data for
initialization, use MODINFOMD_VBE_FB to identify the structure vbe_fb
in kernel metadata.

struct vbe_fb, is populated by boot loader, and is passed to kernel via
metadata payload.

Differential Revision:	https://reviews.freebsd.org/D27373
2020-11-30 08:22:40 +00:00
Michal Meloun
52a832072d NVME: Don't try to swap data on little endian machines.
These swapping functions violate BUSDMA contract - we cannot write
to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least
from little endian machines until a better solution will be developed.

Reviewed by:	imp
MFC after:	3 weeks
2020-11-30 07:01:12 +00:00
Matt Macy
2338da0373 Import kernel WireGuard support
Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by:	grehan@freebsd.org
MFC after:	1 month
Sponsored by:	Rubicon LLC, (Netgate)
Differential Revision:	https://reviews.freebsd.org/D26137
2020-11-29 19:38:03 +00:00
Andrew Turner
e0870cd468 Only set the PCI bus end when we are reducing it
We read the bus end value from the _CRS method. On some systems we need
to further limit it based on the MCFG table.

Support this by setting a default value, then update it if needed in the
_CRS table, and finally reduce it if it is past the end of the MCFG tabel.
This will allow for both systems that use either method to encode this
value.

This partially reverts r347929, removing the error printf.

Reviewed by:	philip
Tested by:	philip, Andrey Fesenko <f0andrey_gmail.com>
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D27274
2020-11-29 16:22:33 +00:00
Alexander Motin
1770bae5f8 Remove aligment requirements for passthrough buffer.
After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers
thanks to extra page added to pbuf_zone.
2020-11-29 00:57:19 +00:00
Alexander Motin
a93d2db0e7 Mark inline functions static. 2020-11-29 00:35:13 +00:00
Alexander Motin
ac90f70d1e Increase nvme(4) maximum transfer size from 1MB to 2MB.
With 4KB page size the 2MB is the maximum we can address with one page PRP.
Going further would require chaining, that would add some more complexity.

On the other side, to reduce memory consumption, allocate the PRP memory
respecting maximum transfer size reported in the controller identify data.
Many of NVMe devices support much smaller values, starting from 128KB.
To do that we have to change the initialization sequence to pull the data
earlier, before setting up the I/O queue pairs.  The admin queue pair is
still allocated for full MIN(maxphys, 2MB) size, but it is not a big deal,
since there is only one such queue with only 16 trackers.

Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2020-11-29 00:20:31 +00:00
Poul-Henning Kamp
5667729fba Add watchdog(9) driver for the Fintek F81803 SuperIO chip 2020-11-28 22:34:33 +00:00
Konstantin Belousov
cd85379104 Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible.  Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*).  Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys.  Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight.  Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by:	imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D27225
2020-11-28 12:12:51 +00:00
Alexander Motin
156c1ebe3b Some code reorganization.
- Remove code duplication by adding two new functions to execute prepared
queue entry via either mbox or request queue and wait for result.
 - Since the new function executing via request queue sleeps any way, make
it sleep also in case of overflows or handle shortages.  It should make it
more reliable and less affecting other less flexible request queue users.
 - Turn isp_target_put_entry() into not target-specific isp_send_entry().
 - Make handling of responses with control handles more universal.
 - Move RQSTYPE_RPT_ID_ACQ handling into new function.
 - Inline isp_handle_other_response(), becoming trivial after above.
 - Clean the list of IOCBs from pre-24xx ones.
2020-11-27 15:50:20 +00:00
Alexander Motin
df9c69d239 Restore break statement lost in r367857. 2020-11-27 05:13:52 +00:00
Alexander Motin
b760d2eca9 More cleanup in response queue and reset code. 2020-11-26 18:47:23 +00:00
Emmanuel Vadot
1a96c1434f sdhci: mmccam: Update vccq in the driver ios
Otherwise we always report that the card is running at 1.2V.
2020-11-26 16:40:39 +00:00
Emmanuel Vadot
b18f2ef413 sdhci: Only print mmccam debug code if hw.sdhci.debug is > 1 2020-11-26 16:40:20 +00:00
Poul-Henning Kamp
c0c2345432 Add support for Fintek F81803 SuperIO chip
Reviewed by:	avg
2020-11-26 07:34:20 +00:00
Alexander Motin
b05f17a12f Some minor FCoE bits I had lying around. 2020-11-26 02:14:52 +00:00
Alexander Motin
8cb0d414a8 Remove some more dead code from pre-24xx. 2020-11-26 01:59:44 +00:00
Alexander Motin
a6222dd789 Remove more legacy of parallel SCSI. 2020-11-24 22:43:27 +00:00
Jung-uk Kim
926ce35a7e Port rtsx(4) driver for Realtek SD card reader from OpenBSD.
This driver provides support for Realtek PCI SD card readers.  It attaches
mmc(4) bus on card insertion and detaches it on card removal.  It has been
tested with RTS5209, RTS5227, RTS5229, RTS522A, RTS525A and RTL8411B.  It
should also work with RTS5249, RTL8402 and RTL8411.

PR:			204521
Submitted by:		Henri Hennebert (hlh at restart dot be)
Reviewed by:		imp, jkim
Differential Revision:	https://reviews.freebsd.org/D26435
2020-11-24 21:28:44 +00:00
Alexander Motin
5bcbd98c8b Update RQSFLAG_* definitions. 2020-11-24 17:37:12 +00:00
Mark Johnston
938a9d7c4f ata(4): Release the ioport resource if device initialization fails
PR:		251346
Submitted by:	janm@transactionware.com
MFC after:	1 week
2020-11-24 17:13:08 +00:00
Alexander Motin
384d27e04d Remove concept of mbox_sleep_ok.
It was broken by design and unused for years due to conflicts between
different threads, fighting for the same set of mailbox registers, not
designed for multiple requests at a time.  So either request has to be
synchronous and spin under the lock, or it should be sent asynchronously
through the queues as Mailbox Command IOCB or some other way.

This removes any OS specifics from the wait code, so it can be inlined.
2020-11-24 15:32:25 +00:00
Alexander Motin
1553bf11b9 Remove unneeded locking around xpt_bus_[de]register().
MFC after:	2 weeks
2020-11-24 14:05:52 +00:00
Hans Petter Selasky
caf4397197 Remove erradic assert after SVN r367149 in mlx5en(4).
The ratelimit tags may be shared, especially for unlimited TLS
traffic, and then the refcount is allowed to be greater than one
when freeing the send tag.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-24 13:07:59 +00:00
Alexander Motin
0f99cb55ff Implement request queue overflow protection.
Before this change in case of request queue overflow driver just froze the
device queue for 100ms to retry after.  It was pretty bad for performance.
This change introduces SIM queue freezing when free space on the request
queue drops below 255 entries (worst case of maximum I/O size S/G list),
checking for a chance to release it on I/O completion.  If the queue still
get overflowed somehow, the old mechanism is still in place, just with
delay reduced to 10ms.

With the earlier queue length increase overflows should not happen often,
but it is still easily reachable on synthetic tests.
2020-11-24 04:16:49 +00:00
Michal Meloun
9138770728 Ensure that the buffer is in nvme_single_map() mapped to single segment.
Not a functional change.

MFC after:	1 week
2020-11-23 14:30:22 +00:00
Edward Tomasz Napierala
6f45fadf5a Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
Reviewed by:	imp, mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26843
2020-11-23 13:05:11 +00:00
Edward Tomasz Napierala
cca5be248f Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free.
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26841
2020-11-23 13:02:23 +00:00
Edward Tomasz Napierala
3bd46ad76d Don't check return from xpt_alloc_ccb() for being NULL; since it's not
the _nowait wariant, it cannot fail.

Suggested by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-11-23 12:59:56 +00:00
Edward Tomasz Napierala
2ef735f477 Make hptmv(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
Reviewed by:	imp, mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26842
2020-11-23 12:57:24 +00:00
Edward Tomasz Napierala
3df3c40de4 smartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that.
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26838
2020-11-23 12:54:19 +00:00
Edward Tomasz Napierala
6feb84e8e7 arcmsr(4): don't bzero newly allocated ccb; xpt_alloc_ccb() already does that.
Reviewed by:	delphij, imp, ching2048@areca.com.tw
Tested by:	ching2048@areca.com.tw
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26840
2020-11-23 12:50:38 +00:00
Emmanuel Vadot
5e38d9e483 if_dwc: Correctly configure the DMA engine based on the fdt properties
Do not hardcode what we setup for the DMA engine configuration but
lookup the fdt properties and configuring accordingly.
Use a default value of 8 for the burst dma length for both TX and
RX, this is what we used for TX before.
2020-11-22 20:16:46 +00:00
Alexander Motin
3037002e33 Fix debug build after 367926. 2020-11-22 16:13:09 +00:00
Alexander Motin
cbf33b3654 Fix build after 367926.
Option ISP_TARGET_MODE is evil.
2020-11-22 05:42:52 +00:00
Alexander Motin
0b19f90a43 Make handlers and atpds overflows unlikely.
- Allocate 256 handlers more than payload commands for management purposes.
 - Increase maximum number of handlers from 8K to 16K by tuning the format.
 - Just to be safe limit the number of payload commands to 16K - 256.
 - Limit number of target exchanges in mixed mode to the number of atpds.
 - If we still somehow get out of atpds -- return BUSY, since we really are.
2020-11-22 04:29:55 +00:00
Alexander Motin
254c652b6d Do not parent all busdma tags to the payload tag.
There is not much to inherit any more, may create more problems than solve.
Instead parent them all directly to upstream.

While there, add missed payload tag and tune scratch tag destructions.
2020-11-22 04:10:13 +00:00
Alexander Motin
c515717a02 Remove remnants of execthrottle and maxalloc parameters.
The first was obsolete since 26xx, not used on 25xx and not needed on 24xx.
The second seems never worked on 24xx and up.
2020-11-22 02:51:30 +00:00
Navdeep Parhar
b3718e2d7e cxgbe(4): Catch up with in-flight netmap rx before destroying queues.
The netmap application using the driver is responsible for replenishing
the receive freelists and they may be totally depleted when the
application exits.  Packets in flight, if any, might block the pipeline
in case there aren't enough buffers left in the freelist.  Avoid this by
filling up the freelists with a driver allocated buffer.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-11-21 03:27:32 +00:00
Alexander Motin
9a201fad1d Unlucky change...
MFC after:	3 days
2020-11-21 00:53:31 +00:00
Alexander Motin
69df0af073 Fix stupid math mistake in r366922.
MFC after:	3 days
2020-11-21 00:51:39 +00:00
Alexander Motin
b8e2395ec5 Increase queue depths from 1024/256 to 8192/1024 IOCBs.
Qlogic chips store S/G lists in the same queue as requests themselves.  In
the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
IOCBs can store only 19 of such requests.  The increase reduces chances of
overflow, while we should be able to afford additional 512KB of RAM per HBA.
The Linux driver uses comparable numbers.

While there, decouple ATIO queue size from response queue size.  There is
no reason for them to be equal.
2020-11-20 19:36:34 +00:00
Alexander Motin
f6854a0cd5 Cleanup DMA handling.
- Make isp_start() to set all the IOCB fields aside of S/G list, removing
extra information from isp_send_cmd(), now only doing S/G lists and sending.
 - Turn DMA setup/free from being card and PCI-specific into OS-specific,
instead add new card-specific method for isp_send_cmd().  Previously this
function was a monster handling all the cards.
 - Remove double error code translation.
2020-11-20 18:02:04 +00:00