arch/powerpc/platforms/cell/spufs/switch.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/cell/spufs/switch.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/cell/spufs/switch.c- Extension
.c- Size
- 63875 bytes
- Lines
- 2207
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- 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/export.hlinux/errno.hlinux/hardirq.hlinux/sched.hlinux/kernel.hlinux/mm.hlinux/vmalloc.hlinux/smp.hlinux/stddef.hlinux/unistd.hasm/io.hasm/spu.hasm/spu_priv1.hasm/spu_csa.hasm/mmu_context.hspufs.hspu_save_dump.hspu_restore_dump.h
Detected Declarations
function acquire_spu_lockfunction disable_interruptsfunction set_watchdog_timerfunction save_spu_runcntlfunction save_mfc_sr1function save_spu_statusfunction save_mfc_stopped_statusfunction halt_mfc_decrfunction save_timebasefunction remove_other_spu_accessfunction issue_mfc_tlbiefunction handle_pending_interruptsfunction save_ppu_querymaskfunction save_ppu_querytypefunction save_ppu_tagstatusfunction save_mfc_csr_tsqfunction save_mfc_csr_cmdfunction save_mfc_csr_atofunction save_mfc_tclass_idfunction set_mfc_tclass_idfunction purge_mfc_queuefunction wait_purge_completefunction setup_mfc_sr1function save_spu_npcfunction save_spu_privcntlfunction reset_spu_privcntlfunction save_spu_lslrfunction reset_spu_lslrfunction save_spu_cfgfunction save_pm_tracefunction save_ppu_mb_statfunction save_ppu_mbfunction save_ppuint_mbfunction save_ch_part1function save_spu_mbfunction save_mfc_cmdfunction reset_chfunction resume_mfc_queuefunction setup_mfc_slbsfunction set_switch_activefunction enable_interruptsfunction send_mfc_dmafunction save_ls_16kbfunction set_spu_npcfunction set_signot1function set_signot2function send_save_codefunction set_ppu_querymask
Annotated Snippet
if (unlikely(status & 0x2)) {
cpu_relax();
}
} while (status & 0x3);
size -= transfer_size;
ea += transfer_size;
ls_offset += transfer_size;
}
return 0;
}
static inline void save_ls_16kb(struct spu_state *csa, struct spu *spu)
{
unsigned long addr = (unsigned long)&csa->lscsa->ls[0];
unsigned int ls_offset = 0x0;
unsigned int size = 16384;
unsigned int tag = 0;
unsigned int rclass = 0;
unsigned int cmd = MFC_PUT_CMD;
/* Save, Step 50:
* Issue a DMA command to copy the first 16K bytes
* of local storage to the CSA.
*/
send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd);
}
static inline void set_spu_npc(struct spu_state *csa, struct spu *spu)
{
struct spu_problem __iomem *prob = spu->problem;
/* Save, Step 51:
* Restore, Step 31.
* Write SPU_NPC[IE]=0 and SPU_NPC[LSA] to entry
* point address of context save code in local
* storage.
*
* This implementation uses SPU-side save/restore
* programs with entry points at LSA of 0.
*/
out_be32(&prob->spu_npc_RW, 0);
eieio();
}
static inline void set_signot1(struct spu_state *csa, struct spu *spu)
{
struct spu_problem __iomem *prob = spu->problem;
union {
u64 ull;
u32 ui[2];
} addr64;
/* Save, Step 52:
* Restore, Step 32:
* Write SPU_Sig_Notify_1 register with upper 32-bits
* of the CSA.LSCSA effective address.
*/
addr64.ull = (u64) csa->lscsa;
out_be32(&prob->signal_notify1, addr64.ui[0]);
eieio();
}
static inline void set_signot2(struct spu_state *csa, struct spu *spu)
{
struct spu_problem __iomem *prob = spu->problem;
union {
u64 ull;
u32 ui[2];
} addr64;
/* Save, Step 53:
* Restore, Step 33:
* Write SPU_Sig_Notify_2 register with lower 32-bits
* of the CSA.LSCSA effective address.
*/
addr64.ull = (u64) csa->lscsa;
out_be32(&prob->signal_notify2, addr64.ui[1]);
eieio();
}
static inline void send_save_code(struct spu_state *csa, struct spu *spu)
{
unsigned long addr = (unsigned long)&spu_save_code[0];
unsigned int ls_offset = 0x0;
unsigned int size = sizeof(spu_save_code);
unsigned int tag = 0;
unsigned int rclass = 0;
unsigned int cmd = MFC_GETFS_CMD;
/* Save, Step 54:
Annotation
- Immediate include surface: `linux/export.h`, `linux/errno.h`, `linux/hardirq.h`, `linux/sched.h`, `linux/kernel.h`, `linux/mm.h`, `linux/vmalloc.h`, `linux/smp.h`.
- Detected declarations: `function acquire_spu_lock`, `function disable_interrupts`, `function set_watchdog_timer`, `function save_spu_runcntl`, `function save_mfc_sr1`, `function save_spu_status`, `function save_mfc_stopped_status`, `function halt_mfc_decr`, `function save_timebase`, `function remove_other_spu_access`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.