Commit Graph

144320 Commits

Author SHA1 Message Date
Andrew Turner
e3917bb256 Disable promotion on pcpu memory on arm64
We need to be careful to not promote or demote the memory containing
the per-CPU structures as the exception handlers will dereference it
so any time it's invalid may cause recursive exceptions.

Add a new pmap function to set a flag in the pte marking memory that
cannot be promoted or demoted and use it to mark pcpu memory.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35434
2022-08-16 15:41:24 +01:00
Søren Schmidt
1331c0f44b Add support for RockChip RK356X to DWC3 driver.
For RK356x platform, we can set bit 26 of DWC3_GUCTL1 register
for usb 2.0 device.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D36211
2022-08-16 12:24:44 +00:00
Mateusz Guzik
84a0be4a23 vfs: plug a dead store in kern_linkat_vp
Reported by:	clang --analyze
2022-08-16 10:46:29 +00:00
Mateusz Guzik
eb9a1f9c68 vfs: plug dead store in vn_io_fault1
Reported by:	clang --analyze
2022-08-16 10:46:20 +00:00
Konrad Sewiłło-Jopek
31ee3a33aa TPM: do not set device description if probe fails
device_set_desc should be called only if driver probes successfully.

Approved by:	mw(mentor)
Reviewed by:	mw, kd
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35998
2022-08-16 11:07:12 +02:00
Navdeep Parhar
a8dc67388a cxgbe(4): Add a knob to request that clocks be gated on suspend.
MFC after:	3 months
Sponsored by:	Chelsio Communications
2022-08-16 01:08:35 -07:00
Navdeep Parhar
a7d081a8ce cxgbe(4): Decode and display some more bits in the PL interrupt handler.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-08-16 01:07:36 -07:00
Navdeep Parhar
2bb28b5f8c cxgbe(4): Update firmwares to 1.27.0.0.
Changes since 1.26.6.0 are listed here.  This list comes from the
Release Notes for "Chelsio Unified Wire 3.17.0.0 for Linux" dated
2022-07-29.

Fixes
-----

BASE:
- Enabled all MA parity interrupt bits.
- Use config file value to override number of rx channel. nrxch=1 was not
  handled in the firmware.
- Replaced read only registers with new registers EDC_H_BIST_USER_WDATA0,
  EDC_H_BIST_USER_WDATA1 and EDC_H_BIST_CMD_LEN to dump the uP memory parity
  error status registers.
- 10G simplex module support enabled.

Obtained from:	Chelsio Communications
MFC after:	1 month
Sponsored by:	Chelsio Communications
2022-08-16 01:06:32 -07:00
Søren Schmidt
66a3e51341 Add RockChip rk809/rk817 pmic support to existing
RockChip pmic drivers.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D36149
2022-08-16 07:55:18 +00:00
Mateusz Guzik
88a782fc84 routing: G/C rt_exportinfo declaration
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-08-15 20:38:31 +00:00
Dimitry Andric
da36b5d244 Adjust function definition in riscv's db_trace.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/riscv/riscv/db_trace.c:56:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    db_md_list_watchpoints()
                          ^
                           void

This is because db_md_list_watchpoints() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after:	3 days
2022-08-15 20:48:35 +02:00
Dimitry Andric
02dd51c9bc Adjust function definitions in mp_cpudep.c.c to avoid clang 15 warnings
With clang 15, the following -Werror warnings are produced:

    sys/powerpc/booke/mp_cpudep.c:54:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cpudep_ap_bootstrap()
                       ^
                        void
    sys/powerpc/booke/mp_cpudep.c:97:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cpudep_ap_setup()
                   ^
                    void

This is because cpudep_ap_bootstrap() and cpudep_ap_setup() are declared
with (void) argument lists, but defined with empty argument lists. Make
the definitions match the declarations.

MFC after:	3 days
2022-08-15 20:48:35 +02:00
Dimitry Andric
ff490346fd Adjust function definition in moea64_native.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/moea64_native.c:306:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_install_native()
                         ^
                          void

This is because moea64_install_native() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after:	3 days
2022-08-15 20:48:35 +02:00
Dimitry Andric
3446738e8d Fix unused variable warning in mmu_radix.c
With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/mmu_radix.c:5409:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable]
            int allfree, field, freed, idx;
                                ^

The 'freed' variable is only used when PV_STATS is defined. Ensure it is
only declared and set in that case.

