Commit graph

39909 commits

Author SHA1 Message Date
Yuri
81fe400fb1 ipmi: do not omit lun in BMC addresses
Some systems put sensors on non-0 lun, so we should not omit it.  This
was the only difference with the Linux driver, where DIMM sensors could
be queried, but not on FreeBSD.

See this report[1] on the FreeBSD forums:
https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/

Reviewed by:	philip
Tested by:	Andrey Lanin[1]
Differential Revision: https://reviews.freebsd.org/D35612

(cherry picked from commit 177f8b3294)
2022-07-11 11:10:23 +08:00
Yuri
1549a6172f ipmi: correctly handle ipmb requests
Handle IPMB requests using SEND_MSG (sent as driver request as we do not
need to return anything back to userland for this) and GET_MSG (sent as
usual request so we can return the data for RECEIVE_MSG ioctl) pair.

This fixes fetching complete sensor data from boards (e.g. HP ProLiant
DL380 Gen10).

Reviewed by:	philip
Differential Revision: https://reviews.freebsd.org/D35605

(cherry picked from commit 18db96dbfd)
(cherry picked from commit c4995b69db)
2022-07-11 11:10:05 +08:00
Gordon Bergling
7dff1d4be7 aic7xxx: Fix a few common typos in source code comments
- s/ingnore/ignore/
- s/ingnored/ignored/

(cherry picked from commit 9bfefcea43)
2022-07-08 04:25:03 +02:00
Gordon Bergling
7e6f7610cf ata(4): Fix a typo in a source code comment
- s/fuctions/functions/

(cherry picked from commit 23781068af)
2022-07-08 04:23:56 +02:00
Gordon Bergling
dc7de3cab9 jme(4): Fix a typo in a source code comment
- s/fuctions/functions/

(cherry picked from commit 015d570cc9)
2022-07-08 04:23:41 +02:00
Gordon Bergling
9179bf221a aic7xxx: Fix a few common typo in source code comments
- s/irrespecitve/irrespective/

Obtained from:	NetBSD

(cherry picked from commit 66147d138a)
2022-07-08 04:23:25 +02:00
Gordon Bergling
23bb344ee3 pci(4): Fix a common typo in source code comments
- s/transistions/transitions/

(cherry picked from commit 00c00c3824)
2022-07-08 04:23:07 +02:00
Alan Cox
815db559ec busdma_iommu: Fine-grained locking for the dmamap's map list
Introduce fine-grained locking on the dmamap's list of map entries,
replacing the use of the domain lock.  This is not the most significant
source of lock contention, but it is the easiest to address.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35557

(cherry picked from commit eeb46578c2)
2022-07-06 12:11:10 -05:00
Alan Cox
a408ed1c92 iommu_gas: Eliminate unnecessary wrappers
Eliminate trivial wrappers for several iommu_gas functions that serve
no functional purpose.

Reviewed by:	br, dougm, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35487

(cherry picked from commit fc2e4f15a9)
2022-07-06 12:10:52 -05:00
Alan Cox
01ebb5b8cf iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT
As of 19bb5a7244, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by:	dougm
MFC with:	19bb5a7244

(cherry picked from commit 7b39a9bc1d)
2022-07-06 12:01:41 -05:00
Alan Cox
cf70aef401 iommu_gas: Tidy up
Move a comment to the code that it describes.  Improve the wording.

Style fixes.

MFC after:	2 weeks

(cherry picked from commit da33f6d76b)
2022-07-06 12:00:59 -05:00
Alan Cox
895d8b1d3c iommu_gas: Add a missing error-case unlock
Release the domain lock when iommu_gas_reserve_region_extend()'s call to
iommu_gas_reserve_region_locked() fails.

MFC after:	2 weeks

(cherry picked from commit 0ba1d86082)
2022-07-06 11:53:38 -05:00
Alan Cox
1334074959 busdma_iommu: Eliminate a redundant trunc_page()
Since OFF_TO_IDX() inherently truncates the given value, there is no
need to perform trunc_page() on it.

MFC after:	2 weeks

(cherry picked from commit 32e82bcc15)
2022-07-06 11:52:52 -05:00
Alan Cox
fed2c1ce8f iommu_gas: Eliminate a stale comment
As of 19bb5a7244, the size passed to iommu_gas_map is no longer
required to be a multiple of the CPU page size.

MFC after:	2 weeks

(cherry picked from commit 164491fb03)
2022-07-06 11:52:06 -05:00
Alan Cox
8c1edfe309 iommu_gas: Correct a broken KASSERT
If iommu_gas_find_space() ever called iommu_gas_uppermatch(), and it
succeeded in allocating space, then the subsequent KASSERT would be
triggered.  Change that KASSERT to accept either success or ENOMEM.

