From nobody Mon Feb 9 21:38:26 2026 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; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1562510099; cv=none; d=zoho.com; s=zohoarc; b=ePjw1wDnI2xtU7L9sE/l+M8eWn4I+tc6psbm7FUSIr5n3Qfd4c2GefE9kLgWRjPpa3ZhH+MrSjQKJTZFOJXknF+e3Y02wAjTJjnkUqLghZMfS0kIu0BkklQvukjj8XWh9RWoCdgDDcWspiXijDjl6rh1AYDze5wZAiyqkjbXaa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562510099; h=Content-Transfer-Encoding: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=twalsPK4FngS7HZHKNQiS/hc3o7mDUleZ3ytJGOito0=; b=fYMJTdMLBBNysPje2GvRG92/H/NvbVc7CCTgfQoEiq5z8AF1ZQUf1lYResE6PTSfXt/oyXOZBx+DGo8Fq2xiEQG5/c+QBs8A5zCVxHxaxtn4Wuh2EO2SS2afToHYDaWbtyIiYsVKjBhGq+1sGe5h9CXXhYQXdJ8sE5XPMFsKuL8= 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562510099608632.4001052512557; Sun, 7 Jul 2019 07:34:59 -0700 (PDT) Received: from localhost ([::1]:35622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hk8Fb-0001WN-KC for importer@patchew.org; Sun, 07 Jul 2019 10:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49484) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hk8Dy-0008Ev-Kn for qemu-devel@nongnu.org; Sun, 07 Jul 2019 10:33:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hk8Dw-0003OY-KQ for qemu-devel@nongnu.org; Sun, 07 Jul 2019 10:33:06 -0400 Received: from mga03.intel.com ([134.134.136.65]:31568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hk8Dw-000363-AB for qemu-devel@nongnu.org; Sun, 07 Jul 2019 10:33:04 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2019 07:32:48 -0700 Received: from tao-optiplex-7060.sh.intel.com ([10.239.13.104]) by fmsmga001.fm.intel.com with ESMTP; 07 Jul 2019 07:32:46 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,462,1557212400"; d="scan'208";a="185497821" From: Tao Xu To: imammedo@redhat.com, eblake@redhat.com, ehabkost@redhat.com Date: Sun, 7 Jul 2019 22:29:47 +0800 Message-Id: <20190707142958.31316-4-tao3.xu@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190707142958.31316-1-tao3.xu@intel.com> References: <20190707142958.31316-1-tao3.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.65 Subject: [Qemu-devel] [PATCH v6 03/14] numa: move numa global variable have_numa_distance into MachineState 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: jingqi.liu@intel.com, tao3.xu@intel.com, fan.du@intel.com, qemu-devel@nongnu.org, jonathan.cameron@huawei.com, dan.j.williams@intel.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Move existing numa global have_numa_distance into NumaState. Reviewed-by: Igor Mammedov Reviewed-by: Liu Jingqi Suggested-by: Igor Mammedov Suggested-by: Eduardo Habkost Signed-off-by: Tao Xu --- Changes in v6: - rebase to upstream, move globals in arm/sbsa-ref --- hw/arm/sbsa-ref.c | 2 +- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 2 +- hw/i386/acpi-build.c | 2 +- include/sysemu/numa.h | 4 ++-- numa.c | 5 ++--- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 9f0cd37d72..13a9bf938c 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -158,7 +158,7 @@ static void create_fdt(SBSAMachineState *sms) qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2); qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); =20 - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { int size =3D nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); uint32_t *matrix =3D g_malloc0(size); int idx, i, j; diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a2cc4b84fe..461a44b5b0 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -797,7 +797,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) if (ms->numa_state->num_nodes > 0) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, vms); - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { acpi_add_table(table_offsets, tables_blob); build_slit(tables_blob, tables->linker, ms); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e7d72096e5..ef051569ef 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -232,7 +232,7 @@ static void create_fdt(VirtMachineState *vms) "clk24mhz"); qemu_fdt_setprop_cell(fdt, "/apb-pclk", "phandle", vms->clock_phandle); =20 - if (have_numa_distance) { + if (nb_numa_nodes > 0 && ms->numa_state->have_numa_distance) { int size =3D nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); uint32_t *matrix =3D g_malloc0(size); int idx, i, j; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d26a7be7a6..0e451e06d1 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2680,7 +2680,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) if (pcms->numa_nodes) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, machine); - if (have_numa_distance) { + if (machine->numa_state->have_numa_distance) { acpi_add_table(table_offsets, tables_blob); build_slit(tables_blob, tables->linker, machine); } diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index bea3b5b899..b9fa457948 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -6,8 +6,6 @@ #include "sysemu/hostmem.h" #include "hw/boards.h" =20 -extern bool have_numa_distance; - struct NodeInfo { uint64_t node_mem; struct HostMemoryBackend *node_memdev; @@ -26,6 +24,8 @@ struct NumaState { /* Number of NUMA nodes */ int num_nodes; =20 + /* Allow setting NUMA distance for different NUMA nodes */ + bool have_numa_distance; }; typedef struct NumaState NumaState; =20 diff --git a/numa.c b/numa.c index d35e5c2c2e..d49c53b3bf 100644 --- a/numa.c +++ b/numa.c @@ -52,7 +52,6 @@ static int have_memdevs =3D -1; static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one. * For all nodes, nodeid < max_numa_nodeid */ -bool have_numa_distance; NodeInfo numa_info[MAX_NODES]; =20 =20 @@ -171,7 +170,7 @@ void parse_numa_distance(MachineState *ms, NumaDistOpti= ons *dist, Error **errp) } =20 numa_info[src].distance[dst] =3D val; - have_numa_distance =3D true; + ms->numa_state->have_numa_distance =3D true; } =20 static @@ -442,7 +441,7 @@ void numa_complete_configuration(MachineState *ms) * asymmetric. In this case, the distances for both directions * of all node pairs are required. */ - if (have_numa_distance) { + if (ms->numa_state->have_numa_distance) { /* Validate enough NUMA distance information was provided. */ validate_numa_distance(ms); =20 --=20 2.20.1