qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC][PATCH] PCI: fix pci_to_cpu_addr() issue
@ 2010-06-30 10:39 Huacai Chen
  2010-06-30 13:38 ` [Qemu-devel] " Isaku Yamahata
  0 siblings, 1 reply; 6+ messages in thread
From: Huacai Chen @ 2010-06-30 10:39 UTC (permalink / raw)
  To: mst; +Cc: yamahata, qemu-devel, aurelien, 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 <zltjiangshi@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-04 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 10:39 [Qemu-devel] [RFC][PATCH] PCI: fix pci_to_cpu_addr() issue Huacai Chen
2010-06-30 13:38 ` [Qemu-devel] " Isaku Yamahata
2010-06-30 14:05   ` chen huacai
2010-07-02  2:11     ` Isaku Yamahata
     [not found]       ` <AANLkTilli02u9jZ52c0aoTBs-JSEY_mYDwqt2GyeKoYw@mail.gmail.com>
     [not found]         ` <20100702101318.GD16712@valinux.co.jp>
2010-07-03  4:11           ` chen huacai
2010-07-04 13:42             ` Isaku Yamahata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).