summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-07-04hw/p*: pass owner to memory_region_init* functionsPaolo Bonzini21-86/+91
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/n*: pass owner to memory_region_init* functionsPaolo Bonzini20-39/+48
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/m*: pass owner to memory_region_init* functionsPaolo Bonzini22-53/+58
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/i*: pass owner to memory_region_init* functionsPaolo Bonzini41-87/+111
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/gpio: pass owner to memory_region_init* functionsPaolo Bonzini4-6/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/d*: pass owner to memory_region_init* functionsPaolo Bonzini15-27/+34
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/c*: pass owner to memory_region_init* functionsPaolo Bonzini19-29/+36
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/block: pass owner to memory_region_init* functionsPaolo Bonzini5-13/+17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04hw/a*: pass owner to memory_region_init* functionsPaolo Bonzini24-68/+88
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04piolist: add owner argument to initialization functions and pass devicesPaolo Bonzini10-12/+17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04pam: pass device to init_pam and use it to set ownerPaolo Bonzini4-13/+15
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04spapr_iommu: pass device to spapr_tce_new_table and use it to set ownerPaolo Bonzini4-5/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vfio: pass device to vfio_mmap_bar and use it to set ownerPaolo Bonzini1-5/+6
Cc: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04ne2000: pass device to ne2000_setup_io, use it as ownerPaolo Bonzini3-5/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: set owner in vga_update_memory_accessPaolo Bonzini1-1/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: pass owner to vga_init_ioPaolo Bonzini3-5/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: pass owner to vga_init_vbePaolo Bonzini6-7/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: pass owner to cirrus_init_commonPaolo Bonzini1-10/+12
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: pass owner to vga_common_initPaolo Bonzini8-10/+10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vga: pass owner to vga_initPaolo Bonzini5-5/+7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04escc: rename struct to ESCCStatePaolo Bonzini1-17/+17
We are using the same struct name for two devices. 8250 is widespread enough that this causes some confusion, rename the other instance. Reviewed-by: Andreas Faerber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: ref/unref memory across address_space_map/unmapPaolo Bonzini1-3/+12
The iothread mutex might be released between map and unmap, so the mapped region might disappear. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04exec: reorganize address_space_mapPaolo Bonzini1-33/+38
First of all, rename "todo" to "done". Second, clearly separate the case of done == 0 with the case of done != 0. This will help handling reference counting in the next patch. Third, this test: if (memory_region_get_ram_addr(mr) + xlat != raddr + todo) { does not guarantee that the memory region is the same across two iterations of the while loop. For example, you could have two blocks: A) size 640 K, mapped at physical address 0, ram_addr_t 0 B) size 64 K, mapped at physical address 0xa0000, ram_addr_t 0xa0000 then mapping 1 M starting at physical address zero will erroneously treat B as the continuation of block A. qemu_ram_ptr_length ensures that no invalid memory is accessed, but it is still a pointless complication of the algorithm. The patch makes the logic clearer with an explicit test that the memory region is the same. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: return MemoryRegion from qemu_ram_addr_from_hostPaolo Bonzini4-19/+26
It will be needed in the next patch. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04exec: move qemu_ram_addr_from_host_nofail to cputlb.cPaolo Bonzini3-15/+16
After the next patch it would not be used elsewhere anyway. Also, the _nofail and the standard versions of this function return different things, which is confusing. Removing the function from the public headers limits the confusion. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04exec: check MRU in qemu_ram_addr_from_hostPaolo Bonzini1-2/+10
This function is not used outside the iothread mutex, so it can use ram_list.mru_block. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: add ref/unref callsPaolo Bonzini16-5/+63
Add ref/unref calls at the following places: - places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM). - memory_region_find callsites - creation of aliases and containers (only the aliased/contained region gets a reference to avoid loops) - around calls to del_subregion/add_subregion, where the region could disappear after the first call Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: introduce memory_region_presentPaolo Bonzini4-7/+28
This new API will avoid having too many memory_region_ref/unref in paths that currently use memory_region_find. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: add ref/unrefPaolo Bonzini2-0/+44
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: add getter for ownerPaolo Bonzini2-0/+13
Whenever memory regions are accessed outside the BQL, they need to be preserved against hot-unplug. MemoryRegions actually do not have their own reference count; they piggyback on a QOM object, their "owner". The owner is set at creation time, and there is a function to retrieve the owner. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04exec: simplify destruction of the phys mapPaolo Bonzini1-33/+1
Do not bother visiting the radix tree when an address space is destroyed. After the previous patch, this has become a pointless exercise. When called from address_space_destroy_dispatch, all you're doing is zeroing out a structure that will be freed as soon as you come back. When called from mem_begin, when phys_page_set_level will call phys_map_node_alloc the radix tree's array will be zeroed too. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: destroy phys_sections one by onePaolo Bonzini1-14/+13
phys_sections_clear is invoked after the dispatch tree has been destroyed. This leaves a window where phys_sections_nb > 0 but the subpages are not valid anymore, which is a recipe for use-after-free bugs. Move the destruction of subpages in phys_sections_clear. We will still destroy the subpages when an address space is cleaned up, because address_space_destroy will clear as->root and commit the change before it calls address_space_destroy_dispatch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: add owner argument to initialization functionsPaolo Bonzini319-759/+787
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04ioport: Move portio types to ioport.hJan Kiszka2-19/+11
This decouples memory.h from ioport.h, concentrating all portio related types in a single header. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vmport: Disentangle read handler type from portioJan Kiszka2-4/+6
In case the latter may vanish one day, make sure the vmport read handler type will remain unaffected. This is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04ioport: Remove unused old dispatching servicesJan Kiszka4-283/+0
Remove unused ioport_register and isa_unassign_ioport along with everything that only those services used. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04ioport: Switch dispatching to memory core layerJan Kiszka6-159/+102
The current ioport dispatcher is a complex beast, mostly due to the need to deal with old portio interface users. But we can overcome it without converting all portio users by embedding the required base address of a MemoryRegionPortio access into that data structure. That removes the need to have the additional MemoryRegionIORange structure in the loop on every access. To handle old portio memory ops, we simply install dispatching handlers for portio memory regions when registering them with the memory core. This removes the need for the old_portio field. We can drop the additional aliasing of ioport regions and also the special address space listener. cpu_in and cpu_out now simply call address_space_read/write. And we can concentrate portio handling in a single source file. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04xen: Mark fixed platform I/O as unalignedJan Kiszka1-0/+4
Before switching to the memory core dispatcher, we need to make sure that this pv-device will continue to receive unaligned portio accesses. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vmware-vga: Accept unaligned I/O accessesJan Kiszka1-0/+4
Before switching to the memory core dispatcher, we need to make sure that this pv-device will continue to receive unaligned portio accesses. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04isa: implement isa_is_ioport_assigned via memory_region_findJan Kiszka4-16/+10
Open-code isa_is_ioport_assigned via a memory region lookup. As all IO ports are now directly or indirectly registered via the memory API, this becomes possible and will finally allow us to drop the ioport tables. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04Privatize register_ioport_read/writeJan Kiszka2-8/+4
No more users outside of ioport.c. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04vt82c686: replace register_ioport*Jan Kiszka1-14/+26
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04prep: replace register_ioport*Jan Kiszka1-8/+15
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04i82374: replace register_ioport*Jan Kiszka1-5/+13
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04wdt_ib700: replace register_ioport*Jan Kiszka1-2/+10
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04applesmc: replace register_ioport*Jan Kiszka1-12/+38
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04adlib: replace register_ioport*Jan Kiszka1-8/+12
Convert over to memory regions to obsolete register_ioport*. CC: malc <av1474@comtv.ru> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04dma: keep a device alive while it has SGListsPaolo Bonzini7-12/+25
Reviewed-by: Anthony Liguori <aliguori@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04scsi: keep device alive while it has requestsPaolo Bonzini1-2/+10
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-02int128: optimize and add test casesPaolo Bonzini3-9/+234
For add, the carry only requires checking one of the arguments. For sub and neg, we can similarly optimize computation of the carry. For ge, we can just do lexicographic order. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>