Commit Graph

37692 Commits

Author SHA1 Message Date
Hans Petter Selasky
86c9b3f3a6 Add support for multiple playback and recording devices per physical USB audio
device. This requires some structural refactoring inside the driver, mostly
about converting existing audio channel structures into arrays.

The main audio mixer is provided by the first PCM instance.
The non-first audio instances may only have a software mixer for PCM playback.

Tested by:	Horse Ma <Shichun.Ma@dell.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-30 16:50:32 +00:00
Ed Maste
aeb665b538 remove extraneous double ;s in sys/ 2020-03-30 16:04:25 +00:00
Hans Petter Selasky
93e39e2325 Implement new mixer API to return the device pointer based on the mixer pointer.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-30 15:36:38 +00:00
Hans Petter Selasky
8e2e5ae7d1 Evaluate modifier keys before the regular keys, so that if a modifier
key is pressed at the same time as a regular key, that means key with
modifier is output. Some automated USB keyboards like Yubikeys need this.

This fixes a regression issue after r357861.

Reported by:	Adam McDougall <mcdouga9@egr.msu.edu>
PR:		224592
PR:		233884
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-03-30 15:29:39 +00:00
Mark Johnston
9b1d850be8 Remove the "config" taskqgroup and its KPIs.
Equivalent functionality is already provided by taskqueue(9), just use
that instead.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-03-30 14:24:03 +00:00
Mark Johnston
9893ab3f50 Fix accounting of hwpmc's thread descriptor freelist.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-03-30 14:23:08 +00:00
Vladimir Kondratyev
006eb44926 evdev: return error rather than zero-length data on blocked read()
if blocked process has been woken up by evdev device destruction.

MFC after:	2 weeks
2020-03-29 23:01:36 +00:00
Vladimir Kondratyev
80ddbddfd7 evdev: Add COMPAT_FREEBSD32 support for amd64 arch
Incompatibility between i386 and amd64 evdev ABIs was caused by presence of
'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for
32 bit binaries.

Big-endian platforms may require additional work due to bitstr_t (array of
unsigned longs) usage in ioctl interface.

MFC after:	2 weeks
2020-03-29 23:00:33 +00:00
Konstantin Belousov
f30cf5588a hdaa: remove verbosity from the normal driver operations.
If hdaa is used in polling mode, it logs each change to the poll
interval under bootverbose, which makes it unusable (slow).  These
messages are arguably useless or are a debugging leftovers at best.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-03-28 16:26:47 +00:00
John Baldwin
c034143269 Refactor driver and consumer interfaces for OCF (in-kernel crypto).
- The linked list of cryptoini structures used in session
  initialization is replaced with a new flat structure: struct
  crypto_session_params.  This session includes a new mode to define
  how the other fields should be interpreted.  Available modes
  include:

  - COMPRESS (for compression/decompression)
  - CIPHER (for simply encryption/decryption)
  - DIGEST (computing and verifying digests)
  - AEAD (combined auth and encryption such as AES-GCM and AES-CCM)
  - ETA (combined auth and encryption using encrypt-then-authenticate)

  Additional modes could be added in the future (e.g. if we wanted to
  support TLS MtE for AES-CBC in the kernel we could add a new mode
  for that.  TLS modes might also affect how AAD is interpreted, etc.)

  The flat structure also includes the key lengths and algorithms as
  before.  However, code doesn't have to walk the linked list and
  switch on the algorithm to determine which key is the auth key vs
  encryption key.  The 'csp_auth_*' fields are always used for auth
  keys and settings and 'csp_cipher_*' for cipher.  (Compression
  algorithms are stored in csp_cipher_alg.)

- Drivers no longer register a list of supported algorithms.  This
  doesn't quite work when you factor in modes (e.g. a driver might
  support both AES-CBC and SHA2-256-HMAC separately but not combined
  for ETA).  Instead, a new 'crypto_probesession' method has been
  added to the kobj interface for symmteric crypto drivers.  This
  method returns a negative value on success (similar to how
  device_probe works) and the crypto framework uses this value to pick
  the "best" driver.  There are three constants for hardware
  (e.g. ccr), accelerated software (e.g. aesni), and plain software
  (cryptosoft) that give preference in that order.  One effect of this
  is that if you request only hardware when creating a new session,
  you will no longer get a session using accelerated software.
  Another effect is that the default setting to disallow software
  crypto via /dev/crypto now disables accelerated software.

  Once a driver is chosen, 'crypto_newsession' is invoked as before.

- Crypto operations are now solely described by the flat 'cryptop'
  structure.  The linked list of descriptors has been removed.

  A separate enum has been added to describe the type of data buffer
  in use instead of using CRYPTO_F_* flags to make it easier to add
  more types in the future if needed (e.g. wired userspace buffers for
  zero-copy).  It will also make it easier to re-introduce separate
  input and output buffers (in-kernel TLS would benefit from this).

  Try to make the flags related to IV handling less insane:

  - CRYPTO_F_IV_SEPARATE means that the IV is stored in the 'crp_iv'
    member of the operation structure.  If this flag is not set, the
    IV is stored in the data buffer at the 'crp_iv_start' offset.

  - CRYPTO_F_IV_GENERATE means that a random IV should be generated
    and stored into the data buffer.  This cannot be used with
    CRYPTO_F_IV_SEPARATE.

  If a consumer wants to deal with explicit vs implicit IVs, etc. it
  can always generate the IV however it needs and store partial IVs in
  the buffer and the full IV/nonce in crp_iv and set
  CRYPTO_F_IV_SEPARATE.

  The layout of the buffer is now described via fields in cryptop.
  crp_aad_start and crp_aad_length define the boundaries of any AAD.
  Previously with GCM and CCM you defined an auth crd with this range,
  but for ETA your auth crd had to span both the AAD and plaintext
  (and they had to be adjacent).

  crp_payload_start and crp_payload_length define the boundaries of
  the plaintext/ciphertext.  Modes that only do a single operation
  (COMPRESS, CIPHER, DIGEST) should only use this region and leave the
  AAD region empty.

  If a digest is present (or should be generated), it's starting
  location is marked by crp_digest_start.

  Instead of using the CRD_F_ENCRYPT flag to determine the direction
  of the operation, cryptop now includes an 'op' field defining the
  operation to perform.  For digests I've added a new VERIFY digest
  mode which assumes a digest is present in the input and fails the
  request with EBADMSG if it doesn't match the internally-computed
  digest.  GCM and CCM already assumed this, and the new AEAD mode
  requires this for decryption.  The new ETA mode now also requires
  this for decryption, so IPsec and GELI no longer do their own
  authentication verification.  Simple DIGEST operations can also do
  this, though there are no in-tree consumers.

  To eventually support some refcounting to close races, the session
  cookie is now passed to crypto_getop() and clients should no longer
  set crp_sesssion directly.

