From nobody Tue Feb 10 01:16:04 2026 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 15054649544721021.9737731162138; Fri, 15 Sep 2017 01:42:34 -0700 (PDT) Received: from localhost ([::1]:51958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsmCn-0000MZ-MW for importer@patchew.org; Fri, 15 Sep 2017 04:42:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsmB3-0006wG-PI for qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsmB2-0002UW-QW for qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:45 -0400 Received: from ozlabs.ru ([107.173.13.209]:44668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsmB2-0002Ql-JS for qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:44 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 11C623A6005D; Fri, 15 Sep 2017 04:41:57 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Fri, 15 Sep 2017 18:40:25 +1000 Message-Id: <20170915084030.40988-9-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170915084030.40988-1-aik@ozlabs.ru> References: <20170915084030.40988-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 v2 08/13] 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. Signed-off-by: Alexey Kardashevskiy --- exec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index b561098df3..3e02b82c05 100644 --- a/exec.c +++ b/exec.c @@ -1303,9 +1303,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; @@ -1334,9 +1334,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, @@ -1348,7 +1349,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 @@ -1357,7 +1357,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(); } @@ -1367,13 +1367,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