arch/powerpc/platforms/cell/spu_base.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/cell/spu_base.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/cell/spu_base.c- Extension
.c- Size
- 18815 bytes
- Lines
- 794
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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/interrupt.hlinux/list.hlinux/init.hlinux/ptrace.hlinux/slab.hlinux/wait.hlinux/mm.hlinux/io.hlinux/mutex.hlinux/linux_logo.hlinux/syscore_ops.hlinux/sysfs.hasm/spu.hasm/spu_priv1.hasm/spu_csa.hasm/kexec.h
Detected Declarations
struct crash_spu_infofunction spu_invalidate_slbsfunction spu_flush_all_slbsfunction mm_needs_global_tlbiefunction spu_associate_mmfunction spu_64k_pages_availablefunction spu_restart_dmafunction spu_load_slbfunction __spu_trap_data_segfunction __spu_trap_data_mapfunction __spu_kernel_slbfunction __slb_presentfunction spu_setup_kernel_slbsfunction spu_irq_class_0function spu_irq_class_1function spu_irq_class_2function spu_request_irqsfunction spu_free_irqsfunction spu_init_channelsfunction spu_add_dev_attrfunction spu_add_dev_attr_groupfunction spu_remove_dev_attrfunction spu_remove_dev_attr_groupfunction spu_create_devfunction create_spufunction spu_acct_timefunction spu_stat_showfunction crash_kexec_stop_spusfunction crash_register_spusfunction list_for_each_entryfunction crash_register_spusfunction init_spu_basemodule init init_spu_baseexport spu_management_opsexport spu_priv1_opsexport cbe_spu_infoexport force_sig_faultexport spu_invalidate_slbsexport spu_associate_mmexport spu_64k_pages_availableexport spu_setup_kernel_slbsexport spu_init_channelsexport spu_add_dev_attrexport spu_add_dev_attr_groupexport spu_remove_dev_attrexport spu_remove_dev_attr_group
Annotated Snippet
static const struct bus_type spu_subsys = {
.name = "spu",
.dev_name = "spu",
};
int spu_add_dev_attr(struct device_attribute *attr)
{
struct spu *spu;
mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list)
device_create_file(&spu->dev, attr);
mutex_unlock(&spu_full_list_mutex);
return 0;
}
EXPORT_SYMBOL_GPL(spu_add_dev_attr);
int spu_add_dev_attr_group(const struct attribute_group *attrs)
{
struct spu *spu;
int rc = 0;
mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list) {
rc = sysfs_create_group(&spu->dev.kobj, attrs);
/* we're in trouble here, but try unwinding anyway */
if (rc) {
printk(KERN_ERR "%s: can't create sysfs group '%s'\n",
__func__, attrs->name);
list_for_each_entry_continue_reverse(spu,
&spu_full_list, full_list)
sysfs_remove_group(&spu->dev.kobj, attrs);
break;
}
}
mutex_unlock(&spu_full_list_mutex);
return rc;
}
EXPORT_SYMBOL_GPL(spu_add_dev_attr_group);
void spu_remove_dev_attr(struct device_attribute *attr)
{
struct spu *spu;
mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list)
device_remove_file(&spu->dev, attr);
mutex_unlock(&spu_full_list_mutex);
}
EXPORT_SYMBOL_GPL(spu_remove_dev_attr);
void spu_remove_dev_attr_group(const struct attribute_group *attrs)
{
struct spu *spu;
mutex_lock(&spu_full_list_mutex);
list_for_each_entry(spu, &spu_full_list, full_list)
sysfs_remove_group(&spu->dev.kobj, attrs);
mutex_unlock(&spu_full_list_mutex);
}
EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group);
static int __init spu_create_dev(struct spu *spu)
{
int ret;
spu->dev.id = spu->number;
spu->dev.bus = &spu_subsys;
ret = device_register(&spu->dev);
if (ret) {
printk(KERN_ERR "Can't register SPU %d with sysfs\n",
spu->number);
return ret;
}
sysfs_add_device_to_node(&spu->dev, spu->node);
return 0;
}
static int __init create_spu(void *data)
{
struct spu *spu;
int ret;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/list.h`, `linux/init.h`, `linux/ptrace.h`, `linux/slab.h`, `linux/wait.h`, `linux/mm.h`, `linux/io.h`.
- Detected declarations: `struct crash_spu_info`, `function spu_invalidate_slbs`, `function spu_flush_all_slbs`, `function mm_needs_global_tlbie`, `function spu_associate_mm`, `function spu_64k_pages_available`, `function spu_restart_dma`, `function spu_load_slb`, `function __spu_trap_data_seg`, `function __spu_trap_data_map`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.