MFC after:	3 days
2022-08-15 20:48:34 +02:00
Dimitry Andric
fb203abd9d Adjust function definitions in mmu_radix.c to avoid clang 15 warnings
With clang 15, the following -Werror warnings are produced:

    sys/powerpc/aim/mmu_radix.c:786:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_tlbie_all()
                       ^
                        void
    sys/powerpc/aim/mmu_radix.c:3615:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_init()
                  ^
                   void
    sys/powerpc/aim/mmu_radix.c:6081:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_scan_init()
                       ^
                        void

This is because mmu_radix_tlbie_all(), mmu_radix_init(), and
mmu_radix_scan_init() are declared with (void) argument lists, but
defined with empty argument lists. Make the definitions match the
declarations.

MFC after:	3 days
2022-08-15 20:48:34 +02:00
Dimitry Andric
7a98c884f2 Adjust function definitions in mmu_oea64.c to avoid clang 15 warnings
With clang 15, the following -Werror warnings are produced:

    sys/powerpc/aim/mmu_oea64.c:1947:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_init()
               ^
                void
    sys/powerpc/aim/mmu_oea64.c:3257:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_scan_init()
                    ^
                     void

This is because moea64_init() and moea64_scan_init() are declared with
(void) argument lists, but defined with empty argument lists. Make the
definitions match the declarations.

MFC after:	3 days
2022-08-15 20:48:34 +02:00
Dimitry Andric
06fce030e7 Adjust function definition in aim_machdep.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/aim_machdep.c:750:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mpc745x_sleep()
                 ^
                  void

This is because mpc745x_sleep() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after:	3 days
2022-08-15 20:48:34 +02:00
Dimitry Andric
b33bfe6e15 Fix unused variable warnings in tcp_hpts.c
With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_hpts.c:1114:10: error: variable 'paced_cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int32_t paced_cnt = 0;
                    ^
    sys/netinet/tcp_hpts.c:1112:11: error: variable 'total_slots_processed' set but not used [-Werror,-Wunused-but-set-variable]
            uint64_t total_slots_processed = 0;
                     ^

The 'paced_cnt' variable was in tcp_hpts.c when it was first added, and
the 'total_slots_processed' variable was added in d7955cc0ff, but
both appear to have been debugging aids that have never been used, so
remove them.

MFC after:	3 days
2022-08-15 20:48:34 +02:00
Dimitry Andric
db6b32867d Adjust function definition in tcp_hpts.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_hpts.c:1594:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    tcp_choose_hpts_to_run()
                          ^
                           void

This is because tcp_choose_hpts_to_run() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after:	3 days
2022-08-15 20:48:33 +02:00
Dimitry Andric
9407408915 Adjust function definition in arm64's db_trace.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/arm64/arm64/db_trace.c:53:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    db_md_list_watchpoints()
                          ^
                           void

This is because db_md_list_watchpoints() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after:	3 days
2022-08-15 20:48:33 +02:00
Dimitry Andric
402dbdd98a Adjust function definition in arm's mv_common.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/arm/mv/mv_common.c:414:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mv_check_soc_family()
                       ^
                        void

This is because mv_check_soc_family() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-15 20:48:33 +02:00
En-Wei Wu
c0b65123d0 wtap: Implement IBSS mode on wtap(4)
For TSF and beacon generation, each STA has to start its local TSF timer
and sends beacon frames when it reaches the state IEEE80211_S_RUN.
The TSF timer will be used for IBSS merge and beacon frame transmission.

The TSF timer is kept in the HAL of wtap(4). It is working by
continuously updating its value on timer interrupt simulated
by callout_reset().

When receiving beacons, the STA will be merged into the IBSS if
- the STA has the same SSID as the beacon sender
- the STA's TSF timer is smaller than the beacon sender's TSF timer.

After the merging process, the younger STA will be in the IBSS
created by the older STA and the younger STA stops sending beacon
frames.  So beacon frames will always be sent by the oldest STA
in IBSS.

Sponsored by:	Google, Inc. (GSoC 2022)
Reviewed By:	lwhsu, adrian
Differential Revision: https://reviews.freebsd.org/D35841
2022-08-15 16:35:36 +00:00
Konstantin Belousov
c9e4d25052 iommu_gas: add iommu_gas_remove()
The function removes the range of addresses from GAS.  Right now it is
unused.

The initial version of the patch was extracted from the stalled work for
integration of DMAR and bhyve, see D25672. Having the function in the
main tree would allow it to co-evolve with other active changes to the
IOMMU driver.

