V1 是什么
CONFIG_IRQ_DOMAIN_HIERARCHY = n
struct irq_domain_ops {
int (*match)(struct irq_domain *d, struct device_node *node,
enum irq_domain_bus_token bus_token);
int (*select)(struct irq_domain *d, struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token);
int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
void (*unmap)(struct irq_domain *d, unsigned int virq);
int (*xlate)(struct irq_domain *d, struct device_node *node,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq, unsigned int *out_type);
};
V2 是什么
CONFIG_IRQ_DOMAIN_HIERARCHY = y
struct irq_domain_ops {
int (*match)(struct irq_domain *d, struct device_node *node,
enum irq_domain_bus_token bus_token);
int (*select)(struct irq_domain *d, struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token);
int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
void (*unmap)(struct irq_domain *d, unsigned int virq);
int (*xlate)(struct irq_domain *d, struct device_node *node,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq, unsigned int *out_type);
int (*alloc)(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs, void *arg);
void (*free)(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs);
int (*activate)(struct irq_domain *d, struct irq_data *irqd, bool reserve);
void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data);
int (*translate)(struct irq_domain *d, struct irq_fwspec *fwspec,
unsigned long *out_hwirq, unsigned int *out_type);
};
为什么要升级 V2
因为 拥有 级联中断控制器 的 计算机系统越来越多了 !!!
所以 内核 要 把他 抽象!!!
也行,有一些缺点
1.用户代码支持:用户要在用户代码(irq chip 驱动中)处理(写死)这种父子关系(HIERARCHY)
2.不灵活 : 设备树变化了父子关系,需要改变代码来适应
3.不管需要与否,某些资源必备申请: 不管子中断控制器有没有使用设备,父中断控制器的该中断线(子中断控制器使用的)都申请了软件中断号和对应资源
升级前后有什么区别
大体上的问题
升级只是做了扩充,那么 V1 独有的API 还要实现吗?
不需要了
解决了之前级联中断控制器编码的缺点,也适用非级联控制器.
系统中只要有级联中断控制器,一般都应该配置 CONFIG_IRQ_DOMAIN_HIERARCHY = y
V1 指针和 V2独有指针的区别
V1 : match select map unmap xlate
V2 : match select alloc free activate deactivate translate
V1 和 V2 都会用 match 和 select
但是一般不实现
这里描述的必须实现
V1 的 map/unmap 对应 V2 的 alloc/free :
V1 的用于做以下事情
1.设置irq_data.chip
2.设置desc->handle_irq
3.设置desc->irq_data.chip_data
4.设置irq status
V2 的包括V1的所有事情,还需要做
1. 调用 V2的 translate 解析 fwsepc
2. 设置irq_data->hwirq
3. 有必要设置 desc->irq_common_data.handler_data 吗? TODO
这里的描述可以不实现,但是一般都实现!!!
V1 会用 xlate 和 默认 (不实现)
V2 会用 translate 或 xlate 或 默认(不实现)
V1 的 xlate 对应 V2 的 translate
V1 和 V2 的功能完全一样,都是解析fwsepc 为 hwirq 和 触发类型
这里描述的一般不实现
但是用于msi的irq_domain要实现
V2 的 activate 和 deactivate 是独有的