|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 09/16] xen/riscv: introduce register_intc_ops() and intc_hw_ops.
Introduce 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`)
- number of interrupt controller irqs.
Add function register_intc_ops() to mentioned above structure.
Co-developed-by: Romain Caritey <Romain.Caritey@xxxxxxxxxxxxx>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
Changes in V2:
- This patch was part of "xen/riscv: Introduce intc_hw_operations abstraction"
and splitted to have ability to merge some patches from this patch series
into one patch.
- Declare host_irq_type member of intc_hw_operations as pointer-to-const.
- Moved up forward declaration of irq_desc.
- Use attribute __init for register_intc_ops().
- Use attribute __ro_after_init for intc_hw_ops variable.
- Update prototype of register_intc_ops() because of what mention in the
previous point.
---
xen/arch/riscv/include/asm/intc.h | 22 ++++++++++++++++++++++
xen/arch/riscv/intc.c | 9 +++++++++
2 files changed, 31 insertions(+)
diff --git a/xen/arch/riscv/include/asm/intc.h
b/xen/arch/riscv/include/asm/intc.h
index 52ba196d87..e72d5fd9d3 100644
--- a/xen/arch/riscv/include/asm/intc.h
+++ b/xen/arch/riscv/include/asm/intc.h
@@ -8,6 +8,8 @@
#ifndef ASM__RISCV__INTERRUPT_CONTOLLER_H
#define ASM__RISCV__INTERRUPT_CONTOLLER_H
+#include <xen/irq.h>
+
enum intc_version {
INTC_APLIC,
};
@@ -17,6 +19,26 @@ struct intc_info {
const struct dt_device_node *node;
};
+struct irq_desc;
+
+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 */
+ const 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 register_intc_ops(struct intc_hw_operations *ops);
+
#endif /* ASM__RISCV__INTERRUPT_CONTOLLER_H */
diff --git a/xen/arch/riscv/intc.c b/xen/arch/riscv/intc.c
index 4061a3c457..122e7b32b5 100644
--- a/xen/arch/riscv/intc.c
+++ b/xen/arch/riscv/intc.c
@@ -5,6 +5,15 @@
#include <xen/init.h>
#include <xen/lib.h>
+#include <asm/intc.h>
+
+static struct __ro_after_init intc_hw_operations *intc_hw_ops;
+
+void __init register_intc_ops(struct intc_hw_operations *ops)
+{
+ intc_hw_ops = ops;
+}
+
void __init intc_preinit(void)
{
if ( acpi_disabled )
--
2.49.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |