When compiling vchiq with clang 21, the following -Werror warning is
produced:
sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c:728:27: error: default initialization of an object of type 'VCHIQ_QUEUE_MESSAGE32_T' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
728 | VCHIQ_QUEUE_MESSAGE32_T args32;
| ^
sys/contrib/vchiq/interface/vchiq_arm/vchiq_ioctl.h:151:40: note: member 'elements' declared 'const' here
151 | const /*VCHIQ_ELEMENT_T * */ uint32_t elements;
| ^
While the warning is formally correct, the 'args32' object is
immediately initialized after its declaration. Therefore, suppress the
warning.
MFC after: 3 days
There are delay loops, checking the BUSY status bit, before writing to
the date or time registers. Each iteration contains a 1usec delay, for a
maximum of 70 iterations.
This is frequently not enough on the D1 platform, where the message is
emitted:
rtc0: could not set date, RTC busy
Bump the loop delay to 10usecs each, and the maximum number of
iterations to 150, for a maximum delay of 1.5msecs between each write of
the register.
In my testing this seems to be adequate.
The loop variable is renamed for clarity/simplicity.
Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54180
Define _ALIGNBYTES using sizeof(void *) (no functional change on any
existing architecture) which will allow it to work with CHERI were we
must align things up to capability alignment.
In _ALIGN, replace integer manipulation which does not preserve pointer
provenance with a type and provenance preserving builtin. This requires
modest changes in code which assumes _ALIGN returns an integer, but
those are relatively rare.
Reviewed by: kib, markj
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D53947
The wrapper functions such as bus_alloc_resource_any() still support
passing the rid by value or pointer, but the underlying implementation
now passes by value.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53402
The platform-dependent macros are added to the various
_stdint.h headers, those that are always the same are
added directly to _stdint.h.
We may want to move the definitions for WCHAR_* and
WINT_* out of the platform header files as those are
always the same.
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53830
For compliance with IOS/IEC 9899:2024 ("C23").
These macros define the width in bits of the basic integer types.
Another new macro, BITINT_MAXWIDTH, is not yet included as I do not
understand what it should be set to. Perhaps it is compiler-specific.
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53825
Removed unused dbg_didr which had been used prior to f42421307b to
detect qemu unsupported debugger. I'm unsure how this slipped through my
testing.
Fixes: f42421307b
Sponsored by: Netflix
Realtek changed how it styled its name 25 or so years ago, but the old
style persisted in many places. These products use the new styling in
their datasheets.
Signed-off-by: ykla yklaxds@gmail.com
Sponsored by: Chinese FreeBSD Community
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1901
Do not create mutexes with snd_mtxcreate(). It doesn't provide any
value, plus it first allocates the mutex with malloc(9). Allocate
mutexes in the stack and use mtx_* functions directly instead of the
snd_mtx* wrappers.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D53855
Add 64 bit support to vchiq:
* update fields to the appropriate fixed bit-size variants (everywhere [cf. e.g., ref:sizes and ref:sizes2])
* refer to event semaphores (that go into the very 32 bit VC) by offset instead of pointers [ref:sems]
* dsb() is dsb(sy) in arm64 (vchiq_{core.c,core.h,kmod.c}) [ref:dsb]
* comment out some unneeded code in parse_rx_slots around VCHIQ_MSG_BULK_RX (cf. [ref:deadcode])
* adapt remote_event_signal to arm64 caching behaviours (vchiq_kmod.c)
* refactor synchronization around remote_event_signal, forcing a wmb to be on the safe side; thereby make it look more like what linux does [ref:sync] (vchiq_{core,kmod}.c); and make a comment in vchiq_core.c true (wasn't before)
* add a few more syncs to be on the safe side (vchiq_2835_arm.c)
* use arm64 dcache invalidation mechanisms (vchiq_2835_arm.c)
* explicitly invalidate pages on arm64 post bulk-read (vchiq_2835_arm.c)
* support bulk transfers on rpi-4 (aka "long address space" transfers), by hard-coding their vc offset (0) and different bit-shift [ref:longbulk] (vchiq_2835_arm.c)
* refactor a loop-of-constant-test (vchiq_2835_arm.c)
* use the correct (hard-coded) cache-line size on arm64
* rework the handling of chipset "features" to account for the extra behaviours with 64 bit chipsets. (vchiq_kmod.c)
* add sysctl-s (log, arm_log) to control debug (vchiq_kmod.c)
* add example kernel config (GENERIC-VCHIQ)
Fixes:
* Rework error handling in create_pagelist, avoiding a potential panic when
freeing memory that had been dmamem_alloc, a potential null dereference,
and a leak when having problems pinning pages (vchiq_2835_arm.c)
* fix a confusion about the behaviour cv_wait_sig that lead to
uninterruptible looping (vchiq_bsd.c)
* implement detection of fatal signals (vchiq_bsd.c)
* fix a confusion with the name of a variable introduced by #a0b8746
that could lead to a panic when closing the cdev file (vchiq_arm.c)
* release user connection when destructing cdevpriv and avoid user processes
sharing connection data, which lead to stalls and data corruption. (vchiq_arm.c)
Update bcm2835_audio to work on 64bit systems:
* update VC audio fields (vc_vchi_audioserv_defs.h, bcm2835_audio.c)
* repurpose the hitherto unused callback field to help push a 64 bit pointer in (bcm2835_audio.c)
* increase (hopefully) the robustness of the code that shifts data to VC (bcm2835_audio.c)
* add a sysctl to control the amount of debugging info output by bcm2835_audio.c
Tested on zero, zero2 and 4+ with ping, functional, bulk and control vchiq_test-s, and omxplayer
[ref:dsb]: 35b7ebda57
[ref:sems]: 24a4262afb
[ref:sizes]: e64568b8ea
[ref:sizes2]: f9bee6dd24
[ref:deadcode]: 14f4d72fb7
[ref:sync]: 51c0712650
[ref:longbulk]: 37f6f19a83
Differential Revision: https://reviews.freebsd.org/D37878
Submitted by: Marco Devesas Campos <devesas.campos@gmail.com>
* Enable RANDOM_ENABLE_TPM by default
* The commit of TPM_HARVEST failed to add it to NOTES
so that the LINT kernel would build the code.
Fixes: 4ee7d3b011
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53460
* Create macros for error, info, warn, trace / debug
* Migrate existing printf() logging to use the above macros
* Add a sysctl knob to control it at runtime
This is based on work done in https://reviews.freebsd.org/D37878 .
Submitted by: Marco Devesas Campos <devesas.campos@gmail.com>
Differential Revision: https://reviews.freebsd.org/D53371
kexec hasn't been ported to these architectures, yet, so appease the
build with dummy headers.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D51625
We have provided implementations for hard float of these for
a while now. Add them to the header to make things official.
This is required for a bunch of legacy programs in ports.
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53156
While here, standardize the place they are enabled in the Makefile. For
armv7 the module subdirectory was added explicitly in the config file,
but this is not idiomatic.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Implement bus_setup_intr and bus_teardown_intr as bus_generic_setup_intr
and bus_generic_teardown_intr respectively for GPIO drivers that support
interrupts. This allows children to setup interrupts.
Reported by: Evgenii Ivanov <devivanov@proton.me>
Reviewed by: imp
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D52197
When FEAT_ECV is implemented on arm64 a Self-Synchronized view of the
counter registers are available. These don't need an isb before reading
the count as they are not able to be speculatively executed.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51820
When a feature is disabled we may need to run a cleanup handler, e.g.
to remove a feature from the sanitized ID registers. Add support for
this with a new feat_disabled handler.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D52577
The check was always true so would incorrectly enable the feature when
it wasn't supported.
Due to another bug this was harmless.
Sponsored by: Arm Ltd
Fix the comment introducing the 'wlan_*' devices (AES-CCMP is missing)
after introducing AES-GCMP.
While here, re-order the devices in order of appearance of the related
technologies.
No functional change (intended).
Reviewed by: adrian, emaste
Fixes: 7bf82ea4fd ("sys: add wlan_gcmp to GENERIC kernels as appropriate")
MFC after: 3 days
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52444
Allow the user to enable/disable supported cpu features/errata from a
known tunable. This will allow the user to disable features, e.g. to
work around broken firmware. It can also be used to enable workarounds
for rare errata.
Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D52358
This will also be used as a tunable to control features in a later
change.
Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D52357
This will be used later to extend cpu feature detection
Reviewed by: imp (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D52356
While FIDO/U2F keys were already supported by the generic uhid(4) and
hidraw(4) drivers, this driver adds some additional features an does
steps to tighten the security of FIDO/U2F access.
- It automatically loads through devd.
- Automatically enables HQ_NO_READAHEAD for FIDO/U2F devices.
- Implements only miminum set of features.
- Do not requires external devfs configuration to set character device
permissions.
- Names character device as u2f/# to make possible capsicum or any
other pledge()-style sandboxing.
PR: 265528
Differential Revision: https://reviews.freebsd.org/D51612
Since gpiobus_attach_bus can attach the gpiobus child along with its
children in the same bus pass, the parent controller's reference to
gpiobus might not be set by the time the children need it. Instead,
drivers should use gpiobus_add_bus and explicitly call
bus_attach_children.
Reviewed by: mmel, imp (older version)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D51578