From nobody Mon Nov 3 20:20:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505984307208960.7378915696424; Thu, 21 Sep 2017 01:58:27 -0700 (PDT) Received: from localhost ([::1]:52450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxJS-0002LR-AX for importer@patchew.org; Thu, 21 Sep 2017 04:58:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxCq-00056k-FF for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duxCm-0001Hw-JG for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:36 -0400 Received: from ozlabs.ru ([107.173.13.209]:54112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxCm-0001CA-Dr for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:32 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 4E8623A60056; Thu, 21 Sep 2017 04:52:48 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 21 Sep 2017 18:51:02 +1000 Message-Id: <20170921085110.25598-11-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170921085110.25598-1-aik@ozlabs.ru> References: <20170921085110.25598-1-aik@ozlabs.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v5 10/18] memory: Alloc dispatch tree where topology is generared 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: Alexey Kardashevskiy , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is to make next patches simpler. Signed-off-by: Alexey Kardashevskiy --- memory.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/memory.c b/memory.c index 98b0b95e6e..eb730cd619 100644 --- a/memory.c +++ b/memory.c @@ -742,6 +742,7 @@ static MemoryRegion *memory_region_get_flatview_root(Me= moryRegion *mr) /* Render a memory topology into a list of disjoint absolute ranges. */ static FlatView *generate_memory_topology(MemoryRegion *mr) { + int i; FlatView *view; =20 view =3D flatview_new(mr); @@ -752,6 +753,14 @@ static FlatView *generate_memory_topology(MemoryRegion= *mr) } flatview_simplify(view); =20 + view->dispatch =3D address_space_dispatch_new(view); + for (i =3D 0; i < view->nr; i++) { + MemoryRegionSection mrs =3D + section_from_flat_range(&view->ranges[i], view); + flatview_add_to_dispatch(view, &mrs); + } + address_space_dispatch_compact(view->dispatch); + return view; } =20 @@ -921,15 +930,6 @@ static void address_space_update_topology(AddressSpace= *as) FlatView *old_view =3D address_space_get_flatview(as); MemoryRegion *physmr =3D memory_region_get_flatview_root(old_view->roo= t); FlatView *new_view =3D generate_memory_topology(physmr); - int i; - - new_view->dispatch =3D address_space_dispatch_new(new_view); - for (i =3D 0; i < new_view->nr; i++) { - MemoryRegionSection mrs =3D - section_from_flat_range(&new_view->ranges[i], new_view); - flatview_add_to_dispatch(new_view, &mrs); - } - address_space_dispatch_compact(new_view->dispatch); =20 if (!QTAILQ_EMPTY(&as->listeners)) { address_space_update_topology_pass(as, old_view, new_view, false); --=20 2.11.0