Commit Graph

38531 Commits

Author SHA1 Message Date
Andrew Turner
12d053032b Support overflow count in hwpmc on arm64
We increment the overflow count when receiving an overflow interrupt
with special care to check if it happens while reading the event counter.

Sponsored by:	Innovate UK
2021-01-04 17:14:41 +00:00
Mark Johnston
caf552a607 mvneta: Fix 64-bit MIB reads
It appears we must read MIB values as 2 4-byte words, lower address
first.  A single 8-byte MIB read returns the value with the lower 4
bytes copied into the upper 4 bytes, resulting in bogus byte counter
values.

Reviewed by:	mw
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D27870
2021-01-04 08:32:54 -05:00
Mark Johnston
c4cceb1d0d md: Fix a race in mdstart_swap()
Release a grabbed page's busy state only after marking it as referenced.
Otherwise there exists a narrow window where the page could be freed
before the update.  Before r356902 this was not a problem since the
object lock was held.

Discussed with:	kib
Sponsored by:	The FreeBSD Foundation
2021-01-04 08:26:14 -05:00
Poul-Henning Kamp
ea70ab2387 Use the actual credentials to create the /dev/nmdm* devices.
This lets plain users create nmdm pairs, which is useful amongst
other things for running retro-computing emulators etc.
2021-01-04 13:18:47 +00:00
Kyle Evans
c4a0333b55 vt: restore tty when console is ungrabbed
When a break-to-debugger is triggered, kdb will grab the console and vt(4)
will generally switch back to ttyv0. If one issues a continue from the
debugger, then kdb will ungrab the console and the system rolls on.

This change adds a perhaps minor feature: when we're down to grab == 0 and
if vt actually switched away to ttyv0, switch back to the tty it was
previously on before the console was grabbed.

The justification behind this is that a typical flow is to work in
!ttyv0 to avoid console spam while occasionally dropping to ddb to inspect
system state before returning. This could easily enough be tossed behind
a sysctl or something if it's not generally appreciated, but I anticipate
indifference.

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D27110
2020-12-31 11:10:11 -06:00
Kyle Evans
be46634337 vt: more carefully handle vt_allocate_keyboard grab work
vt_allocate_keyboard only needs to unwind the effects of keyboard-grabbing,
rather than any associated vt window action that may have also happened.

Split out the bits that do the keyboard work into *_noswitch equivalents,
and use those in keyboard allocation. This will be less error-prone when a
later change will offer up different window state behavior when the console
is ungrabbed.

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D27110
2020-12-31 11:10:11 -06:00
John Baldwin
282381aa53 rsu: Don't modify read-only firmware block.
The firmware header loaded into an rsu(4) device has to be customized
to reflect device settings.  The driver was overwriting the header
from the shared firmware image before sending it to the device.  If
two devices attached at the same time with different settings, one
device could potentially get a corrupted header.  The recent changes
in a095390344 exposed this bug in the
form of a panic as the firmware blobs are now marked read-only in
object files and mapped read-only by the kernel.

To avoid the bug, change the driver to allocate a copy of the firmware
header on the stack that is initialized before writing it to the
device.

PR:		252163
Reported by:	vidwer+fbsdbugs@gmail.com
Tested by:	vidwer+fbsdbugs@gmail.com
Reviewed by:	hselasky, bz, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27850
2020-12-30 15:21:35 -08:00
John Baldwin
6727847500 Don't try to adjust a TLS TOE socket that has been closed.
The handshake timer can race with another thread sending a FIN or RST
to close a TOE TLS socket.  Just bail from the timer without
rescheduling if the connection is closed when the timer fires.

Reported by:	Sony Arpita Das @ Chelsio QA
Reviewed by:	np
Differential Revision:	https://reviews.freebsd.org/D27583
2020-12-30 09:56:24 -08:00
Roger Pau Monné
4e4e43dc9e xen: allow limiting the amount of duplicated pending xenstore watches
Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by:	Citrix Systems R&D
MFC after:	3 days
2020-12-30 11:18:26 +01:00
Toomas Soome
40c4557bee cxgbe: replace zero sized array by flexible array
The issue was found while building cxgbe with gcc 10 (in illumos),
the array subscription check is warning us about outside the bounds
access.