- Assymteric crypto operation structures should be allocated via
  crypto_getkreq() and freed via crypto_freekreq().  This permits the
  crypto layer to track open asym requests and close races with a
  driver trying to unregister while asym requests are in flight.

- crypto_copyback, crypto_copydata, crypto_apply, and
  crypto_contiguous_subsegment now accept the 'crp' object as the
  first parameter instead of individual members.  This makes it easier
  to deal with different buffer types in the future as well as
  separate input and output buffers.  It's also simpler for driver
  writers to use.

- bus_dmamap_load_crp() loads a DMA mapping for a crypto buffer.
  This understands the various types of buffers so that drivers that
  use DMA do not have to be aware of different buffer types.

- Helper routines now exist to build an auth context for HMAC IPAD
  and OPAD.  This reduces some duplicated work among drivers.

- Key buffers are now treated as const throughout the framework and in
  device drivers.  However, session key buffers provided when a session
  is created are expected to remain alive for the duration of the
  session.

- GCM and CCM sessions now only specify a cipher algorithm and a cipher
  key.  The redundant auth information is not needed or used.

- For cryptosoft, split up the code a bit such that the 'process'
  callback now invokes a function pointer in the session.  This
  function pointer is set based on the mode (in effect) though it
  simplifies a few edge cases that would otherwise be in the switch in
  'process'.

  It does split up GCM vs CCM which I think is more readable even if there
  is some duplication.

- I changed /dev/crypto to support GMAC requests using CRYPTO_AES_NIST_GMAC
  as an auth algorithm and updated cryptocheck to work with it.

- Combined cipher and auth sessions via /dev/crypto now always use ETA
  mode.  The COP_F_CIPHER_FIRST flag is now a no-op that is ignored.
  This was actually documented as being true in crypto(4) before, but
  the code had not implemented this before I added the CIPHER_FIRST
  flag.

- I have not yet updated /dev/crypto to be aware of explicit modes for
  sessions.  I will probably do that at some point in the future as well
  as teach it about IV/nonce and tag lengths for AEAD so we can support
  all of the NIST KAT tests for GCM and CCM.

- I've split up the exising crypto.9 manpage into several pages
  of which many are written from scratch.

- I have converted all drivers and consumers in the tree and verified
  that they compile, but I have not tested all of them.  I have tested
  the following drivers:

  - cryptosoft
  - aesni (AES only)
  - blake2
  - ccr

  and the following consumers:

  - cryptodev
  - IPsec
  - ktls_ocf
  - GELI (lightly)

  I have not tested the following:

  - ccp
  - aesni with sha
  - hifn
  - kgssapi_krb5
  - ubsec
  - padlock
  - safe
  - armv8_crypto (aarch64)
  - glxsb (i386)
  - sec (ppc)
  - cesa (armv7)
  - cryptocteon (mips64)
  - nlmsec (mips64)

Discussed with:	cem
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23677
2020-03-27 18:25:23 +00:00
Hans Petter Selasky
9211468fc2 Change default microphone level from 0 to 25.
Discussed with:	Horse Ma <Shichun.Ma@dell.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-27 10:28:15 +00:00
Hans Petter Selasky
c2bc9ff72a Improve USB audio mixer support for USB audio class 1 and 2.
- make sure volume controls are correctly mapped to "pcm" and "rec" depending
  on how they deliver audio to the USB host.
- make sure there are no duplicate record selections.
- remove internal only mixer class type.
- don't add software volume controls for recording only.
- some minor mixer code cleanup.

Tested by:	Horse Ma <Shichun.Ma@dell.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-27 10:22:35 +00:00
Leandro Lupori
f6f325c837 [PowerPC64] Fix OPAL IPMI driver
This change fixes a couple of issues with OPAL IPMI driver and
implements a mechanism to detect timeouts and discard old messages left
in receive queue, to avoid old messages from being confused with the
reply of new ones.

Reviewed by:	jhibbits
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D24185
2020-03-26 12:17:49 +00:00
Hans Petter Selasky
a0be362828 Be more intelligent when classifying USB audio terminal types, so that we
don't end up using SOUND_MIXER_VOLUME for all undefined types.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-26 07:52:04 +00:00
Hans Petter Selasky
91feacd19e Make mute controls available for USB audio mixers.
Submitted by:	Horse Ma <Shichun.Ma@dell.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-26 07:46:16 +00:00
Hans Petter Selasky
edabe1ee6d Factor out USB audio mixer value range check.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-26 07:42:36 +00:00
Hans Petter Selasky
7e88777b24 Avoid scaling USB audio mixer values twice.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-26 07:37:00 +00:00
Justin Hibbits
77cb3b49b7 ichwd: Add Atom C3000 watchdog ID.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc
2020-03-24 21:28:48 +00:00
Justin Hibbits
d681bc9e64 ismt: Fix ISMT_DESC_ADDR_RW macro, slave addresses are already left-shifted
Reverts r293369.  The macro was orginally correct, since our SMBus
framework, unlike i2c, already requires addresses to be 8-bit, LSB-cleared.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc
2020-03-24 18:35:33 +00:00
Baptiste Daroussin
e47b5c3de7 Remove unneeded dependency on libl 2020-03-23 14:33:29 +00:00
Hans Petter Selasky
d0edc32e72 Add new USB ID.
Submitted by:	Konrad Jopek <kjopek@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D24142
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-22 11:44:24 +00:00
Ed Maste
e3e6a34984 Use a separate copy of machdep.h in cp and ce drivers
Previously they included sys/dev/cx/machdep.h, but the cx driver was
retired in r359178.  These drivers haven't had real development for
a decade or more so there's no real benefit in sharing this file; just
copy it to the ce and cp subdirs.
2020-03-20 19:28:55 +00:00
Ed Maste
2733d8c96c retire cx,ctau drivers
The devices supported by these drivers are obsolete ISA cards, and the
sync serial protocols they supported are essentially obsolete too.

Sponsored by:	The FreeBSD Foundation
2020-03-20 16:50:19 +00:00
Navdeep Parhar
aa301e5ffe cxgbe(4): Split sge_nm_rxq into three cachelines.
This reduces the lines bouncing around between the driver rx ithread and
the netmap rxsync thread.  There is no net change in the size of the
struct (it continues to waste a lot of space).

