Statistics
| Branch: | Revision:

root / memory.c @ c09015dd

History | View | Annotate | Download (48.4 kB)

# Date Author Comment
1470a0cd 01/08/2012 01:10 pm Andreas Färber

memory: Fix adjust_endianness()

Commit a621f38de85598a13d8d8524d1a94fc6a1818215 (Direct dispatch
through MemoryRegion) moved byte swaps to a central function.

Add a missing break, so that long-sized byte swaps don't abort.

Signed-off-by: Andreas Färber <>...

2c3579ab 01/08/2012 01:10 pm Andreas Färber

memory: Fix memory_region_wrong_endianness()

Since commit be675c972088eba210e18dc125613e9f205a6bfb (memory: move
endianness compensation to memory core) it was checking for
TARGET_BIG_ENDIAN instead of TARGET_WORDS_BIGENDIAN, thereby not
swapping correctly for Big Endian targets....

0e0df1e2 01/04/2012 01:34 pm Avi Kivity

Convert IO_MEM_{RAM,ROM,UNASSIGNED,NOTDIRTY} to MemoryRegions

Convert the fixed-address IO_MEM_RAM, IO_MEM_ROM, IO_MEM_UNASSIGNED,
and IO_MEM_NOTDIRTY io handlers to MemoryRegions. These aren't real
regions, since they are never added to the memory hierarchy, but they...

dd81124b 01/04/2012 01:34 pm Avi Kivity

Switch cpu_register_physical_memory_log() to use MemoryRegions

Still internally using ram_addr.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

a621f38d 01/04/2012 01:34 pm Avi Kivity

Direct dispatch through MemoryRegion

Now that all mmio goes through MemoryRegions, we can convert
io_mem_opaque to be a MemoryRegion pointer, and remove the thunks
that convert from old-style CPU{Read,Write}MemoryFunc to MemoryRegionOps.

Signed-off-by: Avi Kivity <>...

b3b00c78 01/04/2012 01:34 pm Avi Kivity

Remove IO_MEM_SUBPAGE

Replace with a MemoryRegion flag.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

75c578dc 01/04/2012 01:34 pm Avi Kivity

Drop IO_MEM_ROMD

Unlike ->readonly, ->readable is not inherited from aliase, so we can simply
query the memory region.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

8f77558f 01/04/2012 01:34 pm Avi Kivity

memory: obsolete cpu_physical_memory_[gs]et_dirty_tracking()

The getter is no longer used, so it is completely removed.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>

be675c97 01/04/2012 01:34 pm Avi Kivity

memory: move endianness compensation to memory core

Instead of doing device endianness compensation in cpu_register_io_memory(),
do it in the memory core.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

acbbec5d 01/04/2012 01:34 pm Avi Kivity

memory: move mmio access to functions

Currently mmio access goes directly to the io_mem_{read,write} arrays.
In preparation for eliminating them, add indirection via a function.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

26a83ad0 01/04/2012 01:34 pm Avi Kivity

memory: remove MemoryRegion::backend_registered

backend_registered was used to lazify the process of registering an
mmio region, since the it is different for the I/O address space and
the memory address space. However, it also makes registration dependent...

1d393fa2 01/04/2012 01:34 pm Avi Kivity

Avoid range comparisons on io index types

The code sometimes uses range comparisons on io indexes (e.g.
index =< IO_MEM_ROM). Avoid these as they make moving to objects harder.

Signed-off-by: Avi Kivity <>
Reviewed-by: Richard Henderson <>

c5705a77 01/04/2012 01:34 pm Avi Kivity

vmstate, memory: decouple vmstate from memory API

Currently creating a memory region automatically registers it for
live migration. This differs from other state (which is enumerated
in a VMStateDescription structure) and ties the live migration code
into the memory core....

8991c79b 01/04/2012 01:34 pm Avi Kivity

memory: introduce memory_region_name()

Trivial accessor for the name attribute.

Signed-off-by: Avi Kivity <>

dcd97e33 01/03/2012 07:19 pm Avi Kivity

memory: remove CPUPhysMemoryClient

No longer used.

Signed-off-by: Avi Kivity <>

e34911c4 12/20/2011 02:14 pm Avi Kivity

memory: temporarily add memory_region_get_ram_addr()

This is a layering violation, but needed while the code contains
naked calls to qemu_get_ram_ptr() and the like.

