On 11.03.2025 17:19, Oleksii Kurochko wrote: > Based on the code from [1] provided by Romain Caritey from Microchip > with some minor changes():
"Based on", to me at least, suggests an import from some other project. The reference looks to be to a Xen tree though. With that, a proper description would then be needed here, rather than a list of differences. > --- /dev/null > +++ b/xen/arch/riscv/aplic.c > @@ -0,0 +1,50 @@ > +/* SPDX-License-Identifier: MIT */ > + > +/* > + * xen/arch/riscv/aplic.c > + * > + * RISC-V Advanced Platform-Level Interrupt Controller support > + * > + * Copyright (c) 2023-2024 Microchip. > + * Copyright (c) 2024 Vates > + */ > + > +#include <xen/errno.h> > +#include <xen/init.h> > +#include <xen/types.h> > + > +#include <asm/device.h> > +#include <asm/intc.h> > + > +static struct intc_info aplic_info = { > + .hw_version = INTC_APLIC, > + .node = NULL This latter one can be omitted. > +}; > + > +static int __init aplic_preinit(struct dt_device_node *node, const void *dat) > +{ > + if ( aplic_info.node ) > + { > + printk("XEN doesn't support more than one S mode APLIC\n"); > + return -ENODEV; > + } > + > + /* don't process if APLIC node is not for S mode */ > + if ( dt_get_property(node, "riscv,children", NULL) ) > + return -ENODEV; > + > + aplic_info.node = node; > + > + return 0; > +} > + > +static const struct dt_device_match aplic_dt_match[] __initconst = > +{ > + DT_MATCH_COMPATIBLE("riscv,aplic"), Iirc this requires use of __initconstrel, which would also be nice to be put between type and identifier. > + { /* sentinel */ }, > +}; > + > +DT_DEVICE_START(aplic, "APLIC", DEVICE_INTERRUPT_CONTROLLER) > + .dt_match = aplic_dt_match, > + .init = aplic_preinit, Nit: Indentation looks too deep here. Jan