See also: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
2020-12-29 23:09:15 +02:00
Kyle Evans
ee938b2033 kern: efirt: correct configuration table entry size
Each entry actually stores a native pointer, not a uint64_t quantity. While
we're here, go ahead and export the pointer as-is rather than converting it
to KVA. This may be more useful as consumers can map /dev/mem and observe
the entry.

For reference, see: sys/contrib/edk2/Include/Uefi/UefiSpec.h

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27669
2020-12-29 11:38:34 -06:00
Kyle Evans
0861c7d3e0 kern: efirt: enter runtime environment to deref efi_cfgtbl
This fixes an insta-panic when EFIIOC_GET_TABLE is used.

Reviewed by:	imp (earlier version), kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27669
2020-12-29 11:38:14 -06:00
Hans Petter Selasky
9e7fa1e66c Collect statistics from all rate-limit queues in mlx5en(4).
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-28 14:39:51 +01:00
Mark Johnston
795a009b32 md: Set bio_completed properly in the face of errors
Account for any residual bytes.  This is only relevant for vnode-backed
md(4) devices.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27738
2020-12-27 16:49:35 -05:00
Michal Meloun
c830003198 EXTRES: Ignore index modifier flags for table based clock dividers.
The divider table already contains the correct HW divider value, it should
not be modified by other flags such as 'CLK_DIV_ZERO_BASED'.

