Commit graph

140770 commits

Author SHA1 Message Date
Dmitry Chagin
6fddab804a amd64: Reload CPU ext features after resume or cr4 changes
Reviewed by:		kib
Differential revision:	https://reviews.freebsd.org/D35555
MFC after:		2 weeks

(cherry picked from commit 050f5a8405)
2022-07-13 14:48:49 +03:00
Dmitry Chagin
34b00959fb linprocfs: Decode SGX CPU feature in cpuinfo
MFC after:		2 weeks

(cherry picked from commit c8e7070ce3)
2022-07-13 14:48:38 +03:00
Dmitry Chagin
9736c19884 linprocfs: Decode more CPU flags in cpuinfo
Differential revision:	https://reviews.freebsd.org/D35556
MFC after:		2 weeks

(cherry picked from commit 7ab03740ae)
2022-07-13 14:48:27 +03:00
Dmitry Chagin
f56ea6b7d0 linprocfs: Decode constant_tsc CPU feature
Differential revision:	https://reviews.freebsd.org/D35554
MFC after:		2 weeks

(cherry picked from commit 8da00a514e)
2022-07-13 14:48:14 +03:00
Konstantin Belousov
c41bc56574 ufs_rename(): revert the bump of fvp nlink count in case of EMLINK for tdvp
(cherry picked from commit 513e1bbc73)
2022-07-13 11:38:01 +03:00
Konstantin Belousov
a924a143dd ufs_rename(): do not treat ERELOOKUP specially
(cherry picked from commit ab5ef5fb63)
2022-07-13 11:38:01 +03:00
Konstantin Belousov
0aa68d5fbe UFS rename: make it reliable when using SU and reaching nlink limit
PR:	165392

(cherry picked from commit bc6d0d72f4)
2022-07-13 11:38:01 +03:00
Doug Moore
0a7f5f1885 mips busdma: expunge an extra closing brace
A merge left a dangling right brace unaccounted for.
Delete it.

Reported by:	jenkins
2022-07-12 13:47:44 -05:00
Doug Moore
069ec467c1 iommu_gas: Drop needless bound check in lowermatch
The loop iteration in iommu_gas_lowermatch checks the bound
a->common->lowaddr twice per loop iteration. Rewrite to test only once
per iteration.  Do not worry about passing to iommu_gas_match_one a
range wholly beyond lowaddr. Since that function checks the upper end
of the range against lowaddr, it'll get rejected there.

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

(cherry picked from commit 70b5d8fa0f)
2022-07-12 12:37:48 -05:00
Doug Moore
094bcfa4e1 mips_busdma: fix mips errors after merge
The change "vm_extern: use standard address checkers everywhere"
introduced bugs, as well as features, into head. After it was
introduced, but before those bugs were addressed, mips support was
dropped from head, so those mips bugs were never fixed in head. Now,
that change and those fixes have been merged into stable/13. This
change fixes two of those bugs that were fixed everywhere else but
never in mips.

Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D35793
2022-07-12 12:33:20 -05:00
Doug Moore
48d01e24f9 vm_addr_ok: add power2 invariant check
With INVARIANTS defined, have vm_addr_align_ok and vm_addr_bound_ok
panic when passed an alignment/boundary parameter that is not a power
of two.

Reviewed by:	alc
Suggested by:	kib, se
Differential Revision:	https://reviews.freebsd.org/D33725

(cherry picked from commit ae13829ddc)
2022-07-12 11:26:12 -05:00
Doug Moore
01f79c9da8 busdma: _bus_dmamap_addseg repaired
A recent change introduced a one-off error into a test allowing
coalescing chunks into segments.  This fixes that error.

broke a check in _bus_dmamap_addseg on many architectures. This change makes it clear that it is not a particular range that is being boundary-checked, but the proposed union of the two adjacent ranges.
Reported by:	se
Reviewed by:	se
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
Differential Revision:	https://reviews.freebsd.org/D33715

(cherry picked from commit f1e7a532d1)
2022-07-12 11:26:11 -05:00
Doug Moore
ab0f2ae2ee x86-busdma - Add missing paren
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere

(cherry picked from commit b7810e05ff)
2022-07-12 11:26:10 -05:00
Doug Moore
3af858bd8f riscv-busdma: Balance parens.
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere

(cherry picked from commit b496126886)
2022-07-12 11:26:08 -05:00
Doug Moore
0cbb744f96 iommu_gas: Rename a function missed earlier
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere

(cherry picked from commit cfb2aa3f53)
2022-07-12 11:26:07 -05:00
Doug Moore
6f387a5632 vm_reserv: #include vm_extern.h explicitly, for arm.
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere
(cherry picked from commit f76916c095)
2022-07-12 11:26:06 -05:00
Doug Moore
bf27b9bc7f vm_phys: convert error back to warning
Move an assignment back to where it was before, to turn the
defined-but-not-used error back into a set-but-not-used warning.

Fixes:	01e115ab83 vm_phys: #include vm_extern
(cherry picked from commit e6930b1c5f)
2022-07-12 11:26:05 -05:00
Doug Moore
87e6f3d27e vm_phys: #include vm_extern
Arm64 and powerpc don't include vm_extern.h indirectly in vm_phys.c, which
means that for the sake of those architectures, it must be included explicitly.

Also, fix a set-unused warning that jenkins also found.

Reported by:	Jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere

(cherry picked from commit 01e115ab83)
2022-07-12 11:26:04 -05:00
Doug Moore
c5a5a9dbcf vm_extern: use standard address checkers everywhere
Define simple functions for alignment and boundary checks and use them
everywhere instead of having slightly different implementations
scattered about. Define them in vm_extern.h and use them where
possible where vm_extern.h is included.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D33685

(cherry picked from commit c606ab59e7)
2022-07-12 11:26:03 -05:00
Dmitry Chagin
f8da863470 linux(4): Implement __vdso_time
PR:		240769
MFC after:	3 days

(cherry picked from commit 42317e6426)
2022-07-12 00:28:28 +03:00
Dmitry Chagin
00c933e925 linux(4): Use saved cpu feature bits
MFC after:		3 days

(cherry picked from commit 03473e8ec8)
2022-07-12 00:28:11 +03:00
Dag-Erling Smørgrav
f639aeb3fd Enable CRC64 checksums in xz.
Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35668

(cherry picked from commit 038405f32f)
2022-07-11 21:43:34 +00:00
Doug Moore
bb75580e03 bitstring: fix ff_area() when start!=0
commit 84e2ae64c5 introduced an error in the ff*_area_at
functions for nonzero start parameters when the bit range sought was
found immediately. It mistakenly replaced '_value = _start' with
'_value = 0' in initialization. Undo that mistake.

Reported by:	markj
Reviewed by:	markj
Tested by:	markj
Fixes:	84e2ae64c5 vm_reserv: use enhanced bitstring for popmaps
Differential Revision:	https://reviews.freebsd.org/D35157

(cherry picked from commit 6e7a585348)
2022-07-11 01:01:30 -05:00
John Baldwin
897877ae64 <sys/bitstring.h>: Cast _BITSTR_BITS to int in a ternary operator.
This fixes a -Wsign-compare error reported by GCC due to the two
results of the ternary operator having differing signedness.

Reviewed by:	dougm, rlibby
Differential Revision:	https://reviews.freebsd.org/D34122

(cherry picked from commit 8a67a1a964)
2022-07-11 01:01:12 -05:00
Doug Moore
b1290f4746 vm_reserv: use enhanced bitstring for popmaps
vm_reserv.c uses its own bitstring implemenation for popmaps. Using
the bitstring_t type from a standard header eliminates the code
duplication, allows some bit-at-a-time operations to be replaced with
more efficient bitstring range operations, and, in
vm_reserv_test_contig, allows bit_ffc_area_at to more efficiently
search for a big-enough set of consecutive zero-bits.

Make bitstring changes improve the vm_reserv code.  Define a bit_ntest
method to test whether a range of bits is all set, or all clear.
Define bit_ff_at and bit_ff_area_at to implement the ffs and ffc
versions with a parameter to choose between set- and clear- bits.
Improve the area_at implementation.  Modify the bit_nset and
bit_nclear implementations to allow code optimization in the cases
when start or end are multiples of _BITSTR_BITS.

Add a few new cases to bitstring_test.

Discussed with:	alc
Reviewed by:	markj
Tested by:	pho (earlier version)
Differential Revision:	https://reviews.freebsd.org/D33312

(cherry picked from commit 84e2ae64c5)
2022-07-11 00:54:06 -05:00
Doug Moore
88a5d20e90 vm: alloc pages from reserv before breaking it
Function vm_reserv_reclaim_contig breaks a reservation with enough
free space to satisfy an allocation request and returns the free space
to the buddy allocator. Change the function to allocate the request
memory from the reservation before breaking it, and return that memory
to the caller. That avoids a second call to the buddy allocator and
guarantees successful allocation after breaking the reservation, where
that success is not currently guaranteed.

Reviewed by:	alc, kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D33644

(cherry picked from commit 0d5fac2872)
2022-07-11 00:41:07 -05:00
Doug Moore
b52d35520c Fix clerical error in page alloc
Fix a very recent change that introduced a page accounting error in
case of a reserveration being broken.
Reviewed by:	alc
Fixes:	fb38b29b56 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
Differential Revision:	https://reviews.freebsd.org/D33645

(cherry picked from commit 184c63db3c)
2022-07-11 00:41:06 -05:00
Doug Moore
a8d3ef5bc6 vm_page: Remove extra test from page alloc
Extract code from vm_page_alloc_contig_domain into a new function.  Do
so in a way that eliminates a bound-to-fail reservation test after a
reservation is broken by a call from vm_page_alloc_contig_domain.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33551

(cherry picked from commit fb38b29b56)
2022-07-11 00:41:05 -05:00
Doug Moore
86299ec1c4 vm_phys: hide vm_phys_set_pool
It is only called in the file that defines it, so make it static and
remove the declaration from the header.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33688

(cherry picked from commit 8119cdd38b)
2022-07-11 00:41:04 -05:00
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
ab0ae50786 freescale: Fix a typo in a source code comment
- s/transistions/transitions/

(cherry picked from commit f1334ab76b)
2022-07-08 04:24:47 +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
Mark Johnston
77712e81bf crypto: Fix the NULL_HMAC finalizer
The current implementation leaves the digest buffer partially
uninitialized.

Reported by:	syzkaller
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8179db52c2)
2022-07-07 20:47:03 -04: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
Ruslan Bukin
4ae24f166c Check if iommu ctx is valid before passing it to functions.
Differential Revision:	https://reviews.freebsd.org/D35130
Sponsored by:	UKRI

(cherry picked from commit 8b8e56dd5b)
2022-07-06 11:41:03 -05:00