From mboxrd@z Thu Jan 1 00:00:00 1970 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) From: Huacai Chen Date: Wed, 30 Jun 2010 18:39:53 +0800 Message-Id: <1277894393-3891-1-git-send-email-zltjiangshi@gmail.com> Subject: [Qemu-devel] [RFC][PATCH] PCI: fix pci_to_cpu_addr() issue List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com Cc: yamahata@valinux.co.jp, qemu-devel@nongnu.org, aurelien@aurel32.net, Huacai Chen 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) -- 1.7.0.4