Skip to content

Commit

Permalink
Update submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
liaocj committed Nov 21, 2024
1 parent 2fc1fe9 commit cc738e7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
Empty file.
1 change: 1 addition & 0 deletions linux/内核-驱动/中断/硬中断--中断号映射.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# hwirq 和 irq 的映射
47 changes: 46 additions & 1 deletion linux/内核-驱动/中断/硬中断--初始化.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ kernel/irq/irqdesc.c: early_trap_init
arch/arm/kernel/irq.c: init_IRQ

```c
// 非稀疏irq
int __init early_irq_init(void)
{
int count, i, node = first_online_node;
Expand All @@ -26,10 +27,54 @@ int __init early_irq_init(void)
raw_spin_lock_init(&desc[i].lock);
/* 设置中断描述符的锁所属的类, 此类用于防止死锁 */
lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
/* 一些变量的初始化 */
/* 描述符初始化 */
desc_set_defaults(i, &desc[i], node, NULL);
}

return arch_early_irq_init();
}

/* 描述符初始化 */
static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
struct module *owner)
{
int cpu;

/* 中断号 */
desc->irq_data.irq = irq;
/* 中断描述符的中断控制器芯片为 no_irq_chip */
desc->irq_data.chip = &no_irq_chip;
/* 中断控制器的私有数据为空 */
desc->irq_data.chip_data = NULL;
desc->irq_data.handler_data = NULL;
desc->irq_data.msi_desc = NULL;
/* 设置中断状态 desc->status_use_accessors 为初始化状态_IRQ_DEFAULT_INIT_FLAGS */
irq_settings_clr_and_set(desc, ~0, _IRQ_DEFAULT_INIT_FLAGS);
/* 中断默认被禁止, 设置 desc->irq_data->state_use_accessors = IRQD_IRQ_DISABLED */
irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
/* 设置中断处理回调函数为 handle_bad_irq, handle_bad_irq 作为默认的回调函数, 此函数中基本上不做什么处理, 就是在屏幕上打印此中断信息, 并且 desc->kstat_irqs++ */
desc->handle_irq = handle_bad_irq;
/* 嵌套深度为 1, 表示被禁止 1 次 */
desc->depth = 1;
/* 初始化此中断发送次数为 0 */
desc->irq_count = 0;
/* 无法处理的中断次数为 0 */
desc->irqs_unhandled = 0;
/* 在/proc/interrupts 所显名字为空 */
desc->name = NULL;
/* owner 为空 */
desc->owner = owner;

/* 初始化 kstat_irqs 中每个 CPU 项都为 0 */
for_each_possible_cpu(cpu)
*per_cpu_ptr(desc->kstat_irqs, cpu) = 0;

/* SMP 系统才使用的初始化, 设置
* desc->irq_data.node = first_online_node
* desc->irq_data.affinity = irq_default_affinity
* 清除 desc->pending_mask
*/
desc_smp_init(desc, node);
}

```
2 changes: 1 addition & 1 deletion linux/内核-驱动/中断/软中断--__do_softirq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
enum
{
HI_SOFTIRQ=0, //用于实现tasklet
TIMER_SOFTIRQ, //TIMER_SOFTIRQ和HRTIMER_SOFTIRQ用于实现定时器
TIMER_SOFTIRQ, //TIMER_SOFTIRQ和HRTIMER_SOFTIRQ用于实现定时器
NET_TX_SOFTIRQ,
NET_RX_SOFTIRQ,
BLOCK_SOFTIRQ,
Expand Down
2 changes: 1 addition & 1 deletion linux/内核-驱动/中断/软中断--__raise_softirq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags:

```c
#ifndef local_softirq_pending_ref
#define local_softirq_pending_ref irq_stat.__softirq_pending //软中断挂起位图,每bit代表一种软中断
#define local_softirq_pending_ref irq_stat.__softirq_pending //软中断挂起位图,每bit代表一种软中断
#endif

#define local_softirq_pending() (__this_cpu_read(local_softirq_pending_ref))
Expand Down
2 changes: 1 addition & 1 deletion linux/内核-驱动/中断/软中断--ksoftirqd.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void run_ksoftirqd(unsigned int cpu)
cond_resched();
return;
}
ksoftirqd_run_end(); // 开启cpu 中断响应
ksoftirqd_run_end(); // 开启cpu 中断响应
}
```
Expand Down

0 comments on commit cc738e7

Please sign in to comment.