Commit graph

42099 commits

Author SHA1 Message Date
Warner Losh
a113f9dd98 uart: Support EARLY_PRINTF on x86 for port-mapped COM ports
Support early printf for the ns8250 uart driver. Adding
	options UART_NS8250_EARLY_PORT=0xYYY
	options EARLY_PRINTF
to your kernel config will enable it. The code is rather simple minded,
so caveat emptor. This will enable printf before cninit. cninit
automatically disables this and switches to the real routine. It only
works for port-mapped COM ports, and only if you know the port's address
at compile time. It's intended for be a debugging aide, not a general
purpose thing.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D42306
2023-10-20 16:07:24 -06:00
John Baldwin
f6c2774fe4 acpi_pcib: Rename decoded_bus_range to get_decoded_bus_range
While here, change the return value to bool.

Discussed by:	gibbs
2023-10-20 14:53:49 -07:00
Doug Rabson
da4b0d6eb0 netfront: fix the support for disabling LRO at boot time
The driver has a tunable hw.xn.enable_lro which is intended to control
whether LRO is enabled. This is currently non-functional - even if its
set to zero, the driver still requests LRO support from the backend.
This change fixes the feature so that if enable_lro is set to zero, LRO
no longer appears in the interface capabilities and LRO is not requested
from the backend.

PR:		273046
MFC after:	1 week
Reviewed by:	royger
Differential Revision: https://reviews.freebsd.org/D41439
2023-10-20 11:50:20 +01:00
Wei Hu
49fa9a6437 Hyper-V: vmbus: check if signaling host is needed in vmbus_rxbr_read
It is observed that netvsc's send rings could stall on the latest
Azure Boost platforms. This is due to vmbus_rxbr_read() routine
doesn't check if host is waiting for more room to put data, which
leads to host side sleeping forever on this vmbus channel. The
problem was only observed on the latest platform because the host
requests larger buffer ring room to be available, which causes
the issue to happen much more easily.

Fix this by adding check in the vmbus_rxbr_read call and signaling
the host in the callers if check returns positively.

Reported by:	NetApp
Tested by:	whu
MFC after:	3 days
Sponsored by:	Microsoft
2023-10-20 09:15:21 +00:00
Sumit Saxena
7e02c7074c mpi3mr: Move creation of watchdog to interupt config hook
Move creation of watchdog process from just before we configure the
interrupt config hook to into the config hook itself. This prevents it
from racing the config intr hook and doing an extra reset of the
card. This extra reset is usually harmless, but sometimes it can prevent
discovery of devices if done at just the wrong time. This can lead to no
disks being registered in a box full of disks, for example. Starting it
later eliminates this race, making discovery reliable.

Reviewed by: imp
2023-10-19 15:09:38 -06:00
Mitchell Horne
b5437d6c65 hwpmc_amd: remove an unused variable
This should fix the LINT builds.

Reported by:	Jenkins
Sponsored by:	The FreeBSD Foundation
Fixes:	2c6f474ee8 ("hwpmc_amd: kill of k7 support bits")
2023-10-19 11:00:31 -03:00
John Hall
f07b267d8c smartpqi: Change alignment for dma tags
Problem: Under certain I/O conditions, a program doing large block disk
reads can cause a controller to crash.

Root Cause: The SCSI read request and destination address in the BDMA
descriptor is incorrect, causing the BDMA engine in the controller to
assert.

Fix: Change the alignment for creating bus_dma_tags in the driver from
PAGE_SIZE (4k) to 1, which allows the controller to manage it's own
address range for BDMA transactions.

Risk: Medium

Exposure: This reverts a change first made to support NVMe drives on
Excalibur. At that time a 4k alignment was necessary. This no longer
seems to be the case.

PR: 259541
Reported by: Ka Ho Ng <khng@freebsd.org>
Reviewed by: imp
Differential Revision:	https://reviews.freebsd.org/D41619
2023-10-18 21:12:27 -06:00
John F. Carr
b064a4c9ee smartpqi: Drop spinlock before freeing memory
pqisrc_free_device frees the device softc with the os spinlock
held. This causes crashes when devices are removed because the memory
free might sleep (which is prohibited with spin locks held). Drop the
spinlock before releasing the memory.

MFC After: 2 days
PR: 273289
Reviewed by: imp
2023-10-18 21:06:40 -06:00
Mitchell Horne
82d6d46d0d pmc: remove last bits of AMD K7 CPU support
This includes event definitions from sys/pmc_events.h, definitions from
sys/pmc.h, and the man pages.

Reviewed by:	jkoshy
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41275
2023-10-18 15:05:45 -03:00
Mitchell Horne
2c6f474ee8 hwpmc_amd: kill off k7 support bits
This is i386-only, and has been effectively disabled since 2018 when the
companion support was removed from libpmc (e92a1350b5). Remove the
kernel support to simplify the AMD class.

