Commit Graph

38477 Commits

Author SHA1 Message Date
Michal Meloun
63d973c3e9 Use the standard method for localizing of MSI-X table bar.
Current way, hardcoded value plus heuristic is not conform to the PCI(e)
specification and it fails on systems where MSI-X bar is not initialized by
BIOS/ACPI (many arm or arm64 systems for example).
Instead, use the standard PCI(e) capability for determining of
MSIX table bar address.

MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27265
2020-12-16 14:39:24 +00:00
John Baldwin
3ab53b27e3 Use more standard types for manipulating pointers.
- Use a uintptr_t cast to get the virtual address of a pointer in
  USB_P2U() instead of a ptrdiff_t.

- Add offsets to a char * pointer directly without roundtripping the
  pointer through a ptrdiff_t in USB_ADD_BYTES().

Reviewed by:	imp, hselasky
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27581
2020-12-16 00:27:28 +00:00
John Baldwin
aa54c24283 Use uintptr_t instead of unsigned long for integers holding pointers.
Reviewed by:	imp, gallatin
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27580
2020-12-16 00:17:54 +00:00
John Baldwin
f83d3280f6 Use uintptr_t instead of unsigned long for pointers.
The sense_ptr thing is quite broken.  As near as I can tell, the
driver tries to copyout to a physical address rather than whatever
user address the sense buffer should be copied to.  It is not
immediately obvious what user address the sense buffer should be
copied to.

Reviewed by:	imp
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27578
2020-12-16 00:13:32 +00:00
Hans Petter Selasky
b1f99f9cc9 Improve handling of alternate settings in the USB stack.
Move initialization of num_altsetting under USB_CFG_INIT, else
there will be a page fault when enumerating USB devices.

PR:		251856
MFC after:	1 week
Submitted by:	Ma, Horse <Shichun.Ma@dell.com>
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-15 15:36:41 +00:00
Hans Petter Selasky
b8b3f4fdc3 Improve handling of alternate settings in the USB stack.
Allow setting the alternate interface number to fail when there is only
one alternate setting present, to comply with the USB specification.

Refactor how iface->num_altsetting is computed.

Bump the __FreeBSD_version due to change of core USB structure.

PR:		251856
MFC after:	1 week
Submitted by:	Ma, Horse <Shichun.Ma@dell.com>
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-15 12:05:07 +00:00
Hans Petter Selasky
6da5df4700 Improve handling of alternate settings in the USB stack.
Limit the number of alternate settings to 256.
Else the alternate index variable may wrap around.

PR:		251856
MFC after:	1 week
Submitted by:	Ma, Horse <Shichun.Ma@dell.com>
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-15 11:51:17 +00:00
Conrad Meyer
b499ab877f amdtemp(4): Add missing Family 17h models
Add missing model numbers M20h (Dali, Zen1), M60H (Renoir, Zen2), and
M90H (Van Gogh, Zen2).

Submitted by:	Greg V <greg AT unrelenting.technology>
2020-12-12 19:43:38 +00:00
Conrad Meyer
ea6189d3a4 amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3)
Zen 3 "Vermeer" support, tested on Ryzen 9 5950X.

Model numbers from https://en.wikichip.org/wiki/amd/cpuid "Extended
Model" column.

Submitted by:	Greg V <greg AT unrelenting.technology>
Differential Revision:	https://reviews.freebsd.org/D27552
2020-12-12 19:34:12 +00:00
Ian Lepore
ff3468ac94 Provide userland notification of gpio pin changes ("userland gpio interrupts").
This is an import of the Google Summer of Code 2018 project completed by
Christian Kramer (and, sadly, ignored by us for two years now).  The goals
stated for that project were:

    FreeBSD already has support for interrupts implemented in the GPIO
    controller drivers of several SoCs, but there are no interfaces to take
    advantage of them out of user space yet. The goal of this work is to
    implement such an interface by providing descriptors which integrate
    with the common I/O system calls and multiplexing mechanisms.

