aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ntb
Commit message (Collapse)AuthorAgeFilesLines
* pmap_change_attr: Use void * instead of vm_offset_tJohn Baldwin2026-04-233-4/+4
| | | | | | | Effort: CHERI upstreaming Reviewed by: kib Sponsored by: AFRL, DARPA Pull Request: https://github.com/freebsd/freebsd-src/pull/2068
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-062-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-252-2/+2
| | | | Sponsored by: Netflix
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-4/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* ntb: Add Intel Xeon Gen4 supportAustin Zhang2024-02-072-34/+543
| | | | | | | | | The NTB hardware of XEON Ice lake and Sapphire Rapids has register mapping changes Add a new NTB_XEON_GEN4 device type and use it to conditionalize driver logic differs Reviewed by: vangyzen, dab Sponsored by: Dell Technologies Differential Revision: https://reviews.freebsd.org/D43291
* ntb_hw_plx: Workaround read-only scratchpad registersAlexander Motin2024-01-272-6/+22
| | | | | | | | | | | | On several systems we've noticed that when NTB link goes down, the Physical Layer User Test Pattern registers we use as additional scratchpad registers (that is explicitly allowed by the chip specs) become read-only for about 100us. I see no explanation for this in the chip specs, neither why it was not seen before, may be a race. Since we do need these registers, workaround it by repeating writes until we succeed or 1ms timeout expire. MFC after: 1 week
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-277-7/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()Justin Hibbits2023-08-251-1/+1
| | | | | | | | | | | | Summary: These came in the original DrvAPI commits in 2014, and are obsoleted by bpf_mtap_if() and ether_bpf_mtap_if(). The `_if` suffix, rather than prefix, conveys that it's operating on the bpf of the interface, instead than the interface itself. Reviewed by: glebius Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D41146
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-14/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-164-8/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* ntb: Use uintmax_t casts and %j to print physical addresses.John Baldwin2022-09-282-9/+11
| | | | | | | | This fixes -Wint-to-pointer-cast errors with GCC when compiling on i386 where physical addresses are not the same size as pointers. Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D36751
* ntb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-099-15/+6
|
* ntb_hw_intel: fix xeon NTB gen3 bar disable logicDavid Bright2021-09-271-20/+17
| | | | | | | | | | | | | | | | | In NTB gen3 driver, it was supposed to disable NTB bar access by default, but due to incorrect register access method, the bar disable logic does not work as expected. Those registers should be modified through NTB bar0 rather than PCI configuration space. Besides, we'd better to protect ourselves from a bad buddy node so ingress disable logic should be implemented together. Submitted by: Austin Zhang (austin.zhang@dell.com) Reviewers: markj, mav, vangyzen, dab Differential Revision: https://reviews.freebsd.org/D31736 Sponsored by: Dell EMC MFC to: stable/12, stable/13 MFC after: 1 week
* ntb_hw_intel(4): Add CTLFLAG_MPSAFE flags.Alexander Motin2021-08-111-45/+45
| | | | | | I should have added those in 50f16247a1. MFC after: 2 weeks
* ntb_transport(4): Mark callouts MP-safe.Alexander Motin2021-08-101-3/+3
| | | | | | | The only thing around NTB using Giant lock is NewBus, and these callouts have nothing to do with it. MFC after: 2 weeks
* ntb_hw_intel(4): Remove CTLFLAG_NEEDGIANT flags.Alexander Motin2021-08-101-45/+45
| | | | | | | Most of the sysctls just read hardware registers. They don't need any locking. MFC after: 2 weeks
* newbus: Move from bus_child_{pnpinfo,location}_src to ↵Warner Losh2021-06-236-12/+11
| | | | | | | | | | | | | | | | | | | | | | bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
* ntb: quiet gcc -Wreturn-typeRyan Libby2020-12-111-0/+1
| | | | | | | | | Reviewed by: cem, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27553 Notes: svn path=/head/; revision=368563
* ntb: Fix the 32-bit build after r366969Mark Johnston2020-10-231-1/+2
| | | | | | | | Reported by: Jenkins MFC with: r366969 Notes: svn path=/head/; revision=366973
* ntb: Add Intel Xeon Gen3 supportMark Johnston2020-10-232-48/+437
| | | | | | | | | | | | | | | | | The NTB hardware starting with Skylake has some changes to the register map and the doorbell interface. Add a new NTB_XEON_GEN3 device type and use it to conditionalize driver logic that differs from the existing Xeon code. Reviewed by: vangyzen Discussed with: cem, Bret Ketchum <Bret.Ketchum@dell.com> MFC after: 1 month Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26683 Notes: svn path=/head/; revision=366969
* ntb: Fix an assertion to permit >= 32 doorbellsMark Johnston2020-10-231-1/+1
| | | | | | | | | MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Notes: svn path=/head/; revision=366968
* ntb_tool: ubuf is too small to hold a human readable 64 bit valueEric van Gyzen2020-10-211-1/+1
| | | | | | | | | | | | | | | ubuf buffer is too small. It should be 18 if a NULL is not needed, or 19 to hold the NULL terminator for the full 64-BIT value plus the 0x prefix. Submitted by: bret_ketchum@dell.com Reviewed by: markj mav MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26893 Notes: svn path=/head/; revision=366914
* ntb: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-9/+1
| | | | Notes: svn path=/head/; revision=365192
* o Don't include headers from iommu.h, include them from the headerRuslan Bukin2020-07-292-0/+4
| | | | | | | | | | | | consumers instead; o Order includes properly. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25878 Notes: svn path=/head/; revision=363675
* Fix build.Ruslan Bukin2020-07-292-0/+2
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25879 Notes: svn path=/head/; revision=363666
* o Move the buswide_ctxs bitmap to iommu_unit and rename related functions.Ruslan Bukin2020-07-282-2/+2
| | | | | | | | | | | o Rename bus_dma_dmar_load_ident() as well. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25852 Notes: svn path=/head/; revision=363650
* ntb: Stop checking for failures from malloc(M_WAITOK).Mark Johnston2020-07-231-25/+4
| | | | | | | | | | | PR: 240545 Submitted by: Andrew Reiter <arr@watson.org> Reviewed by: cem, mav MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25768 Notes: svn path=/head/; revision=363445
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-265-62/+70
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Although most of the NIC drivers are epoch ready, due to peer pressureGleb Smirnoff2020-02-241-2/+1
| | | | | | | | | | | | | | | | | | | switch over to opt-in instead of opt-out for epoch. Instead of IFF_NEEDSEPOCH, provide IFF_KNOWSEPOCH. If driver marks itself with IFF_KNOWSEPOCH, then ether_input() would not enter epoch when processing its packets. Now this will create recursive entrance in epoch in >90% network drivers, but will guarantee safeness of the transition. Mark several tested drivers as IFF_KNOWSEPOCH. Reviewed by: hselasky, jeff, bz, gallatin Differential Revision: https://reviews.freebsd.org/D23674 Notes: svn path=/head/; revision=358301
* Add support for Hygon NTB PCI device in ntb_hw_amd driver.Alexander Motin2020-02-142-1/+17
| | | | | | | | | Submitted by: Pu Wen <puwen@hygon.cn> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23565 Notes: svn path=/head/; revision=357920
* Introduce flag IFF_NEEDSEPOCH that marks Ethernet interfaces thatGleb Smirnoff2020-01-231-1/+2
| | | | | | | | | | | supposedly may call into ether_input() without network epoch. They all need to be reviewed before 13.0-RELEASE. Some may need be fixed. The flag is not planned to be used in the kernel for a long time. Notes: svn path=/head/; revision=357010
* Make DMAR allow Intel NTB device to access its own BAR0.Alexander Motin2019-11-281-0/+32
| | | | | | | | | | | | | | | | | | I have no good explanation why it happens, but I found that in B2B mode at least Xeon v4 NTB leaks accesses to its configuration memory at BAR0 originated from the link side to its host side. DMAR predictably blocks those, making access to remote scratchpad registers in B2B mode impossible. This change creates identity mapping in DMAR covering the BAR0 addresses, making the NTB work fine with DMAR enabled. It seems like allowing single 4KB range at 32KB offset may be enough, but I don't see a reason to be so specific. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=355165
* Make the code slightly more compact.Alexander Motin2019-11-281-22/+26
| | | | | | | | | There should be no functional change. MFC after: 1 week Notes: svn path=/head/; revision=355163
* Report XLAT0 register for completeness.Alexander Motin2019-11-251-0/+8
| | | | Notes: svn path=/head/; revision=355074
* Call bus_dma_dmar_set_buswide(9) added in r354830.Alexander Motin2019-11-191-0/+6
| | | | | | | | | | | PLX NTB sends translated DMA requests not only from itsels, but from all slots and functions of its bus. By default DMAR blocks those additional. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=354840
* Make ntb(4) send bus_get_dma_tag() requests to parent buses passing realAlexander Motin2019-11-145-0/+11
| | | | | | | | | | | bus' child pointers instead of grandchilds. DMAR does not like requests from devices not parented directly by PCI. MFC after: 2 weeks Notes: svn path=/head/; revision=354702
* Add compact scraptchpad protocol for ntb_transport(4).Alexander Motin2019-11-101-31/+87
| | | | | | | | | | | | | | | | | | | Previously ntb_transport(4) required at least 6 scratchpad registers, plus 2 more for each additional memory window. That is too much for some configurations, where several drivers have to share resources of the same NTB hardware. This patch introduces new compact version of the protocol, requiring only 3 scratchpad registers, plus one more for each additional memory window. The optimization is based on fact that neither of version, number of windows or number of queue pairs really need more then one byte each, and window sizes of 4GB are not very useful now. The new protocol is activated automatically when the configuration is low on scratchpad registers, or it can be activated explicitly with loader tunable. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=354581
* Allow splitting PLX NTB BAR2 into several memory windows.Alexander Motin2019-11-101-100/+136
| | | | | | | | | | | | | | | | Address Lookup Table (A-LUT) being enabled allows to specify separate translation for each 1/128th or 1/256th of the BAR2. Previously it was used only to limit effective window size by blocking access through some of A-LUT elements. This change allows A-LUT elements to also point different memory locations, providing to upper layers several (up to 128) independent memory windows. A-LUT hardware allows even more flexible configurations than this, but NTB KPI have no way to manage that now. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=354580
* NTB Tool: Test driver for NTB hardware drivers.Alexander Motin2019-08-161-0/+1516
| | | | | | | | | | | | | | | | NTB Tool driver is meant for testing NTB hardware driver functionalities, such as doorbell interrupts, link events, scratchpad registers and memory windows. This is a port of ntb_tool driver from Linux. It has been verified on top of AMD and PLX NTB HW drivers. Submitted by: Arpan Palit <arpan.palit@amd.com> Cleaned up by: mav MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D18819 Notes: svn path=/head/; revision=351137
* Fix i386 build.Alexander Motin2019-08-151-1/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351107
* Limit memory window usage in ntb_transport to 256MB.Alexander Motin2019-08-151-18/+22
| | | | | | | | | | | | | | | | This adds safety net for the case of misconfigured NTB with too big memory window, for which we may be unable to allocate a memory buffer, which does not make much sense for the network interface. While there, fix the code to really work with asymmetric window sizes setup. This makes driver just print warning message on boot instead of hanging if too large memory window is configured. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=351105
* Fix i386 LINT build after r351056.Alexander Motin2019-08-151-8/+8
| | | | | | | MFC after: 13 days Notes: svn path=/head/; revision=351083
* Implement new methods for Intel and PLX NTB.Alexander Motin2019-08-152-0/+83
| | | | | | | | | | | This restores parity with AMD NTB driver. Though without any drivers supporting more then one peer and respective KPI modification to pass peer index to most of the calls this addition is pretty useless now. MFC after: 2 weeks Notes: svn path=/head/; revision=351072
* Add support for PCI Device ID 0x148B in ntb_hw_amd driver.Alexander Motin2019-08-142-62/+107
| | | | | | | | | Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20892 Notes: svn path=/head/; revision=351056
* Include sys/lock.h, as told by man page.Alexander Motin2019-07-021-0/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=349601
* Fix i386 LINT after r349594.Alexander Motin2019-07-021-17/+32
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=349595
* Add driver for NTB in AMD SoC.Alexander Motin2019-07-026-30/+1631
| | | | | | | | | | | | | | | This patch is the driver for NTB hardware in AMD SoCs (ported from Linux) and enables the NTB infrastructure like Doorbells, Scratchpads and Memory window in AMD SoC. This driver has been validated using ntb_transport and if_ntb driver already available in FreeBSD. Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com> MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D18774 Notes: svn path=/head/; revision=349594
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-202-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.Alexander Motin2019-02-211-4/+12
| | | | | | | | | | | Its a hack, we can't know/list all DMA engines, but this covers all I/OAT of Xeon E5/E7 at least from Sandy Bridge till Skylake I saw. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=344437