From patchwork Wed Sep 18 13:06:28 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: 173968 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2446880ill; Wed, 18 Sep 2019 06:13:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtgXbCX1t7YdriRVeCkz79W21guJ8tHozntnDJ2FeD5Xi4mKhguFwwIH1HHbfVGcL4jluk X-Received: by 2002:a05:6214:12c9:: with SMTP id s9mr622573qvv.26.1568812418808; Wed, 18 Sep 2019 06:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568812418; cv=none; d=google.com; s=arc-20160816; b=ROV4FrvbcDBpblbMBzQhwVnVNJSjN20cFk+v8VW3lLv0pjDS7NUle6ZYTZIHq2NBXG jm4ETOreWwmKzfuFTxyJScEqyoGp5MK4t0UJ70T+VHkGjgL6rNlirQKT/d6K4m7c2FiD 9AxbBcBxRpWHl/1/KexUIAfC2lZeHBRCi56LoqaC02Zq/soFVKkQXxfHRMVsCm17pas4 Wqeocowu9yx1VKU21dpqJRjPp9R4pWvJIlG41NE7cGFldiTQIyP5ihEqcW20sk1qUKi7 0Mpu/VAH7NBV+7qOHigR8XDj9C0qcZPUxQVe95yNsbvHFlWCJo6yztDWZaYVOg8ei27y e5mQ== 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=PF/tRCR36d2hXRxrXP2vRlNyrUJdBfgUPjQoM916GOQ=; b=isyQq/T7NLvz47/9FtM8rGB4tEZT3XXYG5l9ZUQxdeynKDVHW7GVZ6vpLqccb3dZGV SSjL/xPeccLn1Zi12UUDbVju8TZRCc3krsYSWwL9lkeLnI9bEmVSzVz8NDAluLskT1Hv lqiQaW9iAOS9BSmRSv+E1ncvgzhWkdEEUAI3oGoDFzzFW2FhY+Q1SKMGzt0iLaZSoZBi eucTV4iNWtpgL1UnRna53ztV8rAQnH1Td+BgzyUduTYjaD3S1M4GQM2ksK4li2d0/T0C JKE2PyIcz1/DmlIiP9mvVF8cUdoBjnZ4QyOyjcdQnv46/fBJptKFH06fkis37ZtLLYR4 OPTw== 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 e1si3541113qkg.97.2019.09.18.06.13.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Sep 2019 06:13:38 -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]:58894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAZm5-0000og-Mf for patch@linaro.org; Wed, 18 Sep 2019 09:13:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58725) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAZh6-0004Pf-Nx for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:08:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAZh5-0003Q5-FL for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:08:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2238 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAZh2-0003NB-Ps; Wed, 18 Sep 2019 09:08:25 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EC85D335BFB28D9FDBF9; Wed, 18 Sep 2019 21:08:22 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 18 Sep 2019 21:08:12 +0800 From: Shameer Kolothum To: , , , Date: Wed, 18 Sep 2019 14:06:28 +0100 Message-ID: <20190918130633.4872-7-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190918130633.4872-1-shameerali.kolothum.thodi@huawei.com> References: <20190918130633.4872-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.191 Subject: [Qemu-devel] [PATCH-for-4.2 v11 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, mst@redhat.com, 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 --- hw/arm/virt-acpi-build.c | 8 ++++++++ hw/arm/virt.c | 2 ++ 2 files changed, 10 insertions(+) -- 2.17.1 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index cadeea0f41..c97661ad68 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -546,6 +546,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), + ms->numa_state->num_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 f926477ba5..d221841c42 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2051,6 +2051,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) @@ -2156,6 +2157,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)