From patchwork Fri Jun 22 10:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 139601 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp695647lji; Fri, 22 Jun 2018 03:24:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcn/40R0sdlBzfETW2zLBAIW9LivAJBS/zmANVnY98On10bJ2zVuRph5rKWW+ww7IQrUM0D X-Received: by 2002:ae9:dfc2:: with SMTP id t185-v6mr749942qkf.274.1529663097483; Fri, 22 Jun 2018 03:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529663097; cv=none; d=google.com; s=arc-20160816; b=oZgDK4U0RuDTOPnACVsDZegJr7Y8uDRiyB31EXntv6bJrv+Ew8X1IB3jNyIAi1uScT AdSPyNkAZdsG2lBMkt/x0kf5vAEFYoyueWamqT0kUKLfxzImF6U3IQbqPjsITeRGE+qS icKs4VPc/iyw5/As/eTB0B4TnL3w1Bdc07BA6VOb5rX3n2n4TfXVlcoom05fwg5fuqnZ 3ja7KscdwfwjyHAFc6UnHAc7dIRQ/XkghkPWfKo8xde8wYwzT+j7/N2cvz2Nj409DGcZ xBbMgvtCpzkk2VXQJ3AVuOEYi14nUjqW9VIlxLKOKGamQ6mtiBRi+JSuuJRoRUdUzPJj V4cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=+AZKtL6yT1pOR1b02x+ymA4c4RnumPFmyHFs25QXu2k=; b=ftUt7jiCA4Z5WuSGKBgs6KVDmPOFidsWAmdwF+8UcVrMEQHT+uUCBReleZgTkGW7Ip d5CMKVo1e4/Fy/SNbksJKz6Vz5tq5TB04NOjUdngYj0Y+flnIrxRMADUEiJ7y09lc+K8 RLINMZ78yoyn+5JcCCAZcRFOoEI5oPs2jLvAe0Xy2NywMTqrgL1CjdKuxCGJh2VAELM/ xCShm5CYtDwtKIfIm+YChC07LzpIdyOSdwcxepby1jLnUzO/O8qduIDdCWotgK/asReT 9EehZycald2k50l42CDA6f7t9NW/Tv0nuYtoOTKhpN86xM2xTwWn2OZ2noFkLs/JP/ld 2iZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a22-v6si6658321qkj.109.2018.06.22.03.24.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jun 2018 03:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:60610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWJFR-00047L-11 for patch@linaro.org; Fri, 22 Jun 2018 06:24:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWJA9-0000Oi-Te for qemu-devel@nongnu.org; Fri, 22 Jun 2018 06:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWJA6-0005dJ-OA for qemu-devel@nongnu.org; Fri, 22 Jun 2018 06:19:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48640 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWJA4-0005c9-86; Fri, 22 Jun 2018 06:19:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C64804023132; Fri, 22 Jun 2018 10:19:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-106.ams2.redhat.com [10.36.117.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EA4B11166E1; Fri, 22 Jun 2018 10:19:22 +0000 (UTC) From: Eric Auger 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 Date: Fri, 22 Jun 2018 12:19:09 +0200 Message-Id: <1529662749-32069-6-git-send-email-eric.auger@redhat.com> In-Reply-To: <1529662749-32069-1-git-send-email-eric.auger@redhat.com> References: <1529662749-32069-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 10:19:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 10:19:23 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shameer Kolothum Generate Memory Affinity Structures for PC-DIMM ranges. Signed-off-by: Shameer Kolothum Signed-off-by: Eric Auger --- hw/arm/virt-acpi-build.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.5.5 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); }