qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	marcel.apfelbaum@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fw_cfg: add bootdevice-ignore-suffixes property
Date: Wed, 8 Aug 2018 16:57:37 -0300	[thread overview]
Message-ID: <20180808195737.GY23195@localhost.localdomain> (raw)
In-Reply-To: <8de65abc-7623-b3ce-f1c6-a0efaec1fac4@redhat.com>

On Wed, Aug 08, 2018 at 09:39:49PM +0200, Laszlo Ersek wrote:
> On 08/08/18 21:19, Mark Cave-Ayland wrote:
> > For the older machines (such as Mac and SPARC) the DT nodes representing
> > bootdevices for disk nodes are irregular for mainly historical reasons.
> > 
> > Since the majority of bootdevice nodes for these machines either do not have a
> > separate disk node or require different (custom) names then it is much easier
> > to disable all suffixes for a particular machine by setting the ignore_suffixes
> > parameter to get_boot_devices_list() to true, and customise the disk nodes as
> > required.
> > 
> > Here we add a new bootdevice-ignore-suffixes property to the FW_CFG device to
> > allow the generation of disk suffixes to be controlled on a per-machine basis.
> > 
> > Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> > ---
> >  hw/nvram/fw_cfg.c         | 9 ++++++++-
> >  include/hw/nvram/fw_cfg.h | 1 +
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> > index b23e7f64a8..52488b999f 100644
> > --- a/hw/nvram/fw_cfg.c
> > +++ b/hw/nvram/fw_cfg.c
> > @@ -861,7 +861,8 @@ static void fw_cfg_machine_reset(void *opaque)
> >      void *ptr;
> >      size_t len;
> >      FWCfgState *s = opaque;
> > -    char *bootindex = get_boot_devices_list(&len, false);
> > +    char *bootindex = get_boot_devices_list(&len,
> > +                                            s->bootdevice_ignore_suffixes);
> >  
> >      ptr = fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len);
> >      g_free(ptr);
> > @@ -990,12 +991,18 @@ FWCfgState *fw_cfg_find(void)
> >      return FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
> >  }
> >  
> > +static Property fw_cfg_properties[] = {
> > +    DEFINE_PROP_BOOL("bootdevice-ignore-suffixes", FWCfgState,
> > +                     bootdevice_ignore_suffixes, false),
> > +    DEFINE_PROP_END_OF_LIST(),
> > +};
> 
> I've got two questions which are not "loaded" -- I honestly have no clue:
> 
> - Do we intend to expose this to users and higher-level tools? If not,
> should it be called "x-..." (experimental)? I can't remember the rules
> about "x-" properties.

That would be a good idea.  But maybe we can skip using QOM to
address this, and go back to a MachineClass field (but this time
not fw_cfg-specific).  See my other reply.


> 
> - I vaguely recall that earlier we tried to add properties to the fw_cfg
> base class, but ultimately added them to the derived classes (see
> "fw_cfg_mem_properties" and "fw_cfg_io_properties"). Despite the fact
> that the referenced fields themselves (dma_enabled, file_slots) belong
> to the base class; IOW, the properties refer to "parent_obj.xxx". I
> don't really remember why we did this. I seem to recall issues
> otherwise, with setting the property from the command line due to object
> construction / realization order, or whatever.

Maybe it was a workaround to an old bug in compat_props handling.
I will try to find out.

> 
> Mark, can you verify whether you can control
> "bootdevice-ignore-suffixes" from the command line, e.g. via "-global"?
> 
> The object model keeps scaring me. :(

You're not alone.  :(

-- 
Eduardo

  reply	other threads:[~2018-08-08 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 19:19 [Qemu-devel] [PATCH] fw_cfg: add bootdevice-ignore-suffixes property Mark Cave-Ayland
2018-08-08 19:39 ` Laszlo Ersek
2018-08-08 19:57   ` Eduardo Habkost [this message]
2018-08-08 19:53 ` Eduardo Habkost
2018-08-08 20:19   ` Mark Cave-Ayland
2018-08-08 20:47     ` Eduardo Habkost
2018-08-10 12:31     ` Mark Cave-Ayland

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=20180808195737.GY23195@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    /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).