The initial imported code supports the following functionality:

 -  A kernel driver that provides an interface to the user space; the
    existing gpioc(4) driver was enhanced with this functionality.
 -  Implement support for the most common I/O system calls / multiplexing
    mechanisms:
     -  read() Places the pin number on which the interrupt occurred in the
        buffer. Blocking and non-blocking behaviour supported.
     -	poll()/select()
     -	kqueue()
     -	signal driven I/O. Posting SIGIO when the O_ASYNC was set.
 -  Many-to-many relationship between pins and file descriptors.
     -  A file descriptor can monitor several GPIO pins.
     -  A GPIO pin can be monitored by multiple file descriptors.
 -  Integration with gpioctl and libgpio.

I added some fixes (mostly to locking) and feature enhancements on top of
the original gsoc code.  The feature ehancements allow the user to choose
between detailed and summary event reporting.  Detailed reporting provides
a record describing each pin change event.  Summary reporting provides the
time of the first and last change of each pin, and a count of how many times
it changed state since the last read(2) call.  Another enhancement allows
the recording of multiple state change events on multiple pins between each
call to read(2) (the original code would track only a single event at a time).

The phabricator review for these changes timed out without approval, but I
cite it below anyway, because the review contains a series of diffs that
show how I evolved the code from its original state in Christian's github
repo for the gsoc project to what is being commited here.  (In effect,
the phab review extends the VC history back to the original code.)

Submitted by:	Christian Kramer
Obtained from:	https://github.com/ckraemer/freebsd/tree/gsoc2018
Differential Revision:	https://reviews.freebsd.org/D27398
2020-12-12 18:34:15 +00:00
Ryan Libby
75dd118247 if_wg: appease gcc
- remove -ferror-limit option
 - quiet -Wredundant-decls

Reviewed by:	mmacy
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27559
2020-12-11 22:52:03 +00:00
Ryan Libby
324f89d9c8 qat: quiet -Wredundant-decls
Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27554
2020-12-11 22:51:53 +00:00
Ryan Libby
da1c42cefe ntb: quiet gcc -Wreturn-type
Reviewed by:	cem, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27553
2020-12-11 22:51:48 +00:00
Brooks Davis
1bcdbfc5de ndis(4): expand deprecation to the whole driver
nids(4) was a clever idea in the early 2000's when the market was
flooded with 10/100 NICs with Windows-only drivers, but that hasn't been
the case for ages and the driver has had no meaningful maintenance in
ages. It only supports Windows-XP era drivers.

Reviewed by:	imp, bcr
MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27527
2020-12-11 21:51:50 +00:00
Brooks Davis
9ee99cec1f hme(4): Remove as previous announced
The hme (Happy Meal Ethernet) driver was the onboard NIC in most
supported sparc64 platforms. A few PCI NICs do exist, but we have seen
no evidence of use on non-sparc systems.

Reviewed by:	imp, emaste, bcr
Sponsored by:	DARPA
2020-12-11 21:40:38 +00:00
Robert Wing
92f7309929 Add deprecation notice for bvmconsole and bvmdebug
Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed.

Mark the '-b' and '-g' flag as deprecated for bhyve(8).

These will be removed in 13.

Reviewed by:    jhb, grehan
Approved by:    kevans (mentor)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27519
2020-12-10 18:07:25 +00:00
Bradley T. Hughes
c05b5848f1 hyperv/vmbus: avoid crash, panic if vbe fb info is missing
Do not assume that VBE framebuffer metadata can be used. Like with the
EFI fb metadata, it may be null, so we should take care not to
dereference the null vbefb pointer. This avoids a panic when booting
-CURRENT on a gen1 VM in Azure.

Approved by:	tsoome
Sponsored by:	Miles AS
Differential Revision:	https://reviews.freebsd.org/D27533
2020-12-10 13:11:52 +00:00
Ryan Libby
ee47a12a49 dmar: reserve memory windows of PCIe root port
PCI memory address space is shared between memory-mapped devices (MMIO)
and host memory (which may be remapped by an IOMMU). Device accesses to
an address within a memory aperture in a PCIe root port will be treated
as peer-to-peer and not forwarded to an IOMMU. To avoid this, reserve
the address space of the root port's memory apertures in the address
space used by the IOMMU for remapping.