This kind of split was originally proposed in D17869 by Marc De La
Gueronniere @ Verisign, Inc.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-03-20 05:12:16 +00:00
Gavin Atkinson
4b156472c6 Add new USB device ID for Elecom 802.11ac USB device.
MFC after:	2 weeks
2020-03-20 04:13:39 +00:00
Hans Petter Selasky
d76ca5b15c Correctly implement support for remote wakeup for USB 3.0 device.
Submitted by:	Horse Ma <Shichun.Ma@dell.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-19 09:15:59 +00:00
Alexander Motin
d26ae2c1ca Add missing STAILQ_INIT() in ciss_disable_adapter().
I think it should fix reported panic after "ADAPTER HEARTBEAT FAILED".

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2020-03-19 00:19:50 +00:00
Konstantin Belousov
4ad58ea85b mlx5_core: lower the severity of message noting that no SR-IOV cap is present.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:47:14 +00:00
Konstantin Belousov
bbcb656af2 mlx5: Route NIC_VPORT_CHANGE events to eswitch code.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:44:48 +00:00
Konstantin Belousov
90959e7e37 mlx5: Read number of VF ports from the SR-IOV cap.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:43:39 +00:00
Konstantin Belousov
18a70fa574 mlx5: Use eswitch interface to configure VFs steering.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:40:26 +00:00
Konstantin Belousov
8982c8003b mlx5: Add 'follow' vport state, relevant for VFs.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:38:57 +00:00
Konstantin Belousov
f6ca0b216a mlx5: Integrate eswitch and mpfs management code.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:33:39 +00:00
Konstantin Belousov
91ad1bd953 mlx5: Restore eswitch management code from attic.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:30:56 +00:00
Konstantin Belousov
9dfa078252 mlx5: Basic PCIe side of SR-IOV support.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 22:17:01 +00:00
Konstantin Belousov
e19a968f15 mlx5_core: add sysctls to report device capabilities.
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
2020-03-18 21:54:32 +00:00
Ed Maste
15f16425e4 if_muge: use C99 bool for boolean vars 2020-03-18 14:16:14 +00:00
Rebecca Cran
7e03a82b63 ath_hal: fix typo in ath_hal_printf 2020-03-18 03:14:17 +00:00
Navdeep Parhar
a8f48cf82f Remove spurious warning about invalid VPD data.
The warning used to be displayed for valid VPDs about 512B or above in
size.  Fix the size check and add a break while here so that the routine
stops if if detects any problem.

Tested with "pciconf -lV"

Reviewed by:	kib@, jhb@
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23679
2020-03-18 01:09:40 +00:00
Hans Petter Selasky
b527d52357 Add new USB device ID to u3g driver.
Submitted by:	super_gromit@hotmail.com
PR:		244798
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-03-17 09:12:47 +00:00
Patrick Kelsey
5d1899eedb Restore power-of-2 queue count constraint from r290948
When vmx(4) was converted to an iflib driver in r343291, the
power-of-2 queue count constraint was removed as it appeared that
current implementations of the VMXNET3 virtual device no longer
required that constraint.  It turns out that some of the
implementations still do, and on such systems, the device will fail to
initialize when configured with a non-power-of-2 RX or TX queue count.

PR:		237321
Reported by:	ncrogers@gmail.com
MFC after:	1 week
2020-03-17 03:32:13 +00:00
Alfredo Dal'Ava Junior
5c6ad2e813 atp: fix mouse attachment on PowerBook5,6 (G4)
Skip device mode switch step on Fountain-based devices as they don't
support RAW_SENSOR_MODE command, so failing to attach.

This was reproduced on PowerBook G4 (model PowerBook5,6) equipped with
product ID 0x020e

Reviewed by:	hselasky
Approved by:	jhibbits (mentor)
Differential Revision:	https://reviews.freebsd.org/D24005
2020-03-16 13:53:29 +00:00
Ed Maste
9f6954e505 if_muge: whitespace and style cleanup
Submitted by:	clang-format (in part)
Sponsored by:	The FreeBSD Foundation
2020-03-15 21:47:16 +00:00
Ed Maste
6c0331ea04 muge: drop CSUM from MUGE_DEFAULT_TSO_CSUM_ENABLE
TSO is independent of checksum offload
2020-03-15 03:32:39 +00:00
Ed Maste
0d5e6868c5 muge: enable RXCSUM as it now works
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-03-15 03:03:01 +00:00
Patrick Kelsey
1342c8c622 Adjust if_vmx default receive parameters for better out-of-box performance
These adjustments improve performance with jumbo frames and/or LRO
enabled (i.e., when there may be multiple descriptors per packet) by
increasing the default size of the receive queues and by always using
page-sized buffers for the body type receive ring.

This patch also adjust the initialization of the max frame size to
remove cases where certain configuration sequences would result in 2K
receive buffers being used instead of 4K ones when jumbo frames were
enabled.

Reviewed by:	gallatin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23950
2020-03-14 20:11:46 +00:00
Patrick Kelsey
f50375eec6 Fix if_vmx receive checksum offload bug and harden against the device skipping receive descriptors
This fixes a bug where the checksum offload status of received packets
was being taken from the first descriptor instead of the last, which
affected LRO packets.

The driver has been hardened against the device skipping receive
descriptors, although it is not believed that this can occur given the
way this implementation configures the receive rings.

Additionally, for packets received with the error indicator set, the
driver now forces the length of all fragments in that packet to zero
prior to passing it to iflib.  Such packets should wind up being
discarded at some point in the stack anyway, but this removes any
questions by killing them in the driver.

Counters have been added (and exposed via sysctls) for skipped receive
descriptors, zero-length packets received, and packets received with
the error indicator set so that these conditions can be easily
observed in the field.

PR:		243126, 243392, 240628
Reported by:	avg, alexandr.oleynikov@gmail.com, Harald Schmalzbauer
Reviewed by:	gallatin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23949
2020-03-14 20:08:04 +00:00
Ed Maste
bec8faad55 muge: correct RX checksum offload
Submitted by:	Johannes <iz-rpi04@hs-karlsruhe.de>
MFC after:	1 week
2020-03-14 01:52:38 +00:00
Alexander Motin
a2386b6f6a Increase buffer in mprsas_log_command() from 192 to 224 bytes.
192 bytes are not enough to print long commands, such as ATA COMMAND PASS
THROUGH(16), that makes debug output difficult to read.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2020-03-13 14:51:11 +00:00
Navdeep Parhar
7a25fb9963 cxgbe(4): Do not display error messages related to the CLIP table if
it's not in use by TOE or KTLS.

Reviewed by:	jhb@
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24046
2020-03-13 00:12:15 +00:00
Vladimir Kondratyev
54c050471c wmt(4): Reapply r358872 (by hselasky) modified to use
maximal input report size instead of wMaxPacketSize.

If the USB frame length is set to 1024 bytes, WMT_BSIZE, the EETI controller
will pack multiple touch events in the packet and the current code will only
process the first touch event.

As a result some important events are lost like releasing the finger from the
touchscreen.