Requested by:	alc
Reviewed by:	alc, dougm
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36001
2022-08-15 17:54:57 +03:00
Søren Schmidt
530d5f8338 Add RockChip RK356X support to existing RockChip iodomain driver. 2022-08-15 12:03:28 +00:00
Wei Hu
fa2d4a22fa mana: add rmb load fence to comply with hw spec
To ensure software reads fresh data after observing ownership bits.

Sponsored by:	Microsoft
2022-08-15 07:39:15 +00:00
Wei Hu
795a997414 Hyper-V: storvsc: Call bus_dmamap_sync() for dma operations
Call bus_dmamap_sync() for related dma operations. This is required
on ARM64 architecture.

Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
MFC after:	2 weeks
Sponsored by:	Microsoft
2022-08-15 07:05:43 +00:00
Alexander V. Chernikov
036f1bc613 routing: retire rib_lookup_info()
This function was added in pre-epoch era ( 9a1b64d5a0 ) to
 provide public rtentry access interface & hide rtentry internals.
The implementation is based on the large on-stack copying and
 refcounting of the referenced objects (ifa/ifp).
It has become obsolete after epoch & nexthop introduction. Convert
 the last remaining user and remove the function itself.

Differential Revision: https://reviews.freebsd.org/D36197
2022-08-15 06:46:30 +00:00
Dimitry Andric
57cdd13d07 Suppress unused variable warning in tcp_stacks's rack.c
With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_stacks/rack.c:17405:12: error: variable 'outstanding' set but not used [-Werror,-Wunused-but-set-variable]
                    uint32_t outstanding;
                             ^

The 'outstanding' variable was used later in the rack_output() function,
but refactoring in 35c7bb3407 removed the usage. To avoid too much
code churn, mark the variable unused to supress the warning.

MFC after:	3 days
2022-08-14 21:27:35 +02:00
Dimitry Andric
e967183cb0 Fix unused variable warning in tcp_stacks's rack.c
With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_stacks/rack.c:16148:6: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt_thru = 1;
                ^

The 'cnt_thru' variable is only used when TCP_ACCOUNTING is defined.
Ensure it is only declared and set in that case.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
7624896571 Fix unused variable warning in tcp_stacks's bbr.c
With clang 15, the following -Werror warning is produced:

sys/netinet/tcp_stacks/bbr.c:11925:11: error: variable 'rtr_cnt' set but not used [-Werror,-Wunused-but-set-variable]
        uint32_t rtr_cnt = 0;
                 ^

The 'rtr_cnt' variable was in bbr.c when it was first added, but it
appears to have been a debugging aid that has never been used, so remove
it.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
9762d48b7f Adjust function definition in kern_poll.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/kern/kern_poll.c:374:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    netisr_pollmore()
                   ^
                    void

This is because netisr_pollmore() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
7a7bbe1021 Adjust function definition in drm_fb_helper.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/drm2/drm_fb_helper.c:86:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    framebuffer_alloc()
                     ^
                      void

This is because framebuffer_alloc() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
0beb88a242 Adjust function definition in riscv's dtrace_subr.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/riscv/dtrace_subr.c:165:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
7701f30159 Adjust function definition in powerpc's dtrace_subr.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/powerpc/dtrace_subr.c:237:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
7357c2e5a6 Adjust function definition in arm's dtrace_subr.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/arm/dtrace_subr.c:174:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Dimitry Andric
0fe8ab6851 Fix unused variable warning in rockchip's rk_spi.c
With clang 15, the following -Werror warning is produced:

    sys/arm64/rockchip/rk_spi.c:229:6: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt = 0;
                ^

The 'cnt' variable was in rk_spi.c when it was first added, but it
appears to have been a debugging aid that has never been used, so remove
it.

MFC after:	3 days
2022-08-14 21:27:34 +02:00
Jessica Clarke
762dcf1064 goldfish_rtc: Fix handling a local time RTC
The default QEMU config is to have the RTC in UTC. However, if run with
-rtc base=localtime (and wall_cmos_clock is set to match), the driver
fails to account for adjkerntz due to the use of CLOCKF_SETTIME_NO_ADJ.
Copy the same code used by other CLOCKF_SETTIME_NO_ADJ-using drivers
to fix this, namely manually subtracting utc_offset().

