Commit Graph

279857 Commits

Author SHA1 Message Date
John Baldwin
42fb28cef4 Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.
GCC 12 defaults to C++17 which removes (not just deprecates)
std::auto_ptr<>.  Trying to use CXXSTD of c++03 doesn't work with
libc++ headers, but c++11 does.

Reviewed by:	brooks, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37531
2022-12-04 16:25:21 -08:00
Warner Losh
68c3f03021 newbus: Change attach failure behavior
In the rare case that we succeed in probing, but fail to attach, flip
the default to be to disable the
device. hw.bus.disable_failed_devices=false is no required to restore
the old behavior. The old behavior dates form a time when dynamic
control of devices wasn't yet present (devctl didn't exist). Now that
one can retry probe/attach the device with devctl, the default doesn't
make sense: The more desirable behaivor is to have stable device numbers
when one has several instances of the same device in a system (common
for NICs or HBAs).

Reviewed by:		jhb (verbal)
Sponsored by:		Netflix
2022-12-04 16:29:03 -07:00
Warner Losh
aa52c6bdd7 newbus: Create a knob to disable devices that fail to attach.
Normally, when a device fails to attach, we tear down the newbus state
for that device so that future driver loads can try again (maybe with a
different driver, or maybe with a re-loaded and fixed kld).

Sometimes, however, it is desirable to have the device fail
permanantly. We do this by calling device_disable() on a failed
attached, as well as keeping the device in DS_ATTACHING forever. This
prevents retries on that device. This is enabled via
hw.bus.disable_failed_devices=1 in either a hint via the loader, or at
runtime with a sysctl setting. Setting from 1 -> 0 at runtime will not
affect previously disabled devices, however: they remain disabled.
They can be re-enabled manually with devctl enable, however.

Sponsored by:		Netflix

Reviewed by:	gallatin, hselasky, jhb
Differential Revision:	https://reviews.freebsd.org/D37517
2022-12-04 16:20:24 -07:00
Warner Losh
9f7269677c kboot: Add md_addr to metadata
Save the address of where the metadata is loaded.

Sponsored by:		Netflix
2022-12-04 13:52:22 -07:00
Warner Losh
0ea00e71a2 kboot: Use #define for DT_DIR
Sponsored by:		Netflix
2022-12-04 13:31:06 -07:00
Warner Losh
8483b3add8 kboot: powerpc64 has no newfstat system call
Powerpc doesn't have a newfstat system call. It does have a fstat call,
which we define properly if SYS_newfstat isn't defined.

Sponsored by:		Netflix
2022-12-04 13:31:06 -07:00
Warner Losh
58091659cf kboot: Add aarch64 termios
Aarch64 has the generic termios interface, so use termios_gen.h

Sponsored by:		Netflix
2022-12-04 13:31:06 -07:00
Warner Losh
1fc8e9b833 kboot: Add missing license to termios
I neglected to include the proper license markings on these
files. Remedy that now.

Sponsored by:		Netflix
2022-12-04 13:31:06 -07:00
Ed Maste
52f2b03877 libdevdctl: update deprecated deprecation warning comment
The comment indicated -Wno-deprecated-declarations was used to avoid
warnings about deprecated auto_ptr and various deprecated function
objects from <functional>.  libdevdctl (now) does not use auto_ptr,
so don't mention it in the comment.

Sponsored by:	The FreeBSD Foundation
2022-12-04 10:17:37 -05:00
Warner Losh
929c6216b1 stand: aarch64 has different nlinks than amd64
Some typedefs are system dependent, so move them into stat_arch.h where
they are used.  On amd64, nlinks is a int64_t, while on aarch64 it's an
int (or int32_t).

Sponsored by:		Netflix
2022-12-03 22:53:18 -07:00
Kirk McKusick
e15d8f2384 Updates to UFS/FFS superblock integrity checks when reading a superblock.
Minor optimization that makes semantics of check clearer.

Sponsored by: The FreeBSD Foundation
2022-12-03 21:33:59 -08:00
Warner Losh
e3b74ec119 kboot: powerpc ldscript catchup
Catch up with the latest ldscript for powerpc. Make it match others in
the tree.

