From nobody Thu Oct 30 01:40:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152648451867777.87025284249; Wed, 16 May 2018 08:28:38 -0700 (PDT) Received: from localhost ([::1]:51441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIyM1-0003oQ-Sb for importer@patchew.org; Wed, 16 May 2018 11:28:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIyG5-000856-F3 for qemu-devel@nongnu.org; Wed, 16 May 2018 11:22:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIyG4-0005x1-IE for qemu-devel@nongnu.org; Wed, 16 May 2018 11:22:29 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2097 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIyFy-0005sq-4E; Wed, 16 May 2018 11:22:22 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 274CED4DEFF90; Wed, 16 May 2018 23:22:06 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.361.1; Wed, 16 May 2018 23:21:57 +0800 From: Shameer Kolothum To: , Date: Wed, 16 May 2018 16:20:25 +0100 Message-ID: <20180516152026.2920-6-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20180516152026.2920-1-shameerali.kolothum.thodi@huawei.com> References: <20180516152026.2920-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [RFC v2 5/6] hw/arm: ACPI SRAT changes to accommodate non-contiguous mem 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, jonathan.cameron@huawei.com, linuxarm@huawei.com, Shameer Kolothum , eric.auger@redhat.com, alex.williamson@redhat.com, zhaoshenglong@huawei.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is in preparation for the next patch where initial ram is split into a non-pluggable chunk and a pc-dimm modeled mem if the vaild iova regions are non-contiguous. Signed-off-by: Shameer Kolothum --- hw/arm/virt-acpi-build.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index c7c6a57..8d17b40 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -488,7 +488,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) AcpiSratProcessorGiccAffinity *core; AcpiSratMemoryAffinity *numamem; int i, srat_start; - uint64_t mem_base; + uint64_t mem_base, mem_sz, mem_len; MachineClass *mc =3D MACHINE_GET_CLASS(vms); const CPUArchIdList *cpu_list =3D mc->possible_cpu_arch_ids(MACHINE(vm= s)); =20 @@ -505,12 +505,28 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) core->flags =3D cpu_to_le32(1); } =20 - mem_base =3D vms->memmap[VIRT_MEM].base; + mem_base =3D vms->bootinfo.loader_start; + mem_sz =3D vms->bootinfo.loader_start; for (i =3D 0; i < nb_numa_nodes; ++i) { numamem =3D acpi_data_push(table_data, sizeof(*numamem)); - build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i, + mem_len =3D MIN(numa_info[i].node_mem, mem_sz); + build_srat_memory(numamem, mem_base, mem_len, i, MEM_AFFINITY_ENABLED); - mem_base +=3D numa_info[i].node_mem; + mem_base +=3D mem_len; + mem_sz -=3D mem_len; + if (!mem_sz) { + break; + } + } + + /* Create table for initial pc-dimm ram, if any */ + if (vms->bootinfo.dimm_mem) { + numamem =3D acpi_data_push(table_data, sizeof(*numamem)); + build_srat_memory(numamem, vms->bootinfo.dimm_mem->base, + vms->bootinfo.dimm_mem->size, + vms->bootinfo.dimm_mem->node, + MEM_AFFINITY_ENABLED); + } =20 build_header(linker, table_data, (void *)(table_data->data + srat_star= t), --=20 2.7.4