Commit Graph

285102 Commits

Author SHA1 Message Date
Joerg Pulz
27b4a1b7e5 isp(4): Add support to read contents of the FLT (flash layout table)
The FLT is like a TOC for the flash area and contains entries for every flash
region with start/end address, size and flags.
Start using NVRAM addresses from FLT instead of hardcoded ones for ISP28xx
based HBAs.

The FLT should be available on earlier HBAs too, probably since ISP24xx based.
This needs further investigation and testing.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:30 -06:00
Joerg Pulz
233ab94cfd ispfw(4): Reword to be more specific
Make clear what "included" means, as suggested by imp@

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:30 -06:00
Joerg Pulz
f76f7fefa1 isp(4): Fix reading NVRAM contents for 28xx based devices
Use correct NVRAM address for ISP28xx based HBAs to read NVRAM contents.
  WWPN/WWNN and framesize are correctly read from NVRAM now.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:30 -06:00
Joerg Pulz
0c5f23d2f7 ispfw(4): Add BUGS section with note about bundled firmware
Note that only firmware for 24xx and 25xx based HBAs is bundled with ispfw(4).
Those get the bundled firmware loaded into the HBAs memory and executed.
All other HBAs will use the firmware from flash.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:29 -06:00
Joerg Pulz
2b4ccfbbc6 isp(4): Document support for new devices
Add 28xx based HBAs to manpage.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:29 -06:00
Joerg Pulz
407abff6a4 isp(4): Add support for QLogic 28xx devices
This covers the following HBAs:
  ISP2812-based 64/32G Fibre Channel to PCIe Controller:
    QLE2770 Single Port 32GFC PCIe Gen4 x8 Adapter
    QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter
    QLE2870 Single Port 64GFC PCIe Gen4 x8 Adapter
    QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter

  ISP2814-based 64/32G Fibre Channel to PCIe Controller:
    QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter
    QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter

While here, add required bits to support 64GB FC.

Default framesize is set to 2048 for ISP28xx based HBAs for now.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726
2023-07-07 15:45:29 -06:00
WuerfelDev
29cbe944e9 CONTRIBUTING.md: minor changes
- Misspelled GitHub
- angle bracket not escaped correctly
- Double white spaces
- White spaces at EOL

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/788
2023-07-07 15:23:24 -06:00
John Baldwin
2329393c61 amd64: Use __seg_gs to implement per-CPU data accesses.
This makes use of the alternate address space support in both GCC and
clang to access per-CPU data as accesses relative to GS:.  The
original motivation for this is that it quiets verbose warnings from
GCC 12.  However, this version is also much easier to read and
allows the compiler to generate better code (e.g. the compiler can
use a GS: memory operand directly in other instructions such as IMUL
and CMP rather than always MOVing to a temporary register).

The one caveat is that the current approach is very inefficient at -O0
since the compiler expects to load the 0 base offset from a global
variable instead of assuming it is 0 (even with the const).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D40647
2023-07-07 13:06:55 -07:00
John Baldwin
1f7e357264 fwctl_fetch: Add a comment describing the tool.
I meant to include this in the earlier commit adding fwctl_fetch but
forgot to amend the commit before pushing it.
2023-07-07 13:06:26 -07:00
Li-Wen Hsu
2597c45a4f
Complete moving kinst of dtrace tests to common
Update its mtree entry.

Reviewed by:	christos, markj
Fixes:	911f026039 dtrace: move kinst tests to common
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40901
2023-07-08 04:05:30 +08:00
John Baldwin
d8bfccb220 fwctl_fetch: A small test utility for the fwctl bhyve device.
This can be run inside a bhyve guest to query the value of fwctl
nodes.  Note that fwctl in bhyve only supports a single hw.ncpu node.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40803
2023-07-07 13:02:13 -07:00
John Baldwin
9ac841e922 divmoddi*: Use separate statements instead of the comma operator.
Differential Revision:	https://reviews.freebsd.org/D40835
2023-07-07 13:01:19 -07:00
Jessica Clarke
aa8567656e bsd.compat.mk: Fix indentation for alignment
Fixes:	91d7edd549 ("Generalise libcompat to be a list rather than a single option")
2023-07-07 20:17:19 +01:00
Dmitry Chagin
bae6bb0698 csu: Implement _start using as to satisfy unwinders on aarch64
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40623
2023-07-07 19:56:02 +03:00
Dmitry Chagin
1a2aa2ffb5 rtld: Clear x29 and lr for thread_start to conform Aarch64 ABI pcs
Strictly speaking, SYS V Aarch64 ABI does not states that lr should be
cleared, however gdb relies on lr and tryes to unwind stack further.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40841
2023-07-07 19:55:43 +03:00
Dmitry Chagin
ac7759f545 rtld: Annotate .rtld_start on aarch64
1. Add a stop indicator to rtld_start to satisfy unwinders on aarch64:
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

