qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] PATCH/RFC: PCI memory mapping


From: Brian Wheeler
Subject: Re: [Qemu-devel] PATCH/RFC: PCI memory mapping
Date: Fri, 03 Apr 2009 12:01:35 -0400

On Fri, 2009-04-03 at 15:28 +0000, Paul Brook wrote:
> > So, for example, a cirrus vga device on bus 1 when calling:
> >
> > cpu_register_physical_memory(addr, s->vram_size,
> > s->cirrus_linear_io_addr);
> 
> Ah, that's a different (but somewhat related) problem. This is for accesses 
> from the CPU to the device. Most current IOMMU effect device->CPU 
> accesses[1].
> 

Ok, so is there an official work around for this one?  Right now we've
hacked around it by just adding pci_mem_base to it during that call but
that limits us to one bus and it requires patching all of the pci
devices we use.

Would a patch implementing this API be acceptable?

--------------
typedef target_phys_addr_t (*pci_map_addr_fn)(void *opaque, PCIDevice *device, 
                            target_phys_addr_t addr, ram_addr_t len);
void pci_register_address_mapper(PCIBus *bus, pci_map_addr_fn map_addr, void 
*opaque);
static inline int pci_register_physical_memory(PCIDevice *device, 
                                 target_phys_addr_t start_addr,
                                 ram_addr_t size,
                                 ram_addr_t phys_offset);
----------------

The pci_register_physical_memory would call the callback (if any) to
generate the appropriate physical address.

So, the cirrus example above would be changed to:

pci_register_physical_memory(addr, s->vram_size,
                             s->cirrus_linear_io_addr);

which would (on the PC and others) just map addr to itself.  On any
architecture which registered an address mapper, the address actually
mapped would be generated.


Thanks!
Brian






> Paul
> 
> [1] For practical purposes assume the the CPU and system ram are on the same 
> bus.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]