Reviewed by:	jkoshy
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41274
2023-10-18 15:05:45 -03:00
Mitchell Horne
75780146d6 hwpmc_amd: simplify counter descriptor definitions
No functional change intended.

Reviewed by:	jkoshy
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41273
2023-10-18 15:05:44 -03:00
Mitchell Horne
d9e3fe3226 hpwmc_amd.c: style improvements
- Return style
 - Explicit value checks
 - Whitespace formatting
 - Comment formatting
 - Local variable declaration order
 - __unused annotations

Reviewed by:	jkoshy
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41272
2023-10-18 15:05:44 -03:00
Mitchell Horne
440e7cb4ac hwpmc_core: remove two non-existent function prototypes
Reviewed by:	jkoshy
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41271
2023-10-18 15:05:44 -03:00
Mitchell Horne
90a6ea5ca0 hwpmc: tidy pcd_finalize methods
Make them a little bit more consistent with one another in terms of what
is done:
 - Add/reduce assertions to what is most useful: a loop to ensure
   pcpu_fini freed everything
 - Add PMCDBG trace entries

The exception is the dmc620/cmn600 classes, which behave a little
differently, so leave them untouched.

Reviewed by:	jkoshy
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41270
2023-10-18 15:05:44 -03:00
John Baldwin
22a6678b62 acpi_pcib: Trust decoded bus range from _CRS over _BBN
Currently if _BBN doesn't match the first bus in the decoded bus range
from _CRS for a Host to PCI bridge, the driver fails to attach as a
defensive measure.

There is now firmware in the field where these do not match, and the
_BBN values are clearly wrong, so rather than failing attach, trust
the range from _CRS over _BBN.

Co-authored-by:	Justin Gibbs <gibbs@FreeBSD.org>
Reported by:	gibbs
Reviewed by:	imp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D42231
2023-10-16 15:33:10 -07:00
Emmanuel Vadot
0cb63dcac4 Revert "dwc: re-rewrite barrier part"
Turns out we need all the barrier.
The one before writing the OWN bit is needed so the DMA engine
have coherent data, the second one (after the OWN bit is set) is
also needed because the DMA buffers are allocated with VM_MEMATTR_DEFAULT
whic equals to being cached.

This reverts commit 2b4f615e7d4720b16007cfa8aaedf720f572067a.
This reverts commit 4870346488051b9c4a1dc8b11cab55d4e5b7c230.

Reported by:	mmel
2023-10-16 21:48:19 +02:00
Andrew Turner
7098f3c756 pci: Set the domain in the pci_generic driver
Tell bus_dma(9) which NUMA domain the PCI driver is closest to so it
can allocate memory from there when possible.

Reviewed by:	markj, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42186
2023-10-16 10:36:39 +01:00
Justin Hibbits
8f31b879ec bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case
bpf_peers_present() would panic from a NULL pointer dereference.  Solve
this by adding a new IfAPI that could deal with a NULL bpf, if such
could occur in the network stack.

Reviewed by:	zlei
Sponsored by:	Juniper Networks, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42082
2023-10-13 14:33:31 -04:00
Justin Hibbits
5e444deec0 Revert "bpf: Add IfAPI analogue for bpf_peers_present()"
This reverts commit c81dd8e5fe.

Commit message needs revised.
2023-10-13 14:33:31 -04:00
Justin Hibbits
c81dd8e5fe bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case
bpf_peers_present() would panic from a NULL pointer dereference.  Solve
this by adding a new IfAPI that includes a NULL check.  Since this API
is used in only a handful of locations, it reduces the the NULL check
scope over inserting the check into bpf_peers_present().

Sponsored by:	Juniper Networks, Inc.
MFC after:	1 week
2023-10-13 13:12:44 -04:00
Emmanuel Vadot
43cd6bbba0 dwc: re-rewrite barrier part
We need the DMA engine to have everything coherent *before* we
set the OWN bit (the bit that tells the DMA engine that it owns
the descriptor).

Fixes:	487034648805 ("dwc: Rewrite barrier part")

Reported by:	jhb
2023-10-12 20:56:16 +02:00
Andrew Gallatin
be91b4797e acpi_ged: Handle events directly
Handle ged interrupts directly from the interrupt handler,
while the interrupt source is masked, so as to conform
with the acpi spec, and avoid spurious interrupts and
lockups on boot.

When an acpi ged interrupt is encountered, the spec requires
the os (as stated in 5.6.4: General Purpose Event Handling)
to leave the interrupt source masked until it runs the
EOI handler.  This is not a good fit for our method of
queuing the work (including the EOI ack of the interrupt),
via the AcpiOsExecute() taskqueue mechanism.

Note this fixes a bug where an arm64 server could lock up if
it encountered a ged interrupt at boot.  The lockup was
due to running on a single core (due to arm64 not using
EARLY_AP_STARTUP), and due to that core encountering a
new interrupt each time the interrupt handler unmasked
the interrupt source, and having the EOI queued on a taskqueue
which never got a chance to run. This is also possible
on any platform when using just a single processor.
The symptom of this is a lockup at boot, with:
"AcpiOsExecute: failed to enqueue task, consider
increasing the debug.acpi.max_tasks tunable" scrolling
on console.