MFC after:	1 week

(cherry picked from commit e6775534ae)
2022-07-06 11:51:05 -05:00
Doug Moore
3a33ebe65f iommu_gas: make iommu_gas_lowermatch non-recursive
Change the recursive implementation to one that uses parent pointers
to walk back up the rb-tree, to slightly improve performance.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35486

(cherry picked from commit f979ad0030)
2022-07-06 11:43:37 -05:00
Doug Moore
9b12e43d1f iommu_gas: use to first-fit search for lowermatch
Reverse the order of the search for a free space in lowermatch, to
make it a first-fit search. Iommu_gas_match_one always allocates from
the beginning of the free gap discovered from searching the tree, so
the current code isn't really allocating in a reverse first-fit
anyway, and making the search first-fit reduces the number of iommu
page table pages that are used.

Reported by:	alc
Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35458

(cherry picked from commit 975715b788)
2022-07-06 11:42:48 -05:00
Doug Moore
2d8b9313f4 iommu_gas: pass size to iommu_map without rounding
Let the caller to iommu_map pass the size parameter without rounding
it up to a multiple of page size.  Let iommu_map round it up when
necessary, which is not all of the time, so that in some cases less
space is reserved.

Reviewed by:	alc, kib (previous version)
Tested by:	pho, br
Discussed with:	andrew
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35424

(cherry picked from commit 19bb5a7244)
2022-07-06 11:41:50 -05:00
Doug Moore
80ad47c932 iommu_gas: Change find_space lower search order
iommu_gas_lowermatch looks right, then left, then right again in its
search for free space.  Change to a more straightforward last-fit
search that touches fewer tree nodes and improves performance.

Reported by:	wxzhu@rice.edu
Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35439

(cherry picked from commit 3003117253)
2022-07-06 11:39:17 -05:00
Mitchell Horne
b475ab8c78 hwpmc: don't validate capabilities in allocation method
These checks were inconsistently applied across the various hwpmc
classes. The condition is already checked by the generic code in
hwpmc_mod.c, so remove them.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31388

(cherry picked from commit 0e78510b75)
2022-07-05 12:39:02 -04:00
Mitchell Horne
1e8f338d7f hwpmc: consistently validate PMC class in allocation method
It is always a good idea. In one case, attempting to allocate N+1 PMCs
from a class with N hardware counters would incorrectly attempt to
allocate from the next class in the list. Without this validation, this
can lead to all kinds of strange behaviour.

Since powerpc_allocate_pmc() is used by both the mpc7xxx and ppc970
classes, add a new global to track which is active (it will never be
both).

Reviewed by:	luporl, ray
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31387

(cherry picked from commit 315cd55dba)
2022-07-05 12:38:52 -04:00
Hans Petter Selasky
d4dd3c8f8b vt: Improve multi lingual word separation.
Suggested by:	Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
Sponsored by:	NVIDIA Networking

(cherry picked from commit 9971e6aff1)
2022-07-05 13:42:28 +02:00
Hans Petter Selasky
4437a2e1dd vt: Fix contents of paste buffer for newcons.
Trim all word separators from end of line, except for last line and
only use '\r' to terminate the pasted lines as expected by TTY.

Submitted by:	Ivan Quitschal <tezeka@hotmail.com>
Differential Revision:	https://reviews.freebsd.org/D35552
PR:		263084
Sponsored by:	NVIDIA Networking

(cherry picked from commit 5fe0a82501)
2022-07-05 13:42:28 +02:00
Alexander Motin
5c55abaf08 hwpmc: Reenable PME before reenabling counters.
Doing otherwise may lead to lost interrupts, that in combination
with hardware PMCs freezing may leave them frozen forever.  It may
also slightly improve profiling accuracy.

MFC after:	2 weeks

(cherry picked from commit f9e62419f6)
2022-07-04 13:48:10 -04:00
Alexander Motin
194796b386 hwpmc: Correct sysctl description.
MFC after:	2 weeks

(cherry picked from commit 918505d0a0)
2022-07-04 13:48:10 -04:00
Alexander Motin
6a69bfc8d5 hwpmc: Increase thread priority while iterating CPUs.
This allows to profile already running high-priority threads, that
otherwise by blocking thread migration to respective CPUs blocked PMC
management, i.e. profiling could start only when workload completed.

While there, return the thread to its original CPU after iterating
the list.  Otherwise all threads using PMC end up on the last CPU.

MFC after:	1 month

