From: Paolo Bonzini <pbonzini@redhat.com>
To: Mark Nesky <thenesk@gmail.com>, qemu-devel@nongnu.org
Subject: Re: Question: how to add CLI options for custom hw model
Date: Fri, 14 Feb 2025 17:32:36 +0100 [thread overview]
Message-ID: <176dd370-ee5d-4c28-8075-47dbc2bd1751@redhat.com> (raw)
In-Reply-To: <CADQ=JkR046QnzWVV2=VshuS14r86riXUzLb3eh+Qer69N1rp0Q@mail.gmail.com>
On 2/14/25 16:31, Mark Nesky wrote:
> Hello,
>
> I am new to the QEMU code base and I am working on a project involving a
> custom hardware model representing a customized ppc board. What is the
> best way to add command line arguments applicable to my model?
>
> I see options in qemu-options.hx + vl.c, but I am not sure if that is
> the right place for arguments that only apply to one model, and I am not
> sure how to access those options from my model.
Hi,
options that apply to only a machine or device can use, respectively,
the -machine or -device options.
For -device this is done using the DEFINE_PROP_* macros.
For -machine, which I assume is the case for you, the process is a bit
more complex. A good example, including a varied set of types, can be
found in the spapr_instance_init function of hw/ppc/spapr.c.
Another possibility for -machine is to pass the option down to a
specific device, which usually will be created at startup. For example
this snipped from hw/i386/pc.c adds a "-machine pcspk-audiodev" option:
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
OBJECT(pcms->pcspk), "audiodev");
Thanks,
Paolo
> I also see the function qemu_opts_create which looks like it can add
> command line arguments at runtime, but I am not sure where to use this
> in my model since it seems like my model code (machine state, class, and
> instance functions) does not run when invoking "qemu-system-ppc -machine
> mymodel -help".
>
> If there is some good documentation or examples, please point me in the
> right direction.
>
> thanks for your help,
> Mark
prev parent reply other threads:[~2025-02-14 16:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 15:31 Question: how to add CLI options for custom hw model Mark Nesky
2025-02-14 16:32 ` Paolo Bonzini [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=176dd370-ee5d-4c28-8075-47dbc2bd1751@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thenesk@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 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.