[ARM异常]-SPIs(共享中断)routing到指定CPU的方法
生活随笔
收集整理的這篇文章主要介紹了
[ARM异常]-SPIs(共享中断)routing到指定CPU的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
快速鏈接:
.
👉👉👉 個人博客筆記導讀目錄(全部) 👈👈👈
原理介紹:
廢話不多說,看圖,看懂的給贊!
內核沒有提供指定SPIs中斷到特定cpu的接口。那代碼我們就胡亂的看一下吧
static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,bool force) {unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);struct irq_desc *desc = container_of(d, struct irq_desc, irq_data);void __iomem *reg;int enabled;u64 val;if (cpu >= nr_cpu_ids)return -EINVAL;if (gic_irq_in_rdist(d))return -EINVAL;/* If interrupt was enabled, disable it first */enabled = gic_peek_irq(d, GICD_ISENABLER);if (enabled)gic_mask_irq(d);reg = gic_dist_base(d) + GICD_IROUTER + (gic_irq(d) * 8);val = gic_mpidr_to_affinity(cpu_logical_map(cpu));gic_write_irouter(val, reg);/** If the interrupt was enabled, enabled it again. Otherwise,* just wait for the distributor to have digested our changes.*/if (enabled)gic_unmask_irq(d);elsegic_dist_wait_for_rwp();return IRQ_SET_MASK_OK; }- val = gic_mpidr_to_affinity(cpu_logical_map(cpu)); //讀出cpu的id值
- gic_write_irouter(val, reg); //將這個值,寫入到GICD寄存器
總結
以上是生活随笔為你收集整理的[ARM异常]-SPIs(共享中断)routing到指定CPU的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Device is not certif
- 下一篇: [crypto]-10-openssl版