Reviewed by:	kib, tychon
Discussed with:	Anton Rang <rang@acm.org>
Tested by:	tychon
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27503
2020-12-09 18:43:58 +00:00
Justin Hibbits
3567a05b56 dev/mfi: Make a seemingly bogus conditional unconditional
Summary:
r358689 attempted to fix a clang warning/error by inferring the intent
of the condition "(cdb[0] != 0x28 || cdb[0] != 0x2A)".  Unfortunately, it looks
like this broke things.  Instead, fix this by making this path unconditional,
effectively reverting to the previous state.

PR:		kern/251483
Reviewed By:	ambrisko
MFC after:	2 days
Differential Revision: https://reviews.freebsd.org/D27515
2020-12-09 02:07:01 +00:00
Adrian Chadd
c1e16b6534 [ath] also remove the magic size value here for the transmit antenna statistics. 2020-12-08 17:28:42 +00:00
Adrian Chadd
68545bc433 [ath] Don't use hard-coded values in the sanity check.
Don't use hard-coded values in the phy error and receive antenna
checks.
2020-12-08 17:27:24 +00:00
Adrian Chadd
2511069a3f [ath] replace the hard-coded magic values in if_athioctl.h with constant defines
Replace some hard-coded magic values in the ioctl stats struct with
#defines.  I'm going to follow up with some more sanity checking in
the receive path that also use these values so we don't do bad
things if the hardware is (more) confused.
2020-12-08 17:25:59 +00:00
Hans Petter Selasky
e87b9cbead Fix compilation after r368397.
MFC after:	3 days
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-07 11:18:51 +00:00
Ed Maste
c0f52e1bdd Add deprecation notice to mn(4)
Sync serial (T1/E1) interfaces are largely irrelevant today and phk
confirms this driver is unnecessary in review D23928.

This leaves ce(4) and cp(4) in the tree.  They're likely not relevant
either, but glebius contacted the manufacturer and those devices are
still available for purchase.  At glebius' suggestion leave them in
the tree as long as they do not impose a maintenace burden.

Approved by:	phk
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-12-06 21:34:04 +00:00
Conrad Meyer
3a52ffb8b3 atkbd(4): Just use nitems() for quirk enumeration
Reviewed by:	imp, wulf
X-MFC-With:	r368365
Differential Revision:	https://reviews.freebsd.org/D27489
2020-12-05 22:04:30 +00:00
Michal Meloun
23e0c68a47 Remove remaning definition of GFB_<foo> options.
They are not used in source files.
This fixes build of some arm boards after r368159.

Reported by: mjg
2020-12-05 19:44:00 +00:00
Michal Meloun
6844eecfed Add basic support for Freescale LX2160A SoC.
All peripherals but the network processor are supported.
2020-12-05 12:08:37 +00:00
Vladimir Kondratyev
6c6fd2b4a9 ig4(4): Add PCI IDs for Intel Tiger Lake
Submitted by:	Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D27483
2020-12-05 10:57:15 +00:00
Vladimir Kondratyev
a5cc5fcef6 atkbd(4): Change quirk table end-of-list marker to NULL vendor/maker/product
This fixes regression introduced in r367349 which effectively resulted in
truncation of quirk table.

PR:		250711
Submitted by:	grembo
Reported by:	Matthias Apitz <guru@unixarea.de>
X-MFC with:	r367349
2020-12-05 10:55:14 +00:00
Michal Meloun
cc2eaa04bb DesignWare PCIe driver: Don't call bus_generic_attach() twice.
bus_generic_attach() should be called from the attach function of the real
implementation, not from the common init function.

