From nobody Wed Nov 12 03:45:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1567587887; cv=none; d=zoho.com; s=zohoarc; b=e3fl6sdzJ2f+rbZvXjNDIxcDu4Vp2zk3Cz/4s4FwxU6Cc1YY503BbYHsm0T1DsjaCZ+19E2Fpsi60wMHmS5up335llqTO2U2i+h0rWp+zrFvnJRSA4ZmuXndyhPprov8+giOW5Pm1YUPxMYHUE9bmIRp77Fxc+Q1FMBGb9HAgxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567587887; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Mso2iKF+ryqsxuXQ7jqBseMQg87RrAqeDDEM5MdTdPA=; b=S5tperfzQaYT4DpvPPcUKyWypMhF0QyF+dkD0R+Zt2N8W4DN9ckJrqh4XkBoleGg2nG1c8PkGitrP+FgSApqp06E2FmSQgSDLsvxzYPHrUGtrzPh2qrFRlqKd9iPEaM6bPT0WbGjeCV8/pQk2i6nIIcUm8yB1J0iiFs9fEs0xFs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567587887445261.576710274931; Wed, 4 Sep 2019 02:04:47 -0700 (PDT) Received: from localhost ([::1]:54770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5RDZ-0004pL-Qz for importer@patchew.org; Wed, 04 Sep 2019 05:04:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38567) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5R72-0007Ij-14 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 04:58:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5R70-0007DL-J8 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 04:57:59 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2193 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5R6x-0007BB-Pt; Wed, 04 Sep 2019 04:57:56 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E2FED7AAAF89D396940F; Wed, 4 Sep 2019 16:57:53 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Wed, 4 Sep 2019 16:57:46 +0800 From: Shameer Kolothum To: , , , Date: Wed, 4 Sep 2019 09:56:24 +0100 Message-ID: <20190904085629.13872-7-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190904085629.13872-1-shameerali.kolothum.thodi@huawei.com> References: <20190904085629.13872-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 2.2.x-3.x [generic] X-Received-From: 45.249.212.190 Subject: [Qemu-devel] [PATCH-for-4.2 v10 06/11] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, sameo@linux.intel.com, ard.biesheuvel@linaro.org, linuxarm@huawei.com, xuwei5@hisilicon.com, shannon.zhaosl@gmail.com, sebastien.boeuf@intel.com, lersek@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Generate Memory Affinity Structures for PC-DIMM ranges. Also, Linux and Windows need ACPI SRAT table to make memory hotplug work properly, however currently QEMU doesn't create SRAT table if numa options aren't present on CLI. Hence add support(>=3D4.2) to create numa node automatically (auto_enable_numa_with_memhp) when QEMU is started with memory hotplug enabled but without '-numa' options on CLI. Signed-off-by: Shameer Kolothum Signed-off-by: Eric Auger Reviewed-by: Igor Mammedov --- v8 --> v9 - Added auto_enable_numa_with_memhp support. --- hw/arm/virt-acpi-build.c | 9 +++++++++ hw/arm/virt.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 5063f28812..a4872a0b00 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -519,6 +519,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) int i, srat_start; uint64_t mem_base; MachineClass *mc =3D MACHINE_GET_CLASS(vms); + MachineState *ms =3D MACHINE(vms); const CPUArchIdList *cpu_list =3D mc->possible_cpu_arch_ids(MACHINE(vm= s)); =20 srat_start =3D table_data->len; @@ -544,6 +545,14 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) } } =20 + if (ms->device_memory) { + numamem =3D acpi_data_push(table_data, sizeof *numamem); + build_srat_memory(numamem, ms->device_memory->base, + memory_region_size(&ms->device_memory->mr), + nb_numa_nodes - 1, + MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED= ); + } + build_header(linker, table_data, (void *)(table_data->data + srat_star= t), "SRAT", table_data->len - srat_start, 3, NULL, NULL); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 29bc2837ce..95accc28f1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2053,6 +2053,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) hc->plug =3D virt_machine_device_plug_cb; hc->unplug_request =3D virt_machine_device_unplug_request_cb; mc->numa_mem_supported =3D true; + mc->auto_enable_numa_with_memhp =3D true; } =20 static void virt_instance_init(Object *obj) @@ -2158,6 +2159,7 @@ static void virt_machine_4_1_options(MachineClass *mc) virt_machine_4_2_options(mc); compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); vmc->no_ged =3D true; + mc->auto_enable_numa_with_memhp =3D false; } DEFINE_VIRT_MACHINE(4, 1) =20 --=20 2.17.1