Commit graph

42762 commits

Author SHA1 Message Date
Dmitry Luhtionov 4cc4b5e2b5 Add some AMD device IDs. 2024-06-07 13:02:03 -04:00
Souradeep Chakrabarti 2b887687ed Hyper-V: TLB flush enlightment using hypercall
Currently FreeBSD uses IPI based TLB flushing for remote
TLB flushing. Hyper-V allows hypercalls to flush local and
remote TLB. The use of Hyper-V hypercalls gives significant
performance improvement in TLB operations.

This patch set during test has shown near to 40 percent
TLB performance improvement.

Also this patch adds rep hypercall implementation as well.

Reviewed by:	whu, kib
Tested by:	whu
Authored-by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Co-Authored-by:	Erni Sri Satya Vennela <ernis@microsoft.com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D45521
2024-06-07 07:56:07 +00:00
Vladimir Kondratyev 07c7c41ca1 LinuxKPI: Add min_not_zero() to linux/minmax.h
It returns the minimum that is not zero, except both equals to zero.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	bz, emaste, ssaxena
Differential Revision:	https://reviews.freebsd.org/D45450
Differential Revision:	https://reviews.freebsd.org/D45451
2024-06-06 23:42:06 +03:00
Maxime Thiebaut b5b90ff984 u3g: Add support for SIM7600G
Signed-off-by:	Maxime Thiebaut <maxime+freebsd@thiebaut.dev>
Reviewed by:	kp
2024-06-06 17:02:15 +02:00
Chandrakanth patil 8d3c3b5242 mpi3mr: Track IO per target counter during queue poll with local variable
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44494
2024-06-06 10:39:16 +00:00
Chandrakanth patil 3f3a15543a mpi3mr: Divert large WriteSame IOs to firmware if unmap and ndob bits are set
Firmware advertises the transfer lenght for writesame commands to driver during init.
So for any writesame IOs with ndob and unmap bit set and transfer lengh is greater
than the max write same length specified by the firmware, then direct those commands
to firmware instead of hardware otherwise hardware will break.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44452
2024-06-06 10:39:15 +00:00
Chandrakanth patil df595fc43e mpi3mr: driver version update to 8.10.0.1.0
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44430
2024-06-06 10:39:15 +00:00
Chandrakanth patil 945c3ce49e mpi3mr: copyright year update to 2024
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44429
2024-06-06 10:39:15 +00:00
Chandrakanth patil baabb91934 mpi3mr: mpi headers update to latest
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44428
2024-06-06 10:39:15 +00:00
Chandrakanth patil 3012fa8fae mpi3mr: Adding FreeBSD OS Type to Fault/Reset Reason Code
The driver is modified to add FreeBSD OS type in the upper nibble of the
fault/reset reason code for appropriate qualification of the reason code.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44427
2024-06-06 10:39:15 +00:00
Chandrakanth patil 4034d7061a mpi3mr: diag fault success beyond F000 fault code
Accept any fault as successful for diagnostic fault reset, not just the 0xF000
code. print fault information and return.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44426
2024-06-06 10:39:15 +00:00
Chandrakanth patil eb7a4b35de mpi3mr: Update consumer index of admin and operational reply queues after every 100 replies
Instead of updating the ConsumerIndex of the Admin and Operational ReplyQueues
after processing all replies in the queue, it will now be periodically updated
after processing every 100 replies.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44425
2024-06-06 10:39:15 +00:00
Chandrakanth patil 571f1d0638 mpi3mr: Decrement per controller and per target counter post reset
Post controller reset, If any device removal events arrive, and if
there are any outstanding IOs then the driver will unnecessarily wait
in the loop for 30 seconds before removing the device from the OS.

reset target outstanding IO counter and controller outstanding IO counter
and remove the redundant wait loop.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44424
2024-06-06 10:39:15 +00:00
Chandrakanth patil 701d776c98 mpi3mr: poll reply queue and add MPI3MR_DEV_REMOVE_HS_COMPLETED flag
An outstanding IO counter per target check has been added before deleting
the target from the OS which will poll the reply queue if there are any
outstanding IOs are found.