Similarly, spurious interrupts would occur when running
with multiple cores, because it was likely that the
interrupt would fire again immediately, before the
ged task could be run, and before an EOI could be sent
to lower the interrupt line.  I would typically see
3-5 copies of every ged event due to this issue.

This adds a tunable, debug.acpi.ged_defer, which can be
set to 1 to restore the old behavior.  This was done
because acpi is a complex system, and it may be
theoretically possible something the ged handler does
may sleep (though I cannot easily find anthing by inspection).

MFC after: 1 month
Reviewed by: andrew, jhb, imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42158
2023-10-12 11:27:44 -04:00
Emmanuel Vadot
257405d707 xilinx: reset: Remove debug printfs
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-10-12 09:32:59 +02:00
Mazin Fadl
94efe9f91b usb: add quirks for the Genesys GL3220 card reader
Without these, card hotplugging does not work on the GL3220.

PR:	263868
Fixes:	520b88860d7a79 ("usb(4): Automagically apply all quirks [...]")
2023-10-11 16:08:53 -05:00
Mazin Fadl
b332adfa96 usb: add necessary quirks for the NOREL Systems NS1081 SD reader
Without these, the Norelsys NS1081 is completely defunct.

PR:	263868
Fixes:	520b88860d7a79 ("usb(4): Automagically apply all quirks [...]")
2023-10-11 16:08:53 -05:00
Poul-Henning Kamp
f17b69fd0f Move (LENOVO, TBT3LAN) from if_ure til if_cdce where it works much better 2023-10-11 15:54:55 +00:00
Warner Losh
afc3d49b17 nvme: Close a race in destroying qpair and timeouts
While we should have cleared all the pending I/O prior to calling
nvme_qpair_destroy, which should ensure that if the callout_drain causes
a call to nvme_qpair_timeout(), it won't schedule any new
timeout. However, it doesn't hurt to set timeout_pending to false in
nvme_qpair_destroy() and have nvme_qpair_timeout() exit early if it sees
it w/o scheduling a timeout. Since we don't otherwise stop the timeout
until we're about to destroy the qpair, this ensures we fail safe. The
lock/unlock also ensures the callout_drain will either remove the callout,
or wait for it to run with the early bailout.

We can likely further improve this by using callout_stop() inside the
pending lock. I'll investigate that for future refinement.

Sponsored by:		Netflix
Suggestions by:		jhb
Reviewed by:		gallatin
Differential Revision:	https://reviews.freebsd.org/D42065
2023-10-10 16:13:57 -06:00
Warner Losh
9cd7b62473 nvme: Eliminate RECOVERY_FAILED state
While it seemed like a good idea to have this state, we can do
everything we wanted with the state by checking ctrlr->is_failed since
that's set before we start failing the qpairs. Add some comments about
racing when we're failing the controller, though in practice I'm not
sure that kind of race could even be lost.

Sponsored by:		Netflix
Reviewed by:		chuck, gallatin, jhb
Differential Revision:	https://reviews.freebsd.org/D42051
2023-10-10 16:13:57 -06:00
Warner Losh
6b2a6e9cb0 nvme: Remove stale comment
After da8324a925, the pre/post hooks are gone. So remove a coment
about why we don't call them in this case.

Sponsored by:		Netflix
Reviewed by:		chuck, jhb
Differential Revision:	https://reviews.freebsd.org/D42050
2023-10-10 16:13:56 -06:00
Warner Losh
4026128983 nvme: Really remove NVME_2X_RESET
da8324a925 removed one of the two instances of NVME_2X_RESET. It
failed to snag the other one, and remove it from the options file.
Remove from both of those here.

Sponsored by:		Netflix
Reviewed by:		chuck, gallatin, jhb
Differential Revision:	https://reviews.freebsd.org/D42049
2023-10-10 16:13:56 -06:00
Warner Losh
bc85cd303c nvme: gc nvme_ctrlr_post_failed_request and related task stuff
In 4b977e6dda we removed the call to nvme_ctrlr_post_failed_request
because we can now directly fail requests in this context since we're in
the reset task already. No need to queue it. I left it in place against
future need, but it's been two years and no panics have resulted. Since
the static analysis (code checking) and the dyanmic analysis (surviving
in the field for 2 years, including at $WORK where we know we've gone
through this path when we've failed drives) both signal that it's not
really needed, go ahead and GC it. If we discover at a later date a flaw
in this analysis, we can add it back easily enough by reverting this and
4b977e6dda.

Sponsored by:		Netflix
Reviewed by:		chuck, gallatin, jhb
Differential Revision:	https://reviews.freebsd.org/D42048
2023-10-10 16:13:56 -06:00
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