Commit graph

42068 commits

Author SHA1 Message Date
John Baldwin
f53355131f Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961
2023-10-10 10:34:43 -07:00
Konstantin Belousov
6e92fc9309 vkbd: correct ref count on cloned cdevs
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42008
2023-10-10 02:37:43 +03:00
Mark Johnston
4640df1b0a mrsas: Fix callout locking in mrsas_complete_cmd()
callout_stop() requires the associated lock to be held.

This is a bit hacky, but I believe it's safe since the subsequent
mrsas_cmd_done() call will also acquire the SIM lock to stop a different
callout.

PR:		265484
Reviewed by:	imp
Tested by:	Jérémie Jourdin <jeremie.jourdin@advens.fr>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39559
2023-10-06 20:31:03 -04:00
Emmanuel Vadot
38cbdae33b dwc: Rewrite barrier part
We only need a barrier after writing the OWN bit so everything is
coherent for the DMA engine.
2023-10-06 19:05:45 +02:00
Emmanuel Vadot
cf037a17c7 dwc: rockchip: Properly calculate mii clock based on pclk_mac 2023-10-06 19:05:43 +02:00
Emmanuel Vadot
7854d0f658 dwc: Get the mii clock after calling IF_DWC_INIT
We need to calculate it based on the clocks and they aren't started
before IF_DWC_INIT.
2023-10-06 19:05:40 +02:00
Emmanuel Vadot
7786911ffd dwc: Rewrite part of the descriptors setup functions
- Add a txdesc_clear which clears the tx desc instead of doing that in
   dwc_setup_txdesc based on arguments.
 - Remove dwc_set_owner, in the end we always set the owner of the desc
   as we do it for id > 0 and then for the first one.
 - Remove dwc_ prefix

No functional changes intended.
2023-10-06 19:05:37 +02:00
Sk Razee
3c871489cd if_re: add Realtek Killer Ethernet E2600 IDs
PR:		274292
MFC after:	1 week
Reviewed by:	kp
Event:		Oslo Hackathon at Modirum
2023-10-06 08:10:04 +02:00
Emmanuel Vadot
b911f50400 dwc: if_dwc_aw: Include net/if_media.h
Needed my miivar.h

Fixes:	6b73554e3e9b ("dwc: Do not re-invent phy mode type")
2023-10-05 19:00:55 +02:00
Emmanuel Vadot
4b7975ecdc dwc: Remove if_dwc_mac_type
This doesn't represent the mac_type but if the DMA engine support
extended descriptors.
Read the HW_FEATURE register to learn if the DMA engine supports it.

No functional changes intended.
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
cef444d068 dwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h
And rename it to DMA_DEFAULT_PBL, this is the default for all (most ?)
dma engine that dwc should support.
While here stop including dwc1000_reg.h in if_dwc.c, we don't need it anymore.

No functional changes intended.
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
801fb66a7e dwc: Do not re-invent phy mode type
Directly uses the MII_CONTYPE_*

No functional changes intended.
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
5d88a52be4 dwc: Move dma engine configuration to dwc1000_dma.c
No functional changes intended.
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
363b7c39fb dwc: Move the dma reset code in dwc1000_dma.c
No functional changes intended
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
f0a7dd7703 dwc: Setup desc addresses in the dma init function. 2023-10-05 17:34:40 +02:00
Emmanuel Vadot
29776aa436 dwc: Move interrupt related code to core and dma file
No functional changes intended.
2023-10-05 17:34:40 +02:00
Emmanuel Vadot
fe82f82dcc dwc: Put all DMA related defines in dma1000_dma.c
No need to polute dwm1000_dma.h now.

No functional changes intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
627726b5b6 dwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core
it's only used there.

No functional change intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
afa0f66e81 dwc: Move the txstart dma part to dwc1000_dma
This is dma related to move it to the dma file.

No functional changes intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
62519d5a4f dwc: Split core functions
Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
In the goal to support all of those in the same base driver start splitting the
core function to a new file.