A new flag, named "MPI3MR_DEV_REMOVE_HS_COMPLETED," is added. If a remove event
for a target occurs and before the deletion of the target resource if the add event
for another target arrives reusing the same target ID then this flag will prevent
the removal of the target reference. This flag ensures synchronization between the interrupt
top and bottom half during target removal and addition events.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44423
2024-06-06 10:39:14 +00:00
Chandrakanth patil 042808f747 mpi3mr: Controller state check before enabling PEL
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44422
2024-06-06 10:39:14 +00:00
Chandrakanth patil 0d7056458d mpi3mr: Block devices persist despite being offlined during reset
The driver removes the drive from the OS if firmware sends 'device added'
event with hidden bit or inaccessible status.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D44421
2024-06-06 10:39:14 +00:00
Mark Johnston c70c791f06 drm2: Remove one more implementation of ilog2()
Reviewed by:	dougm
Fixes:		b0056b31e9 ("libkern: add ilog2 macro")
Differential Revision:	https://reviews.freebsd.org/D45504
2024-06-05 18:18:19 -04:00
Bjoern A. Zeeb 9e012a9da5 iwn(4): correct debug message: "not" to "no"
Sponosred by:	The FreeBSD Foundation
MFC after:	3 days
2024-06-05 22:05:12 +00:00
John Baldwin f46d4971b5 nvmf: Handle shutdowns more gracefully
If an association is disconnected during a clean shutdown, abort all
pending and future I/O requests with an error to avoid hangs either due
to filesystem unmounts or a stuck GEOM event.

If an association is connected during a clean shutdown, gracefully
disconnect from the remote controller and close the open queues.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45462
2024-06-05 12:59:28 -07:00
John Baldwin aacaeeee8e nvmf: Permit failing I/O requests while disconnected
Add a kern.nvmf.fail_on_disconnection sysctl similar to the
kern.iscsi.fail_on_disconnection sysctl.  This causes pending I/O
requests to fail with an error if an association is disconnected
instead of requeueing to be retried once the association is
reconnected.  As with iSCSI, the default is to queue and retry
operations.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45308
2024-06-05 12:59:07 -07:00
John Baldwin e140f85dc1 nvmf: Rescan namespaces after reconnecting
While a host was disconnected from a remote controller, namespaces
might have been added, removed, or altered properties.  Rescan the
namespaces after reconnecting to detect any such changes.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45461
2024-06-05 12:53:08 -07:00
John Baldwin f6d434f110 nvmf: Rescan all namespaces if the changed NS log page is too large
Previously this just punted with a warning message.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45460
2024-06-05 12:52:43 -07:00
John Baldwin 8a082ca89f nvmf: Factor out most of nvmf_rescan_ns into a helper routine
This function accepts a namespace ID and associated namespace data
from IDENTIFY and takes care of updating nvmeXnY and ndaZ.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45459
2024-06-05 12:52:24 -07:00
John Baldwin 02ddb305cc nvmf: Refactor nvmf_add_namespaces to be more generic
Rename to nvmf_scan_active_namespaces and accept an additional
callback function and callback argument.  The callback is invoked on
each active namespace enumerated by the active namespace list from the
IDENTIFY command.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45458
2024-06-05 12:51:56 -07:00
John Baldwin bed59baba2 nvmf: Pass const pointers to namespace data to nvmf_*_ns
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45457
2024-06-05 12:51:37 -07:00
John Baldwin 56b822a17c pci: Only add special VF handling for direct children in bus methods
For activate/deactivate resource, use a more standard check at the
start of the function since the addition of the PCI_IOV code made this
more complex.  For the three recently added methods, just add the
typical check at the beginning that I missed.

This wasn't always fatal as if your system only had PCI device_t's as
children of PCI bus devices it would happen to work ok, but if you
have a non-PCI child device (e.g. an ATA channel) then dereferencing
ivars for non-direct-children could fault.

Reported by:	Cirrus-CI (via emaste)
Reviewed by:	emaste
Fixes:		871b33ad65 pci: Consistently use pci_vf_* for suballocated VF memory resources
Differential Revision:	https://reviews.freebsd.org/D45499
2024-06-05 09:50:05 -07:00
Enji Cooper 637ee13919 pci(4): unbreak the build
`argsp` is not defined in `generic_pcie_unmap_resource(..)`. Remove the
parameter passed to `bus_generic_unmap_resource(..)` as this parameter
is never passed to `generic_pcie_unmap_resource(..)`.

Fixes:	98056127dd ("acpi/pci/vmd: Fix a nit with nested resource mapping requests")
Reported by:	Jenkins (aarch64, armv6, armv7, etc)
Differential Revision:	https://reviews.freebsd.org/D45493
2024-06-05 06:55:33 -07:00
Zhenlei Huang 4eb82e65a7 hidbus(4): Fix wrong assertion of bus
Reviewed by:	wulf
Fixes:		4151ac9f12 hidbus(4): Use generic hid methods to ...
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45496
2024-06-05 20:03:27 +08:00
Andrew Turner c2e0d56f5e arm64: Support BTI checking in most of the kernel
LLD has the -zbti-report=error argument to check if the BTI note is
present when linking. To allow for this to be used when linking the
kernel and modules:
 - Add the BTI note to the remaining assembly files
 - Mark ptrauth.c as protected by BTI
 - Disable -zbti-report for vmm hypervisor switching code as it's not
   used there.

The linux64 module doesn't build with the flag as it includes vdso code
that doesn't include the note.

