Commit graph

42267 commits

Author SHA1 Message Date
Jose Luis Duran
fb69997d37 pci: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:31 -07:00
Jose Luis Duran
00bc86a9a6 isci: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:31 -07:00
Jose Luis Duran
a3db639a9a netvsc: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:31 -07:00
Jose Luis Duran
4654e8a3bf ciss: Fix typo (triple T)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/954
2023-12-27 20:24:30 -07:00
Alexander Motin
b46c7b1ed4 nvme: Add some bits from NVMe 2.0c spec.
MFC after:	1 week
2023-12-27 13:50:54 -05:00
Mark Johnston
99efa2c88d netmap: Ignore errors in CSB_WRITE()
The CSB_WRITE() and _READ() macros respectively write to and read from
userspace memory and so can in principle fault.  However, we do not
check for errors and will proceed blindly if they fail.  Add assertions
to verify that they do not.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	vmaffione
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43200
2023-12-27 10:13:29 -05:00
Gordon Bergling
6dc7bf0c5c hvsock: Fix a typo in a source code comment
- s/recieved/received/

MFC after:	3 days
2023-12-27 09:37:29 +01:00
Richard Scheffenegger
a8b70cf260 netpfil: Use accessor functions and named constants for all tcphdr flags
Update all remaining references to the struct tcphdr th_x2 field.
This completes the compatibilty of various aspects with AccECN
(TH_AE), after the internal ipfw "re-checksum required" was moved
to use the TH_RES1 flag.

No functional change.

Reviewed By:           tuexen, #transport, glebius
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43172
2023-12-25 13:18:01 +01:00
Alexander Motin
358453ce9b iichid(4): Switch taskqueue to "fast"
While "fast" taskqueue may be more expensive due to spinlock use,
when used mainly for timeout tasks it allows to avoid extra context
switches to and from callout thread, that is even more expensive.

MFC after:	1 month
2023-12-26 19:36:34 -05:00
Alexander Motin
a8f80c0c16 iichid(4): Unify two taskqueue tasks
taskqueue_enqueue_timeout(0) is equivalent to taskqueue_enqueue(),
so no need to create a separate periodic_task and event_task to run
exactly the same handler.

MFC after:	1 month
2023-12-26 19:28:56 -05:00
Mark Johnston
ddc8576d29 fb: Explicitly handle errors when getting or setting a colour palette
In the VESA driver, simply ignore errors.  It is not clear to me how to
return them to userspace.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:01:26 -05:00
Mark Johnston
b4a9e6d814 hptmv: Handle errors from copyout() in hpt_set_info()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:01:26 -05:00
Mark Johnston
2873d841f8 tdfx: Handle errors from copyin() and copyout()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 19:00:53 -05:00
Mark Johnston
916273680b ti: Handle errors from copyin() and copyout()
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	1 week
2023-12-26 18:58:24 -05:00
Alexander Motin
5bc10feacc acpi_cpu: Reduce BUS_MASTER_RLD manipulations
Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.

This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware.  Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.

