From patchwork Mon Dec 19 14:13:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 132238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40D5CB704A for ; Tue, 20 Dec 2011 01:14:36 +1100 (EST) Received: from localhost ([::1]:44392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcdz5-0002xp-4f for incoming@patchwork.ozlabs.org; Mon, 19 Dec 2011 09:14:31 -0500 Received: from eggs.gnu.org ([140.186.70.92]:48549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcdyj-0002wT-Iq for qemu-devel@nongnu.org; Mon, 19 Dec 2011 09:14:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcdyg-0001ti-4m for qemu-devel@nongnu.org; Mon, 19 Dec 2011 09:14:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcdyf-0001t6-Ta for qemu-devel@nongnu.org; Mon, 19 Dec 2011 09:14:06 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBJEE2h6024938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Dec 2011 09:14:02 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBJEE07g032288; Mon, 19 Dec 2011 09:14:01 -0500 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id A1696250BA5; Mon, 19 Dec 2011 16:13:54 +0200 (IST) From: Avi Kivity To: Stefano Stabellini , qemu-devel@nongnu.org, "Michael S. Tsirkin" Date: Mon, 19 Dec 2011 16:13:27 +0200 Message-Id: <1324304024-11220-7-git-send-email-avi@redhat.com> In-Reply-To: <1324304024-11220-1-git-send-email-avi@redhat.com> References: <1324304024-11220-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: xen-devel@lists.xensource.com, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 06/23] loader: remove calls to cpu_get_physical_page_desc() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org cpu_get_physical_page_desc() is tied into the memory core's innards, replace it with uses of the API. Signed-off-by: Avi Kivity --- hw/loader.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/loader.c b/hw/loader.c index 9bbcddd..7af5411 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -49,6 +49,8 @@ #include "uboot_image.h" #include "loader.h" #include "fw_cfg.h" +#include "memory.h" +#include "exec-memory.h" #include @@ -674,7 +676,7 @@ static void rom_reset(void *unused) int rom_load_all(void) { target_phys_addr_t addr = 0; - int memtype; + MemoryRegionSection section; Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { @@ -690,9 +692,8 @@ int rom_load_all(void) } addr = rom->addr; addr += rom->romsize; - memtype = cpu_get_physical_page_desc(rom->addr) & (3 << IO_MEM_SHIFT); - if (memtype == IO_MEM_ROM) - rom->isrom = 1; + section = memory_region_find(get_system_memory(), rom->addr, 1); + rom->isrom = section.mr && memory_region_is_rom(section.mr); } qemu_register_reset(rom_reset, NULL); roms_loaded = 1;