All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/4] pc: Remove redundant arguments from xen_hvm_init()
Date: Tue, 25 Aug 2015 12:13:46 +0300	[thread overview]
Message-ID: <55DC31CA.5050802@gmail.com> (raw)
In-Reply-To: <1439836952-15739-2-git-send-email-ehabkost@redhat.com>

On 08/17/2015 09:42 PM, Eduardo Habkost wrote:
> Remove arguments that can be found in PCMachineState.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * Change prototype on xen-hvm-stub.c too
> ---
>   hw/i386/pc_piix.c    |  4 +---
>   hw/i386/pc_q35.c     |  4 +---
>   include/hw/xen/xen.h |  4 ++--
>   xen-hvm-stub.c       |  3 +--
>   xen-hvm.c            | 25 ++++++++++++-------------
>   5 files changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 9558467..2b7afc8 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -134,9 +134,7 @@ static void pc_init1(MachineState *machine)
>           pcms->below_4g_mem_size = machine->ram_size;
>       }
>
> -    if (xen_enabled() && xen_hvm_init(&pcms->below_4g_mem_size,
> -                                      &pcms->above_4g_mem_size,
> -                                      &ram_memory) != 0) {
> +    if (xen_enabled() && xen_hvm_init(pcms, &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 c07d65b..36dd6a4 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -125,9 +125,7 @@ static void pc_q35_init(MachineState *machine)
>           pcms->below_4g_mem_size = machine->ram_size;
>       }
>
> -    if (xen_enabled() && xen_hvm_init(&pcms->below_4g_mem_size,
> -                                      &pcms->above_4g_mem_size,
> -                                      &ram_memory) != 0) {
> +    if (xen_enabled() && xen_hvm_init(pcms, &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 4356af4..e90931a 100644
> --- a/include/hw/xen/xen.h
> +++ b/include/hw/xen/xen.h
> @@ -10,6 +10,7 @@
>
>   #include "hw/irq.h"
>   #include "qemu-common.h"
> +#include "qemu/typedefs.h"
>
>   /* xen-machine.c */
>   enum xen_mode {
> @@ -38,8 +39,7 @@ qemu_irq *xen_interrupt_controller_init(void);
>   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);
> +int xen_hvm_init(PCMachineState *pcms, 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 46867d8..6a39425 100644
> --- a/xen-hvm-stub.c
> +++ b/xen-hvm-stub.c
> @@ -47,8 +47,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)
> +int xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
>   {
>       return 0;
>   }
> diff --git a/xen-hvm.c b/xen-hvm.c
> index 0408462..55bce3a 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -180,8 +180,7 @@ 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,
> +static void xen_ram_init(PCMachineState *pcms,
>                            ram_addr_t ram_size, MemoryRegion **ram_memory_p)
>   {
>       MemoryRegion *sysmem = get_system_memory();
> @@ -198,20 +197,20 @@ static void xen_ram_init(ram_addr_t *below_4g_mem_size,
>       }
>
>       if (ram_size >= user_lowmem) {
> -        *above_4g_mem_size = ram_size - user_lowmem;
> -        *below_4g_mem_size = user_lowmem;
> +        pcms->above_4g_mem_size = ram_size - user_lowmem;
> +        pcms->below_4g_mem_size = user_lowmem;
>       } else {
> -        *above_4g_mem_size = 0;
> -        *below_4g_mem_size = ram_size;
> +        pcms->above_4g_mem_size = 0;
> +        pcms->below_4g_mem_size = ram_size;
>       }
> -    if (!*above_4g_mem_size) {
> +    if (!pcms->above_4g_mem_size) {
>           block_len = ram_size;
>       } else {
>           /*
>            * Xen does not allocate the memory continuously, it keeps a
>            * hole of the size computed above or passed in.
>            */
> -        block_len = (1ULL << 32) + *above_4g_mem_size;
> +        block_len = (1ULL << 32) + pcms->above_4g_mem_size;
>       }
>       memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
>                              &error_abort);
> @@ -229,12 +228,12 @@ static void xen_ram_init(ram_addr_t *below_4g_mem_size,
>        */
>       memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo",
>                                &ram_memory, 0xc0000,
> -                             *below_4g_mem_size - 0xc0000);
> +                             pcms->below_4g_mem_size - 0xc0000);
>       memory_region_add_subregion(sysmem, 0xc0000, &ram_lo);
> -    if (*above_4g_mem_size > 0) {
> +    if (pcms->above_4g_mem_size > 0) {
>           memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi",
>                                    &ram_memory, 0x100000000ULL,
> -                                 *above_4g_mem_size);
> +                                 pcms->above_4g_mem_size);
>           memory_region_add_subregion(sysmem, 0x100000000ULL, &ram_hi);
>       }
>   }
> @@ -1159,7 +1158,7 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data)
>   }
>
>   /* return 0 means OK, or -1 means critical issue -- will exit(1) */
> -int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
> +int xen_hvm_init(PCMachineState *pcms,
>                    MemoryRegion **ram_memory)
>   {
>       int i, rc;
> @@ -1270,7 +1269,7 @@ 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(pcms, ram_size, ram_memory);
>
>       qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
>
>

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel

  reply	other threads:[~2015-08-25  9:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 18:42 [Qemu-devel] [PATCH v2 0/4] pc: Initialization and compat function cleanup Eduardo Habkost
2015-08-17 18:42 ` [Qemu-devel] [PATCH v2 1/4] pc: Remove redundant arguments from xen_hvm_init() Eduardo Habkost
2015-08-25  9:13   ` Marcel Apfelbaum [this message]
2015-08-17 18:42 ` [Qemu-devel] [PATCH v2 2/4] pc: Move compat boolean globals to PCMachineClass Eduardo Habkost
2015-08-17 18:42 ` [Qemu-devel] [PATCH v2 3/4] pc: Move legacy_acpi_table_size global " Eduardo Habkost
2015-08-17 18:42 ` [Qemu-devel] [PATCH v2 4/4] pc: Move acpi_data_size " Eduardo Habkost

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=55DC31CA.5050802@gmail.com \
    --to=marcel.apfelbaum@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --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.