MFC after:	1 month
2023-12-25 21:43:20 -05:00
Mark Johnston
74e713804f iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()
Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43148
2023-12-25 21:04:01 -05:00
Mark Johnston
6cdff09c0d gntdev: Handle errors from suword32() in gntdev_alloc_gref()
Try to copy out output values before handling errors, and check that we
did so successfully.  In particular, it doesn't seem sensible to ignore
errors here, otherwise userspace won't have any way to refer to the
allocations.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	royger
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43145
2023-12-25 21:04:01 -05:00
Mark Johnston
68cc77a3b7 mpr: Handle errors from copyout() in ioctl handlers
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mpr(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43177
2023-12-25 21:04:01 -05:00
Mark Johnston
bcf4a7c7ac mps: Handle errors from copyout() in ioctl handlers
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mps(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43176
2023-12-25 21:04:01 -05:00
Mark Johnston
a01ff11cb7 ocs: Check for copyin errors in the ioctl handler
If copyin() fails, the driver will blindly proceed with whatever had
been in the uninitialized DMA buffer.  This is not what we want.  Check
for copyin failures.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	ram
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43097
2023-12-25 21:04:00 -05:00
Mark Johnston
6bfb7306ef mpi3mr: Check for copyin errors in mpi3mr_map_data_buffer_dma()
A failed copyin will cause the driver to use the contents of
uninitialized buffers instead, which is unlikely to be the behaviour
that we want.  Check for errors.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43098
2023-12-25 21:04:00 -05:00
Mark Johnston
b2caed2f8d uhid: Check for errors from copyin() in ioctl handlers
This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by:	wulf
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43103
2023-12-25 21:04:00 -05:00
Mark Johnston
e452fa70d5 hid: Handle errors from copyin() in ioctl handlers
If copyin() fails, the driver will proceed blindly with a zeroed buffer,
which is not what we want.  In preparation for annotating copyin() with
__result_use_check, start checking for errors.

Reviewed by:	wulf
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43102
2023-12-25 21:04:00 -05:00
Mark Johnston
711880597c ath: Handle errors from copyout() in ath_rate_fetch_node_stats()
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43096
2023-12-25 21:04:00 -05:00
Konstantin Belousov
c0047e7c35 iommu_gas_remove(): consolidate places where decision is made to keep the entry
Move all flag checks into iommu_gas_remove_unmap().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:23 +02:00
Konstantin Belousov
f591287756 iommu_gas: make placeholder entry at the start of the GAS zero size
same as the placeholder at the end.  This is required to allow GAS to
start at zero, for integration with vmm.

Also, in iommu_gas_remove(), accept placeholders after remove op.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
273b4de346 iommu: add iommu_gas_remove_locked()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
a59c252903 IOMMU: add GAS map entry flag IOMMU_MAP_ENTRY_FAKE
to allow to shut down assert in iommu_gas_cmp_entries() when used
against fake entry to search for specific place in the tree.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
cb1d664b00 iommu_gas: zero fake on-stack map entry used in iommu_gas_remove_clip_left()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
733da1eb94 iommu_gas: print entries flags and domains if an overlap detected
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
30ce85ca11 iommu_gas: add ddb 'show iommu_domain' command
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
a869643e18 iommu_gas_match_one(): check for underflow
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Konstantin Belousov
6afa2333d2 iommu: remove leftover sys/cdefs.h includes
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-12-26 03:28:22 +02:00
Alexander Motin
13037eaabe ig4: Actively use FIFO thresholds
Before every wait for FIFO interrupt set how much data/space do we
want to see there.  Previous code was not using it for receive, as
result aggregating interrupts only within processing latency.  The
new code needs only one interrupt per transfer per FIFO length.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces the interrupt rate per device down to 2 per sample or 16-20
per second when idle and 120-160 per second when actively touched.

MFC after:	1 month
2023-12-24 18:18:11 -05:00
Vladimir Kondratyev
96ab16ebab LinuxKPI: Remove sys/rman.h include from LKPI headers.
sys/rman.h defines `resource` structure which conflicts with the Linux
structure of the same name. To fix that remove reference to sys/rman.h
from linux/pci.h and move resource management code to linux_pci.c.
Update consumers which were depending on linux/pci.h pollution.

No functional changes intended.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42792
2023-12-24 11:19:57 +03:00
Jason A. Harmening
2619c5ccfe Avoid waiting on physical allocations that can't possibly be satisfied
- Change vm_page_reclaim_contig[_domain] to return an errno instead
  of a boolean.  0 indicates a successful reclaim, ENOMEM indicates
  lack of available memory to reclaim, with any other error (currently
  only ERANGE) indicating that reclamation is impossible for the
  specified address range.  Change all callers to only follow
  up with vm_page_wait* in the ENOMEM case.

- Introduce vm_domainset_iter_ignore(), which marks the specified
  domain as unavailable for further use by the iterator.  Use this
  function to ignore domains that can't possibly satisfy a physical
  allocation request.  Since WAITOK allocations run the iterators
  repeatedly, this avoids the possibility of infinitely spinning
  in domain iteration if no available domain can satisfy the
  allocation request.

PR:		274252
Reported by:	kevans
Tested by:	kevans
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D42706
2023-12-23 23:01:40 -06:00
Alexander Motin
1a3ee6002f acpi_lid: Remove duplicate events
Remove extra acpi_UserNotify() call per event.  Filter duplicate
notifications received from ACPI without actual status change.

Without this on my Dell XPS 13 9310 I saw 4 devd events for either
open or close, now only one.

MFC after:	1 month
2023-12-23 21:33:51 -05:00
Alexander Motin
68e457df02 iichid(4): Restore/increase sampling rate
My previous commit by reducing precision reduced the sampling rate
from 60Hz to 40Hz on idle system.  Return it back to 60-80Hz range,
that should be good for mouse smoothness on 60Hz displays.

MFC after:	1 months
2023-12-23 19:10:49 -05:00
Alexander Motin
9c9d7fdd9f ig4: Fix FIFO depths detection
At least on my Tiger Lake-LP queue depth detection failed before the
ig4iic_set_config() call, resulting in no FIFO use.  Moving it after
solves the problem, getting proper 64 bytes size.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
by few times reduces context switch rate in the driver, and probably
also improves the I2C bus utilization.

MFC after:	1 month
2023-12-23 19:02:49 -05:00
Alexander Motin
a74df3f96e iicbb: Fix pause_sbt() arguments order
It should make pause interval less strict.

While there, add cpu_spinwait() into a tight spin wait loop to burn
less power and let other SMT thread work more.

MFC after:	1 month
2023-12-23 18:58:51 -05:00
Yuji Hagiwara
553ed8e38b mlx4(5): fix driver initialization
After netlinkification, ether_ifattach() requires ifmedia_init() to be
done before it.

PR:	275897
MFC after:	1 week
2023-12-23 22:53:02 +02:00
Alexander Motin
8c86b98124 iichid(4): Improve idle sampling hysteresis
In sampling mode some devices return same data indefinitely even if
there is nothing to report.  Previous idle hysteresis implementation
activated only when device returned no data, so some devices ended up
polled at fast rate all the time.  This new implementation compares
each new report with the previous, and, if they are identical, after
reaching threshold also drop sampling rate to slow.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces idle power consumption by ~0.5W by reducing number of context
switches in the driver from ~4000 to ~700 per second when not touched.

MFC after:	1 month
2023-12-22 22:50:52 -05:00
Warner Losh
9e6d11ce9a vtnet: Adjust rx buffer so IP header 32-bit aligned
Call madj(m, ETHER_ALIGN) to offset rx buffers when allocating them.
This improves performance everywhere, and allows armv7 to work at all.

PR:			271288 (PR had a different fix than I wound up with)
MFC After:		3 days
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43136
2023-12-20 21:16:45 -07:00
Warner Losh
486ee36440 rl: Fix typo
'or' should be 'of' here

Sponsored by:		Netflix
2023-12-20 21:16:29 -07:00
Dmitry Luhtionov
45835894bd pchtherm(4): Add PCI ID for Wellsburg Thermal Subsystem
MFC after:	2 weeks
2023-12-19 23:32:01 +03:00
Dmitry Luhtionov
cb494408d8 ichsmb(4): Add PCI ID for Intel Ice Lake SMBus controller
MFC after:	2 weeks
2023-12-19 23:32:01 +03:00
Mark Johnston
d9b7301bb7 nvme: Initialize HMB entries before loading them into the controller
struct nvme_hmb_desc contains a pad field which was not getting
initialized before being synced.  This doesn't have much consequence but
triggers a report from KMSAN, which verifies that host-filled DMA memory
is initialized before it is made visible to the device.  So, let's just
initialize it properly.

Reported by:	KMSAN
Reviewed by:	mav, imp
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43090
2023-12-18 17:45:24 -05:00
Ram Kishore Vegesna
a9504d76cc ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf.
Reported by:	imp
 MFC after:	1 week
2023-12-18 14:22:06 +05:30
Gordon Bergling
ada4cd3f77 qat: Fix two typos in source code comments
- s/parmeters/parameters/

MFC after:	3 days
2023-12-17 15:18:57 +01:00
Elliott Mitchell
4c9e6ad320 xen: add atomic #defines to accomodate differing xen_ulong_t sizes
Alas, ARM declared xen_ulong_t to be 64-bits long, unlike i386 where
it matches the word size.  As a result, compatibility wrappers are
needed for Xen atomic operations.

Reviewed by: royger
2023-12-15 14:59:26 +01:00