[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v4 10/30] vl: handle "-device dimm"
From: |
Vasilis Liaskovitis |
Subject: |
[Qemu-devel] [RFC PATCH v4 10/30] vl: handle "-device dimm" |
Date: |
Tue, 18 Dec 2012 13:41:38 +0100 |
Signed-off-by: Vasilis Liaskovitis <address@hidden>
---
vl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/vl.c b/vl.c
index a3ab384..8406933 100644
--- a/vl.c
+++ b/vl.c
@@ -169,6 +169,7 @@ int main(int argc, char **argv)
#include "ui/qemu-spice.h"
#include "qapi/string-input-visitor.h"
+#include "hw/dimm.h"
//#define DEBUG_NET
//#define DEBUG_SLIRP
@@ -249,6 +250,7 @@ static QTAILQ_HEAD(, FWBootEntry) fw_boot_order =
int nb_numa_nodes;
uint64_t node_mem[MAX_NODES];
unsigned long *node_cpumask[MAX_NODES];
+int nb_hp_dimms;
uint8_t qemu_uuid[16];
@@ -2065,6 +2067,50 @@ static int chardev_init_func(QemuOpts *opts, void
*opaque)
return 0;
}
+static int dimmcfg_init_func(QemuOpts *opts, void *opaque)
+{
+ const char *driver;
+ const char *id;
+ uint64_t node, size;
+ uint32_t populated;
+ const char *buf, *busbuf;
+
+ /* DimmDevice configuration needs to be known in order to initialize
chipset
+ * with correct memory and pci ranges. But all devices are created after
+ * chipset / machine initialization. In * order to avoid this problem, we
+ * parse dimm information earlier into dimmcfg structs. */
+
+ driver = qemu_opt_get(opts, "driver");
+ if (!strcmp(driver, "dimm")) {
+
+ id = qemu_opts_id(opts);
+ buf = qemu_opt_get(opts, "size");
+ parse_option_size("size", buf, &size, NULL);
+ buf = qemu_opt_get(opts, "node");
+ parse_option_number("node", buf, &node, NULL);
+ busbuf = qemu_opt_get(opts, "bus");
+ buf = qemu_opt_get(opts, "populated");
+ if (!buf) {
+ populated = 0;
+ } else {
+ populated = strcmp(buf, "on") ? 0 : 1;
+ }
+
+ dimm_config_create((char *)id, size, busbuf ? busbuf : "membus.0",
+ node, nb_hp_dimms, populated);
+
+ /* if !populated, we just keep the config. The real device
+ * will be created in the future with a normal device_add
+ * command. */
+ if (!populated) {
+ qemu_opts_del(opts);
+ }
+ nb_hp_dimms++;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_VIRTFS
static int fsdev_init_func(QemuOpts *opts, void *opaque)
{
@@ -3859,6 +3905,11 @@ int main(int argc, char **argv, char **envp)
}
qemu_add_globals();
+ /* init generic devices */
+ if (qemu_opts_foreach(qemu_find_opts("device"),
+ dimmcfg_init_func, NULL, 1) != 0) {
+ exit(1);
+ }
qdev_machine_init();
QEMUMachineInitArgs args = { .ram_size = ram_size,
--
1.7.9
- [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 01/30] [SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 03/30] [SeaBIOS] acpi-dsdt: Implement functions for memory hotplug, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 02/30] [SeaBIOS] Add SSDT memory device support, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 04/30] [SeaBIOS] acpi: generate hotplug memory devices, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 05/30] [SeaBIOS] q35: Add memory hotplug handler, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 06/30] qapi: make visit_type_size fallback to type_int, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 07/30] Add SIZE type to qdev properties, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 08/30] qemu-option: export parse_option_number, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 10/30] vl: handle "-device dimm",
Vasilis Liaskovitis <=
- [Qemu-devel] [RFC PATCH v4 09/30] Implement dimm device abstraction, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 12/30] acpi_ich9 : Implement memory device hotplug registers, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 17/30] [SeaBIOS] pci: Use paravirt interface for pcimem_start and pcimem64_start, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 13/30] piix_pci and pc_piix: refactor, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 15/30] q35: Add i440fx dram controller initialization, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 16/30] pc: Add dimm paravirt SRAT info, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 11/30] acpi_piix4 : Implement memory device hotplug registers, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 14/30] piix_pci: Add i440fx dram controller initialization, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 18/30] Introduce paravirt interface QEMU_CFG_PCI_WINDOW, Vasilis Liaskovitis, 2012/12/18
- [Qemu-devel] [RFC PATCH v4 20/30] balloon: update with hotplugged memory, Vasilis Liaskovitis, 2012/12/18