* Question: how to add CLI options for custom hw model
@ 2025-02-14 15:31 Mark Nesky
2025-02-14 16:32 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Mark Nesky @ 2025-02-14 15:31 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
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.
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
[-- Attachment #2: Type: text/html, Size: 1011 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Question: how to add CLI options for custom hw model
2025-02-14 15:31 Question: how to add CLI options for custom hw model Mark Nesky
@ 2025-02-14 16:32 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2025-02-14 16:32 UTC (permalink / raw)
To: Mark Nesky, qemu-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-14 16:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).