Fixes:		d63a631e72 ("Add Goldfish RTC device driver for RISC-V")
MFC after:	1 week
2022-08-14 19:50:22 +01:00
Adrian Chadd
2889cbe29e net80211: add an IEEE80211_IS_PROTECTED() macro
Summary: This returns whether the given 802.11 frame has the protected bit set.

Test Plan:
* tested in AP/STA mode
* STA mode - local athp/ath10k driver
* AP mode - in tree ath driver

Subscribers: imp, melifaro, glebius
Reviewed by: bz
Approved by: bz

Differential Revision: https://reviews.freebsd.org/D36183
2022-08-14 09:48:06 -07:00
Dimitry Andric
6e62d9a5a5 gpio: mark more INVARIANTS variables as __diagused
Mark another set of variables that are only used in INVARIANTS builds,
which otherwise result in set-but-not-used warnings.

Fixes:		7dc4d5118c
MFC after:	3 days
2022-08-14 14:12:42 +02:00
Alexander V. Chernikov
a4b8c6d9d5 netlink: add AF_NETLINK / PF_NETLINK definitions
Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D36174
MFC after:	1 weeks
2022-08-14 09:22:33 +00:00
Alexander V. Chernikov
9b967bd65d domains: allow domains to be unloaded
Add domain_remove() SYSUNINT callback that removes the domain
 from the domain list if it has DOMF_UNLOADABLE flag set.
This change is required to support netlink ( D36002 ).

Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D36173
2022-08-14 09:22:33 +00:00
Martin Matuska
271171e0d9 zfs: merge openzfs/zfs@b3d0568cf
Notable upstream pull request merges:
  #9372 Implement a new type of zfs receive: corrective receive (-c)
  #13635 Add snapshots_changed as property
  #13636 Add support for per dataset zil stats and use wmsum counters
  #13643 Fix scrub resume from newly created hole
  #13670 Fix memory allocation for the checksum benchmark
  #13695 Skip checksum benchmarks on systems with slow cpu
  #13711 zpool: fix redundancy check after vdev removal

Obtained from:	OpenZFS
OpenZFS commit:	b3d0568cfd
2022-08-14 01:14:21 +02:00
Colin Percival
02ab915ae0 lapic_init: Reduce LOOPS
While I'm here, instrument lapic_init with TSLOG so it shows up (or
typically not, after this change) on flamecharts.

Reviewed by:	kib
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36186
2022-08-13 15:28:09 -07:00
Andrew Gallatin
2c6ff1d632 LRO: fix BPF filters for lagg in the hpts path
When in the hpts path, we need to handle BPF filters since aggregated
packets do not pass up the stack in the normal way. This is already
done for most interfaces, but lagg needs special handling. This is
because packets received via a lagg are passed up the stack with
the leaf interface's ifp stored in m_pkthdr.rcvif.

To handle lagg packets, we must identify that the passed rcvif is
currently a lagg port by checking for IFT_IEEE8023ADLAG or
IFT_INFINIBANDLAG (since lagg changes the lagg port's type to that
when an interface becomes a lagg member). Then we need to find the
lagg's ifp, and handle any BPF listeners on the lagg.

Note: It is possible to have multiple BPF filters, one on a member
port and one on the lagg itself. That is why we have to have 2
checks and 2 ETHER_BPF_MTAPs.

Reviewed by: jhb, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36136
2022-08-13 17:33:36 -04:00
Kirk McKusick
6b9d4fbb7f Explicitly initialize rather than reading newly allocated UFS inodes.
The function ffs_vgetf() is used to find or load UFS inodes into a
vnode. It first looks up the inode and if found in the cache its
vnode is returned. If it is not already in the cache, a new vnode
is allocated and its associated inode read in from the disk. The
read is done even for inodes that are being initially created.
The contents for the inode on the disk are assumed to be empty. If
the on-disk contents had been corrupted either due to a hardware
glitch or an agent deliberately trying to exploit the system, the
UFS code could panic from the unexpected partially-allocated inode.

