From patchwork Tue Aug 13 21:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 171221 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1401827ily; Tue, 13 Aug 2019 14:14:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYMcxtIN46S07JaW2GN+LSPMKqGwx13o3DDQsCJpyVAMivi8Ef5VeH/kNr4wXVAkjH34uB X-Received: by 2002:a05:620a:7c8:: with SMTP id 8mr11899946qkb.424.1565730843486; Tue, 13 Aug 2019 14:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565730843; cv=none; d=google.com; s=arc-20160816; b=oh4GPLe6D6qbwKLMe9Ogmq/iK3T4tZHU1eCyn8Tau3ZGv2kRRYhuyyvQKYhms2Bmr+ kHdm3/LZahKrbFdaXEg9Pbl+KqlWyUuffsdLRlS0yTH9d+SHnt0v8YCh+/kERI3zjBJQ knE1hrpp/zKdMPGp2i+wWMKJMTcY3iulkTX+BSr/2YtIZDnsm1GyljrCn2LubtozcHUQ MrAFU1SgssxltLRGcdX/NYCYHgflAy0y/LJYeS3Kw7kAtpVvLPMyj1dDNo25zr9iV3qB Df/7pEHAGlr/oyzpI/9SUOaxTPRFYcJqCtk8+gC1mMv1Li9OQsijoHZQZrtKgeVko+a9 jsRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version:references :in-reply-to:message-id:date:to:from; bh=4AA/f4hAnUvuMcxTGXjpVMnrEDmO5xa+XaS0cP7GV3g=; b=NaqIzIfvXg0L+yfQMkE2jRJpohByLOuZGP/PZPzUHv4114OfnOlwTXwS/WGJdAE9Is xi9CEc4fLoUwQ4dtqxTGpxqdVfqWEhyZyfwx01nQcC349z97elQA6ex1j9j1fi8T3ONb iS9QBc/QleOpvQZZhhaN+18Dr0s2kxfrsyaEytUud0islpJtZPQs/gklb3FmYb698zVH DrDFuR06cyulqAuu8OQEufFyB71/FR2NZuMm+G95Xqn1eG+K9aUO/0G0LGitzEbDyHdQ 1tYeAafZ9R+Zp1a2WsHCzza5l7YNGKEYcPufzkeh3wwNIDJA+fo3hGdOLcm6b5GqoEQv H8eA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b23si8273741qkl.26.2019.08.13.14.14.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Aug 2019 14:14:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:55560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxe7H-0007CR-20 for patch@linaro.org; Tue, 13 Aug 2019 17:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41898) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxe1J-00053B-Ix for qemu-devel@nongnu.org; Tue, 13 Aug 2019 17:07:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxe1I-0001YA-FX for qemu-devel@nongnu.org; Tue, 13 Aug 2019 17:07:53 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:60828 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hxe1A-0001H0-K9; Tue, 13 Aug 2019 17:07:45 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BEB44CF41561ABA8969A; Wed, 14 Aug 2019 05:07:36 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.47.94.0) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 14 Aug 2019 05:07:28 +0800 From: Shameer Kolothum To: , , , Date: Tue, 13 Aug 2019 22:05:34 +0100 Message-ID: <20190813210539.31164-8-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190813210539.31164-1-shameerali.kolothum.thodi@huawei.com> References: <20190813210539.31164-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.94.0] 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.35 Subject: [Qemu-devel] [PATCH-for-4.2 v9 07/12] 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(>=4.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(+) -- 2.17.1 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 63fa845076..6d697af2df 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -518,6 +518,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) int i, srat_start; uint64_t mem_base; MachineClass *mc = MACHINE_GET_CLASS(vms); + MachineState *ms = MACHINE(vms); const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(MACHINE(vms)); srat_start = table_data->len; @@ -543,6 +544,14 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } } + if (ms->device_memory) { + numamem = 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_start), "SRAT", table_data->len - srat_start, 3, NULL, NULL); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0949a227a9..56d64fc0a9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2049,6 +2049,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) hc->plug = virt_machine_device_plug_cb; hc->unplug_request = virt_machine_device_unplug_request_cb; mc->numa_mem_supported = true; + mc->auto_enable_numa_with_memhp = true; } static void virt_instance_init(Object *obj) @@ -2154,6 +2155,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 = true; + mc->auto_enable_numa_with_memhp = false; } DEFINE_VIRT_MACHINE(4, 1)