1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00
Commit Graph

9523 Commits

Author SHA1 Message Date
Andrew Turner
f1bc3750cf arm64: Use store-pair to zero the kernel bss
While this won't be noticed by most users the time to zero the bss
while using instruction tracing in the Arm FVP models (simulators) is
noticeable.

Reduce this time by using a store-pair instruction to double the size
of memory we zero on each iteration of the loop.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42733
2024-08-21 10:16:10 +00:00
Andrew Turner
78d69d0a3c arm64: Fix the kernel with options VMM
* We can build the non-VHE code with branch protection, it is already
   build as such in the module.
 * Use the correct file name for the non-VHE exception .o file.
2024-08-21 10:16:10 +00:00
Gleb Smirnoff
6bc966987e dummymbuf: add to LINT 2024-08-20 13:46:09 -07:00
Andrew Turner
bbe97db3c2 arm64/vmm: Add the VHE exception and switcher files
These just need to include the common code with macros to ensure it is
built correctly.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46083
2024-08-20 08:49:16 +00:00
Andrew Turner
55aa31480c arm64/vmm: Create functions to call into EL2
These will become ifuncs to enable VHE in a later change.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46075
2024-08-20 08:49:15 +00:00
Andrew Turner
3d61bcf1eb arm64/vmm: Start to extract code not needed by VHE
We can share some of the vmm code between VHE and non-VHE modes. To
support this create new files that include the common code and create
macros to name what will be the common functions.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46072
2024-08-20 08:49:15 +00:00
Andrew Turner
43e8849bc2 conf: Enable BTI checking in the arm64 kernel
To ensure new code has BTI support make it an error to not have the
BTI ELF note when linking the kernel and kernel modules.

Reviewed by:	kib, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45469
2024-08-20 08:49:15 +00:00
Andrew Turner
12a6257a96 sys/conf: Introduce NOSAN_CFLAGS and NOSAN_C
To simplify disabling the kernel sanitizers in some files add
NOSAN_CFLAGS and NOSAN_C variables. These are CFLAGS and NORMAL_C with
the sanitizer flags removed.

While here add MSAN_CFLAGS to simplify keeping KMSAN in kern_kcov.c

Reviewed by:	khng, brooks, imp, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45498
2024-08-20 08:49:15 +00:00
Igor Ostapenko
8aaffd78c0 Add dummymbuf module for testing purposes
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D45928
2024-08-15 09:28:13 +02:00
Warner Losh
a3c8c061e2 kernel: Add new dwarf symbols
Add new symbols defined in dwarf 4 and dwarf 5.

Submitted by:		Matt Macy (in D17982, done differently)
Sponsored by:		Netflix
Reviewed by:		kib, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44072
2024-07-31 22:23:25 -06:00
Warner Losh
37d6d682af kernel: Move the debug stuff into a common script
Move a copy of amd64's debug code into debug.ldscript. Make all the
kernels use this. This has the effect of modernizing the STABS for
powerpc as the others were almost already in sync. For the ones that
weren't this adds the DWARF 3 debug symbols from i386/amd64.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44071
2024-07-31 22:23:24 -06:00
Dimitry Andric
8ce3e489a5 Fix incorrect -I option in sys/conf/Makefile.arm
In commit 8e53cd7099 the intent was to add sys/dts/include to the
compiler include path, but this was spelled incorrectly, leading to an
error with clang 19:

  cc: error: no such include directory: '$/dts/include' [-Werror,-Wmissing-include-dirs]

Use the spelling -I$S/dts/include instead.

MFC after:	3 days
2024-07-31 21:31:21 +02:00
Dag-Erling Smørgrav
b4e4512d46 filemon: Not an option.
MFC after:	3 days
2024-07-31 02:39:32 +02:00
Dag-Erling Smørgrav
057453ffdf filemon: Document how to build into the kernel.
MFC after:	3 days
Reviewed by:	olce, imp
Differential Revision:	https://reviews.freebsd.org/D46184
2024-07-30 21:04:30 +02:00
Konstantin Belousov
e23731db48 mlx5en: add IPSEC_OFFLOAD support
Right now, only IPv4 transport mode, with aes-gcm ESP, is supported.
Driver also cooperates with NAT-T, and obeys socket policies, which
makes IKEd like StrongSwan working.

Sponsored by:	NVIDIA networking
2024-07-30 18:00:04 +03:00
Mark Johnston
6aa98f78cc conf: Remove kernel stack swapping support, part 12
Remove the NO_SWAPPING option.  There is still some code in
vm_swapout.c, but it relates to RACCT handling.  Remove the option and
make compilation of vm_swapout.c conditional on RACCT.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46130
2024-07-29 01:43:59 +00:00
Mark Johnston
ec84a986ba vm: Remove kernel stack swapping support, part 11
- Remove sysctls that control stack swapping, update documentation.
- Remove vm_swapout_dummy.c, which serves no purpose now.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46129
2024-07-29 01:43:59 +00:00
Allan Jude
169d069116 smbios: Compile into the kernel more completely
Compile more of the IPMI into the kernel, and include all the
dependencies in ipmi.ko.

Sponsored by:		Netflix
Reviewed by:		andrew
Differential Revision:	https://reviews.freebsd.org/D45765
2024-07-24 23:09:57 -06:00
Warner Losh
5a0e9036d8 ipmi: Sort ipmi lines.
Sponsored by:		Netflix
2024-07-24 23:09:57 -06:00
Mark Johnston
82283cad12 dtrace: Avoid including dtrace_isa.c directly into dtrace.c
This was done in the original DTrace import, presumably because that
made it a bit easier to handle includes.  However, this can cause
dtrace_getpcstack() to be inlined into dtrace_probe(), resulting in a
missing frame in stack traces since dtrace_getpcstack() takes care to
bump "aframes" to account for its own stack frame.

To avoid this, compile dtrace_isa.c separately on all platforms.  Add
requisite includes.

