On 08.04.2025 17:57, Oleksii Kurochko wrote: > --- a/xen/arch/riscv/include/asm/irq.h > +++ b/xen/arch/riscv/include/asm/irq.h > @@ -3,6 +3,28 @@ > #define ASM__RISCV__IRQ_H > > #include <xen/bug.h> > +#include <xen/device_tree.h> > + > +#define NR_IRQS 1024 > + > +/* > + * TODO: Should IRQ_TYPE_* be moved to xen/irq.h and wrapped into > + * #ifdef CONFIG_HAS_DEVICE_TREE? > + */
Wouldn't that be more like asm-generic/dt-irq.h (or irq-dt.h)? The field where these values are stored is an arch-specific one, after all. > --- /dev/null > +++ b/xen/arch/riscv/irq.c > @@ -0,0 +1,44 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > + > +/* > + * RISC-V Trap handlers > + * > + * Copyright (c) 2024 Vates > + */ > + > +#include <xen/bug.h> > +#include <xen/init.h> > +#include <xen/irq.h> > + > +static irq_desc_t irq_desc[NR_IRQS]; > + > +int arch_init_one_irq_desc(struct irq_desc *desc) > +{ > + desc->arch.type = IRQ_TYPE_INVALID; > + return 0; > +} > + > +static int __init init_irq_data(void) > +{ > + int irq; > + > + for ( irq = 0; irq < NR_IRQS; irq++ ) For this the variable would better be of unsigned type. I realize though that ... > + { > + struct irq_desc *desc = irq_to_desc(irq); > + int rc = init_one_irq_desc(desc); > + > + if ( rc ) > + return rc; > + > + desc->irq = irq; ... it's a plain int field that we're storing into here. I don't think I can spot any place where a negative value would be stored into there. Jan