From patchwork Wed Jun 30 10:39:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chen huacai X-Patchwork-Id: 57389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5CE75B6F01 for ; Wed, 30 Jun 2010 20:39:07 +1000 (EST) Received: from localhost ([127.0.0.1]:53949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTuh5-0003UE-UF for incoming@patchwork.ozlabs.org; Wed, 30 Jun 2010 06:39:03 -0400 Received: from [140.186.70.92] (port=46986 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTugS-0003U9-81 for qemu-devel@nongnu.org; Wed, 30 Jun 2010 06:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTugQ-00055z-PK for qemu-devel@nongnu.org; Wed, 30 Jun 2010 06:38:23 -0400 Received: from mail-px0-f173.google.com ([209.85.212.173]:62696) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTugQ-00055h-KG for qemu-devel@nongnu.org; Wed, 30 Jun 2010 06:38:22 -0400 Received: by pxi2 with SMTP id 2so312724pxi.4 for ; Wed, 30 Jun 2010 03:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=AR5W4aRrYZHj9rc/QbLSp84A2i1u85d3kkQBljBer30=; b=eyjlnq+4aKTTRx20HV86GWAmapMSH/eL76uRq2b2qDBdEWnDdwXWd2NjaBDZ+QSjEX ASPQDukqOUCxq0BjWjdq292eRj4VX7tM6l0rV4iQCLgGggxJ/LjH1xhKjvwsiMlOuSIs 7j0hzb3H5LKFIw4CNTi77Jd7GJPAAmFFS69sU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=afXZT49WpCCXrQMN/yf1n0B2jJmMlXp071jaMxeAd0v4lu4nUnQF6ba7Xxkc1b0Vif qmBjupIq5uxRzIFvie1NdZ5gr3q35lkv3O1FAILWeXi1VH9gO4O12Tdx4nSnmCl8ZJdT qkbZS6aH0J1z0hkgJ6im+rnr7Cco7lwE9y1sw= Received: by 10.114.187.19 with SMTP id k19mr9474627waf.20.1277894298522; Wed, 30 Jun 2010 03:38:18 -0700 (PDT) Received: from localhost.localdomain ([211.69.198.200]) by mx.google.com with ESMTPS id t25sm51648491wak.10.2010.06.30.03.38.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 30 Jun 2010 03:38:17 -0700 (PDT) From: Huacai Chen To: mst@redhat.com Date: Wed, 30 Jun 2010 18:39:53 +0800 Message-Id: <1277894393-3891-1-git-send-email-zltjiangshi@gmail.com> X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: yamahata@valinux.co.jp, qemu-devel@nongnu.org, aurelien@aurel32.net, Huacai Chen Subject: [Qemu-devel] [RFC][PATCH] PCI: fix pci_to_cpu_addr() issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It seems like software may both use CPU address or PCI address to access a PCI device. For example, Bonito north bridge map PCI memory space at 0x10000000 ~ 0x1C000000. PMON code use 0x00000000 ~ 0x0C000000, but Linux kernel code use 0x10000000 ~ 0x1C000000 to access devices. If set pci_mem_base to 0, PMON can't work, but if set pci_mem_base to 0x10000000, Linux can't access PCI. So I make this patch to make both cases works. However, I don't know whether the modification will break other archs, so request for comments here. Signed-off-by: Huacai Chen --- hw/pci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 7787005..50e3572 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -672,7 +672,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name, static target_phys_addr_t pci_to_cpu_addr(PCIBus *bus, target_phys_addr_t addr) { - return addr + bus->mem_base; + return addr | bus->mem_base; } static void pci_unregister_io_regions(PCIDevice *pci_dev)