Signed-off-by: Avi Kivity <>

e2177955 12/20/2011 02:14 pm Avi Kivity

memory: introduce memory_region_find()

Given an address space (represented by the top-level memory region),
returns the memory region that maps a given range. Useful for implementing
DMA.

The implementation is a simplistic binary search. Once we have a tree...

86e775c6 12/20/2011 02:14 pm Avi Kivity

memory: replace cpu_physical_sync_dirty_bitmap() with a memory API

The function is still used as the implementation.

Signed-off-by: Avi Kivity <>

7664e80c 12/20/2011 02:14 pm Avi Kivity

memory: add API for observing updates to the physical memory map

Add an API that allows a client to observe changes in the global
memory map:
- region added (possibly with logging enabled)
- region removed (possibly with logging enabled)
- logging started on a region...

9f213ed9 12/20/2011 02:14 pm Avi Kivity

kvm: switch kvm slots to use host virtual address instead of ram_addr_t

This simplifies a later switch to the memory API in slot management.

Signed-off-by: Avi Kivity <>

8ea9252a 12/20/2011 02:14 pm Avi Kivity

memory: add memory_region_is_ram()

Signed-off-by: Avi Kivity <>

ce7923da 12/20/2011 02:14 pm Avi Kivity

memory: add memory_region_is_rom()

Signed-off-by: Avi Kivity <>

55043ba3 12/20/2011 02:14 pm Avi Kivity

memory: add memory_region_is_logging()

Signed-off-by: Avi Kivity <>

f76d27b6 12/19/2011 05:45 pm Anthony Liguori

Merge remote-tracking branch 'qemu-kvm/memory/exec-obsolete' into staging

4a1cc680 12/19/2011 05:45 pm Anthony Liguori

Merge remote-tracking branch 'qemu-kvm/memory/xen' into staging

67d95c15 12/19/2011 05:28 pm Avi Kivity

memory: move obsolete exec.c functions to a private header

This will help avoid accidental usage.

Signed-off-by: Avi Kivity <>

fce537d4 12/19/2011 05:23 pm Avi Kivity

memory, xen: pass MemoryRegion to xen_ram_alloc()

Currently xen_ram_alloc() relies on ram_addr, which is going away.
Give it something else to use as a cookie.

Signed-off-by: Avi Kivity <>

e87c099f 12/05/2011 12:04 pm Avi Kivity

memory: optimize empty transactions due to mutators

The mutating memory APIs can easily cause empty transactions,
where the mutators don't actually change anything, or perhaps
only modify disabled regions. Detect these conditions and
avoid regenerating the memory topology....

4703359e 12/05/2011 12:04 pm Avi Kivity

memory: introduce memory_region_set_alias_offset()

Add an API to update an alias offset of an active alias. This can be
used to simplify implementation of dynamic memory banks.

Signed-off-by: Avi Kivity <>

2282e1af 12/04/2011 07:19 pm Avi Kivity

memory: introduce memory_region_set_address()

Allow changing the address of a memory region while it is
in the memory hierarchy.

Signed-off-by: Avi Kivity <>

6bba19ba 12/04/2011 07:00 pm Avi Kivity

memory: introduce memory_region_set_enabled()

This allows users to disable a memory region without removing
it from the hierarchy, simplifying the implementation of
memory routers.

Signed-off-by: Avi Kivity <>

897fa7cf 11/24/2011 06:32 pm Avi Kivity

memory: add MemoryRegionOps::valid.accepts

MemoryRegionOps::valid tries to declaratively specify which transactions
are accepted by the device/bus, however it is not completely generic. Add
a callback for special cases.

Signed-off-by: Avi Kivity <>

88365e47 11/13/2011 12:00 pm Avi Kivity

memory: fix 'info mtree' segfaults

'info mtree' accesses invalid memory in two cases, both due to incorrect
(and unsafe) usage of QTAILQ_FOREACH_SAFE().

Reported-by: Andreas Färber <>
Signed-off-by: Avi Kivity <>

08dafab4 10/16/2011 02:19 pm Avi Kivity

memory: use 128-bit integers for sizes and intermediates

Since the memory API supports 64-bit buses, it needs a larger type to represent
intermediate results.

Signed-off-by: Avi Kivity <>

