qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 21/23] pci: add MemoryRegion based BAR managemen


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 21/23] pci: add MemoryRegion based BAR management API
Date: Tue, 26 Jul 2011 14:06:17 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc15 Thunderbird/3.1.11

On 07/25/2011 11:20 PM, Anthony Liguori wrote:
On 07/25/2011 09:03 AM, Avi Kivity wrote:
Allow registering a BAR using a MemoryRegion. Once all users are converted,
pci_register_bar() and pci_register_bar_simple() will be removed.

Signed-off-by: Avi Kivity<address@hidden>

diff --git a/hw/pci.h b/hw/pci.h
index cfeb042..c51156d 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -94,6 +94,7 @@ typedef struct PCIIORegion {
      uint8_t type;
      PCIMapIORegionFunc *map_func;
      ram_addr_t ram_addr;
+    MemoryRegion *memory;
  } PCIIORegion;

  #define PCI_ROM_SLOT 6
@@ -204,6 +205,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
                              PCIMapIORegionFunc *map_func);
  void pci_register_bar_simple(PCIDevice *pci_dev, int region_num,
pcibus_t size, uint8_t attr, ram_addr_t ram_addr);
+void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
+                             uint8_t attr, MemoryRegion *memory);

This ends up being a very nice API. I had always thought this should be a PCI specific set of callbacks but I do see the benefits of having the callbacks be generic.

Reviewed-by: Anthony Liguori <address@hidden>

One thing I'm curious about, what's the symmetric view of this API?

Would you see a device doing something like:

memory_region_read(&dev->pci_bus->memory, addr, &data, sizeof(data))


I haven't really considered this, but it makes sense to consider the initiating point for DMA. This allows us to do IOMMU transformations naturally.

--
error compiling committee.c: too many arguments to function




reply via email to

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