2. Add a proper annotations for CFA.

That is allows gdb and libunwind successfully stop when unwinding stack
from global constructors and destructors.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40844
2023-07-07 19:55:28 +03:00
Dmitry Chagin
5645dfb41a rtld: Sligtly optimizing .rtld_start on aarch64
Use the LDP (load pair registers) instruction to load entry point
arguments from the stack.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40843
2023-07-07 19:55:08 +03:00
Dmitry Chagin
43e29d03f4 csu: Add the prologue and epilogue to the _init and _fini on aarch64
Normally, modern unwinders uses Dwarf information to unwind stack,
however in case when the code is not annotated by Dwarf instructions,
unwinders fallbacks to a frame-pointer based algorithm.

That is allows libunwind to unwind stack from global constructors and
destructors. Also it makes gdb happy as it printed nonexistent frame
before.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40842
2023-07-07 19:54:53 +03:00
Alfonso Gregory
a2cc93ec7f Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
a9cce232a6 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
72e1ea2f13 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
cccdaf507e Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
1a7ac2bd24 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
a1b6427a97 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
498a0a9c61 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
5c3b5af6a2 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
90597773cd Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
6fde066264 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
6d09982145 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
5762de7243 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
65f3be9110 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
69c0fb2a7a Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Alfonso Gregory
e97468063d Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:17 -06:00
Doug Moore
8df38859d0 radix_trie: replace node count with popmap
Replace the 'count' field in a trie node with a bitmap that
identifies non-NULL children. Drop the 'last' field, and use the
last bit set in the bitmap instead.  In lookup_le, lookup_ge,
remove, and reclaim_all, use the bitmap to find the
previous/next/only/every non-null child in constant time by
examining the bitmask instead of looping across array elements
and null-checking them one-by-one.

A buildworld test suggests that this reduces the cycle count on
those functions that eliminate some null-checks by 4.9%, 1.5%,
0.0% and 13.3%.
Reviewed by:	alc
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D40775
2023-07-07 11:09:36 -05:00
Mike Karels
be30fd3ab2 KERN_PROC_VM_LAYOUT sysctl: fix bug in 32-bit-compatible path
vmspace_free() is called redundantly in the 32-bit-compatible
path in sysctl_kern_proc_vm_layout(), causing a premature free
(possibly for the current address space).  Remove the extra call.

PR:		272401
Reported by:	marklmi at yahoo.com
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40908
2023-07-07 08:37:16 -05:00
Emmanuel Vadot
c81495a621 fwget: Fix quoting
This kind of quoting doesn't work, no idea why shellcheck wanted this.
If there is a "safer" way to "fix" this feel free to do it just test
that it's working after.

Reported by:	Kenneth Raplee <kenrap@kennethraplee.com>
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:	7ad4d94d5b ("Fix some shell issues by adding quotes and replace backticks with $()")
2023-07-07 09:19:41 +02:00
Vadim Goncharov
a81b559dad Fix saving STRUCTURED-DATA in RFC 5424 log format
When saving log files in RFC 5424 format presence of STRUCTURED-DATA
in message caused line to not appear in log file at all, because
a variable forgotten to initialize. This could be tested by (slightly
modified) example from RFC:

    echo '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com su 12345 ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][id@2 test="tast"] BOM"su root" failed for lonvick on /dev/pts/8" ' | nc -w1 -Uu /var/run/log

While here, update stale information in comment to logmsg() that RFC 5424
log format was not supported.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/717
2023-07-06 23:15:10 -06:00
Warner Losh
761ab48d6a kbdcontrol: Remove compat code for 4.x -> 5.x transition
I think we're safely past that now...