Reviewed by:	imp, kib, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45466
2024-06-05 09:23:40 +00:00
John Baldwin 871b33ad65 pci: Consistently use pci_vf_* for suballocated VF memory resources
Some of the bus resource methods were passing these up to the parent
which triggered rman mismatch assertions in INVARIANTS kernels.

Reported by:	kp
Reviewed by:	imp
Tested by:	kp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D45406
2024-06-04 16:51:37 -07:00
John Baldwin 98056127dd acpi/pci/vmd: Fix a nit with nested resource mapping requests
Some bus drivers use rmans to suballocate resources to child devices.
When the driver for a child device requests a mapping for a
suballocated resource, the bus driver translates this into a mapping
request for a suitable subrange of the original resource the bus
driver allocated from its parent.  This nested mapping request should
look like any other resource mapping request being made by the bus
device (i.e. as if the bus device had called bus_map_resource() or
bus_alloc_resource() with RF_ACTIVE).

I had slightly flubbed this last bit though since the direct use of
bus_generic_map/unmap_resource passed up the original child device
(second argument to the underlying kobj interface).  While this is
currently harmless, it is not strictly correct as the resource being
mapped is owned by the bus device, not the child and can break for
other bus drivers in the future.

Instead, use bus_map/unmap_resource for the nested request where the
requesting device is now the bus device that owns the parent resource.

Reviewed by:	imp
Fixes:		0e1246e334 acpi: Cleanup handling of suballocated resources
Fixes:		b377ff8110 pcib: Refine handling of resources allocated from bridge windows
Fixes:		d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Fixes:		d714e73f78 vmd: Use bus_generic_rman_* for PCI bus and memory resources
Differential Revision:	https://reviews.freebsd.org/D45433
2024-06-04 16:51:14 -07:00
Oleksandr Kryvulia ef659a2d04 snd_hda: Add Lenovo X1 Carbon Gen11 support
MFC after:	2 days
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D45361
2024-06-04 02:00:12 +02:00
Ed Maste e0dcb9b611 mfi: correct typo in sysctl/tunable description
Reported by:	jrtc27
Reviewed by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Event:		Kitchener-Waterloo Hackathon 202406
2024-06-03 16:32:36 -04:00
Doug Moore b0056b31e9 libkern: add ilog2 macro
The kernel source contains several definitions of an ilog2 function;
some are slower than necessary, and one of them is incorrect.
Elimininate them all and define an ilog2 macro in libkern to replace
them, in a way that is fast, correct for all argument types, and, in a
GENERIC kernel, includes a check for an invalid zero parameter.

Folks at Microsoft have verified that having a correct ilog2
definition for their MANA driver doesn't break it.

Reviewed by:	alc, markj, mhorne (older version), jhibbits (older version)
Differential Revision:	https://reviews.freebsd.org/D45170
Differential Revision:	https://reviews.freebsd.org/D45235
2024-06-03 11:37:55 -05:00
Joshua Kinard 80828c6fab kern: Remove leftover saf1761otg bits
Almost all code related to the saf1761 driver was removed in commit
44796b7e82, except for two small bits related to saf1761otg support.
This patch completes the removal.

PR:		279302
Signed-off-by:	Joshua Kinard <freebsd@kumba.dev>
Reviewed by:	mhorne
MFC after:	3 days
Fixes:		44796b7e82 ("mips: remove saf1761")
2024-06-03 12:52:58 -03:00
Dmitry Salychev 645a228481
ds1307: Return error code instead of boolean
It's probably a copy-paste leftover from the other functions which
return a boolean value and generates annoying "CLOCK_SETTIME error 1"
from subr_rtc.c on Traverse Ten64 in verbose mode.

No functional changes intended.

MFC after:	3 days
2024-06-03 15:41:11 +02:00
Mark Johnston 542f9494b7 proto: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston 66d2d42a1f uart: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston a3b460d499 mvs: Use device_set_desc(f)()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston de140d60d5 virtio: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston bad36a4998 acpi: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston 801b12ba89 qlnx: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston 17bfbc400f siis: Use device_set_desc(f)()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston 54482989d3 etherswitch: Use device_set_desc(f)()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Mark Johnston a1b8445115 cxgbe: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
Mark Johnston 796bcf1845 cxgb: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
Mark Johnston a866a40b9b bhnd: Use device_set_descf()
Here we are in a device probe routine with no locks held.  M_WAITOK
allocations are ok.  No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
Mark Johnston 25b839dfd2 ata: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
Mark Johnston a74b496507 ahci: Use device_set_desc(f)()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
John Baldwin c7c037fad1 bhnd: Remove orphaned driver for the BHND USB core
This was only connected to the build for MIPS and has been
disconnected from the build since MIPS was removed.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45432
2024-06-01 13:25:12 -07:00