All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>,
	peter.maydell@linaro.org, qemu-devel@nongnu.org,
	rjones@redhat.com, drjones@redhat.com, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH v5 02/11] fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem()
Date: Thu, 18 Dec 2014 12:18:48 +0100	[thread overview]
Message-ID: <5492B818.6060709@redhat.com> (raw)
In-Reply-To: <1418850613-26821-3-git-send-email-lersek@redhat.com>



On 17/12/2014 22:10, Laszlo Ersek wrote:
> This allows us to drop the fw_cfg_init() shim and to enforce the possible
> mappings at compile time.
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v5:
>     - new in v5 [Laszlo]
> 
>  include/hw/nvram/fw_cfg.h |  2 --
>  hw/i386/pc.c              |  4 ++--
>  hw/nvram/fw_cfg.c         | 14 --------------
>  hw/ppc/mac_newworld.c     |  2 +-
>  hw/ppc/mac_oldworld.c     |  2 +-
>  hw/sparc/sun4m.c          |  2 +-
>  hw/sparc64/sun4u.c        |  2 +-
>  7 files changed, 6 insertions(+), 22 deletions(-)
> 
> diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
> index fcc88ea..a99586e 100644
> --- a/include/hw/nvram/fw_cfg.h
> +++ b/include/hw/nvram/fw_cfg.h
> @@ -77,10 +77,8 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
>                                FWCfgReadCallback callback, void *callback_opaque,
>                                void *data, size_t len);
>  void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
>                           size_t len);
> -FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
> -                        hwaddr crl_addr, hwaddr data_addr);
>  FWCfgState *fw_cfg_init_io(uint32_t iobase);
>  FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr);
>  
>  FWCfgState *fw_cfg_find(void);
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index c0e55a6..21e12ea 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -646,9 +646,9 @@ static FWCfgState *bochs_bios_init(void)
>      uint64_t *numa_fw_cfg;
>      int i, j;
>      unsigned int apic_id_limit = pc_apic_id_limit(max_cpus);
>  
> -    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
> +    fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
>      /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86:
>       *
>       * SeaBIOS needs FW_CFG_MAX_CPUS for CPU hotplug, but the CPU hotplug
>       * QEMU<->SeaBIOS interface is not based on the "CPU index", but on the APIC
> @@ -1167,9 +1167,9 @@ FWCfgState *xen_load_linux(const char *kernel_filename,
>      FWCfgState *fw_cfg;
>  
>      assert(kernel_filename != NULL);
>  
> -    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
> +    fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
>      rom_set_fw(fw_cfg);
>  
>      load_linux(fw_cfg, kernel_filename, initrd_filename,
>                 kernel_cmdline, below_4g_mem_size);
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 0035fe6..880311c 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -632,22 +632,8 @@ FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr)
>      return fw_cfg_init1(dev);
>  }
>  
>  
> -FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
> -                        hwaddr crl_addr, hwaddr data_addr)
> -{
> -    if (ctl_port + 1 == data_port && crl_addr == 0 && data_addr == 0) {
> -        return fw_cfg_init_io(ctl_port);
> -    }
> -    if (ctl_port == 0 && data_port == 0 && crl_addr != 0 && data_addr != 0) {
> -        return fw_cfg_init_mem(crl_addr, data_addr);
> -    }
> -    assert(false);
> -    return NULL;
> -}
> -
> -
>  FWCfgState *fw_cfg_find(void)
>  {
>      return FW_CFG(object_resolve_path(FW_CFG_PATH, NULL));
>  }
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 89aee71..5dac389 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -453,9 +453,9 @@ static void ppc_core99_init(MachineState *machine)
>      nvr = MACIO_NVRAM(dev);
>      pmac_format_nvram_partition(nvr, 0x2000);
>      /* No PCI init: the BIOS will do it */
>  
> -    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
> +    fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
>      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch);
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 32c21a4..41fefb7 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -313,9 +313,9 @@ static void ppc_heathrow_init(MachineState *machine)
>          graphic_depth = 15;
>  
>      /* No PCI init: the BIOS will do it */
>  
> -    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
> +    fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
>      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 8273199..a12d3c4 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -1083,9 +1083,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
>      if (hwdef->ecc_base)
>          ecc_init(hwdef->ecc_base, slavio_irq[28],
>                   hwdef->ecc_version);
>  
> -    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
> +    fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
>      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index f42112c..49fb678 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -891,9 +891,9 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>                             0,
>                             graphic_width, graphic_height, graphic_depth,
>                             (uint8_t *)&nd_table[0].macaddr);
>  
> -    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
> +    fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
>      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
> 

YAY!

Paolo

  reply	other threads:[~2014-12-18 11:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 21:10 [Qemu-devel] [PATCH v5 00/11] fw_cfg, bootorder, and UEFI+'-kernel' on arm/virt Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 01/11] fw_cfg: hard separation between the MMIO and I/O port mappings Laszlo Ersek
2014-12-18 11:18   ` Paolo Bonzini
2014-12-18 12:58     ` Peter Maydell
2014-12-18 13:31       ` Paolo Bonzini
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 02/11] fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem() Laszlo Ersek
2014-12-18 11:18   ` Paolo Bonzini [this message]
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 03/11] fw_cfg_mem: max access size and region size are the same for data register Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 04/11] fw_cfg_mem: flip ctl_mem_ops and data_mem_ops to DEVICE_BIG_ENDIAN Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 05/11] exec: allows 8-byte accesses in subpage_ops Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 06/11] fw_cfg_mem: introduce the "data_width" property Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 07/11] fw_cfg_mem: expose the "data_width" property with fw_cfg_init_mem_wide() Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 08/11] arm: add fw_cfg to "virt" board Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 09/11] hw/loader: split out load_image_gzipped_buffer() Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 10/11] hw/arm: pass pristine kernel image to guest firmware over fw_cfg Laszlo Ersek
2014-12-17 21:10 ` [Qemu-devel] [PATCH v5 11/11] hw/arm/virt: enable passing of EFI-stubbed kernel to guest UEFI firmware Laszlo Ersek
2014-12-18 11:22 ` [Qemu-devel] [PATCH v5 00/11] fw_cfg, bootorder, and UEFI+'-kernel' on arm/virt Paolo Bonzini
2014-12-19  9:39 ` Gerd Hoffmann
2014-12-19  9:52   ` Alexander Graf

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=5492B818.6060709@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=drjones@redhat.com \
    --cc=lersek@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@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 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.