All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: pasic@linux.ibm.com, Paolo Bonzini <pbonzini@redhat.com>,
	ehabkost@redhat.com
Subject: [PATCH v6 02/79] machine: introduce memory-backend property
Date: Wed, 19 Feb 2020 11:08:36 -0500	[thread overview]
Message-ID: <20200219160953.13771-3-imammedo@redhat.com> (raw)
In-Reply-To: <20200219160953.13771-1-imammedo@redhat.com>

Property will contain link to memory backend that will be
used for backing initial RAM.
Follow up commit will alias -mem-path and -mem-prealloc
CLI options into memory backend options to make memory
handling consistent (using only hostmem backend family
for guest RAM allocation).

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v4:
 * make property a string, instead of a link.
   Fixes -M memory-backend=foo: foo not found error
   since foo creation is delayed well beyond point
   where machine's properties are set
v3:
 * rename property name from ram-memdev to memory-backend
   (Paolo Bonzini <pbonzini@redhat.com>)

CC: ehabkost@redhat.com
CC: pbonzini@redhat.com
CC: pasic@linux.ibm.com
---
 include/hw/boards.h |  2 ++
 hw/core/machine.c   | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index fb1b43d5b9..7b4b6b79d7 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -4,6 +4,7 @@
 #define HW_BOARDS_H
 
 #include "exec/memory.h"
+#include "sysemu/hostmem.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/accel.h"
 #include "qapi/qapi-types-machine.h"
@@ -285,6 +286,7 @@ struct MachineState {
     bool enforce_config_section;
     bool enable_graphics;
     char *memory_encryption;
+    char *ram_memdev_id;
     DeviceMemoryState *device_memory;
 
     ram_addr_t ram_size;
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 84812a1d1c..1a6e485c87 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -508,6 +508,22 @@ static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
     }
 }
 
+static char *machine_get_memdev(Object *obj, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    return g_strdup(ms->ram_memdev_id);
+}
+
+static void machine_set_memdev(Object *obj, const char *value, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    g_free(ms->ram_memdev_id);
+    ms->ram_memdev_id = g_strdup(value);
+}
+
+
 static void machine_init_notify(Notifier *notifier, void *data)
 {
     MachineState *machine = MACHINE(qdev_get_machine());
@@ -889,6 +905,14 @@ static void machine_initfn(Object *obj)
                                         "Table (HMAT)", NULL);
     }
 
+    object_property_add_str(obj, "memory-backend",
+                            machine_get_memdev, machine_set_memdev,
+                            &error_abort);
+    object_property_set_description(obj, "memory-backend",
+                                    "Set RAM backend"
+                                    "Valid value is ID of hostmem based backend",
+                                     &error_abort);
+
     /* Register notifier when init is done for sysbus sanity checks */
     ms->sysbus_notifier.notify = machine_init_notify;
     qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
-- 
2.18.1



  parent reply	other threads:[~2020-02-19 16:11 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 16:08 [PATCH v6 00/79] refactor main RAM allocation to use hostmem backend Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 01/79] numa: remove deprecated -mem-path fallback to anonymous RAM Igor Mammedov
2020-02-19 16:08 ` Igor Mammedov [this message]
2020-02-19 16:08 ` [PATCH v6 03/79] machine: alias -mem-path and -mem-prealloc into memory-foo backend Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 04/79] machine: introduce convenience MachineState::ram Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 05/79] initialize MachineState::ram in NUMA case Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 06/79] vl.c: move -m parsing after memory backends has been processed Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 07/79] vl.c: ensure that ram_size matches size of machine.memory-backend Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 08/79] alpha/dp264: use memdev for RAM Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 09/79] arm/aspeed: actually check RAM size Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 10/79] arm/aspeed: use memdev for RAM Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 11/79] arm/collie: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 12/79] arm/cubieboard: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 13/79] arm/digic_boards: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 14/79] arm/highbank: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 15/79] arm/imx25_pdk: drop RAM size fixup Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 16/79] arm/imx25_pdk: use memdev for RAM Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 17/79] arm/integratorcp: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 18/79] arm/kzm: drop RAM size fixup Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 19/79] arm/kzm: use memdev for RAM Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 20/79] arm/mcimx6ul-evk: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 21/79] arm/mcimx7d-sabre: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 22/79] arm/mps2-tz: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 23/79] arm/mps2: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 24/79] arm/musicpal: " Igor Mammedov
2020-02-19 16:08 ` [PATCH v6 25/79] arm/nseries: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 26/79] arm/omap_sx1: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 27/79] arm/palm: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 28/79] arm/sabrelite: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 29/79] arm/raspi: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 30/79] arm/sbsa-ref: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 31/79] arm/versatilepb: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 32/79] arm/vexpress: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 33/79] arm/virt: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 34/79] arm/xilinx_zynq: drop RAM size fixup Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 35/79] arm/xilinx_zynq: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 36/79] arm/xlnx-versal-virt: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 37/79] arm/xlnx-zcu102: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 38/79] s390x/s390-virtio-ccw: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 39/79] null-machine: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 40/79] cris/axis_dev88: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 41/79] hppa: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 42/79] x86/microvm: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 43/79] x86/pc: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 44/79] lm32/lm32_boards: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 45/79] lm32/milkymist: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 46/79] m68k/an5206: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 47/79] m68k/q800: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 48/79] m68k/mcf5208: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 49/79] m68k/next-cube: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 50/79] mips/boston: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 51/79] mips/mips_fulong2e: drop RAM size fixup Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 52/79] mips/mips_fulong2e: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 53/79] mips/mips_jazz: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 54/79] mips/mips_jazz: add max ram size check Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 55/79] mips/mips_malta: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 56/79] mips/mips_mipssim: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 57/79] mips/mips_r4k: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 58/79] ppc/e500: drop RAM size fixup Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 59/79] ppc/e500: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 60/79] ppc/mac_newworld: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 61/79] ppc/mac_oldworld: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 62/79] ppc/pnv: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 63/79] ppc/ppc405_boards: add RAM size checks Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 64/79] ppc/ppc405_boards: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 65/79] ppc/{ppc440_bamboo, sam460ex}: drop RAM size fixup Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 66/79] ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 67/79] ppc/spapr: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 68/79] ppc/virtex_ml507: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 69/79] sparc/leon3: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 70/79] sparc/sun4m: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 71/79] sparc/niagara: " Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 72/79] remove no longer used memory_region_allocate_system_memory() Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 73/79] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 74/79] exec: drop bogus mem_path from qemu_ram_alloc_from_fd() Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 75/79] make mem_path local variable Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 76/79] hostmem: introduce "prealloc-threads" property Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 77/79] hostmem: fix strict bind policy Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 78/79] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups Igor Mammedov
2020-02-19 16:09 ` [PATCH v6 79/79] tests:numa-test: use explicit memdev to specify node RAM Igor Mammedov
2020-02-19 16:58 ` [PATCH v6 00/79] refactor main RAM allocation to use hostmem backend no-reply
2020-02-24  8:45 ` Philippe Mathieu-Daudé
2020-02-24 11:33   ` Igor Mammedov
2020-02-24 11:38     ` Philippe Mathieu-Daudé

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=20200219160953.13771-3-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@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.