arch/powerpc/sysdev/xive/native.c
Source file repositories/reference/linux-study-clean/arch/powerpc/sysdev/xive/native.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/sysdev/xive/native.c- Extension
.c- Size
- 20650 bytes
- Lines
- 876
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/irq.hlinux/debugfs.hlinux/smp.hlinux/interrupt.hlinux/seq_file.hlinux/init.hlinux/of.hlinux/of_address.hlinux/slab.hlinux/spinlock.hlinux/delay.hlinux/cpumask.hlinux/mm.hlinux/kmemleak.hasm/machdep.hasm/io.hasm/smp.hasm/irq.hasm/errno.hasm/xive.hasm/xive-regs.hasm/opal.hasm/kvm_ppc.hxive-internal.h
Detected Declarations
function xive_native_populate_irq_datafunction xive_native_configure_irqfunction xive_native_get_irq_configfunction xive_native_configure_queuefunction __xive_native_disable_queuefunction xive_native_disable_queuefunction xive_native_setup_queuefunction xive_native_cleanup_queuefunction xive_native_matchfunction opal_xive_allocate_irqfunction xive_native_get_ipifunction xive_native_alloc_irq_on_chipfunction xive_native_free_irqfunction xive_native_put_ipifunction xive_native_shutdownfunction xive_native_update_pendingfunction xive_native_prepare_cpufunction xive_native_setup_cpufunction xive_native_teardown_cpufunction xive_native_sync_sourcefunction xive_native_sync_queuefunction xive_native_debug_createfunction xive_parse_provisioningfunction xive_native_setup_poolsfunction xive_native_default_eq_shiftfunction xive_native_initfunction xive_native_provision_pagesfunction xive_native_alloc_vp_blockfunction xive_native_free_vp_blockfunction xive_native_enable_vpfunction xive_native_disable_vpfunction xive_native_get_vp_infofunction xive_native_has_single_escalationfunction xive_native_has_save_restorefunction xive_native_get_queue_infofunction xive_native_get_queue_statefunction xive_native_set_queue_statefunction xive_native_has_queue_state_supportfunction xive_native_get_vp_stateexport xive_native_populate_irq_dataexport xive_native_configure_irqexport xive_native_configure_queueexport xive_native_disable_queueexport xive_native_alloc_irq_on_chipexport xive_native_free_irqexport xive_native_sync_sourceexport xive_native_sync_queueexport xive_native_default_eq_shift
Annotated Snippet
if (irq == OPAL_BUSY) {
msleep(OPAL_BUSY_DELAY_MS);
continue;
}
if (irq < 0) {
pr_err("Failed to allocate IPI on CPU %d\n", cpu);
return -ENXIO;
}
xc->hw_ipi = irq;
break;
}
return 0;
}
#endif /* CONFIG_SMP */
u32 xive_native_alloc_irq_on_chip(u32 chip_id)
{
s64 rc;
for (;;) {
rc = opal_xive_allocate_irq(chip_id);
if (rc != OPAL_BUSY)
break;
msleep(OPAL_BUSY_DELAY_MS);
}
if (rc < 0)
return 0;
return rc;
}
EXPORT_SYMBOL_GPL(xive_native_alloc_irq_on_chip);
void xive_native_free_irq(u32 irq)
{
for (;;) {
s64 rc = opal_xive_free_irq(irq);
if (rc != OPAL_BUSY)
break;
msleep(OPAL_BUSY_DELAY_MS);
}
}
EXPORT_SYMBOL_GPL(xive_native_free_irq);
#ifdef CONFIG_SMP
static void xive_native_put_ipi(unsigned int cpu, struct xive_cpu *xc)
{
s64 rc;
/* Free the IPI */
if (xc->hw_ipi == XIVE_BAD_IRQ)
return;
for (;;) {
rc = opal_xive_free_irq(xc->hw_ipi);
if (rc == OPAL_BUSY) {
msleep(OPAL_BUSY_DELAY_MS);
continue;
}
xc->hw_ipi = XIVE_BAD_IRQ;
break;
}
}
#endif /* CONFIG_SMP */
static void xive_native_shutdown(void)
{
/* Switch the XIVE to emulation mode */
opal_xive_reset(OPAL_XIVE_MODE_EMU);
}
/*
* Perform an "ack" cycle on the current thread, thus
* grabbing the pending active priorities and updating
* the CPPR to the most favored one.
*/
static void xive_native_update_pending(struct xive_cpu *xc)
{
u8 he, cppr;
u16 ack;
/* Perform the acknowledge hypervisor to register cycle */
ack = be16_to_cpu(__raw_readw(xive_tima + TM_SPC_ACK_HV_REG));
/* Synchronize subsequent queue accesses */
mb();
/*
* Grab the CPPR and the "HE" field which indicates the source
* of the hypervisor interrupt (if any)
*/
cppr = ack & 0xff;
he = (ack >> 8) >> 6;
Annotation
- Immediate include surface: `linux/types.h`, `linux/irq.h`, `linux/debugfs.h`, `linux/smp.h`, `linux/interrupt.h`, `linux/seq_file.h`, `linux/init.h`, `linux/of.h`.
- Detected declarations: `function xive_native_populate_irq_data`, `function xive_native_configure_irq`, `function xive_native_get_irq_config`, `function xive_native_configure_queue`, `function __xive_native_disable_queue`, `function xive_native_disable_queue`, `function xive_native_setup_queue`, `function xive_native_cleanup_queue`, `function xive_native_match`, `function opal_xive_allocate_irq`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
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.