qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, rjones@redhat.com, pbonzini@redhat.com,
	somlo@cmu.edu, lersek@redhat.com, mst@redhat.com,
	ehabkost@redhat.com, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/6] fw_cfg: move setting of FW_CFG_ID into fw_cfg_init1()
Date: Mon, 12 Jun 2017 13:37:40 +0200	[thread overview]
Message-ID: <20170612133740.2f3eef83@nial.brq.redhat.com> (raw)
In-Reply-To: <1497097821-32754-4-git-send-email-mark.cave-ayland@ilande.co.uk>

On Sat, 10 Jun 2017 13:30:18 +0100
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> wrote:

> The dma_enabled property enables us to set the FW_CFG_ID version
> accordingly.
it might be not safe as patch reorders FW_CFG_ID entry.

(I recall there were patches that sorted fwcfg entries,
but it's worth checking that it won't break migration)

CCing Gerd, maybe he would recall how it works.

> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/nvram/fw_cfg.c |   16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 1313bfd..f7b78a9 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -914,12 +914,19 @@ static void fw_cfg_init1(DeviceState *dev)
>  {
>      FWCfgState *s = FW_CFG(dev);
>      MachineState *machine = MACHINE(qdev_get_machine());
> +    uint32_t version = FW_CFG_VERSION;
>  
>      assert(!object_resolve_path(FW_CFG_PATH, NULL));
>  
>      object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL);
>  
>      fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
> +
> +    if (s->dma_enabled) {
> +        version |= FW_CFG_VERSION_DMA;
> +    }
> +
> +    fw_cfg_add_i32(s, FW_CFG_ID, version);
>      fw_cfg_add_bytes(s, FW_CFG_UUID, &qemu_uuid, 16);
>      fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphics);
>      fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
> @@ -935,7 +942,6 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
>  {
>      DeviceState *dev;
>      FWCfgState *s;
> -    uint32_t version = FW_CFG_VERSION;
>      bool dma_requested = dma_iobase && dma_as;
>  
>      dev = qdev_create(NULL, TYPE_FW_CFG_IO);
> @@ -954,12 +960,8 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
>          /* 64 bits for the address field */
>          s->dma_as = dma_as;
>          s->dma_addr = 0;
> -
> -        version |= FW_CFG_VERSION_DMA;
>      }
>  
> -    fw_cfg_add_i32(s, FW_CFG_ID, version);
> -
>      return s;
>  }
>  
> @@ -975,7 +977,6 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,
>      DeviceState *dev;
>      SysBusDevice *sbd;
>      FWCfgState *s;
> -    uint32_t version = FW_CFG_VERSION;
>      bool dma_requested = dma_addr && dma_as;
>  
>      dev = qdev_create(NULL, TYPE_FW_CFG_MEM);
> @@ -997,11 +998,8 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,
>          s->dma_as = dma_as;
>          s->dma_addr = 0;
>          sysbus_mmio_map(sbd, 2, dma_addr);
> -        version |= FW_CFG_VERSION_DMA;
>      }
>  
> -    fw_cfg_add_i32(s, FW_CFG_ID, version);
> -
>      return s;
>  }
>  

  parent reply	other threads:[~2017-06-12 11:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-10 12:30 [Qemu-devel] [PATCH 0/6] fw_cfg: qdev-related tidy-ups Mark Cave-Ayland
2017-06-10 12:30 ` [Qemu-devel] [PATCH 1/6] fw_cfg: move initialisation of FWCfgState into instance_init Mark Cave-Ayland
2017-06-10 18:05   ` Philippe Mathieu-Daudé
2017-06-12 11:20   ` Igor Mammedov
2017-06-12 11:45     ` Mark Cave-Ayland
2017-06-12 18:27       ` Laszlo Ersek
2017-06-12 18:46         ` Mark Cave-Ayland
2017-06-10 12:30 ` [Qemu-devel] [PATCH 2/6] fw_cfg: move qdev_init_nofail() out from fw_cfg_init1() into callers Mark Cave-Ayland
2017-06-12 11:43   ` Igor Mammedov
2017-06-12 11:54     ` Mark Cave-Ayland
2017-06-12 19:15       ` Laszlo Ersek
2017-06-12 19:50         ` Mark Cave-Ayland
2017-06-12 21:11           ` Mark Cave-Ayland
2017-06-10 12:30 ` [Qemu-devel] [PATCH 3/6] fw_cfg: move setting of FW_CFG_ID into fw_cfg_init1() Mark Cave-Ayland
2017-06-10 18:07   ` Philippe Mathieu-Daudé
2017-06-12 11:37   ` Igor Mammedov [this message]
2017-06-12 11:49     ` Mark Cave-Ayland
2017-06-12 13:03     ` Gerd Hoffmann
2017-06-10 12:30 ` [Qemu-devel] [PATCH 4/6] fw_cfg: move fw_cfg_init1() into the fw_cfg_*_realize() functions Mark Cave-Ayland
2017-06-12 12:03   ` Igor Mammedov
2017-06-10 12:30 ` [Qemu-devel] [PATCH 5/6] fw_cfg: use sysbus_init_mmio() in fw_cfg_io_realize() Mark Cave-Ayland
2017-06-12 12:16   ` Igor Mammedov
2017-06-12 12:59     ` Mark Cave-Ayland
2017-06-10 12:30 ` [Qemu-devel] [PATCH 6/6] fw_cfg: move QOM type defines into fw_cfg.h Mark Cave-Ayland
2017-06-10 17:43   ` Philippe Mathieu-Daudé
2017-06-10 18:15 ` [Qemu-devel] [PATCH 0/6] fw_cfg: qdev-related tidy-ups Philippe Mathieu-Daudé
2017-06-11 15:00   ` 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=20170612133740.2f3eef83@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=somlo@cmu.edu \
    /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).