(cherry picked from commit eff9ee7c0c)
2022-07-04 13:48:10 -04:00
Alexander Motin
56294dd6b1 hwpmc: Add IDs for few more Intel Atom CPUs.
MFC after:	1 month

(cherry picked from commit 1326017849)
2022-07-04 13:48:10 -04:00
Alexander Motin
2bd4b5475f hwpmc: Skip GLOBAL_CTRL updates on stop_pmc().
After we wipe PMC configuration, including its local enable bit(s),
we don't really care about its global enable bit.  Global enable bits
now may only be cleared by interrupt handler in case of error (sample
buffer overflow).  Being set is actually a reset default for them.

This saves one WRMSR per process-scope PMC per context switch, that
is clearly visible in profiles.

MFC after:	1 month

(cherry picked from commit 326a8d3e08)
2022-07-04 13:48:10 -04:00
Alexander Motin
6b1e6a629d hwpmc: Bump Intel's IA32_PERFEVTSELx width to 64 bits.
Haswell added there bits 32/33 for TSX, and AlderLake added bit 34
for Adaptive PEBS Record.

MFC after:	1 month

(cherry picked from commit 1a4614a51e)
2022-07-04 13:48:10 -04:00
Alexander Motin
fad7a311d9 hwpmc: Make powerpc memory allocation alike to x86.
It should remove some unneeded pointer dereferences.

MFC after:	1 month

(cherry picked from commit 47699fc265)
2022-07-04 13:48:10 -04:00
Alexander Motin
633cab8aa4 hwpmc: Remove always zero pc_resync field.
MFC after:	1 month

(cherry picked from commit 5acb4c862b)
2022-07-04 13:48:09 -04:00
Alexander Motin
b8ef2ca9ea hwpmc: Add basic Intel Alderlake CPUs support.
The PMC subsystem is not designed for non-uniform CPU capabilities
(P/E-cores are different), but at least several working architectural
events like cpu_clk_unhalted.thread_p should be better than nothing.

MFC after:	1 month

(cherry picked from commit fe109d3113)
2022-07-04 13:48:09 -04:00
Alexander Motin
e7b63a7c6d hwpmc: Update Intel's programmable counters restrictions.
Primarily remove unneeded restrictions from later CPUs.

MFC after:	1 month

(cherry picked from commit ae57fbc7ec)
2022-07-04 13:48:09 -04:00
Alexander Motin
2154db2220 hwpmc: Correct selection of Intel fixed counters.
Intel json's use event=0 to specify fixed counter number via umask.
Alternatively fixed counters have equivalent programmable event/umask.

MFC after:	1 month

(cherry picked from commit c1e813d123)
2022-07-04 13:48:09 -04:00
Alexander Motin
a7588be68c hwpmc: Use hardware PMCs freezing on PMI on Intel v2+.
Since version 2 Intel CPUs can freeze PMCs when intering PMI to reduce
PMI effects on collected statistics.  Since version 4 hardware supports
"streamlined" mechanism, not requiring IA_GLOBAL_CTRL MSR access.

MFC after:	1 month

(cherry picked from commit 81ffb45f02)
2022-07-04 13:48:09 -04:00
Alexander Motin
698c67184a hwpmc: Add Intel Core register defines up to version 5.
MFC after:	1 month

(cherry picked from commit 245b056556)
2022-07-04 13:48:08 -04:00
Mitchell Horne
78f8ebe0c3 hwpmc_intel: assert for correct nclasses value
This variable is set based on the exact CPU model detected. If this
value is set too small, it could lead to a NULL-dereference from an
improperly initialized pmc_rowindex_to_classdep array.

Though it has been fixed, this was previously the case for Broadwell.
Add two asserts to catch this in DEBUG kernels, as it represents a
configuration error that may be hard to uncover otherwise.

PR:		253687
Reported by:	Zhenlei Huang <zlei.huang@gmail.com>
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8399d923a5)
2022-07-04 13:48:08 -04:00
Mitchell Horne
bdedfb3a00 if_ffec: free the dmamem allocation in detach
Calling bus_dmamap_destroy() for a mapping which was allocated with
bus_dmamem_alloc() will result in a panic. This change is not run-time
tested, but I identified the issue while implementing the analogous
method in if_dwc(4), using this implementation as the template.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8757d0fca9)
2022-07-04 13:34:57 -03:00
Mitchell Horne
eea2563d7f if_ffec: fix some misleading indentation
(cherry picked from commit b93985c11a)
2022-07-04 13:34:57 -03:00
Mitchell Horne
3a72965a25 if_dwc: avoid duplicate packet counts
We already increment the unicast IPACKETS and OPACKETS counters in the
rx/tx paths, respectively. Multicast packets are counted in the generic
ethernet code. Therefore, we shouldn't increment these counters in
dwc_harvest_stats().