Use the maximal input report size as buffer size instead.

PR:		244718
Tested by:	Oskar Holmlund <oskar.holmlund@ohdata.se>, wulf
MFC after:	3 days
Discussed with:	hselasky
2020-03-11 20:05:49 +00:00
Vladimir Kondratyev
b8e3d9b1ed wmt(4): revert r358872 (by hselasky)
Limiting frame size to maximum packet size breaks devices which have input
report size larger than wMaxPacketSize. Maximal input report size should be
used instead.
Revert the commit as it have not been MFC-ed yet.

Discussed with:	hselasky
2020-03-11 19:57:43 +00:00
Hans Petter Selasky
45ddfe6806 If the USB frame length is set to 1024 bytes, WMT_BSIZE, the EETI controller
will pack multiple touch events in the packet and the current code will only
process the first touch event.

As a result some important events are lost like releasing the finger from the
touchscreen.

Use the maximum maximum packet size as buffer size instead.

Submitted by:	Oskar Holmlund <oskar.holmlund@ohdata.se>
PR:		244718
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-03-11 08:16:13 +00:00
Navdeep Parhar
87d228f935 cxgbe/t4_tom: The MSS in a FLOWC work request must not be 0.
Submitted by:	jhb@
MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-03-10 21:49:56 +00:00
Navdeep Parhar
2b9010f070 cxgbe(4): Do not try to use 0 as an rx buffer address when the driver is
already allocating from the safe zone and the allocation fails.

This bug was introduced in r357481.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-03-10 21:44:20 +00:00
Vladimir Kondratyev
c50cdb6319 wmt(4): Fix Synaptics Touch Digitizer V04 attachment
Touch Digitizer V04 report descriptor declares 'Contact Count Maximum' usage
as constant. That was not supported by descriptor parser.

PR:		232040
Reported by:	Sergei Akhmatdinov <sakhmatd@darkn.space>
MFC after:	1 week
2020-03-09 21:01:22 +00:00
Vladimir Kondratyev
9b7938dcf3 iicbus(4): Add support for ACPI-based children enumeration
When iicbus is attached as child of Designware I2C controller it scans all
ACPI nodes for "I2C Serial Bus Connection Resource Descriptor" described
in section 19.6.57 of ACPI specs.
If such a descriptor is found, I2C child is added to iicbus, it's I2C
address, IRQ resource and ACPI handle are added to ivars. Existing
ACPI bus-hosted child is deleted afterwards.

The driver also installs so called "I2C address space handler" which is
disabled by default as nontested.
Set hw.iicbus.enable_acpi_space_handler loader tunable to 1 to enable it.

Reviewed by:		markj
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D22901
2020-03-09 20:31:38 +00:00
Vladimir Kondratyev
ddf8c230b1 acpi: Export functions required by upcoming acpi_iicbus driver. 2020-03-09 20:28:45 +00:00
Vladimir Kondratyev
709749aa29 acpi: Fix stalled value returned by acpi_get_device() after device deletion
Newbus device reference attached to ACPI handle is not cleared when newbus
device is deleted with devctl(8) delete command. Fix that with calling of
AcpiDetachData() from "child_deleted" bus method like acpi_pci driver does.

MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D22902
2020-03-09 20:27:25 +00:00
Leandro Lupori
eb132ade4a [aacraid] Handle both AIF and SYNC interrupts
Without this change, if an AIF interrupt comes at the same time a SYNC
command is finished, the SYNC interrupt will be lost. This happens because
all interrupt bits (bellbits) are cleared, but only one of them is handled.

Debugging shows that, (at least) when !sc->msi_enabled and (sc->flags &
AAC_FLAGS_SYNC_MODE) is true (sync mode), both bits may be set at the same
time.

PR:		237463
Reviewed by:	scottl
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D23859
2020-03-09 19:01:17 +00:00
Emmanuel Vadot
7c96220162 cpufreq: Unbreak build. 2020-03-09 03:34:16 +00:00
Emmanuel Vadot
21d69a144e cpufreq_dt: Fix r358555
Before skipping the current cpu when trying to find the ones that
have the same opp, record that this one have this opp.

Reported by:	mmel
MFC after:	2 weeks
X-MFC-With:	r358555
2020-03-09 02:30:16 +00:00
Hans Petter Selasky
601ee53858 Remove the power bit from the super speed root hub port status register
because it clobbers the super speed link status when a device is in super
speed mode. Currently the power bit is not needed for anything in the USB
hub driver.

This fixes USB warm reset for super speed devices.

Tested by:	Shichun.Ma@dell.com
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-03-08 13:24:34 +00:00
Andreas Tobler
5870983d6e Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof
Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few
years with CTLFLAG_MPSAFE w/o issues.
Add a HACK to handle a special case for a sensor location.
2020-03-06 21:32:42 +00:00
Andreas Tobler
a68ab49154 Drop 'All rights reserved'
Replace hardcoded size by nitems
2020-03-06 21:26:35 +00:00
Andreas Tobler
e65d6406fd Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof
2020-03-06 21:24:09 +00:00
Andreas Tobler
7cc4d41e40 - Drop 'All rights reserved'
- Replace hardcoded size by nitems
2020-03-06 21:21:01 +00:00
Navdeep Parhar
7ba6f5493d cxgbe/t4_tom: Do not uninitialize a toepcb that has not been initialized.
This fixes the following panic:
--- trap 0xc, rip = 0xffffffff80c00411, rsp = 0xfffffe0025192840, rbp = 0xfffffe0025192860 ---
vmem_xfree() at vmem_xfree+0xd1/frame 0xfffffe0025192860
tls_uninit_toep() at tls_uninit_toep+0x78/frame 0xfffffe0025192880
free_toepcb() at free_toepcb+0x32/frame 0xfffffe00251928a0
t4_connect() at t4_connect+0x3be/frame 0xfffffe0025192950
tcp_offload_connect() at tcp_offload_connect+0xa4/frame 0xfffffe0025192990
tcp_usr_connect() at tcp_usr_connect+0xec/frame 0xfffffe00251929f0
soconnect() at soconnect+0xae/frame 0xfffffe0025192a30
kern_connectat() at kern_connectat+0xe2/frame 0xfffffe0025192a90
sys_connect() at sys_connect+0x75/frame 0xfffffe0025192ad0
amd64_syscall() at amd64_syscall+0x137/frame 0xfffffe0025192bf0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0025192bf0
--- syscall (98, FreeBSD ELF64, sys_connect), rip = 0x8008e9d8a, rsp = 0x7fffffffc0f8, rbp = 0x7fffffffc130 ---

