drivers/dca/dca-core.c
Source file repositories/reference/linux-study-clean/drivers/dca/dca-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dca/dca-core.c- Extension
.c- Size
- 10561 bytes
- Lines
- 457
- Domain
- Driver Families
- Bucket
- drivers/dca
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/notifier.hlinux/device.hlinux/dca.hlinux/slab.hlinux/module.h
Detected Declarations
function dca_free_domainfunction dca_provider_ioat_ver_3_0function unregister_dca_providersfunction list_for_each_entry_safefunction dca_add_requesterfunction list_for_each_entryfunction dca_remove_requesterfunction dca_common_get_tagfunction cpufunction dca_get_tagfunction free_dca_providerfunction register_dca_providerfunction unregister_dca_providerfunction dca_register_notifyfunction dca_unregister_notifyfunction dca_initfunction dca_exitexport dca_add_requesterexport dca_remove_requesterexport dca3_get_tagexport dca_get_tagexport alloc_dca_providerexport free_dca_providerexport register_dca_providerexport unregister_dca_providerexport dca_register_notifyexport dca_unregister_notify
Annotated Snippet
if (dca_providers_blocked) {
raw_spin_unlock_irqrestore(&dca_lock, flags);
dca_sysfs_remove_provider(dca);
unregister_dca_providers();
return -ENODEV;
}
raw_spin_unlock_irqrestore(&dca_lock, flags);
rc = dca_pci_rc_from_dev(dev);
newdomain = dca_allocate_domain(rc);
if (!newdomain)
return -ENODEV;
raw_spin_lock_irqsave(&dca_lock, flags);
/* Recheck, we might have raced after dropping the lock */
domain = dca_get_domain(dev);
if (!domain) {
domain = newdomain;
newdomain = NULL;
list_add(&domain->node, &dca_domains);
}
}
list_add(&dca->node, &domain->dca_providers);
raw_spin_unlock_irqrestore(&dca_lock, flags);
blocking_notifier_call_chain(&dca_provider_chain,
DCA_PROVIDER_ADD, NULL);
kfree(newdomain);
return 0;
}
EXPORT_SYMBOL_GPL(register_dca_provider);
/**
* unregister_dca_provider - remove a dca provider
* @dca - struct created by alloc_dca_provider()
*/
void unregister_dca_provider(struct dca_provider *dca, struct device *dev)
{
unsigned long flags;
struct pci_bus *pci_rc;
struct dca_domain *domain;
blocking_notifier_call_chain(&dca_provider_chain,
DCA_PROVIDER_REMOVE, NULL);
raw_spin_lock_irqsave(&dca_lock, flags);
if (list_empty(&dca_domains)) {
raw_spin_unlock_irqrestore(&dca_lock, flags);
return;
}
list_del(&dca->node);
pci_rc = dca_pci_rc_from_dev(dev);
domain = dca_find_domain(pci_rc);
if (list_empty(&domain->dca_providers))
dca_free_domain(domain);
raw_spin_unlock_irqrestore(&dca_lock, flags);
dca_sysfs_remove_provider(dca);
}
EXPORT_SYMBOL_GPL(unregister_dca_provider);
/**
* dca_register_notify - register a client's notifier callback
*/
void dca_register_notify(struct notifier_block *nb)
{
blocking_notifier_chain_register(&dca_provider_chain, nb);
}
EXPORT_SYMBOL_GPL(dca_register_notify);
/**
* dca_unregister_notify - remove a client's notifier callback
*/
void dca_unregister_notify(struct notifier_block *nb)
{
blocking_notifier_chain_unregister(&dca_provider_chain, nb);
}
EXPORT_SYMBOL_GPL(dca_unregister_notify);
static int __init dca_init(void)
{
pr_info("dca service started, version %s\n", DCA_VERSION);
return dca_sysfs_init();
}
static void __exit dca_exit(void)
{
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/notifier.h`, `linux/device.h`, `linux/dca.h`, `linux/slab.h`, `linux/module.h`.
- Detected declarations: `function dca_free_domain`, `function dca_provider_ioat_ver_3_0`, `function unregister_dca_providers`, `function list_for_each_entry_safe`, `function dca_add_requester`, `function list_for_each_entry`, `function dca_remove_requester`, `function dca_common_get_tag`, `function cpu`, `function dca_get_tag`.
- Atlas domain: Driver Families / drivers/dca.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.