All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Octavian Purdila" <tavip@google.com>,
	qemu-devel@nongnu.org, pbonzini@redhat.com, eduardo@habkost.net,
	armbru@redhat.com, "Phil Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [RFC PATCH] cli: add connect-gpios option
Date: Fri, 18 Oct 2024 17:05:28 +0100	[thread overview]
Message-ID: <ZxKHSB8l1HmtxrZ6@redhat.com> (raw)
In-Reply-To: <CAFEAcA9X1bdtxRL9fm_rnw9ezMZSW6HaURfMsA4aLMSHM4fzdw@mail.gmail.com>

On Fri, Oct 18, 2024 at 04:38:24PM +0100, Peter Maydell wrote:
> On Thu, 10 Oct 2024 at 18:39, Octavian Purdila <tavip@google.com> wrote:
> >
> > From: Valentin Ghita <valentinghita@google.com>
> >
> > Add option to allow for connecting device GPIOs. This is useful when
> > adding a peripheral device from the command line which uses an
> > interrupt.
> >
> > It takes the following options:
> >
> > * in-dev-path, out-dev-path - required, the device canonical object
> >   path (e.g. /machine/peripheral-anon/device[0],
> >   /machine/iotkit/cluster0/armv7m0) for the devices that should have
> >   their in <-> out GPIOs connected
> >
> > * in-gpio-name, out-gpio-name - optional, the name of the GPIO list;
> >   if not specified, the unnamed GPIO list is used
> >
> > * in-gpio-index, out-gpio-index - optional, the index in the GPIO list
> >   that identifies the GPIO to be used; if not specified 0 (the first
> >   GPIO in the list) is used
> >
> > Usage example:
> >
> >  # add the tmp105 sensor and connects its irq line to the CPU
> >  qemu-system-arm \
> >   --machine mps2-an505 \
> >   --device tmp105,bus=/versatile_i2c/i2c,address=0x50 \
> >   --connect-gpios out-dev-path=/machine/peripheral-anon/device[0],\
> >     in-dev-path=/machine/iotkit/cluster0/armv7m0,in-gpio-index=100
> 
> 
> This seems to be moving down the path towards "create and
> wire up machines on the command line". We shouldn't
> be doing that ad-hoc with one small commandline option
> at a time, we should be doing it with a coherent plan.

Yeah, as a general rule, adding new CLI args is pretty undesirable.
To avoid that we could utilize QOM for representing data:
eg a "gpio-connection" object:

  --object gpio-connection,out-dev-path=/machine/peripheral-anon/device[0],\
           in-dev-path=/machine/iotkit/cluster0/armv7m0,in-gpio-index=100

this would be OK if we're fine with some code somewhere that iterates
over the 'gpio-connection' object instances performing the wiring.

If we want this wiring done in the machine realization path though,
we would want to properties directly assocaited with the devices,
rather than via a side-loaded object.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2024-10-18 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 17:39 [RFC PATCH] cli: add connect-gpios option Octavian Purdila
2024-10-18 15:38 ` Peter Maydell
2024-10-18 16:05   ` Daniel P. Berrangé [this message]
2024-10-18 16:09     ` Peter Maydell
2024-10-18 18:49       ` Octavian Purdila
2024-10-21 10:43         ` Peter Maydell

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=ZxKHSB8l1HmtxrZ6@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tavip@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.