Reviewed by:	jhb@
MFC after:	3 days
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23989
2020-03-06 19:56:12 +00:00
Leandro Lupori
c65f571c89 ixl: Add missing conversions from/to LE16
This fixes some errors on PPC64, during attach and when trying to assign an IP
to an interface.  With this change, basic operation of X710 NICs is now
possible.

This also fixes builds with IXL_DEBUG enabled

Reviewed by:	erj
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D23975
2020-03-06 12:37:04 +00:00
Stanislav Galabov
46abd6a27e Add Gigabit Ethernet support for RT3883 and RT2880 Ralink/Mediatek SoCs
Submitted by:	yamori813@yahoo.co.jp
Reported by:	yamori813@yahoo.co.jp
Reviewed by:	sgalabov, ray
Obtained from:	yamori813@yahoo.co.jp
Differential Revision:	https://reviews.freebsd.org/D22618
2020-03-06 08:50:18 +00:00
Justin Hibbits
b21fe1ab67 Fix a mistaken conditional in mfi_tbolt_send_frame()
As written, the condition of (cdb[0] != 0x28 || cdb[0] != 0x2A) will always
be true, since if it's one, it's obviously not the other.  Reading the code,
the intent appears to be that it should only perform the operation if it's
neither, otherwise the conditional can be elided.

Found by clang 10.
2020-03-06 01:50:15 +00:00
Leandro Lupori
d8c51c6f74 [aacraid] Port driver to big-endian
Port aacraid driver to big-endian (BE) hosts.

The immediate goal of this change is to make it possible to use the
aacraid driver on PowerPC64 machines that have Adaptec Series 8 SAS
controllers.

Adapters supported by this driver expect FIB contents in little-endian
(LE) byte order. All FIBs have a fixed header part as well as a data
part that depends on the command being issued to the controller.

In this way, on BE hosts, the FIB header and all FIB data structures
used in aacraid.c and aacraid_cam.c need to be converted to LE before
being sent to the adapter and converted to BE when coming from it.

The functions to convert each struct are on aacraid_endian.c.
For little-endian (LE) targets, they are macros that expand
to nothing.
In some cases, when only a few fields of a large structure are used,
the fields are converted inline, by the code using them.

PR:		237463
Reviewed by:	jhibbits
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D23887
2020-03-05 20:04:41 +00:00
Gleb Smirnoff
70b1e1c681 Remove unused function. 2020-03-04 22:31:41 +00:00
Emmanuel Vadot
c30e9beba0 dwmmc: Rework the DMA engine
Each segment can be up to 4096 bytes in chain structure according to the
RK3399 TRM Part 2.
Set the buffers in full ring where the last one point to the first one.
Correctly reports the MMC_IVAR_MAX_DATA.
Use CACHE_LINE_SIZE for bus_dma alignment.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D23894
2020-03-04 20:01:03 +00:00
Brooks Davis
ac09be5297 bnxt(4): Fix ioctls when user addresses are inaccessable.
Check copyin's error code (differ adding copyout checks at this time).

Don't directly access user memory in the switch statement.

Since bnxt_ioctl_data isn't all that big, use a stack allocation.

Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23933
2020-03-04 17:55:57 +00:00
Hans Petter Selasky
cc1efc23c8 Implement a detaching flag for the sound(4) subsystem to take
appropriate actions when we are trying to detach an audio device,
but cannot because someone is using it.

This avoids applications having to wait for the DSP read data
timeout before they receive any error indication.
Tested with virtual_oss(8).

Remove some unused definitions while at it.

PR:		194727
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-04 17:23:20 +00:00
Konstantin Belousov
96dad2b720 mlx5en: Support 50GBase-KR4 media type in mlx5en driver.
Submitted by:	Adam Peace <adam.e.peace@gmail.com>
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2020-03-04 17:13:35 +00:00
Leandro Lupori
cffdc39e5e [aacraid] Add missing unmap call for SYNC mode
This issue was observed on a PowerPC64 machine with an Adaptec RAID Controller
with PCI device ID 0x028d. After several read/write operations, the kernel was
panic'ing in bus_dmamap_sync(). This was due to a missing aac_unmap_command()
in the SYNC path.

PR:	237463
Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D23668
2020-03-04 12:21:38 +00:00
Hans Petter Selasky
0e5670a9a0 Restart the USB keyboard repeat timer at every valid key-press.
This fixes a regression issue after r357861.

Reported by:	James Wright <james.wright@jigsawdezign.com>
PR:	224592
PR:	233884
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-03-04 09:46:42 +00:00
Justin Hibbits
5df2e54c42 Add Atom C3000 (Denverton) SMT PCI ID
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc
2020-03-03 22:23:56 +00:00
Brooks Davis
1b8b041ce9 Use ifr_data_get_ptr() consistently. 2020-03-03 18:58:43 +00:00
Emmanuel Vadot
a969e975c9 cpufreq_dt: Improve multiple opp support
When looking for cpu with the same OPP starts from the root /cpus node
so each instance of cpufreq_dt will now each cpu with the same operating
point.
Also test that the node we are testing have the property "device_type" set
to be equal to "cpu".
While here add more debug printfs (off by defaults).

MFC after:	2 weeks
2020-03-02 21:19:51 +00:00
Ed Maste
2495ef28e9 Add deprecation notices to ctau and cx drivers
These support outdated or obsolete ISA WAN (T1/E1) sync serial cards,
and these drivers haven't really been touched (other than in tree-wide
sweeps to keep them building) for 15+ years.

Related PCI devices ce and cp are still in the tree, with deprecation
proposed in D23928.

MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2020-03-02 20:14:27 +00:00
Leandro Lupori
967c53ac2f [aacraid] Prevent sense data from causing a buffer overflow
This issue was observed on a PowerPC64 machine with an Adaptec RAID
Controller with PCI device ID 0x028d, where sense data was causing a
buffer overflow because of wrong max sense length logic.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D23667
2020-03-02 16:11:25 +00:00
Hans Petter Selasky
543b9d5960 Expose the ACPI power button, sleep button and LID state as evdev's.
This allows libinput to disable touchpads when the lid is closed and
various desktop environments can show power-off dialogs when the power
button is pressed. While the latter is doable with devd a
cross-platform solution is nicer.

Submitted by:	Greg V <greg@unrelenting.technology>
Differential Revision:	https://reviews.freebsd.org/D23863
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-03-02 09:45:06 +00:00
Warner Losh
795140556c Remove bktr(4)
Remove the brooktree driver as discussed on arch@. Bump FreeBSD version to
1300082, though I doubt anything will care.