Rather then having fsck_ffs(8) verify that all unallocated inodes
are properly empty, it is easier and quicker to add a flag to
ffs_vgetf() to indicate that the request is for a newly allocated
inode. When set, the disk read is skipped and the inode is set to
its expected empty (zero'ed out) initial state. As a side benefit,
an unneeded disk I/O is avoided.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-13 13:51:25 -07:00
Kirk McKusick
e688661642 Move the ability to search for alternate UFS superblocks from fsck_ffs(8)
into ffs_sbsearch() to allow use by other parts of the system.

Historically only fsck_ffs(8), the UFS filesystem checker, had code
to track down and use alternate UFS superblocks. Since fsdb(8) used
much of the fsck_ffs(8) implementation it had some ability to track
down alternate superblocks.

This change extracts the code to track down alternate superblocks
from fsck_ffs(8) and puts it into a new function ffs_sbsearch() in
sys/ufs/ffs/ffs_subr.c. Like ffs_sbget() and ffs_sbput() also found
in ffs_subr.c, these functions can be used directly by the kernel
subsystems. Additionally they are exported to the UFS library,
libufs(8) so that they can be used by user-level programs. The new
functions added to libufs(8) are sbfind(3) that is an alternative
to sbread(3) and sbsearch(3) that is an alternative to sbget(3).
See their manual pages for further details.

The utilities that have been changed to search for superblocks are
dumpfs(8), fsdb(8), ffsinfo(8), and fsck_ffs(8). Also, the prtblknos(8)
tool found in tools/diag/prtblknos searches for superblocks.

The UFS specific mount code uses the superblock search interface
when mounting the root filesystem and when the administrator doing
a mount(8) command specifies the force flag (-f). The standalone UFS
boot code (found in stand/libsa/ufs.c) uses the superblock search
code in the hope of being able to get the system up and running so
that fsck_ffs(8) can be used to get the filesystem cleaned up.

The following utilities have not been changed to search for
superblocks: clri(8), tunefs(8), snapinfo(8), fstyp(8), quot(8),
dump(8), fsirand(8), growfs(8), quotacheck(8), gjournal(8), and
glabel(8). When these utilities fail, they do report the cause of
the failure. The one exception is the tasting code used to try and
figure what a given disk contains. The tasting code will remain
silent so as not to put out a slew of messages as it trying to taste
every new mass storage device that shows up.

Reviewed by: kib
Reviewed by: Warner Losh
Tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D36053
Sponsored by: The FreeBSD Foundation
2022-08-13 12:43:40 -07:00
Warner Losh
4e2a0135a0 mrsas module: Use MACHINE_ARCH exlcusively
TARGET_ARCH is always wrong when not used at the toplevel Makefile*, or
in something that has to be included from there. Switch to using
MACHINE_ARCH exclusively here since there's no benefit from assigning
TARGET_ARCH the value of MACHINE_ARCH and then using TARGET_ARCH (and
make TARGET_ARCH=xxx won't work).

Sponsored by:		Netflix
2022-08-13 11:56:53 -06:00
Warner Losh
4f0c9b76cf stand: Only compile decompression routines
We don't need the compress rotuines, nor zstd_opt.c. Remove them.
Expand the number of places we omit code for IN_LIBSA (which are FreeBSD
specific). Due to the agressive optimization, though, this doesn't
reduce the size of the loader. It does reduce the number of 'false
positives' for places to omit to reduce the size as well as reducing the
build time slightly.

Sponsored by:		Netflix
Reviewed by:		tsoome, delphij
Differential Revision:	https://reviews.freebsd.org/D36145
2022-08-12 21:48:18 -06:00
Warner Losh
1482113008 stand: Compile out the extensive superblock diagnostic messages for BIOS loader
The BIOS loader operates in a very constrained environment. The messages
for the super block integrity tests take up about 12k of space. Compile
them out for the BIOS loader, while leaving it intact for all other
loaders that aren't space constrained. These aren't used in the 'super
tiny' *boot* programs, so no adjustment is needed there.

We reply on the fact that (a) i386 doesn't support 32-bit UEFI booting
and (b) LIBSA_CPUARCH is "i386" when building on both i386 and when
we're building the 32-bit libsa32 library.

This saves about 12k of space for this constrained envrionment and will
take a bit of the pressure off some machines where the loader has grown
too big for their BIOS (see comments in i386/loader/Makefile for
details).

Sponsored by:		Netflix
Reviewed by:		mckusick
Differential Revision:	https://reviews.freebsd.org/D36175
2022-08-12 21:48:17 -06:00
Colin Percival
b9fd884a8d sys/vm: Add TSLOG to some functions
The functions pbuf_init, kva_alloc, and keg_alloc_slab are significant
contributors to the kernel boot time when FreeBSD boots inside the
Firecracker VMM.  Instrument them so they show up on flamecharts.
2022-08-12 16:53:04 -07:00