No functional changes intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
972adf0f97 dwc: Split dma functions
Synopsis/Designware controller have multiple dma version, the one included
in the driver is the base one. if_awg is one example of a dwc variant that
have another DMA controller. eqos is a newer variant of dwc that have a newer
dma controller.
In the goal to support all of those in the same base driver start splitting the
dma function to a new file.

No functional changes intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
c36125f6cc dwc: Rename if_dwc.h to dwc1000_reg.h
Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
This file only have definition for the registers of this version so rename it.

No functional changes intended.
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
9e3879fcc1 dwc: Drop 'All rights reserved'
Discussed with:	br
2023-10-05 17:34:39 +02:00
Emmanuel Vadot
50059a60ed dwc: Rewrite clock and reset functions
snps,dwmac have one required clock named stmmaceth and one optional pclk,
correctly handle both in if_dwc, no need to get/enable stmmacseth again
in if_dwc_rk.
It also have one required reset also named stmmaceth and one optional ahb,
correctly handle both.
Rockchip have another optional clock named clk_mac_speed, get it and enable it
if present. Also fix the optional RMII clocks, they were previously wrongly
enabled in RGMII case.
2023-10-05 17:34:38 +02:00
Emmanuel Vadot
b69c49d106 dwc: Add support for aal
snps,aal is used to indicate that the DMA engine should
use Address-Aligned Beats.
2023-10-05 17:34:38 +02:00
Emmanuel Vadot
f4bb6ea521 dwc: Add support for mixed-burst
snps,mixed-burst is used to indicate that the DMA engine should
use mixed-burst mode.
2023-10-05 17:34:38 +02:00
Emmanuel Vadot
27f03f1608 dwc: Remove unused GPIO_ACTIVE_LOW define
While here move comment block above the appropriate functions.
2023-10-05 17:34:38 +02:00
Emmanuel Vadot
f114aadd3e dwc: Rename dwc_reset to dwc_reset_phy
It only deals with reseting the phy.
While here avoid calling ofw_bus_get_node again and save the node in softc.
2023-10-05 17:34:38 +02:00
Emmanuel Vadot
432ae724e6 dwc: Move every sub drivers to dev/dwc
It makes it easier to find all the sub drivers and change them if needed.
While here do not gate dwc_rk with soc options, dwc_rk is made for all rockchip
SoCs. Same thing for dwc_socfpga
2023-10-05 17:34:38 +02:00
Damien Broka
6962da914d axge: Add support for AX88179A
The AX88179A has two firmware modes, one of which is backward
compatible with existing AX88178A/179 driver. The active firmware mode
can be controlled through a register.

Update axge(4) man page to mention 179A support and ensure that, when
bound to a AX88179A, the driver activates the compatible firmware mode.

Reviewed by:	markj
Pull Request:	https://github.com/freebsd/freebsd-src/pull/854
MFC after:	1 week
2023-10-04 11:08:06 -04:00
Emmanuel Vadot
1d6a6a5244 i2c: Add Microcrystal RV3032 RTC driver
This is a simple RTC driver for the rv3032 from Microcrystal.
Just the basic functionality is implemented (no timer, alarm etc ..).

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41995
2023-10-03 09:56:20 +02:00
Emmanuel Vadot
137b58e4d2 i2c: Add cadence iic driver
This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64)
so only enable it there for now.

