qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC v2 00/20] Memory API


From: Avi Kivity
Subject: [Qemu-devel] [RFC v2 00/20] Memory API
Date: Mon, 27 Jun 2011 16:21:47 +0300

As expected, this is taking longer than expected, so I'm releasing something
less complete than I'd have liked.  Not even all of the PC machine is
converted, but the difficult parts are (cirrus).  It appears to work well.

The major change compared to v1 is the introduction of
memory_region_init_alias(), which defines a memory region in terms of another.
With the current API, the ability to alias is provided by address arithmetic
on ram_addr_t:

  ram_addr = qemu_ram_alloc(...);
  cpu_register_physical_memory(..., ram_addr, size, ...);
  /* alias: */
  cpu_register_physical_memory(..., ram_addr + offset, another_size, ...);

With the new API, you have to create an alias:

  memory_region_init_ram(&mem, ...);
  memory_region_register_subregion(..., &mem);
  /* alias: */
  memory_region_init_alias(&alias, ..., &mem, offset, another_size);
  memory_region_register_subregion(..., &alias);

The patchset is somewhat churny.  One of the reasons is that we move from a
handle/pointer scheme in ram_addr_t to an object constructor/destructor scheme.
Another is that region size becomes a property of a region instead of being
maintained externally.  Also, container memory regions must be passed around,
though we don't do that as well as we should.

Todo:
  - eliminate calls to get_system_memory() (where we ignore the bus hierarchy)
  - add PCI APIs for the VGA window
  - support the PIO address space using the memory API (allowing simplified
    PCI BAR registration)
  - convert 440FX
  - convert everything else

Also available in

  git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory-region

with a complementary pair of noisy debug patches.

Avi Kivity (20):
  Hierarchical memory region API
  memory: implement dirty tracking
  memory: merge adjacent segments of a single memory region
  Internal interfaces for memory API
  exec.c: initialize memory map
  pc: grab system_memory
  pc: convert pc_memory_init() to memory API
  pc: move global memory map out of pc_init1() and into its callers
  pci: pass address space to pci bus when created
  pci: add MemoryRegion based BAR management API
  sysbus: add MemoryRegion based memory management API
  usb-ohci: convert to MemoryRegion
  pci: add API to get a BAR's mapped address
  vmsvga: don't remember pci BAR address in callback any more
  vga: convert vga and its derivatives to the memory API
  cirrus: simplify mmio BAR access functions
  cirrus: simplify bitblt BAR access functions
  cirrus: simplify vga window mmio access functions
  vga: simplify vga window mmio access functions
  cirrus: simplify linear framebuffer access functions

 Makefile.target    |    1 +
 exec-memory.h      |   17 ++
 exec.c             |   19 ++
 hw/apb_pci.c       |    2 +
 hw/bonito.c        |    4 +-
 hw/cirrus_vga.c    |  476 ++++++++++++------------------------
 hw/grackle_pci.c   |    5 +-
 hw/gt64xxx.c       |    4 +-
 hw/pc.c            |   62 +++--
 hw/pc.h            |    9 +-
 hw/pc_piix.c       |   20 +-
 hw/pci.c           |   68 ++++-
 hw/pci.h           |   16 +-
 hw/pci_host.h      |    1 +
 hw/pci_internals.h |    1 +
 hw/piix_pci.c      |   13 +-
 hw/ppc4xx_pci.c    |    5 +-
 hw/ppc_mac.h       |    9 +-
 hw/ppc_newworld.c  |    5 +-
 hw/ppc_oldworld.c  |    3 +-
 hw/ppc_prep.c      |    3 +-
 hw/ppce500_pci.c   |    6 +-
 hw/prep_pci.c      |    5 +-
 hw/prep_pci.h      |    3 +-
 hw/sh_pci.c        |    4 +-
 hw/sysbus.c        |   27 ++-
 hw/sysbus.h        |    3 +
 hw/unin_pci.c      |   10 +-
 hw/usb-ohci.c      |   42 ++--
 hw/versatile_pci.c |    2 +
 hw/vga-isa-mm.c    |   66 ++++--
 hw/vga-isa.c       |   13 +-
 hw/vga-pci.c       |   28 +--
 hw/vga.c           |  178 +++++---------
 hw/vga_int.h       |   24 +-
 hw/vmware_vga.c    |   94 +++++---
 memory.c           |  704 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 memory.h           |  202 +++++++++++++++
 38 files changed, 1525 insertions(+), 629 deletions(-)
 create mode 100644 exec-memory.h
 create mode 100644 memory.c
 create mode 100644 memory.h

-- 
1.7.5.3




reply via email to

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