drivers/irqchip/irq-aclint-sswi.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-aclint-sswi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-aclint-sswi.c- Extension
.c- Size
- 5083 bytes
- Lines
- 212
- Domain
- Driver Families
- Bucket
- drivers/irqchip
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/interrupt.hlinux/irqchip.hlinux/irqchip/chained_irq.hlinux/of_address.hlinux/spinlock.hlinux/smp.hlinux/string_choices.hasm/sbi.hasm/vendorid_list.h
Detected Declarations
function aclint_sswi_ipi_sendfunction aclint_sswi_ipi_clearfunction aclint_sswi_ipi_handlefunction aclint_sswi_starting_cpufunction aclint_sswi_dying_cpufunction aclint_sswi_parse_irqfunction aclint_sswi_probefunction generic_aclint_sswi_probefunction generic_aclint_sswi_early_probefunction thead_aclint_sswi_probefunction thead_aclint_sswi_early_probe
Annotated Snippet
if (rc) {
pr_warn("%pfwP: hart index [%d] not found\n", fwnode, i);
return -EINVAL;
}
per_cpu(sswi_cpu_regs, cpu) = reg + hart_index * 4;
}
pr_info("%pfwP: register %u CPU%s\n", fwnode, contexts, str_plural(contexts));
return 0;
}
static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
{
struct irq_domain *domain;
void __iomem *reg;
int virq, rc;
if (!is_of_node(fwnode))
return -EINVAL;
reg = of_io_request_and_map(to_of_node(fwnode), 0, NULL);
if (IS_ERR(reg)) {
pr_err("%pfwP: Failed to map MMIO region\n", fwnode);
return PTR_ERR(reg);
}
/* Parse SSWI setting */
rc = aclint_sswi_parse_irq(fwnode, reg);
if (rc < 0)
return rc;
/* If mulitple SSWI devices are present, do not register irq again */
if (sswi_ipi_virq)
return 0;
/* Find riscv intc domain and create IPI irq mapping */
domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(), DOMAIN_BUS_ANY);
if (!domain) {
pr_err("%pfwP: Failed to find INTC domain\n", fwnode);
return -ENOENT;
}
sswi_ipi_virq = irq_create_mapping(domain, RV_IRQ_SOFT);
if (!sswi_ipi_virq) {
pr_err("unable to create ACLINT SSWI IRQ mapping\n");
return -ENOMEM;
}
/* Register SSWI irq and handler */
virq = ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send);
if (virq <= 0) {
pr_err("unable to create muxed IPIs\n");
irq_dispose_mapping(sswi_ipi_virq);
return virq < 0 ? virq : -ENOMEM;
}
irq_set_chained_handler(sswi_ipi_virq, aclint_sswi_ipi_handle);
cpuhp_setup_state(CPUHP_AP_IRQ_ACLINT_SSWI_STARTING,
"irqchip/aclint-sswi:starting",
aclint_sswi_starting_cpu,
aclint_sswi_dying_cpu);
riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
return 0;
}
/* generic/MIPS variant */
static int __init generic_aclint_sswi_probe(struct fwnode_handle *fwnode)
{
int rc;
rc = aclint_sswi_probe(fwnode);
if (rc)
return rc;
/* Announce that SSWI is providing IPIs */
pr_info("providing IPIs using ACLINT SSWI\n");
return 0;
}
static int __init generic_aclint_sswi_early_probe(struct device_node *node,
struct device_node *parent)
{
return generic_aclint_sswi_probe(&node->fwnode);
}
IRQCHIP_DECLARE(mips_p8700_sswi, "mips,p8700-aclint-sswi", generic_aclint_sswi_early_probe);
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/interrupt.h`, `linux/irqchip.h`, `linux/irqchip/chained_irq.h`, `linux/of_address.h`, `linux/spinlock.h`, `linux/smp.h`, `linux/string_choices.h`.
- Detected declarations: `function aclint_sswi_ipi_send`, `function aclint_sswi_ipi_clear`, `function aclint_sswi_ipi_handle`, `function aclint_sswi_starting_cpu`, `function aclint_sswi_dying_cpu`, `function aclint_sswi_parse_irq`, `function aclint_sswi_probe`, `function generic_aclint_sswi_probe`, `function generic_aclint_sswi_early_probe`, `function thead_aclint_sswi_probe`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source 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.