Relnote: yes
2020-03-01 19:15:03 +00:00
Xin LI
5082c36629 Fix build. 2020-03-01 18:55:59 +00:00
Warner Losh
a11c38d321 Remove noise that once upon a time allowed netback to build on FreeBSD 6. The
network layer has evolved since then, and this won't compile there.
2020-03-01 18:18:11 +00:00
Warner Losh
5f8395cce4 Remove FreeBSD 8 support from virtio.
The sbuf API has evolved since 8, as have many others. The other API sweeps
didn't make the changes conditional, so this is now noise.
2020-03-01 18:18:07 +00:00
Warner Losh
6773051162 Remove support for FreeBSD 4-7 from the iscsi initiator.
Also, inline/remove now empty or trivial macros. CAM has evolved enough this
code couldn't work there anyway, and the API sweeep commits made since then were
made unconditional.
2020-03-01 18:18:01 +00:00
Warner Losh
1a1b54589b Remove conditional code for FreeBSD 8 and earlier frmo cxgb. 2020-03-01 18:17:56 +00:00
Warner Losh
eab6ecc0ae Finish removing support from old versions
Eliminate code for old versions, inline pci_find_cap instead of relying on
compat ifdef.

This commit should have been combined with r358488 before pushing it in.
2020-03-01 18:17:51 +00:00
Warner Losh
e602f0c85d Remove FreeBSD 7-10 support from bxe driver.
Use new PCIER and PCIEM names in the driver rather than relying on old, compat
shims.
2020-03-01 17:46:28 +00:00
Warner Losh
fb2e3c49e1 Remove support for FreeBSD 8 systems. These workarounds and ways of rescanning
devices are no longer done.
2020-03-01 17:27:35 +00:00
Warner Losh
55e306cb12 Remove all the compatibility hacks for systems that predate FreeBSD 8. Some of
these look to be cut and pasted from other drivers since this driver was
committed to FreeBSD 7-current and MFC'd to FreeBSD 6. The ones for FreeBSD 4
and 5 likely never were working...
2020-03-01 17:27:30 +00:00
Warner Losh
246da17ee5 Remove compatibility code for changing sysctl definitions for pre FreeBSD 9
versions. These are just noise these days.
2020-03-01 17:27:25 +00:00
Warner Losh
27dc15d2f6 Remove FreeBSD 7 conditional code... We've had a lot of other changes since then
and al_eth appears only in the Annapurna ARM designs which arrived in the tree
after that.
2020-03-01 16:45:54 +00:00
Warner Losh
9ea5bef27f Remove support for varios versions from FreeBSD 4 to 8.
There's no way arcmsr will still work on those versions. Cleanup really old code
that's no longer needed.
2020-02-29 22:16:27 +00:00
Warner Losh
94c1cb8c3d add deprecation notice for bktr driver.
We plan to remove bktr(4) in FreeBSD 13. Document that here.

Relnotes: yes
2020-02-29 21:50:08 +00:00
Emmanuel Vadot
d5151ea87a mmc: dwmmc: Fix off by one error
The IVAR_MAX_DATA is supposed to have the number of descriptor X the mmc
block size and desc_count contain all this information + 1.