Sponsored by:		Netflix
2022-12-03 21:41:28 -07:00
Warner Losh
aed1e5d332 stand/efi: Break stlye rules a little for easier sharing
Break the style rules a little to allow easier sharing between efi and
kboot. This will allow the ifdefs to be fewer in number.

Sponsored by:		Netflix
2022-12-03 17:23:25 -07:00
Warner Losh
3f2c1eb5b8 stand/efi: Better include order for sharing
Have a better include order so this can more easily be shared between
EFI and kboot. Fewer ifdefs and the same (enough) include order as
before.

Sponsored by:		Netflix
2022-12-03 17:23:22 -07:00
Warner Losh
3df86732af stand/efi: Remove redundant parenthesis
Style: Remove redundant parens.

Sponsored by:		Netflix
2022-12-03 17:23:20 -07:00
Warner Losh
67e39a0d1b stand/efi: Document the copy size trick
We call bi_copymodules twice: once with 0 and once with the size of the
arena. We do this to find the size, it turns out. Document this.

Sponsored by:		Netflix
2022-12-03 17:23:16 -07:00
Warner Losh
cc623784c1 kboot: Enable fewer things by default
We don't need NFS / network support by default, nor do we need gzip
support. Remove them for now.

Sponsored by:		Netflix
2022-12-03 12:48:45 -07:00
Warner Losh
4f6c506c6f kboot: Make dosfs support conditional
Sponsored by:		Netflix
2022-12-03 12:48:45 -07:00
Warner Losh
59cbe840cf kboot: Add readme
Document how to test kboot and how to build a initrd.

Sponsored by:		Netflix
2022-12-03 12:48:45 -07:00
Warner Losh
a2fbc88593 kboot: Move archsw init earlier
Do archsw init first thing.

Sponsored by:		Netflix
2022-12-03 12:48:45 -07:00
Vincenzo Maffione
4ad57c7afa netmap_update_config: update na->name to cope with reconfigurations
MFC after:	1 week
2022-12-03 18:12:04 +00:00
Alexander Motin
7467a69536 CTL: Allow userland supply tags via ioctl frontend.
Before this ioctl frontend always replaced tags with sequential ones.
It was done for ctladm, that can not keep track of global tag list.
But in case of virtio-scsi in bhyve we can pass provided tags as-is.
It should be on virtio-scsi initiator to provide us valid tags.  It
should allow proper task management, error reporting, etc.  In case
of several virtio-scsi devices, they should use different CTL ports
or initiator IDs to avoid conflicts, but this is expected by design.

PR:	267539
2022-12-03 12:05:05 -05:00
Alexander Motin
fcdcfa2189 Missed chunk of 0acc026dda. 2022-12-03 11:26:22 -05:00
Alexander Motin
0acc026dda CTL: Increase maximum SCSI tag size from 32 to 64 bits.
SAM-5 specification states maximum size of command identifier (tag),
defined by specific transports, should not be larger than 64 bits.
While most of supported transports use 32 bits or less, it was
reported that virtio-scsi uses 64 bits.  Truncation to 32 bits in
bhyve code caused false tag conflict errors reported and possibly
other issues.

This changes CTL ABI and HA protocol, so CTL_HA_VERSION is bumped.

While we make HA protocol incompatible, increase default maximum
number of ports in CTL from 256 to 1024, matching number of LUNs.
There are many reports from people who need many iSCSI targets with
only one LUN each.  Increased memory consumption should be less of
a problem these days.

PR:	267539
2022-12-03 10:23:29 -05:00
Alexander Motin
b81ac5cdc3 bhyve virtio-scsi: Fix residual reporting.
CTL does not really use residual field and it always returned zero.
Use ext_data_filled instead.

MFC after:	2 weeks
2022-12-03 10:08:20 -05:00
Ed Maste
e92d692345 libpmc: remove unused auto_ptr warning suppression
libpmc used -Wno-deprecated-declarations to silence warnings about usage
of deprecated std::auto_ptr, but there is (now) now use of auto_ptr in
libpmc.

