qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-trivial@nongnu.org, mjt@tls.msk.ru, laurent@vivier.eu,
	thuth@redhat.com, pbonzini@redhat.com, jak@jak-linux.org,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] qemu-options.hx: Document -M as -machine alias
Date: Wed, 3 Dec 2025 16:20:31 +0000	[thread overview]
Message-ID: <aTBjTzbaX0befChO@gallifrey> (raw)
In-Reply-To: <CAFEAcA-Uy0UQwGEK+f95BJmDripg1-8vhzPF5qRSY40=duhRUQ@mail.gmail.com>

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On Wed, 3 Dec 2025 at 14:00, Dr. David Alan Gilbert <dave@treblig.org> wrote:
> >
> > * Alex Bennée (alex.bennee@linaro.org) wrote:
> > > dave@treblig.org writes:
> > >
> > > > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > > >
> > > > -M is used heavily in documentation and scripts, but isn't actually
> > > > documented anywhere.
> > > > Document it as equivalent to -machine.
> > > >
> > > > Reported-by: Julian Andres Klode <jak@jak-linux.org>
> > > > Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> > > > ---
> > > >  qemu-options.hx | 12 +++++++-----
> > > >  1 file changed, 7 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/qemu-options.hx b/qemu-options.hx
> > > > index fca2b7bc74..ec92723f10 100644
> > > > --- a/qemu-options.hx
> > > > +++ b/qemu-options.hx
> > > > @@ -44,6 +44,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
> > > >  #endif
> > > >      "                memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n"
> > > >      "                cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]\n"
> > > > +    "                sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n"
> > > >      "                smp-cache.0.cache=cachename,smp-cache.0.topology=topologylevel\n",
> > > >      QEMU_ARCH_ALL)
> > > >  SRST
> > > > @@ -179,6 +180,9 @@ SRST
> > > >
> > > >              -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512
> > > >
> > > > +    ``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}``
> > > > +        Define an SGX EPC section.
> > > > +
> > >
> > > This seems unrelated.
> > >
> > > >      ``smp-cache.0.cache=cachename,smp-cache.0.topology=topologylevel``
> > > >          Define cache properties for SMP system.
> > > >
> > > > @@ -208,12 +212,10 @@ SRST
> > > >  ERST
> > > >
> > > >  DEF("M", HAS_ARG, QEMU_OPTION_M,
> > > > -    "                sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n",
> > > > -    QEMU_ARCH_ALL)
> > > > -
> > > > +    "-M              as -machine\n", QEMU_ARCH_ALL)
> > > >  SRST
> > > > -``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}``
> > > > -    Define an SGX EPC section.
> > > > +``-M``
> > > > +    as -machine.
> 
> Surprisingly, this and -h/--help are our only two options where
> we provide a short synonym. I note that this handling of -M
> is not consistent with how we document -h/--help, where we
> print both on a single line:
> -h or -help     display this help and exit
> 
> But it would be trickier to fit that in for -machine and
> perhaps confusing given the suboptions.

Right, that's one of the two reasons I kept it separate.
The other reason, is that I couldn't figure out how '-help' and '-h'
both got defined - why is the second DEF(...) not needed?

> > > Did we have a merge conflict at some point that messed things up?
> >
> > It's not clear - it was the only option hanging around in -M and it was
> > already appearing wrong in the man output.
> > I wondered if it was some requirement to have *something* in the -M
> > definition so thought it best to move it at the same time.
> 
> It looks like this was incorrectly added under -M by
> commit dfce81f1b9 ("vl: Add sgx compound properties to expose
> SGX EPC sections to guest"), which should have put it under
> -machine like all our other machine suboption documentation.
> 
> The result is that the sgx-epc documentation appears OK
> in --help because the --help output just concatenates
> everything so it gets tacked on after the -machine help,
> but it is misrendered in the HTML docs:
> https://qemu-project.gitlab.io/qemu/system/invocation.html
> as it appears as if a top level option rather than one
> indented to indicate that it's a machine sub-option.
> So this change fixes that bug (and should ideally say so
> in its commit message).
> 
> Before that it simply read
> -HXCOMM Deprecated by -machine
> -DEF("M", HAS_ARG, QEMU_OPTION_M, "", QEMU_ARCH_ALL)
> 
> (Commit dfce81f1b9 also silently dropped that "deprecated"
> comment, which it shouldn't really have done.)

Ah.

Dave

> thanks
> -- PMM
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


  reply	other threads:[~2025-12-03 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03 13:15 [PATCH] qemu-options.hx: Document -M as -machine alias dave
2025-12-03 13:28 ` Alex Bennée
2025-12-03 13:59   ` Dr. David Alan Gilbert
2025-12-03 16:06     ` Peter Maydell
2025-12-03 16:20       ` Dr. David Alan Gilbert [this message]
2025-12-03 16:28         ` Peter Maydell
2025-12-03 16:37           ` Dr. David Alan Gilbert
2025-12-03 16:43             ` Peter Maydell
2025-12-11  3:31       ` Xiaoyao Li
2025-12-03 13:59 ` Paolo Bonzini
2025-12-04  7:31 ` Thomas Huth

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=aTBjTzbaX0befChO@gallifrey \
    --to=dave@treblig.org \
    --cc=alex.bennee@linaro.org \
    --cc=jak@jak-linux.org \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.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).