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]: https://github.com/raspberrypi/linux/commit/35b7ebda57affcfd3616d39d5a727a4495b31123
[ref:sems]: https://github.com/raspberrypi/linux/commit/24a4262afb10907fce3cdbc3ae336fcf4cdaece5
[ref:sizes]: https://github.com/raspberrypi/linux/commit/e64568b8ea6c04e747e432c17ce2452652075216
[ref:sizes2]: https://github.com/raspberrypi/linux/commit/f9bee6dd24addfa00c2c8d50c25b73efbfbb28ba
[ref:deadcode]: https://github.com/raspberrypi/linux/commit/14f4d72fb799a9b3170a45ab80d4a3ddad541960
[ref:sync]: https://github.com/raspberrypi/linux/commit/51c071265079319583e4c6e8c61e09660300d0bf
[ref:longbulk]: https://github.com/raspberrypi/linux/commit/37f6f19a83722c9b866cecb5e455b2e16e5bbc6b
Differential Revision: https://reviews.freebsd.org/D37878
Submitted by: Marco Devesas Campos <devesas.campos@gmail.com>
We need to preserve modification times on bootstrap tools, but `cp -p`
also tries to preserve flags, which fails if OBJROOT is on NFS. A -N
option was added to cp for this purpose, but trying to use that would
break cross-building on hosts that don't have that option. The best
remaining option is `install -p`, which we already assume is present.
PR: 275030
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D53751
The change can introduce a deadlock if we release the vnode lock in
order to release a reference, and then end up releasing the final
reference after all, requiring a relock of the vnode. This relock may
violate the usual parent->child vnode lock order.
This reverts commit 99cb3dca47.
Reported by: jhb
The intention was clearly that these ACPI bits would be included for
arm64, but MACHINE_ARCH there is aarch64 -- correct the minor typo to
build everything that should be there.
Fixes: c2e9c5bbf0 ("tpm: Refactor TIS and add a SPI attachment")
Some TPM implementations have a different start method that requires
an additional notification for some state changes; for instance, the
"Pluton" start method. Just factor these transitions out for now, and
the coming commits will introduce points that the start method can hook
in at.
Reviewed by: obrien
Differential Revision: https://reviews.freebsd.org/D53682
Rather than superscript <sup>, for a nicer looking list.
Reviewed by: vexeduxr
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53000
A stupid microoptimization I made leaving empty STAILQ inconsistent
is a brainfart that is related to much earlier version of this code,
where it was safe to do so.
Pointy hat to: glebius
Fixes: 69f61cee2e
Begin documenting module loader commands in loader(8), where the reader
would look for them. Segregate them by their availability in individual
loader implementations, like build(7) targets.
These details were graciously donated by kevans.
MFC after: 3 days
Reviewed by: kevans
Co-authored-by: Kyle Evans <kevans@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D50727
console=comconsole is for the loader and boot_serial is for the kernel.
I think we should centralize documentation on the loader settings in one
manual, such a loader.8. The current proliferation is not obvious where
to find the documentation. To the user, these are all set in loader.conf
or at the loader prompt.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53695
Historically, lam(1) closes stdin once we've hit EOF the first time,
which would stop it from doing anything else on subsequent gatherline()
calls with another openfile. However, this doesn't seem to be strictly
necessary- the EOF flag on FILEs is quite sticky, so we can assume that
a subsequent fgetc(stdin) will flag EOF properly.
This 'fixes' the below-referenced commit in the sense that it surfaced
this problem as a fatal error, but the issue was pre-existing. If we
do `lam - -`, then one gatherline() will fclose(stdin) and set `ip->eof`
for *that* openfile, while the next one will then observe that
STDIN_FILENO has been closed and turn it into an EBADF.
Add a few tests that were easy to snipe while I'm here, but I haven't
aimed for anything close to exhaustive because I think re@ would prefer
this fix go in sooner rather than later to land in 15.0.
Minor style adjustment for the previous commit while we're here.
Reported by: cperciva
Discussed with: jrtc27
Reviewed by: des, jlduran
Fixes: 4472fd66d0 ("lam: fail on I/O errors")
MFC after: 3 days (tentative)
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53750
With help from: mckusick
Reviewed by: emaste, pauamma_gundo.com
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D53589
* Rewrite the first paragraph to clarify that quot(8) only supports FFS.
* Document which options can or cannot be combined with each other.
MFC after: 1 week
Reviewed by: ziaee
Differential Revision: https://reviews.freebsd.org/D53727
The existing parser was needlessly complicated and wildly inconsistent
in how it handled invalid input. Rewrite using getline() and treat
invalid input consistently: silently ignore lines that don't begin with
a number, and print a warning if the inode number is out of range.
PR: 290992
MFC after: 1 week
Reviewed by: obrien
Differential Revision: https://reviews.freebsd.org/D53726
The pr_soreceive method first scans the buffer holding the both I/O sx(9)
and socket buffer mutex(9) and after figuring out how much needs to be
copied out drops the mutex. Since the other side may only append to the
buffer, it is safe to continue the operation holding the sx(9) only.
However, the code had a bug that it used pointer in the very last mbuf as
marker of the place where to stop. This worked both in a case when we
drain a buffer completely (marker points at NULL) and in a case when we
wanted to stop at MSG_EOR (marker points at next mbuf after MSG_EOR).
However, this pointer is not consistent after we dropped the socket buffer
mutex.
Rewrite the logic to use the data length as bounds for the copyout cycle.
Provide a test case that reproduces the race. Note that the race is very
hard to hit, thus test will pass on unmodified kernel as well. In a
virtual machine I needed to add tsleep(9) for 10 nanoseconds into the
middle of function to be able to reproduce.
PR: 290658
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53632
Fixes: d157927807
* Send a TX A-MPDU exchange successfully; we were allocating the
A-MPDU TX queue but returning 0 to net80211 was telling it
to not establish the TX A-MPDU session and none of the BA session
tracking stuff would work.
* Clean up the TX A-MPDU queue lookup in the transmit path - only
QoS data frames are allowed, not qos null-data, cf/ack/etc frames;
only send them if the A-MPDU session is established.
* Tell net80211 that we've established the TX A-MPDU session once
the firmware queue has been created.
* Check to make sure we're not double (or more) creating TX AMDPU
sessions - only allocate a qid if we're not doing A-MPDU yet.
* Delete IWX_FLAG_A-MPDUTX - it's now being properly tracked!
Locally tested:
* AX210, STA mode - gets 50/50mbit on 2GHz HT20, and 100/100mbit on
5GHz VHT/40.
Differential Revision: https://reviews.freebsd.org/D53725
Reviewed by: thj
I noticed a couple of things were happening:
* during suspend, I'd get a timeout in the NIC lock path (which
sets a bit on the NIC to say that the host wants to talk to it);
* resume wouldn't come back - scan commands would fail, and you'd have
to reinit the NIC again for it to work.
The thing is:
* the suspend path should already shut down the NIC by shutting down all
the VAPs (and the last VAP should call ic_parent to bring it down), and
* the resume path should already bring up the NIC by bringing up each VAP,
and the first VAP to be brought up calls ic_parent to bring it up.
So instead, I've shuffled around the code to just double check the
hardware state is consistent /before/ ieee80211_suspend_all() and
ieee80211_resume_all() is called.
This both fixes the errant hardware timeout during suspend, and it
fixes resume to work.
Locally tested:
* AX210, STA mode, both hardware ACPI suspend/resume and devctl suspend
and devctl resume
Differential Revision: https://reviews.freebsd.org/D53721
Reviewed by: thj
* Add IWN_DEBUG_KEYMGMT as a debug flag
* Convert DPRINTF(()) in key add/set to IWN_DPRINTF()
* printf() -> net80211_vap_printf()
* add braces around return value
Differential Revision: https://reviews.freebsd.org/D53703
Reviewed by: thj
* constify mtw_write_region_1()'s data field
* convert to use ieee80211_crypto_get_*()
* .. note that rx/tx mic data routines are explicitly being called,
as this NIC is doing TKIP + MIC offload
Differential Revision: https://reviews.freebsd.org/D53704
Reviewed by: bz
Migrate to the ieee80211_crypto_key_*() routines.
Should be no functional change.
Locally tested:
* RTL8821AU, STA mode
Differential Revision: https://reviews.freebsd.org/D52712
Only i386 has a four-byte alignment for uint64_t, others have
eight-byte alignment. This causes the structure to mismatch
on armv7 binaries running under aarch64, breaking the aio interface.
Fixes: 3858a1f4f5
Approved by: markj (mentor)
Reported by: Mark Millard <marklmi26-fbsd@yahoo.com>
Discussed with: jrtc27
PR: 290962
MFC after: immediately (for 15.0)
Explain driver loading and application access in the body of the manual.
Crossreference other game controller driver manuals, and devfs.rules to
hint about how to configure application access. Add a common dongle to
supported hardware. Add evdev a few places to make it really clear how
it works.
MFC after: immediately for inclusion in 15.0R
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D53290
- Catch up with the new cause/perr registers. The high level approach
is the same but the T7 has an extra top level INT_CAUSE concentrator
and a PERR_CAUSE concentrator with a changed layout.
- Add various flags to control the interrupt handlers' behavior.
- Implement a t4_intr_clear that internally use the slow handler as an
iterator over known cause/perr registers. This lets the driver clear
all of the interrupt sources that it knows about. The firmware sets
up the interrupt enables and clears the causes normally so this call
should be redundant.
MFC after: 1 week
Sponsored by: Chelsio Communications
Cast &end to vm_offset_t before subtracting VM_MIN_KERNEL_ADDRESS to
ensure the resulting size is correct for PRELOAD_PUSH_VALUE.
Previously the correct size was effectively divided by sizeof(void *).
Reviewed by: andrew
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D53699
Disabled by default, but also redundant, since most of the errors they
catch will be caught anyway by WITNESS and the locking subsystem.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D53735
uiomove_faultflag() takes care of that already.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D53733
It is defined by default, and there is no reason to have a switch for
it. While here, also get rid of some unnecessary comments and ioctl
definitions.
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
If devfs_set_cdevpriv() fails, we will panic when we enter the
cuse_client_free() callback, for a number of reasons:
- pcc->server is not yet assigned, so we'll use a NULL pointer.
- pcc has not yet been added to the pcs->hcli TAILQ, but we'll try to
remove it.
- pccmd->sx and pccmd->cv are not yet initializated, but we'll try to
destroy them.
Even if we'd get past all these somehow, we'd still get two errors in
the devfs_set_cdevpriv() failure block:
- We'll unref the server twice, once in cuse_client_free(), and again in
cuse_client_open().
- A double-free panic, since we'd be trying to free(pcc), which has
already been freed in cuse_client_free().
Fix all those issues. While here, also get rid of some unnecessary
devfs_clear_cdevpriv().
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D53708
In the manual page:
- Fix synopsis and use better argument names
- Improve description of flags.
- In EXAMPLES, list the contents of iguana and chameleon files.
- Use Rs to reference The Cartoon Guide to Statistics
- Fix misc indentation and style issues
- Tag SPDX
MFC after: 1 week
Reviewed by: bcr, ziaee
Differential Revision: https://reviews.freebsd.org/D53710