Reviewed by:	mhorne
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37576
2022-12-02 18:52:30 -05:00
Alexander V. Chernikov
6ab87ec483 netlink: fix non-multipath build 2022-12-02 22:21:00 +00:00
Gleb Smirnoff
657729a89d Retire trpt(8).
trpt(8) was utility to pull TCP debugging data from the kernel
originating back from 4.2BSD.  It is not used nowadays by TCP
developers.  We have more powerful debugging facilities, e.g.
the Dtrace probing, the TCP black box logging and siftr.

Discussed with: rscheff, tuexen, rrs, jtl and others
2022-12-02 14:10:55 -08:00
Gleb Smirnoff
0aa120d52f inpcb: allow to provide protocol specific pcb size
The protocol specific structure shall start with inpcb.

Differential revision:	https://reviews.freebsd.org/D37126
2022-12-02 14:10:55 -08:00
Alexander V. Chernikov
cc2be31177 netlink: store user-provided rtm_protocol
Store user-supplied source protocol in the nexthops and nexthop groups.
Protocol specification help routing daemons like bird to quickly
identify self-originated routes after the crash or restart.

Example:
```
10.2.0.0/24 via 10.0.0.2 dev vtnet0 proto bird
10.3.0.0/24 proto bird
	nexthop via 10.0.0.2 dev vtnet0 weight 3
	nexthop via 10.0.0.3 dev vtnet0 weight 4
```
2022-12-02 20:08:47 +00:00
Alexander V. Chernikov
42f8123a4f routing: provide dedicated function for nhgrp creation and linking.
There is a need to store client metadata in nexthops and nexthop groups.
This metadata is immutable and participate in nhop/nhg comparison.

Nexthops KPI already supports its: nexthop creation pattern is
```
nhop_alloc()
nhop_set_...()
...
nhop_get_nhop()
```

This change provides a similar pattern for the nexthop groups.
Specifically, it adds nhgrp_alloc(), nhgrp_get_nhgrp() and
nhgrp_set_uidx().

MFC after:	2 weeks
2022-12-02 20:08:47 +00:00
Warner Losh
da5d0a1dbc kboot: Use unsigned long long.
For the 64-bit platforms, this is a nop. Currently kboot only supports
64-bit platforms, though. If we support 32-bit in the future, this will
become important.

Noticed by:		rpokala
Sponsored by:		Netflix
2022-12-02 12:41:01 -07:00
Warner Losh
7685e8d97a kboot: Enhance hostdisk
Added missing functionality to allow us to boot off of things like
/dev/nvme0n1p2 successfully. And to list all available devices and
partitions with 'lsdev'.

Sponsored by:		Netflix
2022-12-02 11:31:26 -07:00
Warner Losh
c51e1d7c0a kboot: amd64 use /sys/firmware/memmap to find free memory
Use the system's firmware memory map to find a good place to put the
kernel that won't stomp on anything else. While this uses obstensibly MI
interfaces to get this data, arm64 doesn't have this, nor does
powerpc64, so place it here.

Sponsored by:		Netflix
2022-12-02 11:17:28 -07:00
Warner Losh
6f8e9f2273 kboot: move to using devparse
We can use devparse directly now. No need to invent a kboot_parsedev
that just does what devparse does now that we've refactored.

Sponsored by:		Netflix
2022-12-02 11:17:27 -07:00
Warner Losh
7e1a2e46aa kboot: Create routines to read Linux tiny files
Most of the files in /sys/ and /proc/ are small with one value. Create
two routines to help us read the file and decode that value.

Sponsored by:		Netflix
2022-12-02 11:08:11 -07:00
Warner Losh
858a73f14c full-test: Start of a full testing suite.
full-test.sh aims to be a test suite generator for the boot loader. It
tries to grab artifacts from the web and then constructs minimal boot
environments from that as well as writing qemu-system-* using scripts
that facilitates testing all the ways we can boot... At least all the
ways that we an boot that qemu can emulate.

This is very much a work in progress, and likely could use a good
cleanup at some point.

