Commit Graph

41297 Commits

Author SHA1 Message Date
Vladimir Kondratyev
4a0db5e292 evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interface
of psm(4), ums(4) and sysmouse(4) drivers.
EVIOCGRAB ioctl execution on /dev/input/event# device node gains
exclusive access to this device to caller. It is used mostly for
development purposes and remote control software. See e.g.
https://reviews.freebsd.org/D30020 which is the reason of creation
of this change.

MFC after:	2 weeks
Tested by:	corvink
Differential revision:	https://reviews.freebsd.org/D30542
2022-11-18 00:48:42 +03:00
Emmanuel Vadot
0860c27fe8 usb/dwc3: Use more () for macros variables
Suggested by:	andrew
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-11-16 11:58:32 +01:00
Emmanuel Vadot
d47f5f2886 usb/dwc3: Only force USB2 based on the PHY register and IP version
We shouldn't force USB2 only based on if we have an external PHY.
The internal PHY register tell us what link speed we can acheive
and we need to force USB2 only if it cannot do USB3.
This is only available after revision 0x290A of the dwc3 IP.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D37394
Fixed:	1331c0f44b ("Add support for RockChip RK356X to DWC3 driver.")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-11-16 11:58:32 +01:00
Emmanuel Vadot
0e87f58bd7 usb/dwc3: Read the full IDs/version
We need to enable some quirks based on the version so read it.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D37393
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-11-16 11:58:31 +01:00
Emmanuel Vadot
0a5f342aa5 dwc3: Handle optional clocks
Usually dwc3 needs a glue node that contain the SoC specific clocks/resets.
For some reason the RK3328 DTS doesn't have this glue node and the clocks
are specified in the dwc3 node directly.
The bindings says that it is allowed but doesn't specified some strict names
for them.
Add a specific case for RK3328 based on the compatible string.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D37392
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-11-16 11:58:31 +01:00
John Baldwin
2ff447ee3b cxgbe: Enable TOE TLS RX when an RX key is provided via setsockopt().
Rather than requiring a socket to be created as a TLS socket from the
get go, switch a TOE socket from "plain" TOE to TLS mode when a
receive key is added to the socket.

The firmware is only able to switch a "plain" TOE connection to TLS
mode if the head of the pending socket data is the start of a TLS
record, so the connection is migrated to TLS mode as a multi-step
process.

When TOE TLS RX is enabled, the associated connection's receive side
is frozen via a flag in the TCB.  The state of the socket buffer is
then examined to determine if the pending data in the socket buffer
ends on a TLS record boundary.  If so, the connection is migrated to
TLS mode and unfrozen.  Otherwise, the connection is unfrozen
temporarily until more data arrives.  Once more data arrives, the
receive queue is frozen again and rechecked.  This continues until the
connection is paused at a record boundary.  Any records received
before TLS mode is enabled are decrypted as software records.

Note that this removes the 'rx_tls_ports' sysctl.  TOE TLS offload for
receive is now enabled automatically on existing TOE connections when
using a KTLS-aware SSL library just as it was previously enabled
automatically for TLS transmit.  This also enables TLS offload for TOE
connections which enable TLS after passing initial data in the clear
(e.g. STARTTLS with SMTP).

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37351
2022-11-15 12:08:51 -08:00
John Baldwin
21186bdb2d cxgbe: Various whitespace fixes.
Mostly trailing whitespace and spaces before tabs.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37350
2022-11-15 12:03:57 -08:00
Wanpeng Qian
8ab99dbea1
bhyve: abort and return FEATURE_NOT_SAVEABLE while set feature with a save flag for NVMe controller.
Currently bhyve's NVMe controller cannot save feature values cross
reboot. It should return a FEATURE_NOT_SAVEABLE error when the command
specifies a save flag.

Quote from NVMe specification, page 205:

https://nvmexpress.org/wp-content/uploads/NVM-Express-1_4-2019.06.10-Ratified.pdf

