Received: from eggs.gnu.org ([2001:4830:134:3::10]:39022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vgfzr-0007pg-Hr for qemu-devel@nongnu.org; Wed, 13 Nov 2013 14:21:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vgfzl-0005us-If for qemu-devel@nongnu.org; Wed, 13 Nov 2013 14:21:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vgfzl-0005ue-9n for qemu-devel@nongnu.org; Wed, 13 Nov 2013 14:20:57 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rADJKucu002185 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Nov 2013 14:20:56 -0500 Date: Wed, 13 Nov 2013 21:23:55 +0200 From: "Michael S. Tsirkin" Message-ID: <1384370613-6433-5-git-send-email-mst@redhat.com> References: <1384370613-6433-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1384370613-6433-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PATCH v2 4/7] exec: pass hw address to phys_page_find List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Luiz Capitulino callers always shift by target page bits so let's just do this internally. Signed-off-by: Michael S. Tsirkin --- exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index ec46aea..edb577f 100644 --- a/exec.c +++ b/exec.c @@ -216,10 +216,11 @@ static void phys_page_set(AddressSpaceDispatch *d, phys_page_set_level(&d->phys_map, &index, &nb, leaf, P_L2_LEVELS - 1); } -static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr index, +static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr addr, Node *nodes, MemoryRegionSection *sections) { PhysPageEntry *p; + hwaddr index = addr >> TARGET_PAGE_BITS; int i; for (i = P_L2_LEVELS; lp.skip && (i -= lp.skip) >= 0;) { @@ -245,8 +246,7 @@ static MemoryRegionSection *address_space_lookup_region(AddressSpaceDispatch *d, MemoryRegionSection *section; subpage_t *subpage; - section = phys_page_find(d->phys_map, addr >> TARGET_PAGE_BITS, - d->nodes, d->sections); + section = phys_page_find(d->phys_map, addr, d->nodes, d->sections); if (resolve_subpage && section->mr->subpage) { subpage = container_of(section->mr, subpage_t, iomem); section = &d->sections[subpage->sub_section[SUBPAGE_IDX(addr)]]; @@ -800,7 +800,7 @@ static void register_subpage(AddressSpaceDispatch *d, MemoryRegionSection *secti subpage_t *subpage; hwaddr base = section->offset_within_address_space & TARGET_PAGE_MASK; - MemoryRegionSection *existing = phys_page_find(d->phys_map, base >> TARGET_PAGE_BITS, + MemoryRegionSection *existing = phys_page_find(d->phys_map, base, next_map.nodes, next_map.sections); MemoryRegionSection subsection = { .offset_within_address_space = base, -- MST