fdt: Support SCMI shared memory under reserved-memory nodes
Add a simplebus-based pseudo-bus that matches the "reserved-memory"
node in the device tree. Update the SCMI shared memory driver so that
it can attach either as a child of mmio_sram or directly under
simplebus (via the new reserved-memory bus). Make the mmio_sram memory
resource shareable so both attachment methods can coexist when required.
MFC after: 1 week
Reviewed by: manu
if_bnxt: add support for HW generic stats
HW generic stats provide information about PCIe transactions and
out-of-order doorbell writes, useful for debug. Allocate a DMA buffer
for them (disabling BNXT_FW_CAP_GENERIC_STATS if the allocation
fails), fetch them via HWRM_STAT_GENERIC_QSTATS once per admin-status
tick on P5+ chips, and expose them to userspace under
dev.bnxt.<unit>.hwstats.generic_stats.* via sysctl.
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D58614
(cherry picked from commit d1619865da1cd4c5b557158b4bbf666e0f7f040b)
if_bnxt: avoid FTQM/STQM pg_info alias on reset
Copying the STQM backing-store context to seed FTQM's also copied
STQM's pg_info pointer verbatim. On cold load STQM's pg_info is still
NULL so this is harmless, but on a firmware reset STQM's pg_info is
already non-NULL, making FTQM alias STQM's backing-store pages. The
allocator then skips FTQM since it looks already allocated, and FTQM
is later indexed as its own array, reading out of bounds into STQM's
buffer and dereferencing a bogus DMA address.
Clear ctxm->pg_info after the memcpy so FTQM always gets its own
backing store.
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D58615
(cherry picked from commit f2ce672ade231a1e19f1238922a2c3b6fe696e22)
if_bnxt: add support for SIOCGI2CPB page/bank i2c requests
Advertise IFLIB_I2C_PAGE_BANK and forward the requested page/bank to
firmware, so CMIS optics can be read correctly instead of falling
back to bogus legacy SFF-8472 decoding. Also fix bnxt_i2c_req() to
return positive errno values.
Signed-off-by: gallatin
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D59573
(cherry picked from commit fdab50f6f8107c9d825a7e6d92d7a6b89c417bbb)
bnxt_en: dcb: stop zeroing ETS and PFC config in bnxt_dcb_init()
bnxt_dcb_init() currently pushes all-zero ETS and PFC settings to
the firmware at every attach. This reserves bandwidth allocation
for RoCE traffic, which prevents L2 traffic from reaching line rate.
These settings should only be updated with valid values when the
RoCE driver is loaded. Therefore, we should stop programming them
during bnxt_dcb_init().
Signed-off-by: Andy Gospodarek <gospo at broadcom.com>
Reviewed by: chandrakanth.patil_broadcom.com, gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D60516
(cherry picked from commit 31cbd8f27d687ce9b10a22c858296532be400bb4)
if_bnxt: Fix interrupt storm on Thor2
An interrupt storm was observed on Thor2 because the Rx CQ consumer
index was always one less than it should be. Correct the Rx CQ
consumer index to fix the storm.
Reported by: gallatin
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Broadcom Inc.
Differential Revision: https://reviews.freebsd.org/D58602
(cherry picked from commit 8c69a5dc60b3630a4c5bca0bda714f791324afad)
nuageinit: fix support on OpenStack
Change added in 90a7728cd8905cd26b90d06f7873df8bad43ae9a contained a
lot of bugs:
- If all network interfaces correctly respond to DHCP, then pwait was
waiting forever.
- If there was more than 1 interface, then "cat
/tmp/ephemeraldhcp.*.pid" joined pid numbers into one long string.
- "for iface in $left; do kill -15 $left; done" is not using $iface.
Tested by: adam.mizerski at ovhcloud.com
Sponsored by: OVHcloud
Pull Request: https://github.com/freebsd/freebsd-src/pull/2436
(cherry picked from commit 13d5f20e5b9ecb42ecf7de4e98d5af0bd5d63c82)
LinuxKPI: Add dma_length field to struct scatterlist
On Linux `dma_length` field of `struct scatterlist` is present on the
arches where DMA mapping code is able to coalesce adjacent segments
of physical address space. It contains total length of coalesced
segments while `length` field contains non-coalesced length of each
segment. On other arches `dma_length` is aliased to `length` field with
`sg_dma_len` macro. As FreeBSD does not merge scatterlist segments it
do not have `dma_length` field. It is appered that at least i915kms
driver depends on existence of `dma_length` field.
Add the field and disable it by default. To enable add to Makefile
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || \\
${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "powerpc"
CFLAGS+= -DCONFIG_NEED_SG_DMA_LENGTH
.endif
Reported by: Ryan Fahy
[6 lines not shown]
linuxkpi: Fix cancel_delayed_work_sync() return value
Align behavior between the Linux cancel_delayed_work_sync()
function return value and the LinuxKPI equivalent.
Linux cancel_delayed_work_sync() returns whether delayed
work was pending, even if canceled before executing. This
includes the case where the timer fired and work was queued
but the callback had not yet started.
The LinuxKPI version used the return value from taskqueue_cancel()
as the return value of the public facing API, which inverted the
behavior of two cases, violating the Linux API contract.
Queued work which was removed before running would return false, and
work whose callback was already executing would return true.
Track the taskqueue pending count separately from the
taskqueue_cancel() return value.
Use the pending count for the public return value.
[13 lines not shown]
hid: Add Sony DualSense gamepad driver
Add a driver for the Sony PS5 DualSense controller (054c:0ce6)
providing gamepad input via evdev, lightbar RGB LED control, and
player indicator LEDs through sysctl.
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Reviewed by: ziaee, wulf
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D56345
(cherry picked from commit d8e315ba975163a2050dd3d3e193f2472dbc2478)
15.2: Update stable/15 to -PRERELEASE
This marks the start of the FreeBSD 15.2 release cycle; the stable/15
tree is now in "code slush".
Developers are encouraged to prioritize fixing bugs (and/or merging bug
fixes from HEAD) over new features at this time. Commit approval from
re@ is not required but if new features introduce problems they may be
removed from the release.
Approved by: re (implicit)
Sponsored by: OpenSats Initiative
nvme: Fix default is_storage_device kobj method
makeobjops.awk only accepts an uppercase DEFAULT before a default kobj
method. This commit fixes a typo introduced in 949804c81909 so non-PCI
drivers actually use nvme_is_storage_device_default instead of
kobj_error_method. Note that even though kobj_error_method returns
ENXIO (6), it does not get implicitly cast to a bool due to the function
pointer casting in the nvme_if.h generated by makeobjops. Instead the
codegen for the NVME_IS_STORAGE_DEVICE callsite shows that only the
lowest bit is being checked as if it were always a bool. Without this
any nvme driver that doesn't implement is_storage_device is not treated
as a storage device.
Reviewed by: imp, kevans
Differential Revision: https://reviews.freebsd.org/D60112
netipsec: Fix V_spd_size updates
key_unregister_ifnet() was erroneously decrementing the size of the
global security policy database, V_sptree, but it doesn't modify that
database. V_sptree_ifnet is for policies attached to if_ipsec
interfaces. Note also that key_register_ifnet() was not incrementing
the counter.
Move the definition of V_spd_size up to the rest of the SPD definitions.
Its inclusion among the SPD cache definitions was confusing to me.
Reviewed by: ae
Reported by: Stephan de Wit and Cedrik Pischem from OPNsense
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60418
(cherry picked from commit 6b1d5fec57f9604a447864ec5e66940126b38df4)
gve: fix kernel panic on attach failure
When device initialization fails during attach (for instance, if device
resource configuration or firmware negotiation fails), the driver aborts
and unrolls partial state via its detach routine. However, the teardown
path assumes transmit and receive queues have already been created. If
attach aborts before queue allocation, tearing down the uninitialized
queues triggers a NULL pointer dereference and panics the kernel during
boot.
Guard queue teardown against uninitialized queue state so that early
attach failures unwind safely, allowing the driver to report the failure
gracefully without crashing the operating system.
Signed-off-by: Jasper Tran O'Leary <jtranoleary at google.com>
Reviewed by: adrian, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60385
[2 lines not shown]
amd64/vmm: Don't advertise support for performance counters
vmm doesn't implement them, and after commit 2272fac218a8
("hwpmc: Add support for AMD-only IRPERF in hwpmc PERF class"), FreeBSD
guests fail to boot since they access the unimplemented IRPERF MSR.
MFC after: 1 week
(cherry picked from commit c83e075d72f62c91cb27dd644a62d6a6f5bd56ba)
gve: fix double free on ring allocation failure
When gve_alloc_rings fails (such as when failing to acquire MSI-X
vectors or during partial ring allocation), ring cleanup can be
executed multiple times across nested error paths (e.g. within
gve_alloc_rings abort and gve_attach abort).
Because gve_free_counters invoked counter_u64_free without nullifying
the pointer in the stats array, repeated invocation caused a double-free
panic when freeing the same counter references.
Check for non-NULL before freeing and nullify each counter pointer
upon release in gve_free_counters.
Signed-off-by: Jasper Tran O'Leary <jtranoleary at google.com>
Reviewed by: adrian, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D60386
[2 lines not shown]
epair: Make vnet_epair_uninit() run earlier
I can't see a reason for vnet_epair_init() and vnet_epair_uninit() to be
inconsistent in the sys(un)init run order. Move vnet_epair_uninit() to
SI_SUB_PSEUDO, which is more appropriate for software ifnet drivers.
Reviewed by: glebius
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60388
(cherry picked from commit 5c20c75b67e3c96d58c1bbfe82472a8371bfa161)
sysctl: Return ECAPMODE when trying to access sysctls in capability mode
We have always returned EPERM in this case, but it's incorrect, we
should return ECAPMODE for capability mode violations. Fix the errno
value.
Reviewed by: emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D59887
(cherry picked from commit a76e986470f86731dd3a5f9eeae1ba28b8b160fb)
dtrace/arm64: Fix copyout and copyoutstr
Calling dtrace_copy and dtrace_copystr with the kaddr and uaddr
arguments inversed does not work with PAN. Rename them
dtrace_copyin_pan and dtrace_copyinstr_pan, respectively, and
implement dtrace_copyout_pan and dtrace_copyoutstr_pan.
Avoid excessive faulting by checkin DTrace's CPU flags. Implement the
trick from OpenSolaris/Illumos of only checking the flags when
crossing into a new page, altough more effectively by examining the
vaddr instead of the count.
Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D59449
(cherry picked from commit a6deeaa2fb3b28a61ae56a85f2275f67fcf23262)
icmp: Limit routing table updates to the FIB of the redirect
When we receive an ICMP redirect, rib_add_redirect() is used to apply
the redirect to all FIBs. This has been the case since support for
multiple FIBs was added. However, it seems rather dubious: the new
gateway might not be routable from all FIBs, and the validation done for
v4 redirects in icmp_verify_redirect_gateway() is only applied to the
FIB from which the redirect originated.
Modify the handler to apply the redirect only in the originating FIB.
Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by: pouria, zlei, glebius, melifaro
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59567
(cherry picked from commit 01a95394abfdef2adb3216e74d88b9c33321260e)
inotify.2: Add some entries to the BUGS section
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit fa6fe034a73c8b17320d1e68767ad2aa99eaa8bf)