Drop the early return from dwc_rxfinish_one() so that we still count
received packets with e.g. a checksum error.

PR:		263817
Reported by:	Jiahao LI <jiahali@blackberry.com>
Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35499

(cherry picked from commit 9718759043)
2022-07-04 13:34:57 -03:00
Mitchell Horne
5dec16de37 if_dwc: add detach method
It can be useful for testing.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35496

(cherry picked from commit 27b39e58b3)
2022-07-04 13:34:57 -03:00
Jiahao Li
164bdd8f9a if_dwc: enable RX checksum offload feature
We claim support in ifcaps, but don't actually enable it.

PR:		263886
Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35498

(cherry picked from commit 35c9edab41)
2022-07-04 13:34:56 -03:00
Mitchell Horne
68d02feaef if_dwc: consistently use if.c helper methods
And if_t rather than struct ifnet *. No functional change intended.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35497

(cherry picked from commit ca01879004)
2022-07-04 13:34:56 -03:00
Bjoern A. Zeeb
66754c01ff XHCI: clear warm and port reset
It seems we do not clear UPS_C_BH_PORT_RESET and UPS_C_PORT_RESET
conditions after warm or port reset.  Add that code.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35483

(cherry picked from commit 8f892e9bee)
2022-07-01 13:50:19 +00:00
Bjoern A. Zeeb
39cd7aa134 USB: add quirks to XHCI
While XHCI is very generic some revisions of chipsets have problems.
On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
enable it.
For that introduce quirks to xhci so that controllers can steer
certain features.  I would hope that this is and remains the only one.

Obtained from:	an old patch mainly debugging other problems
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D35482

(cherry picked from commit 447c418da0)
2022-07-01 13:50:10 +00:00
Hans Petter Selasky
20d3224919 uhid(4): Don't read-ahead from the USB IN endpoint.
This avoids an issue where IN endpoint data received from the device right
before the file handle is closed, gets lost.

PR:		263995
Sponsored by:	NVIDIA Networking

(cherry picked from commit b6f615255d)
2022-06-30 11:39:43 +02:00
Neel Chauhan
7a8188739a if_ix: Reset on an ECC error
This mirrors the Linux behavior as seen in the kernel commit d773ce2.

Reviewed by:		kbowling
MFH after:		3 days
Differential Revision:	https://reviews.freebsd.org/D35542

(cherry picked from commit 4f1d91e413)
2022-06-29 10:07:50 -07:00
Mitchell Horne
e06f07bc3f kerneldump: remove physical argument from d_dumper
The physical address argument is essentially ignored by every dumper
method. In addition, the dump routines don't actually pass a real
address; every call to dump_append() passes a value of zero for
physical.

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35173

(cherry picked from commit 489ba22236)
2022-06-27 16:32:06 -03:00
Mitchell Horne
758e72c0a8 Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a
file-backed vnode.

Unlike existing disk or network dumpers, the vnode dumper should not be
invoked during a system panic, and therefore is not added to the global
dumper_configs list. Instead, the vnode dumper is constructed ad-hoc
when a live dump is requested using the new ioctl on /dev/mem. This is
similar in spirit to a kgdb session against the live system via
/dev/mem.

As described briefly in the mem(4) man page, live dumps are not
guaranteed to result in a usuable output file, but offer some debugging
value where forcefully panicing a system to dump its memory is not
desirable/feasible.

A future change to savecore(8) will add an option to save a live dump.

Reviewed by:	markj, Pau Amma <pauamma@gundo.com> (manpages)
Discussed with:	kib
MFC after:	3 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D33813

(cherry picked from commit c9114f9f86)
2022-06-27 16:32:06 -03:00
Doug Moore
c253ae9fe4 iommu_gas: restrict tree search to promising paths
In iommu_gas_lowermatch and iommu_gas_uppermatch, a subtree search is
quickly terminated if the largest available free space in the subtree
is below a limit, where that limit is related to the size of the
allocation request. However, that limit is too small; it does not
account for both of the guard pages that will surround the allocated
space, but only for one of them. Consequently, it permits the search
to proceed through nodes that cannot produce a successful allocation
for all the requested space. Fix that limit to improve search
performance.

Reviewed by:	alc, kib
Submitted by:	Weixi Zhu (wxzhu@rice.edu)
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35414

(cherry picked from commit b831865fe3)
2022-06-27 00:36:42 -05:00