If the Feature Identifier specified in the Set Features command is not
saveable by the controller and the controller receives a Set Features
command with the Save bit set to one, then the command shall be aborted
with a status of Feature Identifier Not Saveable.

Reviewed by:		chuck (older version)
Approved by:		manu (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D32767
2022-11-15 07:48:24 +01:00
Mark Johnston
db494ceb65 virtio: Silence a -Wunused warning
Remove virtio_swap_endian().  htole*() are nops on little-endian
platforms.  No functional change intended.

MFC after:	1 week
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37298
2022-11-14 15:07:34 -05:00
John Baldwin
573bd1fcf5 wg: Drop the compat shim for sbcreatecontrol().
I had to make a few other changes when merging the driver to stable/13
anyway, so adjusting this as well isn't really a big deal.

MFC after:	3 days
2022-11-11 14:18:48 -08:00
Andrey V. Elsukov
8526120ad4 ixgbe: workaround errata about UDP frames with zero checksum
Intel 82599 has errata related to IPv4 UDP frames with zero checksum.
It reports such datagrams with L4 integrity errors in IXGBE_XEC
register. And after afb1aa4e6d commit such errors are reported
via IFCOUNTER_IERRORS. This confuses users, since actually all frames
are handled correctly by the system.
To workaround the problem, let's ignore the XEC register value for
82599 cards for now.

PR:		266048
Discussed with:	erj
MFC after:	1 week
Sponsored by:	Yandex LLC
2022-11-10 12:34:40 +03:00
John Baldwin
e4bc19b2fa cxgbe tom: Fix jobtotid() compilation.
The previous commit lost an implicit struct socket * cast.  Use an
inline function instead as the macro is already rather long.

Fixes:		e1401f7579 cxgbe: use standard sototcpcb() accessor macro to get socket's tcpcb
Sponsored by:	Chelsio Communications
2022-11-08 11:25:58 -08:00
Gleb Smirnoff
9eb0e8326d tcp: provide macros to access inpcb and socket from a tcpcb
There should be no functional changes with this commit.

Reviewed by:		rscheff
Differential revision:	https://reviews.freebsd.org/D37123
2022-11-08 10:24:40 -08:00
Bjoern A. Zeeb
f2978460c7 LinuxKPI: tasklet add (*callback) support
In addition to (*func) tasklet also seems to have a (*callback) with
a different argument.  Add support for this and add tasklet_setup()
as well for support in more drivers.

The from_tasklet() definition is duplicated in the tree; hide it there
under #ifndef to avoid a re-definition.  People should generally add
LinuxKPI bits to linuxkpi rather than private files if they also rely
on other LinuxKPI bits.

X-MFC:		DO NOT MFC, space allocated by drivers not us.
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D37216
2022-11-08 18:14:17 +00:00
Jakub Kołodziej
f1717ffd7a gpio: Fix typo causing GPIO configuration mismatch
Polarity inversion register was mistekanly filled with the value of
the direction configuration register.
Correct that.

Reviewed by:	kd
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D37262
2022-11-08 14:14:59 +01:00
Navdeep Parhar
b2700160cc pcireg.h: Add values for ACS PCIe Extended capability.
These values come from section 7.7.11 ("ACS Extended Capability") of the
PCI Express Base Specification Revision 6.0, dated 16 Dec 2021.

MFC after:	1 week
Sponsored by:	Chelsio Communications
Reviewed by:	kib@
Differential Revision:	https://reviews.freebsd.org/D37270
2022-11-07 13:20:21 -08:00
Justin Hibbits
d56c7ac87f dpaa: Go to cleanup exit point on fman attach error
If fman_init() fails it can leave things in a state where it cannot
attach at all in the future, because it would simply exit without
tearing down everything that was already set up.  Go to the exit point
to clean up on error instead, so that it can try again later.

MFC after:	1 week
2022-11-05 20:05:24 -04:00
Warner Losh
eb40e3e757 bnxt: Only filter out i386
Only i386 is missing bus_read_8. The other 32-bit platforms can be fixed
with a cast to a printf.

Suggested by:	kevans
Sponsored by:	Netflix
2022-11-04 22:40:00 -06:00
Sumit Saxena
58d84ef870 if_bnxt: Added support for mgmt interface for passthrough hwrms
Added support for application management interface. There are two types of commands supported:

1. Firmware IOCTLs: These ioctls are meant for firmware
   consumption. Driver acts as a transport for these.
2. Driver only IOCTLs: These ioctls are meant for driver
   consumption. Driver will serve these ioctls without sending them down
   to firmware.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36448
2022-11-04 16:40:29 -06:00
Sumit Saxena
2ed061f08d if_bnxt: Add support for smaller backing_store_cfg message size
Add compat logic to fallback to the older/smaller backing_store_cfg
message size.

Reviewed by: imp
Differentil Revision: https://reviews.freebsd.org/D36447
2022-11-04 16:33:21 -06:00
Sumit Saxena
19a57f85ba if_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36446
2022-11-04 16:31:24 -06:00
Sumit Saxena
baef1301a2 if_bnxt: Fix the issue when kernel invokes _init() again without _stop()
Fixed the issue when kernel invokes _init() when it is already in
_init() state by invoking _stop() in such case.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36445
2022-11-04 16:28:51 -06:00
Sumit Saxena
72e9dbb58c if_bnxt: Remove sysctl node vlan_only which is not being used
Removed sysctl node vlan_only which is not being used after migrating
from l2_set_rx_mask to l2_filter_alloc.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36444
2022-11-04 16:26:03 -06:00
Sumit Saxena
91fcacc355 if_bnxt: Add support for VLAN on Thor
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36443
2022-11-04 16:24:32 -06:00
Sumit Saxena
cfdca95f78 if_bnxt: Add support for RSS on Thor
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442
2022-11-04 16:21:20 -06:00
Sumit Saxena
6033382aab if_bnxt: Display firmware version along with SIT package version
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441
2022-11-04 16:18:38 -06:00
Sumit Saxena
fb4b7e02d2 if_bnxt: Add support for async link status update
Reivewed by: imp
Differential Revision: https://reviews.freebsd.org/D36440
2022-11-04 16:14:49 -06:00
Sumit Saxena
055196a7d7 if_bnxt: Add support for admin down/up and jumbo
Make ifconfig up/down work, as well as adding support for jumbo frames.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36439
2022-11-04 16:11:10 -06:00
Sumit Saxena
8945584f93 if_bnxt: add support for Thor controller
Added support for Thor controller.
Below are the supported operations:

1. IPv4 ping (ICMP)
2. iperf / netperf (IPv4 TCP)
3. Promiscuous (tcpdump)
4. Can achieve 20 Gbps on a 25 G link (Uni-Di)
5. Can achieve 60 Gbps on a 100 G link (Uni-Di)
6. Port level and queue level driver stats.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36438
2022-11-04 16:05:57 -06:00
Sumit Saxena
49a3df78c7 if_bnxt: Convert all doorbell writes into function pointers
This is preparatory patch for making a base for Broadcom's Thor
controller support. It converts all doorbell writes into function
pointers.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36437
2022-11-04 16:02:29 -06:00
Sumit Saxena
97315f68fe if_bnxt: update hsi_struct_def.h headers
Updates the drivers to Broadcom's latest:
	HWRM Version 1.10.2.34 using HSI definition version 1.8.4

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36436
2022-11-04 15:58:43 -06:00
Florian Walpen
ad370f7658 sound(4): Fix memory map of /dev/dsp devices when buffer size is not a multiple of PAGE_SIZE.
By using sndbuf_getallocsize() instead of sndbuf_getsize() in dsp_mmap_single().

PR:		267555
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-11-04 19:05:34 +01:00
Souradeep Chakrabarti
602861820d arm64: Hyper-V: making INTR MP Safe
Makeing the interrupt MP safe.

Reviewed by:	andrew
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37222
2022-11-04 10:20:16 +00:00
Li-Wen Hsu
d0b5e4a30a
mana(4): Make the code cross-platform
Discussed with:	whu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36388
2022-11-04 11:45:35 +08:00
Roger Pau Monné
dabb3db7a8 xen/netfront: deal with mbuf data crossing a page boundary
There's been a report recently of mbufs with data that crosses a page
boundary. It seems those mbufs are generated by the iSCSI target
system:

https://lists.xenproject.org/archives/html/xen-devel/2021-12/msg01581.html

In order to handle those mbufs correctly on netfront use the bus_dma
interface and explicitly request that segments must not cross a page
boundary. No other requirements are necessary, so it's expected that
bus_dma won't need to bounce the data and hence it shouldn't
introduce a too big performance penalty.

Using bus_dma requires some changes to netfront, mainly in order to
accommodate for the fact that now ring slots no longer have a 1:1
match with mbufs, as a single mbuf can use two ring slots if the data
buffer crosses a page boundary. Store the first packet of the mbuf
chain in every ring slot that's used, and use a mbuf tag in order to
store the bus_dma related structures and a refcount to keep track of
the pending slots before the mbuf chain can be freed.

Reported by: G.R.
Tested by: G.R.
MFC: 1 week
Differential revision: https://reviews.freebsd.org/D33876
2022-11-03 13:32:21 +01:00
Colin Percival
75549de770 vtblk: Fix dumping
Now that vtblk uses busdma, it keeps important information inside its
request structures.  The functions used for kernel dumps synthesize
their own request structures rather than using structures initialized
with the necessary bits for busdma.

Add busdma-bypass paths.  Since dumping writes contiguous blocks of
physical memory, vtblk doesn't need busdma in that case.

Reported by:	glebius
Tested by:	glebius
Differential Revision:	https://reviews.freebsd.org/D37243
2022-11-03 00:52:43 -07:00
Elliott Mitchell
21cc0918c7 sys: Nuke double-semicolons
A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, rrs
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31716
2022-11-02 09:34:20 -06:00
Wentao Wang
923704f7b8 vmw_pvscsi: Expand vcpuHint to 16 bit to aliagn with host side change.
vcpuHint has been expanded to 16 bit on host side to enable
interruptions to be routed to more CPUs. Guest side should align with
the change.

This change has been tested with hosts with 8-bit and 16-bit vcpuHint,
on both platforms host side can get correct value.

This driver is for ESXi product which only supports x86/x64. They are
little-endian. So there is no need to consider big-endian system.

PR:		264840
Reviewed by:	imp@, Zhenlei Huang
2022-11-02 09:14:52 -06:00
Chuck Silvers
f0f3e3e961 ipmi: use a queue for kcs driver requests when possible
The ipmi watchdog pretimeout action can trigger unintentionally in
certain rare, complicated situations.  What we have seen at Netflix
is that the BMC can sometimes be sent a continuous stream of
writes to port 0x80, and due to what is a bug or misconfiguration
in the BMC software, this results in the BMC running out of memory,
becoming very slow to respond to KCS requests, and eventually being
rebooted by its own internal watchdog.  While that is going on in
the BMC, back in the host OS, a number of requests are pending in
the ipmi request queue, and the kcs_loop thread is working on
processing these requests.  All of the KCS accesses to process
those requests are timing out and eventually failing because the
BMC is responding very slowly or not at all, and the kcs_loop thread
is holding the IPMI_IO_LOCK the whole time that is going on.
Meanwhile the watchdogd process in the host is trying to pat the
BMC watchdog, and this process is sleeping waiting to get the
IPMI_IO_LOCK.  It's not entirely clear why the watchdogd process
is sleeping for this lock, because the intention is that a thread
holding the IPMI_IO_LOCK should not sleep and thus any thread
that wants the lock should just spin to wait for it.  My best guess
is that the kcs_loop thread is spinning waiting for the BMC to
respond for so long that it is eventually preempted, and during
the brief interval when the kcs_loop thread is not running,
the watchdogd thread notices that the lock holder is not running
and sleeps.  When the kcs_loop thread eventually finishes processing
one request, it drops the IPMI_IO_LOCK and then immediately takes the
lock again so it can process the next request in the queue.
Because the watchdogd thread is sleeping at this point, the kcs_loop
always wins the race to acquire the IPMI_IO_LOCK, thus starving
the watchdogd thread.  The callout for the watchdog pretimeout
would be reset by the watchdogd thread after its request to the BMC
watchdog completes, but since that request never processed, the
pretimeout callout eventually fires, even though there is nothing
actually wrong with the host.

To prevent this saga from unfolding:

 - when kcs_driver_request() is called in a context where it can sleep,
   queue the request and let the worker thread process it rather than
   trying to process in the original thread.
 - add a new high-priority queue for driver requests, so that the
   watchdog patting requests will be processed as quickly as possible
   even if lots of application requests have already been queued.

With these two changes, the watchdog pretimeout action does not trigger
even if the BMC is completely out to lunch for long periods of time
(as long as the watchdogd check command does not also get stuck).

Sponsored by:	Netflix
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D36555
2022-11-01 10:55:14 -07:00
Souradeep Chakrabarti
654749832b arm64: Hyper-V: fixing hung issue during Hyper-V initialization
In non-Hyper-V systems during Hyper-V initialization, system
initialization was getting hung, as hyperv_identify(),
was returning successful irrespective of the type of the platform.

Reviewed by:	andrew, whu
Fixes:	9729f076e4
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37219
2022-11-01 14:13:50 +00:00
Gordon Bergling
816d5c1e98 isci(4): Fix common typos in source code comments
- s/assinged/assigned/

MFC after:	3 days
2022-11-01 08:34:11 +01:00
Gordon Bergling
5014dc958f isci(4): Fix a typo in a source code comment
- s/interrutp/interrupt/

MFC after:3 days
2022-11-01 07:58:26 +01:00
Gordon Bergling
e902e62644 bxe(4): Fix a typo in a source code comment
- s/interrutps/interrupts/

MFC after:	3 days
2022-11-01 07:55:55 +01:00
Doug Moore
a2c57c60d9 iommu_gas: drop fini cleanup loop
Assertions suggest that the loop in iommu_gas_fini_domain is executed
zero times, so remove it.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D37204
2022-10-29 12:56:06 -05:00
Doug Moore
8b221ca631 iommu_gas: start space search from 1st free space
Maintain a pointer to an element in the domain map that is left of any
sufficiently large free gap in the tree and start the search for free
space there, rather than at the root of the tree. On find_space, move
that pointer to the leftmost leaf in the subtree of nodes with
free_down greater than or equal to the minimum allocation size before
starting the search for space from that pointer. On removal of a node
with address less than that pointer, update that pointer to point to
the predecessor or successor of the removed node.

In experiments with netperf streaming, this reduces by about 40% the
number of map entries examined in first-fit allocation.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36624
2022-10-29 00:50:44 -05:00
John Baldwin
854d066251 wg: Trim compat shims for versions older than current stable/13.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36913
2022-10-28 13:36:13 -07:00
John Baldwin
c640d1af2c wg: Retire now unused support.h.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36912
2022-10-28 13:36:13 -07:00
John Baldwin
dcf581bb49 wg: Use zfree.
Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36911
2022-10-28 13:36:13 -07:00
John Baldwin
e32e1a160e wg: Use atomic(9) instead of concurrency-kit atomics.
Kernel sanitizers only support atomic(9) operations.

Reviewed by:	kevans, markj, emaste
Reported by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36910
2022-10-28 13:36:13 -07:00
John Baldwin
744bfb2131 Import the WireGuard driver from zx2c4.com.
This commit brings back the driver from FreeBSD commit
f187d6dfbf plus subsequent fixes from
upstream.

Relative to upstream this commit includes a few other small fixes such
as additional INET and INET6 #ifdef's, #include cleanups, and updates
for recent API changes in main.

Reviewed by:	pauamma, gbe, kevans, emaste
Obtained from:	git@git.zx2c4.com:wireguard-freebsd @ 3cc22b2
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36909
2022-10-28 13:36:12 -07:00