Sponsored by:		Netflix
2023-07-06 23:10:18 -06:00
Michael
971bac5ace kbd: consolidate kb interfaces (phase one)
Refactor to eliminate duplicated rate and delay tables, with minor style
tweaks for changed lines.  Remove an obsolete comment about needing to
convert from microseconds to ticks (that's done elsewhere). Remove
traiing whitespace in kbdcontrol.c.

Except for the new warning, no change in behavior

Sponsored by: 		DSS GmbH
Reviewed by:		imp [minor style tweaks as well]
Pull Request:		https://github.com/freebsd/pull/683
Differential Revision: 	https://reviews.freebsd.org/D38818
2023-07-06 23:10:18 -06:00
Ka Ho Ng
034c085601 modules: fix freebsd32_modstat on big endian platforms
The layout of modspecific_t on both little endian and big endian are as
follows:
|0|1|2|3|4|5|6|7|
+-------+-------+
|uintval|       |
+-------+-------+
|ulongval       |
+-------+-------+

For the following code snippet:
        CP(mod->data, data32, longval);
        CP(mod->data, data32, ulongval);
It only takes care of little endian platforms that it truncates the
highest 32bit automatically. However on big endian platforms it takes
the highest 32bit instead. This eventually returns a garbage syscall
number to the 32bit userland.

Since modspecific_t's usage currently is for the use of syscall modules,
we only initialize modspecific32_t with uintval. Now on both BE and LE
64-bit platforms it always pick up the first 4 bytes.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40814
MFC after:	1 week
2023-07-07 00:22:59 -04:00
Konstantin Belousov
97f14168f2 src.conf.5: regen 2023-07-07 04:45:34 +03:00
Greg Becker
642cd51102 libthr: Add src.conf variable WITHOUT_PTHREADS_ASSERTIONS
This patch fixes a bug which prevents building libthr without
_PTHREADS_INVARIANTS defined. The default remains to build libthr
with -D_PTHREADS_INVARIANTS. However, with this patch, if one builds
libthr with WITHOUT_PTHREADS_ASSERTIONS=true then the latency to
acquire+release a default pthread mutex is reduced by roughly 5%, and a
robust mutex by roughly 18% (as measured by a simple synthetic test on a
Xeon E5-2697a based machine).

Reviewed by:	jhb, kib, mjg
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40900
2023-07-07 04:45:09 +03:00
Mateusz Guzik
80bd5ef070 vfs: factor out mount point traversal to a dedicated routine
While here tidy up asserts in the area.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D40883
2023-07-07 01:15:04 +00:00
Mateusz Guzik
ebf37c3fed vfs: drop LK_RETRY when crossing mount points in vfs_lookup
vn_lock already returns the expected error.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D40883
2023-07-07 01:14:55 +00:00
Kyle Evans
2f700ca965 libbe: bail out early if the zfs kmod isn't loaded
As noted in the comment, we already know the rest of libbe_init() will
fail because there's no pool imported.  Avoid the side effect by
checking beforehand and bailing out early.

With this, freebsd-update(8) should no longer trigger a load of the zfs
kmod just because it runs `bectl check`.

Reviewed by:	jwmaag_gmail.com, rew
Differential Revision:	https://reviews.freebsd.org/D36188
2023-07-06 19:41:14 -05:00
Piotr Kubaj
a146207d66 ixl: implement support for dumping NIC registers
To enable faster debug of customer issues Intel wants an end user to
gather information about PHY configuration and status to debug link and
connection issues in the field. For this reason the end user should
have possibility of obtaining PHYs registers values at runtime during
debugging.

Differential Revision:	https://reviews.freebsd.org/D40354
Approved by:	erj
2023-07-07 01:45:44 +02:00
Doug Moore
8579bf27d7 inline_fls - HAVE_INLINE_FLSLL is always true
flsll is inlined, or replaced by a smart binary search implementation,
on all architectures, and HAVE_INLINE_FLSLL is #defined always. So
remove code the the #undefined case.

Reviewed by:	mhorne, tuexen
Differential Revision:	https://reviews.freebsd.org/D40704
2023-07-06 15:27:31 -05:00
Doug Moore
d4e236c70b inline_ffs: remove backup binary implementation
There is no longer be any point to maintaining a binary search routine
for ffs; inlines will always do it as well or better.
Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D40703
2023-07-06 13:36:12 -05:00
Doug Moore
6419ed7ee7 inline_fls: drop compile-time check
HAVE_INLINE_FLSLL is #defined always. This change assumes that where
__HAVE_INLINE_FLSLL is tested, the two leading underscores are a
mistake, and that the code will be better for using the efficient
flsll implementation.
Reviewed by:	markj, mhorne
Differential Revision:	https://reviews.freebsd.org/D40705
2023-07-06 13:32:59 -05:00
Doug Moore
e087768130 inline_fls: remove redundant INLINE_FLS test
HAS_INLINE_FLS and similar macros are defined always.
Removes the redundant tests for these always-true conditions.
Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D40707
2023-07-06 13:29:13 -05:00