03808f58 10/11/2011 04:57 pm Jan Kiszka

memory: Fix old portio word accesses

As we register old portio regions via ioport_register, we are also
responsible for providing the word access wrapper.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

6bf9fd43 10/11/2011 04:57 pm Avi Kivity

Introduce PortioList

Add a type and methods for manipulating a list of disjoint I/O ports,
used in some older hardware devices.

Based on original patch by Richard Henderson.

Signed-off-by: Richard Henderson <>
Signed-off-by: Avi Kivity <>

4b474ba7 10/02/2011 05:27 pm Jan Kiszka

memory: Print region priority

Useful to discover eclipses.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

06631810 10/02/2011 05:27 pm Jan Kiszka

memory: Do not print empty PIO root

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

9479c57a 10/02/2011 05:27 pm Jan Kiszka

memory: Print regions in ascending order

Makes reading the output more user friendly.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

314e2987 10/02/2011 05:27 pm Blue Swirl

memory: simple memory tree printer

Add a monitor command 'info mtree' to show the memory hierarchy
much like /proc/iomem in Linux.

Signed-off-by: Blue Swirl <>
Signed-off-by: Avi Kivity <>

fb1cd6f9 09/25/2011 02:48 pm Avi Kivity

memory: implement memory_region_set_readonly()

The property is inheritable, but only if set to true. This is so
that memory routers can mark sections of RAM as read-only via aliases.

Signed-off-by: Avi Kivity <>

860329b2 09/18/2011 02:55 pm Michael Walle

memory: fix subregion collision warning

Instead of the offset property use the proper addr property to calculate
the offsets.

Additionally, be a little more verbose on the warning and print the
subregion name.

Signed-off-by: Michael Walle <>...

d2963631 09/14/2011 11:21 am David Gibson

Fix subtle integer overflow bug in memory API

It is quite common to have a MemoryRegion with size of INT64_MAX.
When processing alias regions in render_memory_region() it's quite
easy to find a case where it will construct a temporary AddrRange with
a non-zero start, and size still of INT64_MAX. When means attempting...

021d26d1 08/30/2011 11:20 am Jan Kiszka

memory: Fix memory_region_get_ram_ptr for ROM devices

Mask out the sub-page bits that are used by ROM device for storing the
io-index and the IO_MEM_ROMD flag.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

b5fe14cc 08/29/2011 11:52 am Avi Kivity

memory: fix rom_device I/O mode

When adding a rom_device in I/O mode, we incorrectly masked off the low
bits, resulting in a pure RAM map. Fix my masking off the high bits and
IO_MEM_ROMD, yielding a pure I/O map.

Signed-off-by: Avi Kivity <>

75f5941c 08/26/2011 12:35 am Avi Kivity

memory: add opaque parameter to memory_region_init_rom_device()

The MemoryRegionOps callbacks expect it.

Signed-off-by: Avi Kivity <>

7bc2b9cd 08/25/2011 02:56 pm Avi Kivity

memory: fix memory_region_init_rom_device() not initializing ->ops

Signed-off-by: Avi Kivity <>

563ea489 08/22/2011 07:29 pm Richard Henderson

memory: Fix old_portio vs non-zero offset

The legacy functions that we're wrapping expect that offset
to be included in the register. Indeed, they generally
expect the absolute address and then mask off the "high" bits.

The FDC is the first converted device with a non-zero offset....

a5e1cbc8 08/22/2011 07:14 pm Anthony Liguori

memory: temporarily suppress the subregion collision warning

After 312b4234, the APIC and PCI devices are colliding with each other. This
is harmless in practice because the APIC accesses are special cased and never
make there way onto the bus.

Avi is working on a proper fix, but until that's ready, avoid printing the...

164a4dcd 08/22/2011 02:27 am Avi Kivity

memory: abstract cracking of write access ops into a function

The memory API automatically cracks large reads and writes into smaller
ones when needed. Factor out this mechanism, which is now duplicated between
memory reads and memory writes, into a function....

3a130f4e 08/22/2011 02:27 am Avi Kivity

memory: crack wide ioport accesses into smaller ones when needed

The memory API supports cracking wide accesses into narrower ones
when needed; but this was no implemented for the pio address space,
causing lsi53c895a's IO BAR to malfunction.

Fix by correctly cracking wide accesses when needed....

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

