wqriscv/intc: Introduce intc_hw_operations abstraction
PATCH 7/14 wqriscv/intc: Introduce intc_hw_operations abstraction
In reply to a message not in the archiveIntroduce the intc_hw_operations structure to encapsulate interrupt controller-specific data and operations. This structure includes:
- A pointer to interrupt controller information (intc_info)
- Callbacks to initialize the controller and set IRQ type/priority
- A reference to an interupt controller descriptor (host_irq_type)
Also introduce generic helper functions:
- intc_init(): Initializes the interrupt controller
- register_intc_ops(): Registers the intc_hw_operations implementation
- intc_route_irq_to_xen(): Configures IRQ routing to Xen, setting handler, type, and priority
Most of these functions act as thin wrappers around the corresponding callbacks in intc_hw_operations.
This abstraction lays the groundwork for supporting multiple interrupt controller types (e.g., PLIC, APLIC) in extensible way.
This patch is based on the changes from [1].
[1] https://gitlab.com/xen-project/people/olkur/xen/-/commit/7cfb4bd4748ca268142497ac5c327d2766fb342d
--- xen/arch/riscv/include/asm/intc.h | 23 ++++++++++++++ xen/arch/riscv/intc.c | 51 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
xen/arch/riscv/include/asm/intc.h +23 -0
@@ -17,6 +17,29 @@ struct intc_info { const struct dt_device_node *node; }; +struct intc_hw_operations { +/* Hold intc hw information */ +const struct intc_info *info; +/* Initialize the intc and the boot CPU */ +int (*init)(void ); + +/* hw_irq_controller to enable/disable/eoi host irq */ +hw_irq_controller *host_irq_type; + +/* Set IRQ type */ +void (*set_irq_type)(struct irq_desc *desc,unsigned int type); +/* Set IRQ priority */ +void (*set_irq_priority)(struct irq_desc *desc,unsigned int priority); + +}; +void intc_preinit (void ); +void intc_init (void ); + +void register_intc_ops (const struct intc_hw_operations *ops); + +struct irq_desc ; +void intc_route_irq_to_xen (struct irq_desc *desc,unsigned int priority); +#endif /* ASM__RISCV__INTERRUPT_CONTOLLER_H */
xen/arch/riscv/intc.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
2.49.0