MFC after:	2 weeks
Sponsored by:	Innovate UK
2024-07-24 17:24:46 -04:00
Jessica Clarke
8415a654d0 Retire non-NEW_PCIB code and remove config option
All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent
to do so in 121be55599 (arm: Set NEW_PCIB in DEFAULTS rather than a
subset of kernel configs")), so it's time we removed the legacy code
that no longer sees much testing and has a significant maintenance
burden.

Reviewed by:	jhb, andrew, emaste
Differential Revision:	https://reviews.freebsd.org/D32954
2024-07-18 18:55:12 +01:00
John Baldwin
03248b3f50 NOTES: Correct swapped descriptions of virtio_scmi and virtio_scsi
Sponsored by:	Chelsio Communications
2024-07-18 13:28:57 -04:00
Konstantin Belousov
ef2a572bf6 ipsec_offload: kernel infrastructure
Inline IPSEC offload moves almost whole IPSEC processing from the
CPU/MCU and possibly crypto accelerator, to the network card.

The transmitted packet content is not touched by CPU during TX
operations, kernel only does the required policy and security
association lookups to find out that given flow is offloaded, and then
packet is transmitted as plain text to the card. For driver convenience,
a metadata is attached to the packet identifying SA which must process
the packet. Card does encryption of the payload, padding, calculates
authentication, and does the reformat according to the policy.

Similarly, on receive, card does the decapsulation, decryption, and
authentification.  Kernel receives the identifier of SA that was
used to process the packet, together with the plain-text packet.

Overall, payload octets are only read or written by card DMA engine,
removing a lot of memory subsystem overhead, and saving CPU time because
IPSEC algos calculations are avoided.

If driver declares support for inline IPSEC offload (with the
IFCAP2_IPSEC_OFFLOAD capability set and registering method table struct
if_ipsec_accel_methods), kernel offers the SPD and SAD to driver.
Driver decides which policies and SAs can be offloaded based on
hardware capacity, and acks/nacks each SA for given interface to
kernel.  Kernel needs to keep this information to make a decision to
skip software processing on TX, and to assume processing already done
on RX.  This shadow SPD/SAD database of offloads is rooted from
policies (struct secpolicy accel_ifps, struct ifp_handle_sp) and SAs
(struct secasvar accel_ipfs, struct ifp_handle_sav).

Some extensions to the PF_KEY socket allow to limit interfaces for
which given SP/SA could be offloaded (proposed for offload).  Also,
additional statistics extensions allow to observe allocation/octet/use
counters for specific SA.

Since SPs and SAs are typically instantiated in non-sleepable context,
while offloading them into card is expected to require costly async
manipulations of the card state, calls to the driver for offload and
termination are executed in the threaded taskqueue.  It also solves
the issue of allocating resources needed for the offload database.
Neither ipf_handle_sp nor ipf_handle_sav do not add reference to the
owning SP/SA, the offload must be terminated before last reference is
dropped.  ipsec_accel only adds transient references to ensure safe
pointer ownership by taskqueue.

Maintaining the SA counters for hardware-accelerated packets is the
duty of the driver.  The helper ipsec_accel_drv_sa_lifetime_update()
is provided to hide accel infrastructure from drivers which would use
expected callout to query hardware periodically for updates.

Reviewed by:	rscheff	(transport, stack integration), np
Sponsored by:	NVIDIA networking
Differential revision:	https://reviews.freebsd.org/D44219
2024-07-12 07:27:58 +03:00
Emmanuel Vadot
5ed91e788f conf: hidmap is always needed for hms
So bring it in when hms is in the kernel config

Fixes:	13d00a43cb ("conf: Add usbhid and hidbus to GENERIC* kernel configs")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-07-10 08:55:24 +02:00
Mitchell Horne
88d81453b1 riscv: support PV_STATS pmap option
It is rarely used but trivially supported; add the missing stat calls
and enable it in LINT.

Reviewed by:	markj, br (previous version), jhb (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45475
2024-07-08 11:44:10 -03:00
Mariusz Zaborski
96d8f35f2a bde: remove lingering references
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45874
2024-07-08 12:43:38 +02:00
Shawn Anastasio
3465f14dac ossl: Add support for powerpc64/powerpc64le
Summary:
Add support for building ossl(4) on powerpc64* by implementing ossl_cpuid and
other support functions for powerpc. The required assembly files for ppc were
already present in-tree.

Test Plan: The changes were tested using the in-tree tools/tools/crypto/cryptocheck.c tool on both powerpc64 and powerpc64le on a POWER9 system.

Reviewed by:	#powerpc, jhibbits, jhb
Differential Revision: https://reviews.freebsd.org/D41837
2024-06-21 03:29:04 -04:00
Mark Johnston
ddf0ed09bd sdt: Implement SDT probes using hot-patching
The idea here is to avoid a memory access and conditional branch per
probe site.  Instead, the probe is represented by an "unreachable"
unconditional function call.  asm goto is used to store the address of
the probe site (represented by a no-op sled) and the address of the
function call into a tracepoint record.  Each SDT probe carries a list
of tracepoints.

When the probe is enabled, the no-op sled corresponding to each
tracepoint is overwritten with a jmp to the corresponding label.  The
implementation uses smp_rendezvous() to park all other CPUs while the
instruction is being overwritten, as this can't be done atomically in
general.  The compiler moves argument marshalling code and the
sdt_probe() function call out-of-line, i.e., to the end of the function.

Per gallatin@ in D43504, this approach has less overhead when probes are
disabled.  To make the implementation a bit simpler, I removed support
for probes with 7 arguments; nothing makes use of this except a
regression test case.  It could be re-added later if need be.

The approach taken in this patch enables some more improvements:
1. We can now automatically fill out the "function" field of SDT probe
   names.  The SDT macros let the programmer specify the function and
   module names, but this is really a bug and shouldn't have been
   allowed.  The intent was to be able to have the same probe in
   multiple functions and to let the user restrict which probes actually
   get enabled by specifying a function name or glob.
2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability
   to include blocks of code in the out-of-line path.  For example:

	if (SDT_PROBES_ENABLED()) {
		int reason = CLD_EXITED;

		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
		SDT_PROBE1(proc, , , exit, reason);
	}

could be written

	SDT_PROBE1_EXT(proc, , , exit, reason,
		int reason;

		reason = CLD_EXITED;
		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
	);

In the future I would like to use this mechanism more generally, e.g.,
to remove branches and marshalling code used by hwpmc, and generally to
make it easier to add new tracepoint consumers without having to add
more conditional branches to hot code paths.

Reviewed by:	Domagoj Stolfa, avg
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D44483
2024-06-19 16:57:41 -04:00
Doug Rabson
e97ad33a89 Add an implementation of the 9P filesystem
This is derived from swills@ fork of the Juniper virtfs with many
changes by me including bug fixes, style improvements, clearer layering
and more consistent logging. The filesystem is renamed to p9fs to better
reflect its function and to prevent possible future confusion with
virtio-fs.

Several updates and fixes from Juniper have been integrated into this
version by Val Packett and these contributions along with the original
Juniper authors are credited below.

To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The
bhyve virtio-9p device allows access from the guest to files on the host
by mapping a 'sharename' to a host path. It is possible to use p9fs as a
root filesystem by adding this to /boot/loader.conf:

	vfs.root.mountfrom="p9fs:sharename"

for non-root filesystems add something like this to /etc/fstab:

	sharename /mnt p9fs rw 0 0

In both examples, substitute the share name used on the bhyve command
line.

The 9P filesystem protocol relies on stateful file opens which map
protocol-level FIDs to host file descriptors. The FreeBSD vnode
interface doesn't really support this and we use heuristics to guess the
right FID to use for file operations.  This can be confused by privilege
lowering and does not guarantee that the FID created for a given file
open is always used for file operations, even if the calling process is
using the file descriptor from the original open call. Improving this
would involve changes to the vnode interface which is out-of-scope for
this import.

Differential Revision: https://reviews.freebsd.org/D41844
Reviewed by: kib, emaste, dch
MFC after: 3 months
Co-authored-by: Val Packett <val@packett.cool>
Co-authored-by: Ka Ho Ng <kahon@juniper.net>
Co-authored-by: joyu <joyul@juniper.net>
Co-authored-by: Kumara Babu Narayanaswamy <bkumara@juniper.net>
2024-06-19 13:12:04 +01:00
Andrew Turner
6abad5b606 Remove the arm FIQ support
It isn't used, and only masks/unmasks FIQs on the local CPU so will be
broken on SMP.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D33804
2024-06-10 15:16:10 +00: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
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
Andrew Turner
361da40536 arm64: Disable outling atomics
We don't have the symbols for this. The virtio randon number driver
uses a C11 atomic operation. With inline atomics this is translated to
an Armv8.0 atomic operation, with outling atomics this becomes a
function call to a handler. As we don't have the needed function the
kernel fails to link.

Fix by disabling outline atomics for now.

Reviewed by:	brooks, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45301
2024-06-05 09:23:40 +00:00
Mitchell Horne
191bf63da2 riscv: Move sigcode out of locore.S
It really doesn't fit here anymore as locore is all about early startup
code. Thus, move it to its own file.

Reviewed by:	br
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45320
2024-06-04 20:18:05 -03: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
Minsoo Choo
079d67b1d8 sys: Disable C standards prior to C99 from kernel build
The kernel hasn't built with anything less than c99 for a long
time. Retire support in the build for it.  In addition, retire the
translation of c99 to -std=iso9899:1999, since all latter day C
compilers that we support have had this for maybe 15 years or so (gcc
since 4.5, clang since the earliest version) and it simplifies the code.

Reviewed-by: imp, emaste
Differential-Revision: https://reviews.freebsd.org/D44145
2024-06-03 08:58:18 -06:00
Emmanuel Vadot
70c2998c0e Revert "files: make uart_bus_puc.c not depend on puc"
This reverts commit 114ab149e2.

This doesn't work, no idea how I tested this at the time but clearly the wrong way.
2024-05-29 19:06:41 +02:00
Warner Losh
175b2c00a6 Fix bnxt build in LINT
LINT includes bnxt_re driver. Adjust the path in files, add missing
files and add a new BNXT_C to build (which thinly wraps OFED version
with bnxt specicif stuff).

Sponsored by:		Netflix
Fixes: acd884dec9 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
2024-05-29 09:49:53 -06:00
Bojan Novković
da76d349b6 uma: Deduplicate uma_small_alloc
This commit refactors the UMA small alloc code and
removes most UMA machine-dependent code.
The existing machine-dependent uma_small_alloc code is almost identical
across all architectures, except for powerpc where using the direct
map addresses involved extra steps in some cases.

The MI/MD split was replaced by a default uma_small_alloc
implementation that can be overridden by architecture-specific code by
defining the UMA_MD_SMALL_ALLOC symbol. Furthermore, UMA_USE_DMAP was
introduced to replace most UMA_MD_SMALL_ALLOC uses.

Reviewed by: markj, kib
Approved by: markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D45084
2024-05-25 19:24:46 +02:00
Konstantin Belousov
40d951bc59 x86/iommu: extract useful utilities into x86_iommu.c
related to the page tables page allocation and mapping.

Sponsored by:	The FreeBSD Foundation
Sponsored by:	Advanced Micro Devices (AMD)
MFC after:	1 week
2024-05-25 08:32:01 +03:00
Andrew Turner
c2628accc0 sys: Build arm64 per-thread SSP with GCC
It has been supported since GCC 9. It is unlikely anything older than
that will build the kernel so mark it as supported by GCC.

Reviewed by:	brooks, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45267
2024-05-22 08:20:01 +00:00
Randall Stewart
ea916b6412 Remove TCP_SAD optional code now that the sack filter performs this function.
With the commit of D44903 we no longer need the SAD option. Instead all stacks that
use the sack filter inherit its protection against sack-attack.

Reviewed by: tuexen@
 Differential Revision:https://reviews.freebsd.org/D45216
2024-05-18 10:57:04 -04:00
Simon J. Gerraty
dd4d206cad kmod.mk use ${XARGS}
Also ${XARGS_J} this allows use of non-BSD xargs when building
kernel modules.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45146
2024-05-10 12:05:05 -07:00
Justin Hibbits
de1ac9462f conf: Generate fdt_static_dtb.h in OBJDIR
Though the kernel build expects ${.OBJDIR} to be equal to ${.CURDIR}
that may not always be the case.  Correctly generate fdt_static_dtb.h in
${.OBJDIR}, which is conceptually more correct anyway.

Obtained from:	Juniper Networks, Inc.
2024-05-10 14:35:50 -04:00
Florian Walpen
5687c71d5f snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver.
Add a sound(4) bridge device driver for the RME HDSP 9632 and HDSP 9652
sound cards. These cards require a nowadays rare PCI 32bit (not PCIe)
slot, but still see use due to their value and wealth of features.
The HDSP 9632 is mostly comparable to the newer HDSPe AIO, while the
HDSP 9652 is similar to the HDSPe RayDAT. These HDSPe PCIe cards are
supported by the snd_hdspe(4) driver which was taken as a starting point
for development of snd_hdsp(4).

Implementation is kept separately due to substantial differences in
hardware configuration and to allow easy removal in case PCI 32bit
support would be phased out in the future.

The snd_hdsp(4) kernel module is not enabled by default, and can be
loaded at runtime with kldload(8) or during boot via loader.conf(5).
Basic operation was tested with both cards, not including all optional
cable connectors and expansion boards. Features should be roughly on par
with the snd_hdspe(4) supported cards.

Reviewed by:	christos, br
Differential Revision:	https://reviews.freebsd.org/D45112
2024-05-09 19:36:40 +01:00
Poul-Henning Kamp
d3831ca8e3 Remove lingering geom_bde references. 2024-05-07 09:25:23 +00:00
Gleb Smirnoff
99b0270adc sockets: hide socket hhook(9)s under SOCKET_HHOOK
There are no in-tree consumers of these hooks.

Reviewed by:		stevek
Differential Revision:	https://reviews.freebsd.org/D44928
2024-05-06 12:49:29 -07:00
Justin Hibbits
c2e9c5bbf0 tpm: Refactor TIS and add a SPI attachment
Summary:
Though mostly used in x86 devices, TPM can be used on others, with a
direct SPI attachment.  Refactor the TPM 2.0 driver set to use an
attachment interface, and implement a SPI bus interface.

Test Plan:
Tested on a Raspberry Pi 4, with a GeeekPi TPM2.0 module (SLB9670
TPM) using security/tpm2-tools tpm2_getcaps for very light testing against the
spibus attachment.

Reviewed by:	kd
Obtained from:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D45069
2024-05-03 16:26:11 -04:00
John Baldwin
a15f7c96a2 nvmft: The in-kernel NVMe over Fabrics controller
This is the server (target in SCSI terms) for NVMe over Fabrics.
Userland is responsible for accepting a new queue pair and receiving
the initial Connect command before handing the queue pair off via an
ioctl to this CTL frontend.

This frontend exposes CTL LUNs as NVMe namespaces to remote hosts.
Users can ask LUNS to CTL that can be shared via either iSCSI or
NVMeoF.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44726
2024-05-02 16:38:30 -07:00
John Baldwin
0c4ee619df ctl: Support for NVMe commands
- Add support for queueing and executing NVMe admin and NVM commands
  via ctl_run and ctl_queue.  This requires fixing a few places that
  were SCSI-specific to add NVME logic.

- NVMe has much simpler command ordering requirements than SCSI.  In
  particular, the HBA is not required to enforce any specific ordering
  for requests with overlapping LBAs.  The host is required to manage
  that ordering.  However, fused commands (currently only COMPARE and
  WRITE NVM commands can be fused) are required to be executed
  atomically.

  To support fused commands, make the second half of a fused command
  block on the first half, and have commands submitted after a fused
  command pair block on the second half.

- Add handlers and command tables for admin and NVM commands that
  operate on individual namespaces and will be passed down from an
  NVMe over Fabrics controller to a CTL LUN.

Reviewed by:	ken, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44720
2024-05-02 16:32:09 -07:00