qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: peter.maydell@linaro.org, aliguori@amazon.com,
	marcel.a@redhat.com, armbru@redhat.com,
	stefanb@linux.vnet.ibm.com, mjt@tls.msk.ru,
	qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com,
	vasilis.liaskovitis@profitbricks.com, quintela@redhat.com,
	kraxel@redhat.com, stefanha@redhat.com, hutao@cn.fujitsu.com,
	pbonzini@redhat.com, lcapitulino@redhat.com, chegu_vinod@hp.com,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 03/27] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS
Date: Sun, 22 Dec 2013 13:20:35 +0200	[thread overview]
Message-ID: <20131222112035.GE31586@redhat.com> (raw)
In-Reply-To: <20131220134847.1a23e16b@nial.usersys.redhat.com>

On Fri, Dec 20, 2013 at 01:48:47PM +0100, Igor Mammedov wrote:
> On Thu, 19 Dec 2013 16:35:05 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Nov 21, 2013 at 03:38:24AM +0100, Igor Mammedov wrote:
> > > 'etc/reserved-memory-end' will allow QEMU to tell BIOS where PCI
> > > BARs mapping could safely start in high memory.
> > > 
> > > Allowing BIOS to start mapping 64-bit PCI BARs at address where it
> > > wouldn't conflict with other mappings QEMU might place before it.
> > > 
> > > That permits QEMU to reserve extra address space before
> > > 64-bit PCI hole for memory hotplug.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > v2:
> > >    * disable 'etc/reserved-memory-end' for 1.7 and older machine types
> > > ---
> > >  hw/i386/pc.c         |   27 +++++++++++++++++++++++++--
> > >  hw/i386/pc_piix.c    |    1 +
> > >  hw/i386/pc_q35.c     |    1 +
> > >  hw/pci-host/piix.c   |    3 ++-
> > >  hw/pci-host/q35.c    |    3 ++-
> > >  include/hw/i386/pc.h |   11 +++++++++--
> > >  6 files changed, 40 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > > index 6c82ada..ba82c67 100644
> > > --- a/hw/i386/pc.c
> > > +++ b/hw/i386/pc.c
> > > @@ -1094,14 +1094,37 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
> > >  }
> > >  
> > >  /* setup pci memory address space mapping into system address space */
> > > -void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
> > > -                            MemoryRegion *pci_address_space)
> > > +void pc_pci_as_mapping_init_1_7(Object *owner, MemoryRegion *system_memory,
> > > +                                MemoryRegion *pci_address_space,
> > > +                                uint64_t reserved_memory_end)
> > >  {
> > >      /* Set to lower priority than RAM */
> > >      memory_region_add_subregion_overlap(system_memory, 0x0,
> > >                                          pci_address_space, -1);
> > >  }
> > >  
> > > +static
> > > +void pc_pci_as_mapping_init_1_8(Object *owner, MemoryRegion *system_memory,
> > > +                                MemoryRegion *pci_address_space,
> > > +                                uint64_t reserved_memory_end)
> > > +{
> > > +    uint64_t *val;
> > > +    FWCfgState *fw_cfg = fw_cfg_find();
> > > +    g_assert(fw_cfg);
> > > +    /*
> > > +     *  Align address at 1G, this makes sure it can be exactly covered
> > > +     *  with a PAT entry even when using huge pages.
> > > +     */
> > > +    val = g_malloc(sizeof(*val));
> > > +    *val = cpu_to_le64(ROUND_UP(reserved_memory_end, 0x1ULL << 30));
> > > +    fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val));
> > > +
> > > +    pc_pci_as_mapping_init_1_7(owner, system_memory, pci_address_space,
> > > +                               reserved_memory_end);
> > > +}
> > > +
> > > +pc_pci_as_mapping_init_fn pc_pci_as_mapping_init = pc_pci_as_mapping_init_1_8;
> > > +
> > >  void pc_acpi_init(const char *default_dsdt)
> > >  {
> > >      char *filename;
> > > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > > index 36f2495..e1fe85a 100644
> > > --- a/hw/i386/pc_piix.c
> > > +++ b/hw/i386/pc_piix.c
> > > @@ -249,6 +249,7 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
> > >  static void pc_compat_1_7(QEMUMachineInitArgs *args)
> > >  {
> > >      smbios_type1_defaults = false;
> > > +    pc_pci_as_mapping_init = pc_pci_as_mapping_init_1_7;
> > >  }
> > >  
> > >  static void pc_compat_1_6(QEMUMachineInitArgs *args)
> > > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> > > index 50ca458..5525465 100644
> > > --- a/hw/i386/pc_q35.c
> > > +++ b/hw/i386/pc_q35.c
> > > @@ -233,6 +233,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
> > >  static void pc_compat_1_7(QEMUMachineInitArgs *args)
> > >  {
> > >      smbios_type1_defaults = false;
> > > +    pc_pci_as_mapping_init = pc_pci_as_mapping_init_1_7;
> > >  }
> > >  
> > >  static void pc_compat_1_6(QEMUMachineInitArgs *args)
> > 
> > I don't much like this: why not use a global flag like we do
> > for other properties?
> because flag would add extra branching clattering code, while
> overriding function makes caller cleaner and potentially maps
> well into method override when machines are converted to QOM objects.
> So why not to try this vs flags?

For consistency with other code. We have too many unfinished
conversions across the codebase, they are a bigger problem
than some branches here and there.

So I would say let's delay these experiments until this QOM
cleanup happens.

> > 
> > Also, 1_8 should be replaced with 2_0 now.
> sure
> 
> > 
> > > diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> > > index 63be7f6..615ab0d 100644
> > > --- a/hw/pci-host/piix.c
> > > +++ b/hw/pci-host/piix.c
> > > @@ -352,7 +352,8 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
> > >  
> > >      /* setup pci memory mapping */
> > >      pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
> > > -                           f->pci_address_space);
> > > +                           f->pci_address_space,
> > > +                           0x100000000ULL + above_4g_mem_size);
> > >  
> > >      memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
> > >                               f->pci_address_space, 0xa0000, 0x20000);
> > > diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> > > index 81c8240..6e28418 100644
> > > --- a/hw/pci-host/q35.c
> > > +++ b/hw/pci-host/q35.c
> > > @@ -359,7 +359,8 @@ static int mch_init(PCIDevice *d)
> > >  
> > >      /* setup pci memory mapping */
> > >      pc_pci_as_mapping_init(OBJECT(mch), mch->system_memory,
> > > -                           mch->pci_address_space);
> > > +                           mch->pci_address_space,
> > > +                           0x100000000ULL + mch->above_4g_mem_size);
> > >  
> > >      /* smram */
> > >      cpu_smm_register(&mch_set_smm, mch);
> > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> > > index 9af09d3..c4e8048 100644
> > > --- a/include/hw/i386/pc.h
> > > +++ b/include/hw/i386/pc.h
> > > @@ -129,8 +129,15 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
> > >  #define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
> > >  
> > >  
> > > -void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
> > > -                            MemoryRegion *pci_address_space);
> > > +typedef
> > > +void (*pc_pci_as_mapping_init_fn)(Object *owner, MemoryRegion *system_memory,
> > > +                                  MemoryRegion *pci_address_space,
> > > +                                  uint64_t reserved_memory_end);
> > > +extern pc_pci_as_mapping_init_fn pc_pci_as_mapping_init;
> > > +
> > > +void pc_pci_as_mapping_init_1_7(Object *owner, MemoryRegion *system_memory,
> > > +                                MemoryRegion *pci_address_space,
> > > +                                uint64_t reserved_memory_end);
> > >  
> > >  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> > >                             const char *kernel_filename,
> > > -- 
> > > 1.7.1
> > 

  reply	other threads:[~2013-12-22 11:17 UTC|newest]

