From nobody Mon Nov 3 20:20:23 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 1505984296018937.9520053762795; Thu, 21 Sep 2017 01:58:16 -0700 (PDT) Received: from localhost ([::1]:52449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxJH-0002CF-AX for importer@patchew.org; Thu, 21 Sep 2017 04:58:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxCk-00051U-BV for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duxCj-0001Fd-DA for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:30 -0400 Received: from ozlabs.ru ([107.173.13.209]:54112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duxCj-0001CA-7n for qemu-devel@nongnu.org; Thu, 21 Sep 2017 04:51:29 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 058043A60056; Thu, 21 Sep 2017 04:52:44 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 21 Sep 2017 18:50:59 +1000 Message-Id: <20170921085110.25598-8-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 07/18] memory: Cleanup after switching to FlatView 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" We store AddressSpaceDispatch* in FlatView anyway so there is no need to carry it from mem_add() to register_subpage/register_multipage. This should cause no behavioural change. Signed-off-by: Alexey Kardashevskiy --- exec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index d2b9f60494..548ec71b4c 100644 --- a/exec.c +++ b/exec.c @@ -1302,9 +1302,9 @@ static void phys_sections_free(PhysPageMap *map) g_free(map->nodes); } =20 -static void register_subpage(FlatView *fv, AddressSpaceDispatch *d, - MemoryRegionSection *section) +static void register_subpage(FlatView *fv, MemoryRegionSection *section) { + AddressSpaceDispatch *d =3D flatview_to_dispatch(fv); subpage_t *subpage; hwaddr base =3D section->offset_within_address_space & TARGET_PAGE_MASK; @@ -1333,9 +1333,10 @@ static void register_subpage(FlatView *fv, AddressSp= aceDispatch *d, } =20 =20 -static void register_multipage(AddressSpaceDispatch *d, +static void register_multipage(FlatView *fv, MemoryRegionSection *section) { + AddressSpaceDispatch *d =3D flatview_to_dispatch(fv); hwaddr start_addr =3D section->offset_within_address_space; uint16_t section_index =3D phys_section_add(&d->map, section); uint64_t num_pages =3D int128_get64(int128_rshift(section->size, @@ -1347,7 +1348,6 @@ static void register_multipage(AddressSpaceDispatch *= d, =20 void mem_add(FlatView *fv, MemoryRegionSection *section) { - AddressSpaceDispatch *d =3D flatview_to_dispatch(fv); MemoryRegionSection now =3D *section, remain =3D *section; Int128 page_size =3D int128_make64(TARGET_PAGE_SIZE); =20 @@ -1356,7 +1356,7 @@ void mem_add(FlatView *fv, MemoryRegionSection *secti= on) - now.offset_within_address_space; =20 now.size =3D int128_min(int128_make64(left), now.size); - register_subpage(fv, d, &now); + register_subpage(fv, &now); } else { now.size =3D int128_zero(); } @@ -1366,13 +1366,13 @@ void mem_add(FlatView *fv, MemoryRegionSection *sec= tion) remain.offset_within_region +=3D int128_get64(now.size); now =3D remain; if (int128_lt(remain.size, page_size)) { - register_subpage(fv, d, &now); + register_subpage(fv, &now); } else if (remain.offset_within_address_space & ~TARGET_PAGE_MASK)= { now.size =3D page_size; - register_subpage(fv, d, &now); + register_subpage(fv, &now); } else { now.size =3D int128_and(now.size, int128_neg(page_size)); - register_multipage(d, &now); + register_multipage(fv, &now); } } } --=20 2.11.0