MFC after:	1 week
2020-12-05 10:55:09 +00:00
Warner Losh
082905cad1 nvme: Remove a wmb() that's not necessary.
bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can
be DMA'd immediately after it returns. The details differ, but this
mirrors atomic thread release semantics, at least for the buffers
synced.

For non-x86 platforms, bus_dmamap_sync() has the right syncing and
fences. So in the past, wmb() had been omitted for them.

For x86 platforms, the memory ordering is already strong enough to
ensure DMA to the device sees the current contents. As such, we don't
need the wmb() here. It translates to an sfence which is only needed
for writes to regions that have the write combining attribute set or
when some exotic opcodes are used. The nvme driver does neither of
these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we
can be assured any optimizer won't reorder the bus_dmamap_sync and the
bus_space_write operations. The wmb() was a vestiage of the pre-busdma
version initially committed to the tree.

Reviewed by: kib@, gallatin@, chuck@, mav@
Differential Revision: https://reviews.freebsd.org/D27448
2020-12-04 21:34:48 +00:00
Michal Meloun
e62f770bca Add a driver for FAN53555 based PMIC. 2020-12-04 15:23:43 +00:00
Michal Meloun
81359d594f Add a driver for HYM8563 based RTC. 2020-12-04 15:09:42 +00:00
Michal Meloun
4388c70c08 Add a driver for ACT8846 used as PMIC for RK3288 SoC. 2020-12-04 14:57:12 +00:00
John Baldwin
0082e479ef Clear TLS offload mode if a TLS socket hangs without receiving data.
By default, if a TOE TLS socket stops receiving data for more than 5
seconds, revert the connection back to plain TOE mode.  This provides
a fallback if the userland SSL library does not support KTLS.  In
addition, for client TLS 1.3 sockets using connect(), the TOE socket
blocks before the handshake has completed since the socket option is
only invoked for the final handshake.

The timeout defaults to 5 seconds, but can be changed at boot via the
hw.cxgbe.toe.tls_rx_timeout tunable or for an individual interface via
the dev.<nexus>.toe.tls_rx_timeout sysctl.

Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27470
2020-12-03 22:06:08 +00:00
Navdeep Parhar
180c2dca4e cxgbe(4): Fix vertical alignment in sysctl_cpl_stats.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-12-03 22:04:23 +00:00
John Baldwin
99963f5343 Don't transmit mbufs that aren't yet ready on TOE sockets.
This includes mbufs waiting for data from sendfile() I/O requests, or
mbufs awaiting encryption for KTLS.

Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27469
2020-12-03 22:01:13 +00:00
Navdeep Parhar
dbc5c85c66 cxgbe(4): two new debug sysctls.
dev.<nexus>.<instance>.misc.tid_stats
dev.<nexus>.<instance>.misc.tnl_stats

MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-12-03 22:00:41 +00:00
John Baldwin
a42f096821 Clear TLS offload mode for unsupported cipher suites and versions.
If TOE TLS is requested for an unsupported cipher suite or TLS
version, disable TLS processing and fall back to plain TOE.  In
addition, if an error occurs when saving the decryption keys in the
card's memory, disable TLS processing and fall back to plain TOE.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27468
2020-12-03 21:59:47 +00:00
John Baldwin
05d5675520 Fix downgrading of TOE TLS sockets to plain TOE.
If a TOE TLS socket ends up using an unsupported TLS version or
ciphersuite, it must be downgraded to a "plain" TOE socket with TLS
encryption/decryption performed on the host.  The previous
implementation of this fallback was incomplete and resulted in hung
connections.