Thread overview: 143+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  2:38 [Qemu-devel] [PATCH 00/27 RFC v7] ACPI memory hotplug Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 01/27] acpi: factor out common pm_update_sci() into acpi core Igor Mammedov
2013-12-05 12:37   ` Michael S. Tsirkin
2013-12-05 15:11     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 02/27] rename pci_hotplug_fn to hotplug_fn and make it available for other devices Igor Mammedov
2013-11-25 12:49   ` Paolo Bonzini
2013-11-25 13:11     ` Paolo Bonzini
2013-11-25 15:57     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 03/27] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS Igor Mammedov
2013-12-19 14:35   ` Michael S. Tsirkin
2013-12-20 12:48     ` Igor Mammedov
2013-12-22 11:20       ` Michael S. Tsirkin [this message]
2013-11-21  2:38 ` [Qemu-devel] [PATCH 04/27] vl: convert -m to qemu_opts_parse() Igor Mammedov
2013-11-21  6:01   ` Li Guang
2013-11-21 13:45     ` Igor Mammedov
2013-11-21 10:12   ` Markus Armbruster
2013-11-26 13:17     ` Igor Mammedov
2013-11-26 14:49       ` Markus Armbruster
2013-11-26 16:55         ` Igor Mammedov
2013-11-27 14:35           ` Markus Armbruster
2013-11-27 15:28             ` Igor Mammedov
2013-11-27 17:31               ` Markus Armbruster
2013-11-27  0:27         ` [Qemu-devel] [PATCH 04/28] vl: convert -m to QemuOpts Igor Mammedov
2013-11-27  0:27           ` [Qemu-devel] [PATCH 05/28] vl.c: extend -m option to support options for memory hotplug Igor Mammedov
2013-12-10  7:23           ` [Qemu-devel] [PATCH 04/28] vl: convert -m to QemuOpts Paolo Bonzini
2013-12-10 10:53             ` Igor Mammedov
2013-11-25 12:51   ` [Qemu-devel] [PATCH 04/27] vl: convert -m to qemu_opts_parse() Paolo Bonzini
2013-11-27  0:32     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 05/27] qapi: add SIZE type parser to string_input_visitor Igor Mammedov
2013-11-21 10:15   ` Markus Armbruster
2013-11-25 15:36     ` Igor Mammedov
2013-11-25 16:04       ` Michael S. Tsirkin
2013-11-25 16:32         ` Paolo Bonzini
2013-11-25 16:43           ` Eric Blake
2013-11-25 17:01             ` Paolo Bonzini
2013-11-27 14:15             ` Markus Armbruster
2013-11-27 15:17               ` Paolo Bonzini
2013-11-27 17:02                 ` Markus Armbruster
2013-11-27 17:10                   ` Paolo Bonzini
2013-12-19 14:40             ` Michael S. Tsirkin
2013-12-19 15:14               ` Markus Armbruster
2013-12-19 15:32                 ` Michael S. Tsirkin
2013-12-19 15:31               ` Paolo Bonzini
2013-12-19 15:40                 ` Michael S. Tsirkin
2013-12-19 15:46                   ` Paolo Bonzini
2013-11-21  2:38 ` [Qemu-devel] [PATCH 06/27] get reference to /backend container via qemu_get_backend() Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 07/27] add memdev backend infrastructure Igor Mammedov
2013-11-25 12:54   ` Paolo Bonzini
2013-11-25 16:01     ` Igor Mammedov
2013-11-25 16:09       ` Paolo Bonzini
2013-11-27 14:37         ` Igor Mammedov
2013-11-27 15:21           ` Paolo Bonzini
2013-11-27 15:57             ` Igor Mammedov
2013-11-27 15:25   ` Eric Blake
2013-11-27 16:09     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 08/27] dimm: implement dimm device abstraction Igor Mammedov
2013-11-25 12:57   ` Paolo Bonzini
2013-11-25 15:10     ` Igor Mammedov
2013-11-25 15:16       ` Paolo Bonzini
2013-11-21  2:38 ` [Qemu-devel] [PATCH 09/27] dimm: map DimmDevice into DimBus provided address space Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 10/27] dimm: add busy slot check and slot auto-allocation Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 11/27] dimm: add busy address check and address auto-allocation Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 12/27] dimm: add hotplug callback to DimmBus Igor Mammedov
2013-11-25 13:01   ` Paolo Bonzini
2013-11-25 14:40     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 13/27] acpi: memory hotplug ACPI hardware implementation Igor Mammedov
2013-11-21  9:42   ` Michael S. Tsirkin
2013-11-21 14:21     ` Igor Mammedov
2013-11-21 14:38       ` Michael S. Tsirkin
2013-11-22 17:14         ` Igor Mammedov
2013-11-24 10:58           ` Michael S. Tsirkin
2013-11-25  7:27             ` Markus Armbruster
2013-11-25 13:45               ` Paolo Bonzini
2013-11-25 14:18                 ` Igor Mammedov
2013-11-25 14:31                   ` Paolo Bonzini
2013-11-25 14:57                     ` Igor Mammedov
2013-11-25 13:56             ` Igor Mammedov
2013-11-27 17:59   ` Eric Blake
2013-11-21  2:38 ` [Qemu-devel] [PATCH 14/27] acpi: initialize memory hotplug ACPI PIIX4 hardware Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 15/27] acpi: piix4: add memory-hotplug-io-base property to piix4_pm Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 16/27] acpi: ich9: allow guest to clear SCI rised by GPE Igor Mammedov
2013-11-21  7:14   ` Michael S. Tsirkin
2013-11-21  8:12     ` Hu Tao
2013-11-21  8:18       ` Li Guang
2013-11-21  8:29         ` Michael S. Tsirkin
2013-11-21  8:32           ` Li Guang
2013-11-21  9:43             ` Michael S. Tsirkin
2013-11-22  0:57               ` Li Guang
2013-11-25 11:13                 ` Igor Mammedov
2013-11-26  0:29                   ` Li Guang
2013-11-26 22:36                     ` Igor Mammedov
2013-11-27  0:15                       ` Li Guang
2013-11-27  0:57                         ` Igor Mammedov
2013-11-27  1:48                           ` Li Guang
2013-11-27  9:43                             ` Paolo Bonzini
2013-11-21 13:19             ` Igor Mammedov
2013-11-22  1:03               ` Li Guang
2013-11-21  8:26       ` Michael S. Tsirkin
2013-11-21  8:28         ` Hu Tao
2013-11-21 13:31           ` Igor Mammedov
2013-11-21 13:21         ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 17/27] acpi: initialize memory hotplug ACPI ICH9 hardware Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 18/27] acpi: ich9: add memory-hotplug-io-base property to ich9_pm Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 19/27] acpi: piix4/ich9: add optional vmstate field for MemHotplugState migration Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 20/27] pc: piix: make PCII440FXState type public Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine Igor Mammedov
2013-11-21  5:48   ` Li Guang
2013-11-21 14:13     ` Andreas Färber
2013-11-21 14:34       ` Igor Mammedov
2013-11-21 14:39         ` Michael S. Tsirkin
2013-11-21 16:09         ` Andreas Färber
2013-11-21 16:17           ` Michael S. Tsirkin
2013-11-25 10:41           ` Igor Mammedov
2013-11-25 17:00             ` Andreas Färber
2013-11-26 20:26               ` Igor Mammedov
2013-11-22 14:23   ` Gerd Hoffmann
2013-11-25 11:00     ` Igor Mammedov
2013-11-25 11:39       ` Gerd Hoffmann
2013-11-25 13:34         ` Igor Mammedov
2013-11-25 13:35         ` Paolo Bonzini
2013-11-25 14:24           ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 22/27] pc: add memory hotplug Q35 machine Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 23/27] pc: ACPI BIOS: implement memory hotplug interface Igor Mammedov
2013-11-21  9:37   ` Michael S. Tsirkin
2013-11-25 14:39     ` Igor Mammedov
2013-12-16 19:50       ` Michael S. Tsirkin
2013-12-16 21:42         ` Igor Mammedov
2013-11-25 13:42   ` Paolo Bonzini
2013-11-25 14:26     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 24/27] pc: ACPI BIOS: add ssdt-mem.hex.generated and update ssdt-misc.hex.generated Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 25/27] pc: ACPI BIOS: use enum for defining memory affinity flags Igor Mammedov
2013-11-21  7:20   ` Michael S. Tsirkin
2013-11-25 10:11     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole Igor Mammedov
2013-11-21  7:18   ` Michael S. Tsirkin
2013-11-25 10:11     ` Igor Mammedov
2013-11-21  2:38 ` [Qemu-devel] [PATCH 27/27] pc: ACPI BIOS: make GPE.3 handle memory hotplug event on PIIX and Q35 machines Igor Mammedov
2013-11-21  6:20 ` [Qemu-devel] [PATCH 00/27 RFC v7] ACPI memory hotplug Michael S. Tsirkin
2013-11-21 13:39   ` Igor Mammedov
2013-11-21 13:43     ` Michael S. Tsirkin
2013-11-21 14:37       ` Igor Mammedov
2013-11-21 14:45         ` Michael S. Tsirkin
2013-11-25 10:09           ` Igor Mammedov

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=20131222112035.GE31586@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=chegu_vinod@hp.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=vasilis.liaskovitis@profitbricks.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).