d0a9b5bc 08/12/2011 04:31 pm Avi Kivity

memory: add API for creating ROM/device regions

ROM/device regions act as mapped RAM for reads, can I/O memory for
writes. This allow emulation of flash devices.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

545e92e0 08/12/2011 04:31 pm Avi Kivity

memory: reclaim resources when a memory region is destroyed for good

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

39b796f2 08/05/2011 06:57 pm Avi Kivity

memory: synchronize dirty bitmap before unmapping a range

When a range is being unmapped, ask accelerators (e.g. kvm) to synchronize the
dirty bitmap to avoid losing information forever.

Fixes grub2 screen update.

Signed-off-by: Avi Kivity <>...

8417cebf 08/05/2011 06:57 pm Avi Kivity

memory: use signed arithmetic

When trying to map an alias of a ram region, where the alias starts at
address A and we map it into address B, and A > B, we had an arithmetic
underflow. Because we use unsigned arithmetic, the underflow converted
into a large number which failed addrrange_intersects() tests....

14a3c10a 07/29/2011 04:25 pm Avi Kivity

memory: rename MemoryRegion::has_ram_addr to ::terminates

I/O regions will not have ram_addrs, so this is a better name.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

16ef61c9 07/29/2011 04:25 pm Avi Kivity

memory: late initialization of ram_addr

For non-RAM memory regions, we cannot tell whether this is an I/O region
or an MMIO region. Since the qemu backing registration is different for
the two, we have to defer initialization until we know which address...

658b2224 07/29/2011 04:25 pm Avi Kivity

memory: I/O address space support

Allow registering I/O ports via the same mechanism as mmio ranges.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

627a0e90 07/29/2011 04:25 pm Avi Kivity

memory: add backward compatibility for old portio registration

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

74901c3b 07/29/2011 04:25 pm Avi Kivity

memory: add backward compatibility for old mmio registration

This eases the transition to the new API.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

3e9d69e7 07/29/2011 04:25 pm Avi Kivity

memory: add ioeventfd support

As with the rest of the memory API, the caller associates an eventfd
with an address, and the memory API takes care of registering or
unregistering when the address is made visible or invisible to the
guest.

Signed-off-by: Avi Kivity <>...

b8af1afb 07/29/2011 04:25 pm Avi Kivity

memory: separate building the final memory map into two steps

Instead of adding and deleting regions in one pass, do a delete
pass followed by an add pass. This fixes the following case:

from:
0x0000-0x0fff ram (a1)
0x1000-0x1fff mmio (a2)
0x2000-0x2fff ram (a3)...

4ef4db86 07/29/2011 04:25 pm Avi Kivity

memory: transaction API

Allow changes to the memory hierarchy to be accumulated and
made visible all at once. This reduces computational effort,
especially when an accelerator (e.g. kvm) is involved.

Useful when a single register update causes multiple changes...

093bc2cd 07/29/2011 04:25 pm Avi Kivity

Hierarchical memory region API

The memory API separates the attributes of a memory region (its size, how
reads or writes are handled, dirty logging, and coalescing) from where it
is mapped and whether it is enabled. This allows a device to configure
a memory region once, then hand it off to its parent bus to map it according...

5a583347 07/29/2011 04:25 pm Avi Kivity

memory: implement dirty tracking

Currently dirty tracking is implemented by passing through
all calls to the underlying cpu_physical_memory_*() calls.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

3d8e6bf9 07/29/2011 04:25 pm Avi Kivity

memory: merge adjacent segments of a single memory region

Simple implementations of memory routers, for example the Cirrus VGA memory banks
or the 440FX PAM registers can generate adjacent memory regions which are contiguous.
Detect these and merge them; this saves kvm memory slots and shortens lookup times....

1c0ffa58 07/29/2011 04:25 pm Avi Kivity

Internal interfaces for memory API

get_system_memory() provides the root of the memory hierarchy.

This interface is intended to be private between memory.c and exec.c.
If this file is included elsewhere, it should be regarded as a bug (or
TODO item). However, it will be temporarily needed for the conversion...

cc31e6e7 07/29/2011 04:25 pm Avi Kivity

memory: abstract address space operations

Prepare for multiple address space support by abstracting away the details
of registering a memory range with qemu's flat representation into an
AddressSpace object.

Note operations which are memory specific are not abstracted, since they will...