qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Sourojeet Adhikari <s23adhik@csclub.uwaterloo.ca>
Cc: qemu-devel@nongnu.org, philmd@linaro.org, qemu-arm@nongnu.org
Subject: Re: [PATCH] bcm2838: Add GIC-400 timer interupt connections
Date: Mon, 10 Mar 2025 10:49:33 +0000	[thread overview]
Message-ID: <CAFEAcA87OntUbW+CnebWZirnrHw4ZwFwROeRs4qJd91O6B3U4w@mail.gmail.com> (raw)
In-Reply-To: <3660e47b-0f37-4e6d-8bbd-7d646eb67207@csclub.uwaterloo.ca>

On Mon, 10 Mar 2025 at 06:29, Sourojeet Adhikari
<s23adhik@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


      reply	other threads:[~2025-03-10 10:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16  3:54 [PATCH] bcm2838: Add GIC-400 timer interupt connections Sourojeet Adhikari
2025-02-24 13:22 ` Peter Maydell
2025-02-27  9:15   ` Sourojeet Adhikari
2025-02-27 15:17     ` Peter Maydell
2025-03-01  1:47       ` Sourojeet Adhikari
2025-03-01 14:09         ` Peter Maydell
2025-03-10  6:29           ` Sourojeet Adhikari
2025-03-10 10:49             ` Peter Maydell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA87OntUbW+CnebWZirnrHw4ZwFwROeRs4qJd91O6B3U4w@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=s23adhik@csclub.uwaterloo.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).