Reviewed by:	np
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27467
2020-12-03 21:49:20 +00:00
Adrian Chadd
94e3e7d2e8 [axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue
* uninitialised variable use
* Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV()
  seems wrong and also causes a compiler warning.

Reviewed by:	rpokala
Differential Revision:	  https://reviews.freebsd.org/D26839
2020-12-03 16:54:59 +00:00
Emmanuel Vadot
3e5cd548af if_dwc: Honor snps,pbl property
DTS node can have this property which configure the burst length
for both TX and RX if it's the same.
This unbreak if_dwc on Allwinner A20 and possibly other boards that
uses this prop.

Reported by:	qroxana <qroxana@mail.ru>
2020-12-03 11:15:49 +00:00
Navdeep Parhar
8eba75ed68 cxgbe(4): Stop but don't free netmap queues when netmap is switched off.
It is common for freelists to be starving when a netmap application
stops.  Mailbox commands to free queues can hang in such a situation.
Avoid that by not freeing the queues when netmap is switched off.
Instead, use an alternate method to stop the queues without releasing
the context ids.  If netmap is enabled again later then the same queue
is reinitialized for use.  Move alloc_nm_rxq and txq to t4_netmap.c
while here.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-12-03 08:30:29 +00:00
Mitchell Horne
1c5d066a72 uart: allow UART_DEV_DBGPORT for fdt consoles
Allow fdt devices to be used as debug ports for gdb(4).

A debug console can be specified with the "freebsd,debug-path" property
in the device tree's /chosen node, or using the environment variable
hw.fdt.dbgport.

The device should be specified by its name in the device tree, for
example hw.fdt.dbgport="serial2".

PR:		251053
Submitted by:	Dmitry Salychev <dsl@mcusim.org>
Submitted by:   stevek (original patch, D5986)
Reviewed by:	andrew, mhorne
Differential Revision:	https://reviews.freebsd.org/D27422
2020-12-02 21:01:52 +00:00
Navdeep Parhar
f42f3b2955 cxgbe(4): Revert r367917.
r367917 fixed the backpressure on the netmap rxq being stopped but that
doesn't help if some other netmap rxq is starved (because it is stopping
too although the driver doesn't know this yet) and blocks the pipeline.
An alternate fix that works in all cases will be checked in instead.

Sponsored by:	Chelsio Communications
2020-12-02 20:54:03 +00:00
Mitchell Horne
a3cd24398a em: fix a null de-reference in em_free_pci_resources
A failure in iflib_device_register() can result in
em_free_pci_resources() being called after receive queues have already
been freed. In particular, a failure to allocate IRQ resources will goto
fail_queues, where IFDI_QUEUES_FREE() will be called via
iflib_tx_structures_free(), preceding the call to IFDI_DETACH().

Cope with this by checking adapter->rx_queues before dereferencing it.
A similar check is present in ixgbe(4) and ixl(4).

MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D27260
2020-12-02 17:37:32 +00:00
Michal Meloun
8f9d5a8dbf NVME: Multiple busdma related fixes.
- in nvme_qpair_process_completions() do dma sync before completion buffer
  is used.
- in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm
  and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure
  that all CPU stores are visible to external (including DMA) observers.
- Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems,
  buffers continuously owned (and accessed) by DMA must be allocated with this
  flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems
  (or coherent buses in mixed systems).

MFC after:	4 weeks
Reviewed by:	mav, imp
Differential Revision: https://reviews.freebsd.org/D27446
2020-12-02 16:54:24 +00:00
Chuck Tuffli
8d08cdc721 nvme: Fix typo in definition
Change occurrences of "selt test" to "self tests in the NVMe header
file.

Reviewed by:	imp, mav
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D27439
2020-12-02 15:59:08 +00:00
Oleksandr Tymoshenko
523a67bbee [arm64] Parse ACPI _PXM property on ARM64 platform
Enable devices' NUMA proximity infromation parsing on ARM64 systems

Sponsored by:	Ampere Computing
Submitted by:	Klara, Inc.
2020-12-01 20:27:06 +00:00
Bjoern A. Zeeb
9d2d04462d USB umass: add quirk to not probe
Some USB WLAN devices have "on-board" storage showing up as umass
and making the root mount wait for a very long time.
The WLAN drivers know how to deal with that an issue an eject
command later when attaching themselves.
Introduce a quirk to not probe these devices as umass and avoid
hangs and confusion altogether.

Reviewed by:	hselasky, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27434
2020-12-01 18:24:06 +00:00