qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Rashmica Gupta <rashmica.g@gmail.com>
Cc: "Andrew Jeffery" <andrew@aj.id.au>,
	qemu-arm <qemu-arm@nongnu.org>, "Joel Stanley" <joel@jms.id.au>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [Qemu-devel] [PATCH v3 0/3] Add Aspeed GPIO controller model
Date: Tue, 6 Aug 2019 15:08:43 +0100	[thread overview]
Message-ID: <CAFEAcA_-qLt4JzMkG7mm5wnVvrpC8qnO=XC0GWmcU2ZXoMQEtA@mail.gmail.com> (raw)
In-Reply-To: <20190730054501.32727-1-rashmica.g@gmail.com>

On Tue, 30 Jul 2019 at 06:45, Rashmica Gupta <rashmica.g@gmail.com> wrote:
>
> There are a couple of things I'm not confident about here:
> - what should be in init vs realize?

We are not very good at documenting this distinction (and there's
some bits of it I'm not sure about either), but:
 * init cannot contain anything that might fail
 * init cannot contain anything that affects the simulation
 * init shouldn't do anything that needs explicit cleanup
   (eg memory allocation)
 * property creation has to happen in init, because properties
   are set after init but before realize

Thomas did a good blog post on this:
http://people.redhat.com/~thuth/blog/qemu/2018/09/10/instance-init-realize.html


> - should the irq state be in vmstate?

I guess you mean the "uint32_t int_status;" field here?
If it's state that's in your device then it needs to be
in vmstate (this roughly corresponds to 'is there a flipflop
in the hardware that holds this state', though that is not
a 100% perfect guide). A 'qemu_irq' holds no state of its own,
so you cannot query it for the state of the line after migration.
So if your device model needs to be able to know that state
itself then it has to keep it in a struct field and migrate
that struct field. (For some devices the state of the outbound
interrupt line is a purely combinatorial result of some other
state: "int_output = int_status & int_mask" is a common one
where there's a "raw interrupt status" and a mask bit that
suppresses the outbound irq line. In that case the int_output
need not be in the device's state struct or migrated, because
we can just calculate it when we need it from the int_status
and int_mask state.)

> - is there a better way to do composition of classes (patch 3)?

No strong opinion. From a quick scan through of patch 3 it
didn't look obviously doing something in a suboptimal way.

thanks
-- PMM


  parent reply	other threads:[~2019-08-06 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  5:44 [Qemu-devel] [PATCH v3 0/3] Add Aspeed GPIO controller model Rashmica Gupta
2019-07-30  5:44 ` [Qemu-devel] [PATCH v3 1/3] hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500 Rashmica Gupta
2019-08-06 13:57   ` Peter Maydell
2019-08-14  7:20     ` Rashmica Gupta
2019-07-30  5:45 ` [Qemu-devel] [PATCH v3 2/3] aspeed: add a GPIO controller to the SoC Rashmica Gupta
2019-07-30  5:45 ` [Qemu-devel] [PATCH v3 3/3] hw/gpio: Add in AST2600 specific implementation Rashmica Gupta
2019-08-13  7:31   ` Alexey Kardashevskiy
2019-08-14  7:21     ` Rashmica Gupta
2019-08-06 14:08 ` Peter Maydell [this message]
2019-08-14 12:46 ` [Qemu-devel] [PATCH v3 0/3] Add Aspeed GPIO controller model Cédric Le Goater

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='CAFEAcA_-qLt4JzMkG7mm5wnVvrpC8qnO=XC0GWmcU2ZXoMQEtA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rashmica.g@gmail.com \
    /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).