All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Corey Minyard <minyard@acm.org>
Cc: "Bret Ketchum" <bcketchum@gmail.com>,
	"Corey Minyard" <cminyard@mvista.com>,
	"Corey Minyard" <cminyard@mvsita.com>,
	qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 14/16] pc: Postpone adding ACPI and SMBIOS to fw_cfg
Date: Thu, 14 Nov 2013 09:30:36 +0200	[thread overview]
Message-ID: <20131114073036.GB12673@redhat.com> (raw)
In-Reply-To: <1384273995-16486-15-git-send-email-cminyard@mvista.com>

On Tue, Nov 12, 2013 at 10:33:13AM -0600, Corey Minyard wrote:
> Postpone the addition of the ACPI and SMBIOS tables until after
> device initialization.  This allows devices to add entries to these
> tables.
> 
> Signed-off-by: Corey Minyard <cminyard@mvsita.com>

Why delay adding FW_CFG_ACPI_TABLES?
These are normally specified by user so they are constant.

> ---
>  hw/i386/pc.c | 38 ++++++++++++++++++++++++++++++--------
>  1 file changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index dee409d..765c95e 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -607,8 +607,6 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)
>  static FWCfgState *bochs_bios_init(void)
>  {
>      FWCfgState *fw_cfg;
> -    uint8_t *smbios_table;
> -    size_t smbios_len;
>      uint64_t *numa_fw_cfg;
>      int i, j;
>      unsigned int apic_id_limit = pc_apic_id_limit(max_cpus);
> @@ -631,14 +629,8 @@ static FWCfgState *bochs_bios_init(void)
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)apic_id_limit);
>      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_bytes(fw_cfg, FW_CFG_ACPI_TABLES,
> -                     acpi_tables, acpi_tables_len);
>      fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
>  
> -    smbios_table = smbios_get_table(&smbios_len);
> -    if (smbios_table)
> -        fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
> -                         smbios_table, smbios_len);
>      fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
>                       &e820_table, sizeof(e820_table));
>  
> @@ -1127,6 +1119,31 @@ void pc_acpi_init(const char *default_dsdt)
>      }
>  }
>  
> +struct pc_bios_post_init {
> +    Notifier post_init;
> +    void *fw_cfg;
> +};
> +
> +/* Add the ACPI and SMBIOS tables after all the hardware has been initialized.
> + * This gives devices a chance to add to those tables.
> + */
> +static void pc_bios_post_initfn(Notifier *n, void *opaque)
> +{
> +    struct pc_bios_post_init *p = container_of(n, struct pc_bios_post_init,
> +                                               post_init);
> +    uint8_t *smbios_table;
> +    size_t smbios_len;
> +
> +    fw_cfg_add_bytes(p->fw_cfg, FW_CFG_ACPI_TABLES,
> +                     acpi_tables, acpi_tables_len);
> +    smbios_table = smbios_get_table(&smbios_len);
> +    if (smbios_table)
> +        fw_cfg_add_bytes(p->fw_cfg, FW_CFG_SMBIOS_ENTRIES,
> +                         smbios_table, smbios_len);
> +}
> +
> +static struct pc_bios_post_init post_init;
> +
>  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>                             const char *kernel_filename,
>                             const char *kernel_cmdline,
> @@ -1196,6 +1213,11 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>          rom_add_option(option_rom[i].name, option_rom[i].bootindex);
>      }
>      guest_info->fw_cfg = fw_cfg;
> +
> +    post_init.fw_cfg = fw_cfg;
> +    post_init.post_init.notify = pc_bios_post_initfn;
> +    qemu_add_machine_init_done_notifier(&post_init.post_init);
> +
>      return fw_cfg;
>  }
>  
> -- 
> 1.8.3.1

  parent reply	other threads:[~2013-11-14  7:27 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12 16:32 [Qemu-devel] [PATCH 00/16] Add an IPMI device to QEMU Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 01/16] qemu-char: Allocate CharDriverState in qemu_chr_new_from_opts Corey Minyard
2014-01-23 13:32   ` Andreas Färber
2014-01-23 13:58     ` Andreas Färber
2013-11-12 16:33 ` [Qemu-devel] [PATCH 02/16] qemu-char: Allow a chardev to reconnect if disconnected Corey Minyard
2013-11-12 16:43   ` Eric Blake
2013-11-12 17:08     ` Corey Minyard
2013-11-14  7:32       ` Michael S. Tsirkin
2013-11-14 13:29         ` Corey Minyard
2013-11-13  8:55   ` Gerd Hoffmann
2013-11-13 20:51     ` Corey Minyard
2013-11-14 13:56       ` Michael S. Tsirkin
2013-11-12 16:33 ` [Qemu-devel] [PATCH 03/16] qemu-char: remove free of chr from win_stdio_close Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 04/16] qemu-char: Close fd at end of file Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 05/16] Add a base IPMI interface Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 06/16] ipmi: Add a PC ISA type structure Corey Minyard
2014-01-29 14:58   ` Andreas Färber
2013-11-12 16:33 ` [Qemu-devel] [PATCH 07/16] ipmi: Add a KCS low-level interface Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 08/16] ipmi: Add a BT " Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 09/16] ipmi: Add a local BMC simulation Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 10/16] ipmi: Add an external connection simulation interface Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 11/16] ipmi: Add tests Corey Minyard
2013-11-13 14:12   ` Bret Ketchum
2013-11-13 20:51     ` Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 12/16] ipmi: Add documentation Corey Minyard
2013-11-13 16:08   ` Bret Ketchum
2013-11-12 16:33 ` [Qemu-devel] [PATCH 13/16] ipmi: Add migration capability to the IPMI device Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 14/16] pc: Postpone adding ACPI and SMBIOS to fw_cfg Corey Minyard
2013-11-13 14:31   ` Bret Ketchum
2013-11-14  7:30   ` Michael S. Tsirkin [this message]
2013-11-14 13:28     ` Corey Minyard
2013-11-14 13:38       ` Michael S. Tsirkin
2013-11-14 13:40         ` Corey Minyard
2013-11-14 13:50           ` Michael S. Tsirkin
2013-11-26 10:03           ` Michael S. Tsirkin
2013-11-12 16:33 ` [Qemu-devel] [PATCH 15/16] smbios: Add a function to directly add an entry Corey Minyard
2013-11-13 14:37   ` Bret Ketchum
2013-11-13 16:22     ` Andreas Färber
2013-11-13 20:52     ` Corey Minyard
2013-11-12 16:33 ` [Qemu-devel] [PATCH 16/16] ipmi: Add SMBIOS table entry Corey Minyard
2013-11-14  7:46   ` Michael S. Tsirkin
2013-11-14 13:43     ` Corey Minyard

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=20131114073036.GB12673@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=bcketchum@gmail.com \
    --cc=cminyard@mvista.com \
    --cc=cminyard@mvsita.com \
    --cc=minyard@acm.org \
    --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 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.