drivers/ntb/hw/intel/ntb_hw_gen1.c
Source file repositories/reference/linux-study-clean/drivers/ntb/hw/intel/ntb_hw_gen1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ntb/hw/intel/ntb_hw_gen1.c- Extension
.c- Size
- 57568 bytes
- Lines
- 2092
- Domain
- Driver Families
- Bucket
- drivers/ntb
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/pci.hlinux/random.hlinux/slab.hlinux/ntb.hntb_hw_intel.hntb_hw_gen1.hntb_hw_gen3.hntb_hw_gen4.h
Detected Declarations
function ndev_reset_unsafe_flagsfunction ndev_is_unsafefunction ndev_ignore_unsafefunction ndev_mw_to_barfunction ndev_db_addrfunction ndev_db_readfunction ndev_db_writefunction ndev_db_set_maskfunction ndev_db_clear_maskfunction ndev_vec_maskfunction ndev_spad_addrfunction ndev_spad_readfunction ndev_spad_writefunction ndev_interruptfunction ndev_vec_isrfunction ndev_irq_isrfunction ndev_init_isrfunction ndev_deinit_isrfunction ndev_ntb_debugfs_readfunction ndev_debugfs_readfunction ndev_init_debugfsfunction ndev_deinit_debugfsfunction intel_ntb_mw_countfunction intel_ntb_mw_get_alignfunction intel_ntb_mw_set_transfunction intel_ntb_link_is_upfunction intel_ntb_link_enablefunction intel_ntb_link_disablefunction intel_ntb_peer_mw_countfunction intel_ntb_peer_mw_get_addrfunction intel_ntb_db_is_unsafefunction intel_ntb_db_valid_maskfunction intel_ntb_db_vector_countfunction intel_ntb_db_vector_maskfunction intel_ntb_db_readfunction intel_ntb_db_clearfunction intel_ntb_db_set_maskfunction intel_ntb_db_clear_maskfunction intel_ntb_peer_db_addrfunction intel_ntb_peer_db_setfunction intel_ntb_spad_is_unsafefunction intel_ntb_spad_countfunction intel_ntb_spad_readfunction intel_ntb_spad_writefunction intel_ntb_peer_spad_addrfunction intel_ntb_peer_spad_readfunction intel_ntb_peer_spad_writefunction xeon_db_ioread
Annotated Snippet
static const struct file_operations intel_ntb_debugfs_info;
static struct dentry *debugfs_dir;
static int b2b_mw_idx = -1;
module_param(b2b_mw_idx, int, 0644);
MODULE_PARM_DESC(b2b_mw_idx, "Use this mw idx to access the peer ntb. A "
"value of zero or positive starts from first mw idx, and a "
"negative value starts from last mw idx. Both sides MUST "
"set the same value here!");
static unsigned int b2b_mw_share;
module_param(b2b_mw_share, uint, 0644);
MODULE_PARM_DESC(b2b_mw_share, "If the b2b mw is large enough, configure the "
"ntb so that the peer ntb only occupies the first half of "
"the mw, so the second half can still be used as a mw. Both "
"sides MUST set the same value here!");
module_param_named(xeon_b2b_usd_bar2_addr64,
xeon_b2b_usd_addr.bar2_addr64, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_usd_bar2_addr64,
"XEON B2B USD BAR 2 64-bit address");
module_param_named(xeon_b2b_usd_bar4_addr64,
xeon_b2b_usd_addr.bar4_addr64, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_usd_bar4_addr64,
"XEON B2B USD BAR 4 64-bit address");
module_param_named(xeon_b2b_usd_bar4_addr32,
xeon_b2b_usd_addr.bar4_addr32, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_usd_bar4_addr32,
"XEON B2B USD split-BAR 4 32-bit address");
module_param_named(xeon_b2b_usd_bar5_addr32,
xeon_b2b_usd_addr.bar5_addr32, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_usd_bar5_addr32,
"XEON B2B USD split-BAR 5 32-bit address");
module_param_named(xeon_b2b_dsd_bar2_addr64,
xeon_b2b_dsd_addr.bar2_addr64, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_dsd_bar2_addr64,
"XEON B2B DSD BAR 2 64-bit address");
module_param_named(xeon_b2b_dsd_bar4_addr64,
xeon_b2b_dsd_addr.bar4_addr64, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_dsd_bar4_addr64,
"XEON B2B DSD BAR 4 64-bit address");
module_param_named(xeon_b2b_dsd_bar4_addr32,
xeon_b2b_dsd_addr.bar4_addr32, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_dsd_bar4_addr32,
"XEON B2B DSD split-BAR 4 32-bit address");
module_param_named(xeon_b2b_dsd_bar5_addr32,
xeon_b2b_dsd_addr.bar5_addr32, ullong, 0644);
MODULE_PARM_DESC(xeon_b2b_dsd_bar5_addr32,
"XEON B2B DSD split-BAR 5 32-bit address");
static int xeon_init_isr(struct intel_ntb_dev *ndev);
static inline void ndev_reset_unsafe_flags(struct intel_ntb_dev *ndev)
{
ndev->unsafe_flags = 0;
ndev->unsafe_flags_ignore = 0;
/* Only B2B has a workaround to avoid SDOORBELL */
if (ndev->hwerr_flags & NTB_HWERR_SDOORBELL_LOCKUP)
if (!ntb_topo_is_b2b(ndev->ntb.topo))
ndev->unsafe_flags |= NTB_UNSAFE_DB;
/* No low level workaround to avoid SB01BASE */
if (ndev->hwerr_flags & NTB_HWERR_SB01BASE_LOCKUP) {
ndev->unsafe_flags |= NTB_UNSAFE_DB;
ndev->unsafe_flags |= NTB_UNSAFE_SPAD;
}
}
static inline int ndev_is_unsafe(struct intel_ntb_dev *ndev,
unsigned long flag)
{
return !!(flag & ndev->unsafe_flags & ~ndev->unsafe_flags_ignore);
}
static inline int ndev_ignore_unsafe(struct intel_ntb_dev *ndev,
unsigned long flag)
{
flag &= ndev->unsafe_flags;
ndev->unsafe_flags_ignore |= flag;
return !!flag;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/pci.h`, `linux/random.h`, `linux/slab.h`.
- Detected declarations: `function ndev_reset_unsafe_flags`, `function ndev_is_unsafe`, `function ndev_ignore_unsafe`, `function ndev_mw_to_bar`, `function ndev_db_addr`, `function ndev_db_read`, `function ndev_db_write`, `function ndev_db_set_mask`, `function ndev_db_clear_mask`, `function ndev_vec_mask`.
- Atlas domain: Driver Families / drivers/ntb.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.