From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
peter.maydell@linaro.org, shameerali.kolothum.thodi@huawei.com,
kwangwoo.lee@sk.com, imammedo@redhat.com
Subject: [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT
Date: Fri, 22 Jun 2018 12:19:09 +0200 [thread overview]
Message-ID: <1529662749-32069-6-git-send-email-eric.auger@redhat.com> (raw)
In-Reply-To: <1529662749-32069-1-git-send-email-eric.auger@redhat.com>
From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Generate Memory Affinity Structures for PC-DIMM ranges.
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
hw/arm/virt-acpi-build.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 74f5744..38a6886 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -43,6 +43,7 @@
#include "hw/pci/pcie_host.h"
#include "hw/pci/pci.h"
#include "hw/arm/virt.h"
+#include "hw/mem/memory-device.h"
#include "sysemu/numa.h"
#include "kvm_arm.h"
@@ -532,6 +533,35 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
"SPCR", table_data->len - spcr_start, 2, NULL, NULL);
}
+static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
+ uint64_t len, int default_node)
+{
+ MemoryDeviceInfoList *info_list = qmp_memory_device_list();
+ AcpiSratMemoryAffinity *numamem;
+ MemoryDeviceInfoList *info;
+ MemoryDeviceInfo *mi;
+ PCDIMMDeviceInfo *di;
+ uint64_t end = base + len, cur, size;
+
+ for (cur = base, info = info_list; cur < end;
+ cur += size, info = info->next) {
+ bool is_nvdimm;
+
+ if (!info) {
+ break;
+ }
+ numamem = acpi_data_push(table_data, sizeof(*numamem));
+
+ mi = info->value;
+ is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
+ di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
+
+ build_srat_memory(numamem, di->addr, di->size,
+ 0, MEM_AFFINITY_ENABLED);
+ size = di->size;
+ }
+}
+
static void
build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
@@ -564,6 +594,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
mem_base += numa_info[i].node_mem;
}
+ build_srat_hotpluggable_memory(table_data,
+ vms->bootinfo.device_memory_start,
+ vms->bootinfo.device_memory_size , 0);
+
build_header(linker, table_data, (void *)(table_data->data + srat_start),
"SRAT", table_data->len - srat_start, 3, NULL, NULL);
}
--
2.5.5
next prev parent reply other threads:[~2018-06-22 10:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 10:19 [Qemu-devel] [RFC 0/5] ARM virt: Support PC-DIMM at 2TB Eric Auger
2018-06-22 10:19 ` [Qemu-devel] [RFC 1/5] hw/arm/virt: Allocate device_memory Eric Auger
2018-06-22 10:19 ` [Qemu-devel] [RFC 2/5] hw/arm/virt: Add pc-dimm mem hotplug framework Eric Auger
2018-06-22 10:19 ` [Qemu-devel] [RFC 3/5] hw/arm/boot: introduce fdt_add_memory_node helper Eric Auger
2018-06-22 10:19 ` [Qemu-devel] [RFC 4/5] hw/arm/boot: Expose the PC-DIMM nodes in the DT Eric Auger
2018-06-22 10:19 ` Eric Auger [this message]
2018-06-22 13:19 ` [Qemu-devel] [RFC 0/5] ARM virt: Support PC-DIMM at 2TB no-reply
2018-06-22 13:22 ` Auger Eric
2018-06-22 13:26 ` no-reply
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=1529662749-32069-6-git-send-email-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=imammedo@redhat.com \
--cc=kwangwoo.lee@sk.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shameerali.kolothum.thodi@huawei.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).