qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Don Slutz <dslutz@verizon.com>
Cc: xen-devel@lists.xensource.com,
	"Stefano Stabellini" <stefano.stabellini@eu.citrix.com>,
	qemu-devel@nongnu.org, "Anthony Liguori" <aliguori@amazon.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v5 3/3] xen-hvm: Pass is_default to xen_hvm_init
Date: Sun, 8 Jun 2014 18:42:38 +0300	[thread overview]
Message-ID: <20140608154238.GF8464@redhat.com> (raw)
In-Reply-To: <1402077126-17799-4-git-send-email-dslutz@verizon.com>

On Fri, Jun 06, 2014 at 01:52:06PM -0400, Don Slutz wrote:
> This is the xen part of "pc & q35: Add new machine opt max-ram-below-4g"
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Don Slutz <dslutz@verizon.com>
> ---
> v5:
>   Added Acked-by: Stefano Stabellini
>   Minor change of pmc to pcms.
> 
> 
>  hw/i386/pc_piix.c    |  1 +
>  hw/i386/pc_q35.c     |  1 +
>  include/hw/xen/xen.h |  2 +-
>  xen-hvm-stub.c       |  2 +-
>  xen-hvm.c            | 36 ++++++++++++++++++++----------------
>  5 files changed, 24 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 25f4727..27851c6 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -125,6 +125,7 @@ static void pc_init1(MachineState *machine,
>      }
>  
>      if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,
> +                                      !(pcms && pcms->max_ram_below_4g),
>                                        &ram_memory) != 0) {
>          fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
>          exit(1);
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 155cdf1..6436fce 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -114,6 +114,7 @@ static void pc_q35_init(MachineState *machine)
>      }
>  
>      if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,
> +                                      !(pcms && pcms->max_ram_below_4g),
>                                        &ram_memory) != 0) {
>          fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
>          exit(1);
> diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
> index f71f2d8..6b94c14 100644
> --- a/include/hw/xen/xen.h
> +++ b/include/hw/xen/xen.h
> @@ -41,7 +41,7 @@ void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
>  
>  #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
>  int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
> -                 MemoryRegion **ram_memory);
> +                 bool is_default, MemoryRegion **ram_memory);
>  void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
>                     struct MemoryRegion *mr);
>  void xen_modified_memory(ram_addr_t start, ram_addr_t length);
> diff --git a/xen-hvm-stub.c b/xen-hvm-stub.c
> index 2d98696..d1bdb76 100644
> --- a/xen-hvm-stub.c
> +++ b/xen-hvm-stub.c
> @@ -52,7 +52,7 @@ void xen_modified_memory(ram_addr_t start, ram_addr_t length)
>  }
>  
>  int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
> -                 MemoryRegion **ram_memory)
> +                 bool is_default, MemoryRegion **ram_memory)
>  {
>      return 0;
>  }
> diff --git a/xen-hvm.c b/xen-hvm.c
> index a0b6b5d..8d27ee6 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -156,31 +156,34 @@ qemu_irq *xen_interrupt_controller_init(void)
>  /* Memory Ops */
>  
>  static void xen_ram_init(ram_addr_t *below_4g_mem_size,
> -                         ram_addr_t *above_4g_mem_size,
> +                         ram_addr_t *above_4g_mem_size, bool is_default,
>                           ram_addr_t ram_size, MemoryRegion **ram_memory_p)
>  {
>      MemoryRegion *sysmem = get_system_memory();
>      ram_addr_t block_len;
>  
> -    block_len = ram_size;
> -    if (ram_size >= HVM_BELOW_4G_RAM_END) {
> -        /* Xen does not allocate the memory continuously, and keep a hole at
> -         * HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH
> +    if (is_default) {
> +        if (ram_size >= HVM_BELOW_4G_RAM_END) {
> +            *above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
> +            *below_4g_mem_size = HVM_BELOW_4G_RAM_END;
> +        } else {
> +            *above_4g_mem_size = 0;
> +            *below_4g_mem_size = ram_size;
> +        }
> +    }
> +    if (!*above_4g_mem_size) {
> +        block_len = ram_size;
> +    } else {
> +        /*
> +         * Xen does not allocate the memory continuously, and keep a hole of
> +         * of the size computed above or passed in.

of of -> typo

>           */
> -        block_len += HVM_BELOW_4G_MMIO_LENGTH;
> +        block_len = (1ULL << 32) + *above_4g_mem_size;
>      }
>      memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len);
>      *ram_memory_p = &ram_memory;
>      vmstate_register_ram_global(&ram_memory);
>  
> -    if (ram_size >= HVM_BELOW_4G_RAM_END) {
> -        *above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
> -        *below_4g_mem_size = HVM_BELOW_4G_RAM_END;
> -    } else {
> -        *above_4g_mem_size = 0;
> -        *below_4g_mem_size = ram_size;
> -    }
> -
>      memory_region_init_alias(&ram_640k, NULL, "xen.ram.640k",
>                               &ram_memory, 0, 0xa0000);
>      memory_region_add_subregion(sysmem, 0, &ram_640k);
> @@ -962,7 +965,7 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data)
>  }
>  
>  int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
> -                 MemoryRegion **ram_memory)
> +                 bool is_default, MemoryRegion **ram_memory)
>  {
>      int i, rc;
>      unsigned long ioreq_pfn;
> @@ -1040,7 +1043,8 @@ int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
>  
>      /* Init RAM management */
>      xen_map_cache_init(xen_phys_offset_to_gaddr, state);
> -    xen_ram_init(below_4g_mem_size, above_4g_mem_size, ram_size, ram_memory);
> +    xen_ram_init(below_4g_mem_size, above_4g_mem_size, is_default, ram_size,
> +                 ram_memory);
>  
>      qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
>  
> -- 
> 1.8.4

      parent reply	other threads:[~2014-06-08 15:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 17:52 [Qemu-devel] [PATCH v5 0/3] Add max-ram-below-4g (was Add pci_hole_min_size machine option) Don Slutz
2014-06-06 17:52 ` [Qemu-devel] [PATCH v5 1/3] xen-hvm: Fix xen_hvm_init() to adjust pc memory layout Don Slutz
2014-06-06 17:52 ` [Qemu-devel] [PATCH v5 2/3] pc & q35: Add new machine opt max-ram-below-4g Don Slutz
2014-06-08 15:40   ` Michael S. Tsirkin
2014-06-09 14:20     ` Don Slutz
2014-06-09 14:38       ` Michael S. Tsirkin
2014-06-09 15:10         ` Marcel Apfelbaum
2014-06-09 15:37           ` Igor Mammedov
2014-06-09 17:33             ` Marcel Apfelbaum
2014-06-09 20:03               ` Don Slutz
2014-06-09 19:13         ` Don Slutz
2014-06-10  7:36           ` Gerd Hoffmann
2014-06-17 17:51             ` Don Slutz
2014-06-18  9:52               ` Gerd Hoffmann
2014-06-17 18:22   ` Michael S. Tsirkin
2014-06-17 18:44     ` Don Slutz
2014-06-17 19:43       ` Michael S. Tsirkin
2014-06-17 20:05         ` Michael S. Tsirkin
2014-06-17 20:08         ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2014-06-17 20:17           ` Michael S. Tsirkin
2014-06-18 13:28             ` Slutz, Donald Christopher
2014-06-17 20:35           ` Pasi Kärkkäinen
2014-06-06 17:52 ` [Qemu-devel] [PATCH v5 3/3] xen-hvm: Pass is_default to xen_hvm_init Don Slutz
2014-06-08 15:24   ` Michael S. Tsirkin
2014-06-09 14:25     ` Don Slutz
2014-06-09 14:39       ` Michael S. Tsirkin
2014-06-08 15:42   ` Michael S. Tsirkin [this message]

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=20140608154238.GF8464@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=dslutz@verizon.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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).