From nobody Mon Feb 9 20:35:25 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=1555570866; cv=none; d=zoho.com; s=zohoarc; b=NVr4l9Gk7aQFYuCLsp/tSqU+PNaJPFgP19sYEcQ5RuATmBO5RbI3dMwIwpR0khSfkjiivA2wwbvjhL93lzRtqRjFB0GBSo2hMjOL0kVR5SaWQDvOK8eDAoqKVnUOWm0/ODiAq+0Ren+jjfgJPU/auOQX+aOfV5akbPqwQZXJWlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555570866; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=i+hbJVQEeUGjCv9BkoQ5L25hCdRXsimAG7EpZf8aKY4=; b=D24tVDSIa9NHw8NVKaQNZkkr/05shgM9RTLrXHjL4NWj3ehDQZZesSilNYAaWc1ZfDX2IA1MZGNYz4LGoRxhGE07ZCak3/DluRx+pRU9KUghpLOpy0Jh2KUX5u0giN1+SqSlcnzt4gxoVizf6U+FYeYoHzdbaO1JxWlI0FLzL7o= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555570866414256.5193585866044; Thu, 18 Apr 2019 00:01:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:36806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hH12a-00008Z-1Q for importer@patchew.org; Thu, 18 Apr 2019 03:01:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hH10R-0007Gi-Fh for qemu-devel@nongnu.org; Thu, 18 Apr 2019 02:58:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hH0qT-00060q-02 for qemu-devel@nongnu.org; Thu, 18 Apr 2019 02:48:30 -0400 Received: from mga01.intel.com ([192.55.52.88]:17093) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hH0qS-0005wY-Lk for qemu-devel@nongnu.org; Thu, 18 Apr 2019 02:48:28 -0400 Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 23:48:23 -0700 Received: from vmmtaopc.sh.intel.com ([10.239.13.92]) by orsmga006.jf.intel.com with ESMTP; 17 Apr 2019 23:48:22 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,364,1549958400"; d="scan'208";a="136790443" From: Tao Xu To: imammedo@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com Date: Thu, 18 Apr 2019 14:46:01 +0800 Message-Id: <20190418064602.24558-3-tao3.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190418064602.24558-1-tao3.xu@intel.com> References: <20190418064602.24558-1-tao3.xu@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 Subject: [Qemu-devel] [PATCH v2 2/3] numa: move numa global variable have_numa_distance into MachineState 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: jingqi.liu@intel.com, tao3.xu@intel.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The aim of this patch is to move existing numa global have_numa_distance into NumaState. Suggested-by: Igor Mammedov Suggested-by: Eduardo Habkost Signed-off-by: Tao Xu --- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 1 + hw/i386/acpi-build.c | 2 +- include/hw/boards.h | 3 +++ include/sysemu/numa.h | 2 -- numa.c | 5 ++--- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 88722e0746..76316f13fd 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -815,7 +815,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) if (nb_numa_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 430189af1a..8a07f0442f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -197,6 +197,7 @@ static void create_fdt(VirtMachineState *vms) { MachineState *ms =3D MACHINE(vms); int nb_numa_nodes =3D ms->numa_state->nb_numa_nodes; + bool have_numa_distance =3D ms->numa_state->have_numa_distance; void *fdt =3D create_device_tree(&vms->fdt_size); =20 if (!fdt) { diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 7d9bc88ac9..43a807c483 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2685,7 +2685,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/hw/boards.h b/include/hw/boards.h index c4e8bb2437..5737275775 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -237,6 +237,9 @@ typedef struct NumaState { /* Number of NUMA nodes */ int nb_numa_nodes; =20 + /* Allow setting NUMA distance for different NUMA nodes */ + bool have_numa_distance; + } NumaState; =20 /** diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index a55e2be563..1a29408db9 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; diff --git a/numa.c b/numa.c index 4cc4d5ff5c..57aa8abf42 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 @@ -437,7 +436,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.17.1