Sponsored by:		Netflix
2022-12-02 11:08:11 -07:00
Warner Losh
aad99ded88 Add test notes
Add notes on how to test things. This will likely need to be fleshed out
more in the future, but this is a good start.

Sponsored by:		Netflix
2022-12-02 11:07:33 -07:00
Warner Losh
7652743540 devd: Warn for deprecated 'kern' system type
One year ago, I deprecated 'kern' in favor of 'kernel' for the system
name for some power events. I'm about to remove it from the kernel, but
realized there's been no warning generated for users. Preserve POLA by
converting on the fly here and issuing a warning for 14.x, and an fatal
error after we branch 15. Make compiling it an error on 16 to remove
the gross hack after we branch.

Sponsored by:		Netflix
Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D37584
2022-12-02 10:48:02 -07:00
Warner Losh
8d147537bf newbus: Remove deprecated "kern" system name for resume events.
The new "kernel" system name is the one that's documented and has
been generated for a year now. Remove the old one now that 14.0
is getting close.

Sponsored by:		Netflix
Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D37582
2022-12-02 10:48:02 -07:00
Alan Somers
d2ce00e9a6 Allow any user to read the NFS stats, for example with nfsstat(1).
This was originally allowed by 3cea29603d (2011).  But it got broken by
693957f886 (2016) and apparently nobody noticed.

MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	rmacklem, ken
Differential Revision: https://reviews.freebsd.org/D37589
2022-12-01 22:21:14 -07:00
Kristof Provost
97c802923e if_ovpn: remove peer limit
Replace the fixed-sized array by an RB_TREE. This should both speed up
lookups and remove the 128 peer limit.

Reviewed by:	zlei
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37524
2022-12-01 17:42:57 +01:00
Cy Schubert
6742ff42ab heimdal: Fix bus fault when zero-length request received
Zero length client requests result in a bus fault when attempting to
free malloc()ed pointers within the requests softc. Return an error
when the request is zero length.

PR:		268062
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	3 days
2022-12-01 06:24:12 -08:00
Cy Schubert
d24b272832 heimdal: Add additional checks for bad kadmind input
Check return codes for bad input.

MFC after:	3 days
2022-12-01 06:24:12 -08:00
Jean-Sébastien Pédron
e101c1c2c9 linuxkpi: Introduce module_param() of type bint
In Linux, this limits the accepted value to -1, 0 and 1.
In FreeBSD, this remains a signed integer with no specific constraints.

This change is a requirement to update our DRM drivers to Linux 5.12.

Differential Revision:	https://reviews.freebsd.org/D37364
2022-12-01 15:03:00 +01:00
Jean-Sébastien Pédron
0adc02a979 linuxkpi: Add PCIE_SPEED_{32,64}_0GT PCI-E bus speed constants
This change is a requirement to update our DRM drivers to Linux 5.12.

Differential Revision:	https://reviews.freebsd.org/D37363
2022-12-01 15:02:27 +01:00
Jean-Sébastien Pédron
e79a57d4ec linuxkpi: Add cmpxchg64() in <asm/atomic.h>
Differential Revision:	https://reviews.freebsd.org/D36966
2022-12-01 14:59:16 +01:00
Jean-Sébastien Pédron
18e4112337 linuxkpi: Add seqcount_mutex_t support in <linux/seqlock.h>
To achieve that, the header uses the C11 type generic selection keyboard
_Generic() because the macros are supposed to work with seqcount_t
and seqcount_mutex_t.

Differential Revision:	https://reviews.freebsd.org/D36965
2022-12-01 14:58:27 +01:00
Alexander V. Chernikov
984b27d879 net: add if_allocdescr() to permit updating iface description from the kernel
Reviewed by:	kp,zlei
Differential Revision: https://reviews.freebsd.org/D37566
MFC after:	2 weeks
2022-12-01 11:31:36 +00:00
Kornel Dulęba
6f9c622690 rx8803: Improve probing logic
Add a PNP macro in order to load this driver automatically.
While here check if the device is enabled in DT before probing it.

Reviewed by:	wma
Sponsored by:	Alstom
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D37579
2022-12-01 10:14:58 +01:00