On Mon, 10 Mar 2025 at 06:29, Sourojeet Adhikari <s23ad...@csclub.uwaterloo.ca> wrote: > > Hello, > > So far I've figured out that I need to add a member called SplitIRQ > in the BCMSocPeripheralBaseState struct, which is of size defined > by `BCM2835_NUM_SPLITTERS`. Then from what I can tell through > reading through the codebase, I should do something similar to > what happens in `exynos4210.c` in the `exynos4210_init_board_irqs` > function?
QEMU qdev devices have a multiple-stage initialization process: (1) 'init', which in this case means calling object_initialize_child(). In this case you should do this in raspi_peripherals_base_init(), where we do this for the other child devices of the common peripheral base object. (2) set properties (in this case the "num-lines" property, which needs to be set to 2). You do this in the parent object's 'realize' method, in this case bcm_soc_peripherals_common_realize(). There are several different equivalent APIs to set a simple integer property; using qdev_prop_set_uint16() like the exynos code does is fine. (3) realize the device by calling qdev_realize(); this has to be done after all properties are set. (4) wire up the input and output GPIO lines (you want to wire up a GPIO only once the devices on both ends have been realized). For this case, in the bcm_soc_peripherals_common_realize() function we're going to wire up the the device's outbound IRQ to the input of the appropriate splitter, and connect output 0 of that splitter to the BCM2835_IC correct interrupt controller input. (5) The last bit of wiring, where we connect splitter output 1 to the correct GIC input, we do in bcm2838.c, and only after we've called 'realize' for both the bcm2835_peripherals object and the GIC object. > Sorry for taking a while to get back and still having quite a few > questions about this. Thank you for helping me out with writting > this patch. No worries; this stuff is all quite complicated and we don't really document it very well. thanks -- PMM