Differential Revision:	https://reviews.freebsd.org/D41994
2023-10-03 09:56:20 +02:00
Emmanuel Vadot
125f5c5b48 iicbus: Move opencores i2c driver into controller subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41914
2023-10-03 09:56:20 +02:00
Emmanuel Vadot
7c569caa0a iicbus: Move i2c sensors drivers into new sensor subdirectory
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41913
2023-10-03 09:56:20 +02:00
Emmanuel Vadot
06589d6e02 iicbus: Move ADC drivers into a new adc subfolder
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41911
2023-10-03 09:56:19 +02:00
Emmanuel Vadot
22d7dd834b iicbus: Move adm1030 and adt746x to new pwm subdirectory
Those are (mainly) pwm controller so move it under a new subdirectory.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41910
2023-10-03 09:56:19 +02:00
Emmanuel Vadot
062944cc42 iicbus: Move Silergy pmic/regulators under pmic/silergy subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41909
2023-10-03 09:56:19 +02:00
Emmanuel Vadot
2f16049c98 iicbus: Move remaining rtc driver into rtc subfolder
No reason that they should live directly under iicbus

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41908
2023-10-03 09:56:19 +02:00
Emmanuel Vadot
580d00f42f iicbus: Move twsi under a new controller subdirectory
The folder is a mess so start moving stuff into sub-directories.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41907
2023-10-03 09:56:19 +02:00
Olivier Certner
ebaea1bcd2 x86: AMD Zen2: Zenbleed chicken bit mitigation
Applies only to bare-metal Zen2 processors.  The system currently
automatically applies it to all of them.

Tunable/sysctl 'machdep.mitigations.zenbleed.enable' can be used to
forcibly enable or disable the mitigation at boot or run-time.  Possible
values are:

    0: Mitigation disabled
    1: Mitigation enabled
    2: Run the automatic determination.

Currently, value 2 is the default and has identical effect as value 1.
This might change in the future if we choose to take into account
microcode revisions in the automatic determination process.

The tunable/sysctl value is simply ignored on non-applicable CPU models,
which is useful to apply the same configuration on a set of machines
that do not all have Zen2 processors.  Trying to set it to any integer
value not listed above is silently equivalent to setting it to value 2
(automatic determination).

The current mitigation state can be queried through sysctl
'machdep.mitigations.zenbleed.state', which returns "Not applicable",
"Mitigation enabled" or "Mitigation disabled".  Note that this state is
not guaranteed to be accurate in case of intervening modifications of
the corresponding chicken bit directly via cpuctl(4) (this includes the
cpucontrol(8) utility).  Resetting the desired policy through
'machdep.mitigations.zenbleed.enable' (possibly to its current value)
will reset the hardware state and ensure that the reported state is
again coherent with it.

Reviewed by:	kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41817
2023-10-02 15:29:18 -04:00
David Sloan
7ea866eb14 nvme: Fix memory leak in pt ioctl commands
When running nvme passthrough commands through the ioctl interface
memory is mapped with vmapbuf() but not unmapped. This results in leaked
memory whenever a process executes an nvme passthrough command with a
data buffer. This can be replicated with a simple c function (error
checks skipped for brevity):

void leak_memory(int nvme_ns_fd, uint16_t nblocks) {
	struct nvme_pt_command pt = {
		.cmd = {
			.opc = NVME_OPC_READ,
			.cdw12 = nblocks - 1,
		},
		.len = nblocks * 512, // Assumes devices with 512 byte lba
		.is_read = 1, // Reads and writes should both trigger leak
	}
	void *buf;

	posix_memalign(&buf, nblocks * 512);
	pt.buf = buf;
	ioctl(nvme_ns_fd, NVME_PASSTHROUGH_COMMAND, &pt);
	free(buf);
}

Signed-off-by: David Sloan <david.sloan@eideticom.com>

PR:		273626
Reviewed by:	imp, markj
MFC after:	1 week
2023-10-02 11:50:14 -04:00
Bjoern A. Zeeb
f156cd892b net80211 / drivers: remove public use of ieee80211_node_incref()
ieee80211_node_incref() is the FreeBSD implementation of
ieee80211_ref_node().  Not being interested in the node returned
it was used as a shortcut in 3 drivers (ath, uath, wpi).
Replace the call with the public KPI of ieee80211_ref_node() and
ignore the result.
This leaves us with the single internal call going
ieee80211_ref_node() -> ieee80211_node_incref() and that should
help increasing portability but also limiting the places to trace
for node reference operations.

Sponsored by:	The FreeBSD Foundation
MFC after:	4 weeks
2023-10-02 14:52:57 +00:00
Mark Johnston
015daf5221 hdac: Defer interrupt allocation in hdac_attach()
hdac_attach() registers an interrupt handler before allocating various
driver resources which are accessed by the interrupt handler.  On some
platforms we observe what appear to be spurious interrupts upon a cold
boot, resulting in panics.

Partially work around the problem by deferring irq allocation until
after other resources are allocated.  I think this is not a complete
solution, but is correct and sufficient to work around the problems
reported in the PR.

PR:		268393
Tested by:	Alexander Sherikov <asherikov@yandex.com>
Tested by:	Oleh Hushchenkov <o.hushchenkov@gmail.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41883
2023-09-27 08:28:27 -04:00
Warner Losh
1d6021cd72 nvme: Supress noise messages
When we're suspending, we get messages about waiting for the controller
to reset. These are in error: we're not waiting for it to reset. We put
the recovery state as part of suspending, so we should suppress these as
a false positive.

Also remove a stray debug that's left over from earlier versions of
the recovery code that no longer makes sense.

Sponsored by:		Netflix
2023-09-25 22:21:58 -06:00
John Baldwin
99159b076a Update a couple of tools to not embed __FBSDID in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41955
2023-09-25 07:50:11 -07:00
John Baldwin
16837d353c Remove a few more stray __FBSDID uses
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41954
2023-09-25 07:49:52 -07:00
John Baldwin
fc3cc652e5 videomode: Regenerate files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41953
2023-09-25 07:49:30 -07:00
John Baldwin
bd524e2ddb videomode/devlist2h.awk: Don't include $FreeBSD$ in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41952
2023-09-25 07:46:53 -07:00
Priit Trees
0a5d2802b4 vge: correct pause_frames sysctl description
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/806
2023-09-24 13:34:36 -04:00
Warner Losh
da8324a925 nvme: Fix locking protocol violation to fix suspend / resume
Currently, when we suspend, we need to tear down all the qpairs. We call
nvme_admin_qpair_abort_aers with the admin qpair lock held, but the
tracker it will call for the pending AER also locks it (recursively)
hitting an assert. This routine is called without the qpair lock held
when we destroy the device entirely in a number of places. Add an assert
to this effect and drop the qpair lock before calling it.
nvme_admin_qpair_abort_aers then locks the qpair lock to traverse the
list, dropping it around calls to nvme_qpair_complete_tracker, and
restarting the list scan after picking it back up.

Note: If interrupts are still running, there's a tiny window for these
AERs: If one fires just an instant after we manually complete it, then
we'll be fine: we set the state of the queue to 'waiting' and we ignore
interrupts while 'waiting'. We know we'll destroy all the queue state
with these pending interrupts before looking at them again and we know
all the TRs will have been completed or rescheduled. So either way we're
covered.

Also, tidy up the failure case as well: failing a queue is a superset of
disabling it, so no need to call disable first. This solves solves some
locking issues with recursion since we don't need to recurse.. Set the
qpair state of failed queues to RECOVERY_FAILED and stop scheduling the
watchdog. Assert we're not failed when we're enabling a qpair, since
failure currently is one-way. Make failure a little less verbose.

Next, kill the pre/post reset stuff. It's completely bogus since we
disable the qparis, we don't need to also hold the lock through the
reset: disabling will cause the ISR to return early. This keeps us from
recursing on the recovery lock when resuming. We only need the recovery
lock to avoid a specific race between the timer and the ISR.

Finally, kill NVME_RESET_2X. It'S been a major release since we put it
in and nobody has used it as far as I can tell. And it was a motivator
for the pre/post uglification.

These are all interrelated, so need to be done at the same time.

Sponsored by:		Netflix
Reviewed by:		jhb
Tested by:		jhb (made sure suspend / resume worked)
MFC After:		3 days
Differential Revision:	https://reviews.freebsd.org/D41866
2023-09-24 07:17:18 -06:00