Reported by:	phk
MFC after:	1 week
2020-02-28 21:31:40 +00:00
Jeff Roberson
7aaf252c96 Convert a few triviail consumers to the new unlocked grab API.
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D23847
2020-02-28 20:34:30 +00:00
Justin Hibbits
f37cc7137d Add Denverton UART PCI ID
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc
2020-02-28 15:59:35 +00:00
John Baldwin
6d44e8e6b5 Rename TOE TLS stats from [rt]x_tls_* to [rt]x_toe_tls_*.
This more clearly differentiates TLS records encrypted and decrypted
in TOE connections from those encrypted via NIC TLS.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-02-28 00:42:27 +00:00
Hiroki Sato
28180b6298 Add MODULE_PNP_INFO() to autoload the rtwn_pci(4) kernel module.
Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23807
2020-02-27 19:35:17 +00:00
Hiroki Sato
ff29a95213 Add workaround for models which do not follow the ACPI specification strictly.
Extra objects are now simply ignored instead of rejecting everything.
2020-02-27 17:13:57 +00:00
Warner Losh
e07d0aae4a Remove FreeBSD 4 support 2020-02-27 15:25:31 +00:00
Warner Losh
a9208e9862 Remove FreeBSD 7-9 support from oce
Use newer pci_find_cap API now that the need to remap the old API is gone.
2020-02-27 15:25:26 +00:00
Warner Losh
adc1d71c8b Remove support for FreeBSD 7 and 8
Also, unifdef -DSFXGE_HAVE_DESCRIBE_INTR since it's now always defined.
2020-02-27 15:25:21 +00:00
Pawel Biernacki
4312ebfe0b Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (18 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Reviewed by:	cem
Approved by:	csprng, kib (mentor, blanket)
Differential Revision:	https://reviews.freebsd.org/D23841
2020-02-27 13:12:14 +00:00
Warner Losh
2a12053589 Remove support for FreeBSD 4-7.
It's doubtful this driver would still work unchanged there.
Compile tested only because I no longer have ahc/ahd devices.
2020-02-26 19:39:59 +00:00
Warner Losh
4f8959b9f4 Remove support for FreeBSD 4.x and earlier from agp driver
Compile tested only, but do we still need this driver?
2020-02-26 19:39:52 +00:00
Warner Losh
0d87f3c702 Remove support for all pre FreeBSD 11.0 versions from mpr and mps.
Remove a number of workarounds for older versions of FreeBSD. FreeBSD stable/10
was branched over 6 years ago. All of these changes date from about that time or
earlier. These workarounds are extensive and get in the way of understanding
the current flow in the driver.
2020-02-26 19:15:08 +00:00
Pawel Biernacki
7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Brandon Bergren
f55185bcd8 [PowerPC] [Book-E] Remove obsolete interrupt binding workaround
Remove an old workaround that is no longer necessary since rS343824.

There used to be a problem with FMan interrupts firing on multiple CPUS
at the same time.

This ended up being due to multicast interrupts being unsupported in the
Freescale PIC (so instead of using a selection algorithm, it would do some
unspecified action, such as interrupting multiple cpus at random.)

Reviewed by:	jhibbits
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D23829
2020-02-25 22:03:30 +00:00
Pawel Biernacki
41fc1ce14c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (16 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.

Reviewed by:	royger
Approved by:	kib (mentor, blanket)
Differential Revision:	https://reviews.freebsd.org/D23638
2020-02-25 19:04:39 +00:00
Konstantin Belousov
a324b7f71d Fix IBRS for machines with IBRS_ALL capability.
When turning IBRS mitigation using sysctl, as opposed to loader tunable,
send IPI to tweak MSR on all cores.  Right now code only performed MSR write
onr the CPU where sysctl was run.

Properly report hw.ibrs_active for IBRS_ALL.  Split hw_ibrs_ibpb_active out
from ibrs_active, to keep the current semantic of guiding kernel entry and
exit handlers.

Reported and tested by:	mav
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-02-25 17:26:10 +00:00
Hans Petter Selasky
0ba490729b Use hid_get_data_unsigned() instead of hid_get_data() when reading the
key-codes from the USB keyboard. Negative key-codes are currently skipped.

While at it use the bit size value provided by the HID location structure
instead of assuming a value of 8.

This fixes a regression issue after r357861.

Reported by:	Minoru TANABE <kotanabe3@gmail.com>
PR:	224592
PR:	233884
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2020-02-25 12:56:06 +00:00
Warner Losh
4c1cdd4a7c Before issing the REMOVE_DEVICE command to the firmware, make sure that all
commands have completed.

It's not OK to force complete any pending commands before we send the
REMOVE_DEVICE. Instead, make sure that all pending commands are complete before
sending that. By trying to second guess the firmware here, we run the risk of
completing commands twice, which leads to corruption.

This removes the forced completion of commands introduced in r218811. So it's a
partial backout of that commit, but replaces it with a more rebust
mechanism. Either these commands will complete due to the TARGET RESET, or they
will timeout and be aborted, but they will all complete.

Add assert that all commands are complete to REMOVE_DEVICE completion
routine. We attempt to assure this programatically, so we shouldn't have any
commands in the queue because we've waited for them all. Any commands that make
it into our action routine after we mark the target in removal will complete
immediately with an error.

When we're removing a target that's not a volume, advertise up the stack that
it's actually gone, as opposed to having a transient selection error we should
retry. Do this both in the action routine, and when we get a notification of an
aborted command. We don't do this for volumes because the driver tries hard not
to advertise to the OS a volume has disappeared.

Apply these changes to both mpr and mps since they are based on quite similar
designs.

Discussed with: scottl@
Differential Revision: https://reviews.freebsd.org/D23768
2020-02-25 04:27:23 +00:00
Brandon Bergren
b9931c0786 [PowerPC] [Book-E] Fix dpaa interrupt binding.
After the network epoch was added, we lost the ability to migrate the
ithread in the middle of dispatch, as being in the network epoch will pin
the current thread (for safety reasons.)

Luckily, we don't actually have to do this workaround in the first place,
as we can just bind it to the correct cpu when we preallocate it.

Pass dev through to XX_PreallocAndBindIntr() and actually bind it to the
cpu like it was supposed to in the first place, instad of leaving it
floating and moving it to the correct cpu the first time it fires.

This fixes panics while bringing up dtsec on my X5000.

Reviewed by:	jhibbits
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D23826
2020-02-25 03:35:52 +00:00
Gleb Smirnoff
e87c494015 Although most of the NIC drivers are epoch ready, due to peer pressure
switch over to opt-in instead of opt-out for epoch.

Instead of IFF_NEEDSEPOCH, provide IFF_KNOWSEPOCH. If driver marks
itself with IFF_KNOWSEPOCH, then ether_input() would not enter epoch
when processing its packets.

Now this will create recursive entrance in epoch in >90% network
drivers, but will guarantee safeness of the transition.

Mark several tested drivers as IFF_KNOWSEPOCH.

Reviewed by:		hselasky, jeff, bz, gallatin
Differential Revision:	https://reviews.freebsd.org/D23674
2020-02-24 21:07:30 +00:00
Ed Maste
eea248ec9a smsc: remove pre-FreeBSD-10 compat support
Sponsored by:	The FreeBSD Foundation
2020-02-24 19:50:28 +00:00
Ed Maste
fa078712c6 muge: fix rxcsum enable test
if_capabilities indicates capabilities supported by the hardware;
if_capenable which are enabled.  Note that rx checksum is still disabled
in the driver at compile time.

Submitted by:	Johannes <iz-rpi04@hs-karlsruhe.de>
MFC after:	2 weeks
2020-02-24 19:48:29 +00:00
Marcin Wojtas
888810f0fb Rework and simplify Tx DMA mapping in ENA
Driver working in LLQ mode in some cases can send only few last segments
of the mbuf using DMA engine, and the rest of them are sent to the
device using direct PCI transaction. To map the only necessary data, two DMA
maps were used. That solution was very rough and was causing a bug - if
both maps were used (head_map and seg_map), there was a race in between
two flows on two queues and the device was receiving corrupted
data which could be further received on the other host if the Tx cksum
offload was enabled.

As it's ok to map whole mbuf and then send to the device only needed
segments, the design was simplified to use only single DMA map.

The driver version was updated to v2.1.1 as it's important bug fix.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2020-02-24 15:35:31 +00:00
Pawel Biernacki
20b91f0aa5 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (15 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.
2020-02-24 10:51:26 +00:00
Pawel Biernacki
5c2c6e01a6 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (11 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Approved by:	kib (mentor, blanket)
Differential Revision:	https://reviews.freebsd.org/D23636
2020-02-24 10:41:22 +00:00
Hans Petter Selasky
f9e1dc6857 Always check return value from acpi_GetInteger() after r358219.
If a failure happens reading the lid state, assume the lid is opened.

Suggested by:	cem @
Differential Revision:	https://reviews.freebsd.org/D23724
PR:		240881
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-02-24 09:31:30 +00:00
Pawel Biernacki
08f5e6bb81 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (7 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all low hanging fruits as MPSAFE.

Reviewed by:	markj
Approved by:	kib (mentor, blanket)
Differential Revision:	https://reviews.freebsd.org/D23626
2020-02-21 16:32:17 +00:00
Hans Petter Selasky
9b6e45d459 Fix broken MLX5_IB_INDEX() macro in mlx5ib(4).
The index should be computed as distance from arg[0] and not
the beginning of struct mlx5_ib_congestion .

While at it fix a use of zero length array to avoid depending
on undefined compiler behaviour.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-02-21 10:14:02 +00:00
Hans Petter Selasky
d021415006 Make sure the ACPI lid state is updated during boot and after resume.
While at it update the sysctl(9) description for the lid state.

Differential Revision:	https://reviews.freebsd.org/D23724
PR:		240881
Submitted by:	Yuri Pankov <yuripv@yuripv.me>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-02-21 09:52:20 +00:00
Kristof Provost
55cd93249b virtio: Pass the interrupt type in mmio mode
When we register an interrupt handler we need to pass the intr_type along in
bus_setup_intr().

The interrupt type matters because it is used to decide if we need to enter
NET_EPOCH. That meant that vtmmio-based if_vtnet did not, which led to panics
with INVARIANTS set.

Sponsored by:	Axiado
2020-02-20 17:26:08 +00:00
Konstantin Belousov
b08bdabee4 Add more values for PCI capabilities, PCIe extended capabilities, and subclasses.
Taken from
https://pcisig.com/sites/default/files/files/PCI_Code-ID_r_1_11__v24_Jan_2019.pdf

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2020-02-20 17:08:52 +00:00
Adrian Chadd
af2441fbc7 [ath] Attempt to fix epoch handling.
The epoch stuff with taskqueues works fine if the driver never calls
the receive path in other contexts, but this driver does.  If there was
a chip reset during active receive then part of the reset will call
the receive path to flush out any active packets before reinitialising
the receive queue and that needs to be done with the epoch held.

So:

* make the receive task a normal task again
* explicitly call epoch enter/exit around the legacy and newer DMA
  receive paths
* add a couple of epoch asserts to ensure that the receive packet
  path itself is called with epoch held.

This fixes it on my Atom eeepc laptop (circa 2010!) that I did
all of my initial 802.11n work in this driver and net80211.

Tested:

* AR9285, STA mode

TODO:

* Test on EDMA chipset (AR9380)
* Test in AP/adhoc modes, just to be sure (eg for beacon
  receive processing in particular.)
2020-02-20 07:12:43 +00:00
Hiroki Sato
294de6bbd6 Add _BIX (Battery Information Extended) object support.
ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery.  FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.

As of writing, _BIX has two revisions.  One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1).  It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.

After this change, the acpi_cmbat module gets battery information from
_BIX or _BIF object and internally uses _BIX rev.1 data structure as
the primary information store in the kernel.  ACPIIO_BATT_GET_BI[FX]
returns an acpi_bi[fx] structure built by using information obtained
from a _BIF or a _BIX object found on the system.  The revision number
field can be used to check which field is available.  The acpiconf(8)
utility will show additional information if _BIX is available.

Although ABIs of ACPIIO_BATT_* were changed, the existing APIs for
userland utilities are not changed and the backward-compatible ABIs
are provided.  This means that older versions of acpiconf(8) can also
work with the new kernel. The (union acpi_battery_ioctl_arg) was
padded to 256 byte long to avoid another ABI change in the future.
A _BIX object with its revision number >1 will be treated as
compatible with the rev.1 _BIX format.

Reviewed by:	takawata
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23728
2020-02-19 06:28:55 +00:00
Navdeep Parhar
02cd773916 cxgbe(4): Congestion drops are maintained per E-channel and not per
buffer group.

This fixes a bug where congestion drops on port 1 of a T6 card would
incorrectly be counted as drops on port 0.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-02-19 00:48:58 +00:00
Navdeep Parhar
9a4a1be02c cxgbe/iw_cxgbe: correctly enforce the max reg_mr depth.
Reported by:	Andrew Zhu @ Netapp
Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-02-18 20:43:10 +00:00
Scott Long
332e6e31c2 Fix syntax error from r357647. Adjust a variable name to make the use more
clear.

Reported by:	dim
2020-02-17 20:12:34 +00:00
Andrew Turner
334790ea6b Use EARLY_DRIVER_MODULE in the acpi bus.
We need this to use EARLY_DRIVER_MODULE in child drivers on arm64. This
should be a no-op on x86 as it has DRIVER_MODULE in the nexus driver making
all later drivers attach in the last pass.

Reviewed by:	imp
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D23717
2020-02-17 15:32:21 +00:00
Konstantin Belousov
eca86ffaa1 Fix typo.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-02-17 13:26:36 +00:00
Pawel Biernacki
59e4be225c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (5 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked). Use it in
preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Reviewed by:	imp, kib
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D23633
2020-02-16 17:11:54 +00:00
Dimitry Andric
bacffcd4b1 Merge r357970 from the clang1000-import branch:
Fix the following -Werror warning from clang 10.0.0 in hptmv(4):

sys/dev/hptmv/ioctl.c:240:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        _vbus_p=pArray->pVBus;
                        ^
sys/dev/hptmv/ioctl.c:237:10: note: previous statement is here
                if(!mIsArray(pArray))
                ^

This is because the return statement after the if statement was not
indented.  (Note that this file has been idented assuming 4-space tabs.)

MFC after:	3 days
2020-02-15 19:15:24 +00:00
Pawel Biernacki
f8d2b1f3f7 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (2 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked). Use it in
preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Reviewed by:	hselasky, kib
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D23632
2020-02-15 18:52:12 +00:00
Pawel Biernacki
e0d69c5a88 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (1 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked). Use it in
preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Reviewed by:	kib, trasz
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D23640
2020-02-15 18:48:38 +00:00
Dimitry Andric
ceba62b93d Fix the following -Werror warning from clang 10.0.0 in hptmv(4):
sys/dev/hptmv/ioctl.c:240:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        _vbus_p=pArray->pVBus;
                        ^
sys/dev/hptmv/ioctl.c:237:10: note: previous statement is here
                if(!mIsArray(pArray))
                ^

This is because the return statement after the if statement was not
indented.  (Note that this file has been idented assuming 4-space tabs.)

MFC after:	3 days
2020-02-15 18:37:26 +00:00
Dimitry Andric
74dc6beb30 Merge ^/head r357855 through r357920. 2020-02-14 19:32:58 +00:00
Alexander Motin
0d9cef0a94 Add support for Hygon NTB PCI device in ntb_hw_amd driver.
Submitted by:	Pu Wen <puwen@hygon.cn>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23565
2020-02-14 15:04:56 +00:00
Alexander Motin
a6da07a319 Add Hygon PCI ID and description for AHCI SATA controller.
Submitted by:	Pu Wen <puwen@hygon.cn>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23556
2020-02-14 14:55:40 +00:00
Hans Petter Selasky
144d6690b5 Exclude modifier keys from keyboard repeat logic.
This restores USB keyboard driver behaviour prior to r357861.

Requested by:	jkim@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-02-14 00:29:21 +00:00
John Baldwin
ff8c6681c8 Don't check the auth algorithm for GCM.
The upstream OpenSSL changes only set the cipher for GCM since the
authentication is redundant, and changes to OCF will soon remove the
GCM authentication algorithm constants entirely for the same reason.
In addition, ktls_create_session() already validates these fields and
wouldn't pass down an invalid auth_algorithm value to any drivers or
ktls backends.

Reviewed by:	hselasky
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23671
2020-02-13 23:04:11 +00:00
John Baldwin
ca3b3c573e Remove the per-TXQ tls_wrs stat.
It duplicated the kern_tls_records stat and was not conditional on NIC
TLS being enabled.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D23670
2020-02-13 22:55:45 +00:00
Konstantin Belousov
4e012582d3 hyperv: Add Hygon Dhyana support.
Submitted by:	Pu Wen <puwen@hygon.cn>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D23563
2020-02-13 19:12:07 +00:00