MFC after:	4 weeks
2020-12-27 17:47:19 +01:00
Marius Strobl
2f00fe725b nsphy(4): Remove obsolete support for pcn(4)
This should have gone in 607790d10f and
r347915 respectively along with pcn(4).
2020-12-26 19:40:56 +01:00
Marius Strobl
e51ed06ae1 mlphy(4)/tlphy(4): Remove obsolete drivers
These drivers should have been removed along with tl(4) as part of
7c897ca91f and r347918 respectively
as these fromer made sure to only ever attach to the latter, e. g.:
<...>
static int
tlphy_probe(device_t dev)
{

	if (!mii_dev_mac_match(dev, "tl"))
		return (ENXIO);
<...>
2020-12-26 19:40:55 +01:00
Marius Strobl
b63eeef41f scc(4)/uart(4): Remove obsolete support for Siemens SAB 82532
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-26 13:48:06 +01:00
Marius Strobl
6535f188f1 bge(4): remove obsolete support for on-board Fujitsu and Sun MACs
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 20:04:19 +01:00
Marius Strobl
50d823d5b8 fwohci(4): remove support for Sun PCIO-2 FireWire controllers
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 19:47:46 +01:00
Marius Strobl
5db1ed2f33 ohci(4): remove support for Sun PCIO-2 USB controllers
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 19:47:46 +01:00
Marius Strobl
28ca6c20cf gallant12x22(4): remove obsolete font
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 19:47:45 +01:00
Marius Strobl
9cca83b6db mk48txx(4): remove obsolete driver
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 19:47:45 +01:00
Marius Strobl
d141239c56 mc146818(4): remove obsolete driver
It's no longer used since 58aa35d429
and r357455 respectively.
2020-12-25 19:47:45 +01:00
Michal Meloun
aa76f0c397 PMC: remove now orphaned PMC for INTEL XScale processors.
Support for XScale architecture has been deleted in FreeBSD 13.
2020-12-25 15:21:53 +01:00
Ryan Libby
322a188d45 wmt: quiet gcc -Wparentheses
Reviewed by:	wulf
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27767
2020-12-24 12:49:27 -08:00
Vladimir Kondratyev
30f34a5193 ukbd(4): Push LED events in ioctl handler rather than in xfer callback
If LED state is set through evdev interface, than asynchronous nature
of USB transfer callback can lead to change of order of events echoed
back to userland as it causes LED events to be echoed with some lag.

Fix that with echoing of LED events synchronously in ioctl handler.

Reviewed by:	hselasky
Obtained from:	sysutils/iichid
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D27750
2020-12-24 22:08:04 +03:00
Vladimir Kondratyev
769935a4ed ukbd(4): Do not serialize evdev key events
Unlike AT keyboards, HID devices are able to send all pc105 key
states within a single report. Let evdev to transmit all key state
changes within a single report too.

Reviewed by:	hselasky
Obtained from:	sysutils/iichid
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D27749
2020-12-24 21:56:33 +03:00
Hans Petter Selasky
a8261b70e6 Add support for USB-C and TB3 Gen2 to if_ure(4).
Add support for LAN found on Thinkpad USB-C and Thunderbolt Gen 2
docking stations.

Submitted by:	ali.abdallah@suse.com
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-24 12:59:19 +01:00
Vladimir Kondratyev
c26a348427 wmt(4): Use sys/param.h macroses to work with bit fields
Obtained from:	sysutils/iichid
2020-12-24 01:27:17 +03:00
Vladimir Kondratyev
18a3b77e22 wmt(4): Refactor 'Contact Count Maximum' parsing
That is done mainly to reduce diff with upstream.

Obtained from:	sysutils/iichid
2020-12-24 01:26:06 +03:00
Vladimir Kondratyev
501022d3a0 wmt(4): Add support for hardware timestamp reporting
Hardware timestamp reporting is disabled by default as it produces many
extra events which are not handled by consumers like libinput.
Add hw.usb.wmt.timestamps=1 tunable to loader.conf to enable it.

Obtained from:	sysutils/iichid
2020-12-24 01:24:53 +03:00
Vladimir Kondratyev
8de78df54d wmt(4): Add support for touchpads
Obtained from:	sysutils/iichid
2020-12-24 01:22:56 +03:00
Vladimir Kondratyev
7eae6aab7d wmt(4): Fetch and parse HID report descriptor only one time
Do it at probe stage and reuse results during attach.

Obtained from:	sysutils/iichid
2020-12-24 01:21:53 +03:00
Vladimir Kondratyev
0ba4b5ff4c wmt(4): Add support for hybrid mode
In Hybrid mode, the number of contacts that can be reported in one
report is less than the maximum number of contacts that the device
supports.  For example, a device that supports a maximum of 4
concurrent physical contacts, can set up its top-level collection to
deliver a maximum of two contacts in one report.  If four contact
points are present, the device can break these up into two serial
reports that deliver two contacts each.

Obtained from:	sysutils/iichid
2020-12-24 01:19:41 +03:00
Oleksandr Tymoshenko
e523262107 [if_dwc] add support for multi-descriptor packets in TX path
Original if_dwc driver used m_defrag as an implementation shortcut but on
1000Mb networks it affects performance. Implement multi-descriptor support for
TX path.

Tested on RK3399-Firefly, patch adds ~15% of network throughput.

Reviewed By:	manu
Differential Revision:	https://reviews.freebsd.org/D27520
2020-12-23 12:29:29 -08:00
Robert Wing
c4df8cbfde Remove bvmconsole and bvmdebug.
Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed.

This also removes the '-b' and '-g' flag from bhyve(8). These two flags were
marked deprecated in r368519.

Reviewed by:    grehan, kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D27490
2020-12-23 17:15:23 -09:00
Mark Johnston
a7a7c306bf md: Fix a read-after-free in BIO_GETATTR handling
g_handleattr_int() consumes the bio if the attribute matches, so when we
check bp->bio_cmd bp may have been freed.

Move GETATTR handling to a separate function to avoid the problem.  We
do not need to set bio_completed for such bios, g_handleattr_int() will
handle it.  Also remove the setting of bio_resid before the
devstat_end_transaction_bio() call.  All of the md(4) bio handlers set
bio_resid already.

Reported by:	KASAN
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27724
2020-12-23 11:16:40 -05:00
Andrew Turner
e324f1e9f4 Stop redefining PAGE_SHIFT in virtio-mmio
This is alreaady defined by each architecture as that is the only place
we can know what the correct page shift should be.

Sponsored by:	Innovate UK
2020-12-23 13:10:26 +00:00
Hans Petter Selasky
1622a49852 No need to stop XHCI endpoints in disabled state.
Some AMD XHCI implementations apparently assert a permanent
internal failure if this happens.

Submitted by:	ali.abdallah@suse.com
PR:		251503
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-23 12:04:51 +01:00
Vladimir Kondratyev
2ac1c19272 psm(4): Always initialize Synaptics touchpad report range with defaults
Otherwise libinput refuses to recoginize some Synaptics touchpads with
"kernel bug: device has min == max on ABS_X" message in Xorg.log.

PR:		251149
Reported-by:	Jens Grassel <freebsd-ports@jan0sch.de>
Tested-by:	Jens Grassel <freebsd-ports@jan0sch.de>
MFC-after:	2 weeks
2020-12-23 11:10:53 +03:00
Vladimir Kondratyev
bde56c9942 acpi_wmi(4): Allow attachment to ACPI node if EC is not found
Conducted tests showed that Embedded Controller is not mandatory for
WMI extensions to work.

Reported-by:	yuripv
Reviewed-by:	avg
MFC-after:	2 weeks
Differential-Revision:	https://reviews.freebsd.org/D27653
2020-12-23 11:10:53 +03:00
Vladimir Kondratyev
54d2dfc4b2 cyapa(4): Add support for evdev protocol
Tested-by:	Matthias Apitz <guru@unixarea.de>
MFC-after:	2 weeks
2020-12-23 11:10:49 +03:00
Vladimir Kondratyev
a223aa8abd cyapa(4): Make button detection matching ChromeOS driver
Tested-by:	Matthias Apitz <guru@unixarea.de>
MFC-after:	2 weeks
2020-12-23 11:09:25 +03:00
Hans Petter Selasky
7d0368ee34 Ensure a minimum packet length before creating a mbuf in if_ure.
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-19 11:03:54 +00:00
Hans Petter Selasky
412bbd0811 Move SYSCTL_ADD_PROC() to unlocked context in if_ure to avoid lock order reversal.
MFC after:	1 week
Reported by:	Mark Millard <marklmi@yahoo.com>
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-19 11:00:11 +00:00
Jessica Clarke
ddf42202c9 usb: Replace ITUNERNET vendor with MICROCHIP and improve product names
These Mini-Box LCDs are using Microchip components and sub-licensed product
IDs. Whilst here, update the constant names and descriptions for the products
to use the names listed on the manufacturer's website rather than vague ones.
The picoLCD 4x20 is named that on the manufacturer's website so prefer that
name, even though linux-usb.org lists it with the numbers reversed as one might
expect.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D27670
2020-12-18 23:31:36 +00:00
Mark Johnston
0f8b212a1e acpi: Ensure that adjacent memory affinity table entries are coalesced
The SRAT may contain multiple distinct entries that together describe a
contiguous region of physical memory.  In this case we were not
coalescing the corresponding entries in the memory affinity table, which
led to fragmented phys_avail[] entries.  Since r338431 the vm_phys_segs[]
entries derived from phys_avail[] will be coalesced, resulting in a
situation where vm_phys_segs[] entries do not have a covering
phys_avail[] entry.  vm_page_startup() will not add such segments to the
physical memory allocator, leaving them unused.

Reported by:	Don Morris <dgmorris@earthlink.net>
Reviewed by:	kib, vangyzen
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27620
2020-12-18 16:04:48 +00:00
Jessica Clarke
50a6b28a31 virtio_mmio: Fix feature negotiation copy-paste issue in r361943
This caused us to write to the low half of the feature word twice, once with
the high bits and once with the low bits. Common legacy device implementations
seem to be fairly lenient about being able to write to the feature bits
multiple times, but Arm's models use a stricter implementation that will ignore
the second write. This fixes using vtnet(4) on those models.

Reported by:	Jean-Philippe Brucker <jean-philippe@linaro.org>
Pointy hat:	jrtc27
2020-12-18 15:07:14 +00:00
Konstantin Belousov
94f5c1cc71 pci_iov: When pci_iov_detach(9) is called, destroy VF children
instead of bailing out with EBUSY if there are any.

If driver module is unloaded, or just device is forcibly detached from
the driver, there is no way for driver to correctly unload otherwise.
Esp. if there are resources dedicated to the VFs which prevent turning
down other resources.

Reviewed by:	jhb
Sponsored by:	Mellanox Technologies / NVidia Networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D27615
2020-12-18 03:46:50 +00:00