summaryrefslogtreecommitdiffstats
path: root/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove qemu_host_page_bitsStefan Weil2011-09-211-4/+0
| | | | | | | | It was introduced with commit 54936004fddc52c321cb3f9a9a51140e782bed5d as host_page_bits but never used. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-24/+24
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix QLIST usage for RAM listPaolo Bonzini2011-08-121-1/+1
| | | | | | | Spotted while reviewing the migration thread patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Integrate I/O memory regions into qemuAvi Kivity2011-08-081-0/+10
| | | | | | | | get_system_io() returns the root I/O memory region. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use mmap to allocate execute memoryTobias Nygren2011-08-071-1/+2
| | | | | | | Use mmap to allocate executable memory on NetBSD as well. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Avoid allocating TCG resources in non-TCG modeJan Kiszka2011-08-051-5/+14
| | | | | | | | | Do not allocate TCG-only resources like the translation buffer when running over KVM or XEN. Saves a "few" bytes in the qemu address space and is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* memory: use signed arithmeticAvi Kivity2011-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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. The concrete example which triggered this was cirrus vga mapping the framebuffer at offsets 0xc0000-0xc7fff (relative to the start of the framebuffer) into offsets 0xa0000 (relative to system addres space start). With our favorite analogy of a windowing system, this is equivalent to dragging a subwindow off the left edge of the screen, and failing to clip it into its parent window which is on screen. Fix by switching to signed arithmetic. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'agraf/xen-next' into stagingAnthony Liguori2011-07-291-6/+7
|\
| * cpu-common: Have a ram_addr_t of uint64 with Xen.Anthony PERARD2011-07-261-4/+5
| | | | | | | | | | | | | | | | In Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
| * exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).Anthony PERARD2011-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | As the variable pd and addr1 inside the function cpu_physical_memory_rw are mean to handle a RAM address, they should be of the ram_addr_t type instead of unsigned long. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | exec.c: initialize memory mapAvi Kivity2011-07-291-0/+19
|/ | | | | | | Allocate the root memory region and initialize it. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix unassigned memory access handlingBlue Swirl2011-07-201-6/+6
| | | | | | | | cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memory access handling. Fix them by always passing CPUState to the handlers. Reported-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu_ram_ptr_length: take ram_addr_t as argumentsStefano Stabellini2011-07-171-7/+14
| | | | | | | | | | | | | | | | | | | | | | qemu_ram_ptr_length should take ram_addr_t as argument rather than target_phys_addr_t because is doing comparisons with RAMBlock addresses. cpu_physical_memory_map should create a ram_addr_t address to pass to qemu_ram_ptr_length from PhysPageDesc phys_offset. Remove code after abort() in qemu_ram_ptr_length. Changes in v2: - handle 0 size in qemu_ram_ptr_length; - rename addr1 to raddr; - initialize raddr to ULONG_MAX. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
* xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XENJan Kiszka2011-07-171-8/+8
| | | | | | | | | Xen won't be enabled if there is no backend support available for the host. And that also means the map cache will work. So drop the separate config switch and move the required stubs over to xen-stub.c. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* xen: Clean up map cache API namingJan Kiszka2011-07-171-8/+10
| | | | | | | The map cache is a Xen thing, so its API should make this clear. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* exec.c: Fix calculation of code_gen_buffer_max_sizePeter Maydell2011-07-121-2/+2
| | | | | | | | | | | | When calculating the point at which we should not try to put another TB into the code gen buffer, we have to allow not just for OPC_MAX_SIZE but OPC_BUF_SIZE. This is because the target translate.c will only stop when an instruction has put it past the OPC_MAX_SIZE limit, so we have to include the MAX_OP_PER_INSTR margin which that final insn might have used. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* exec: add endian specific phys ld/st functionsAlexander Graf2011-07-121-10/+191
| | | | | | | | | | | | | | | | Device code some times needs to access physical memory and does that through the ld./st._phys functions. However, these are the exact same functions that the CPU uses to access memory, which means they will be endianness swapped depending on the target CPU. However, devices don't know about the CPU's endianness, but instead access memory directly using their own interface to the memory bus, so they need some way to read data with their native endianness. This patch adds _le and _be functions to ld./st._phys. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori2011-06-271-3/+7
|\
| * exec: last_first_tb was only used in !ONLY_USER caseJuan Quintela2011-06-241-3/+7
| | | | | | | | | | | | | | | | Once there, use a better variable name. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | Remove exec-all.h include directivesBlue Swirl2011-06-261-1/+0
|/ | | | | | Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote-tracking branch 'mst/for_anthony' into stagingAnthony Liguori2011-06-221-6/+33
|\ | | | | | | | | Conflicts: hw/usb-uhci.c
| * Merge remote-tracking branch 'origin/master' into pciMichael S. Tsirkin2011-06-151-18/+110
| |\ | | | | | | | | | | | | Conflicts: hw/virtio-pci.c
| * | CPUPhysMemoryClient: batch addresses in catchupAlex Williamson2011-06-121-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a phys memory client registers and we play catchup by walking the page tables, we can make a huge improvement in the number of times the set_memory callback is called by batching contiguous pages together. With a 4G guest, this reduces the number of callbacks at registration from 1048866 to 296. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | | xen: mapcache performance improvementsStefano Stabellini2011-06-191-18/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use qemu_invalidate_entry in cpu_physical_memory_unmap. Do not lock mapcache entries in qemu_get_ram_ptr if the address falls in the ramblock with offset == 0. We don't need to do that because the callers of qemu_get_ram_ptr either try to map an entire block, other from the main ramblock, or until the end of a page to implement a single read or write in the main ramblock. If we don't lock mapcache entries in qemu_get_ram_ptr we don't need to call qemu_invalidate_entry in qemu_put_ram_ptr anymore because we can leave with few long lived block mappings requested by devices. Also move the call to qemu_ram_addr_from_mapcache at the beginning of qemu_ram_addr_from_host. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | | exec.c: refactor cpu_physical_memory_mapStefano Stabellini2011-06-191-17/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce qemu_ram_ptr_length that takes an address and a size as parameters rather than just an address. Refactor cpu_physical_memory_map so that we call qemu_ram_ptr_length only once rather than calling qemu_get_ram_ptr one time per page. This is not only more efficient but also tries to simplify the logic of the function. Currently we are relying on the fact that all the pages are mapped contiguously in qemu's address space: we have a check to make sure that the virtual address returned by qemu_get_ram_ptr from the second call on is consecutive. Now we are making this more explicit replacing all the calls to qemu_get_ram_ptr with a single call to qemu_ram_ptr_length passing a size argument. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> CC: agraf@suse.de CC: anthony@codemonkey.ws Signed-off-by: Alexander Graf <agraf@suse.de>
* | | xen: remove xen_map_block and xen_unmap_blockStefano Stabellini2011-06-191-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace xen_map_block with qemu_map_cache with the appropriate locking and size parameters. Replace xen_unmap_block with qemu_invalidate_entry. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | | xen: remove qemu_map_cache_unlockStefano Stabellini2011-06-191-1/+1
| |/ |/| | | | | | | | | | | | | There is no need for qemu_map_cache_unlock, just use qemu_invalidate_entry instead. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | Merge remote branch 'rth/axp-next' into alpha-mergeEdgar E. Iglesias2011-06-101-6/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rth/axp-next: (26 commits) target-alpha: Implement TLB flush primitives. target-alpha: Use a fixed frequency for the RPCC in system mode. target-alpha: Trap for unassigned and unaligned addresses. target-alpha: Remap PIO space for 43-bit KSEG for EV6. target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode. target-alpha: Implement more CALL_PAL values inline. target-alpha: Disable interrupts properly. target-alpha: All ISA checks to use TB->FLAGS. target-alpha: Swap shadow registers moving to/from PALmode. target-alpha: Implement do_interrupt for system mode. target-alpha: Add IPRs to be used by the emulation PALcode. target-alpha: Use kernel mmu_idx for pal_mode. target-alpha: Add various symbolic constants. target-alpha: Use do_restore_state for arithmetic exceptions. target-alpha: Tidy up arithmetic exceptions. target-alpha: Tidy exception constants. target-alpha: Enable the alpha-softmmu target. target-alpha: Rationalize internal processor registers. target-alpha: Merge HW_REI and HW_RET implementations. target-alpha: Cleanup MMU modes. ...
| * | target-alpha: Trap for unassigned and unaligned addresses.Richard Henderson2011-05-311-6/+6
| | | | | | | | | | | | Signed-off-by: Richard Henderson <rth@twiddle.net>
* | | Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond2011-06-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | | exec: Implement qemu_ram_free_from_ptr()Alex Williamson2011-06-031-0/+13
|/ / | | | | | | | | | | | | | | | | Required for regions mapped via qemu_ram_alloc_from_ptr(). VFIO and ivshmem will make use of this to remove mappings when devices are hot unplugged. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* | Merge branch 'trivial-patches' of git://repo.or.cz/qemu/stefanhaAurelien Jarno2011-05-231-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://repo.or.cz/qemu/stefanha: Fix typos in comments (chek -> check) hw/sd.c: Don't complain about SDIO commands CMD52/CMD53 hw/realview.c: Remove duplicate #include line piix_pci: fix piix3_set_irq_pic()
| * | Fix typos in comments (chek -> check)Stefan Weil2011-05-221-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | | s390x: complain when allocating ram failsAlexander Graf2011-05-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying out the > 64GB guest RAM patch, I hit some virtual address limitations of my host system, which resulted in mmap failing. Unfortunately, qemu didn't tell me about this failure, but just used the NULL pointer happily, resulting in either segmentation faults or other fun errors. To spare other users from tracing this down, let's print a nice message instead so the user can figure out what's wrong from there. Signed-off-by: Alexander Graf <agraf@suse.de>
* | | s390x: change mapping base to allow guests > 2GBChristian Borntraeger2011-05-201-3/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | the current s390x qemu memory layout is 0x1000000: guest start 0x80000000: qemu binary which limits the amount of available memory to <2GB. This patch moves the guest pages to 32GB to not collide with the binary and to leave some space for the program break of qemu. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | Introduce qemu_put_ram_ptrAnthony PERARD2011-05-081-3/+35
| | | | | | | | | | | | | | | | | | | | This function allows to unlock a ram_ptr give by qemu_get_ram_ptr. After a call to qemu_put_ram_ptr, the pointer may be unmap from QEMU when used with Xen. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* | xen: Introduce the Xen mapcacheJun Nakajima2011-05-081-4/+44
|/ | | | | | | | | | | | | | | | | | | | | On IA32 host or IA32 PAE host, at present, generally, we can't create an HVM guest with more than 2G memory, because generally it's almost impossible for Qemu to find a large enough and consecutive virtual address space to map an HVM guest's whole physical address space. The attached patch fixes this issue using dynamic mapping based on little blocks of memory. Each call to qemu_get_ram_ptr makes a call to qemu_map_cache with the lock option, so mapcache will not unmap these ram_ptr. Blocks that do not belong to the RAM, but usually to a device ROM or to a framebuffer, are handled in a separate function. So the whole RAMBlock can be map. Signed-off-by: Jun Nakajima <jun.nakajima@intel.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* Merge remote branch 'origin/master' into pciMichael S. Tsirkin2011-05-051-14/+25
|\ | | | | | | | | Conflicts: exec.c
| * Redirect cpu_interrupt to callback handlerJan Kiszka2011-05-021-1/+3
| | | | | | | | | | | | | | | | This allows to override the interrupt handling of QEMU in system mode. KVM will make use of it to set a specialized handler. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * Break up user and system cpu_interrupt implementationsJan Kiszka2011-05-021-4/+10
| | | | | | | | | | | | | | | | | | Both have only two lines in common, and we will convert the system service into a callback which is of no use for user mode operation. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| * Remove unused function parameter from cpu_restore_stateStefan Weil2011-04-201-5/+4
| | | | | | | | | | | | | | | | | | The previous patch removed the need for parameter puc. Is is now unused, so remove it. Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
| * Replace cpu_physical_memory_rw were possibleStefan Weil2011-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Using cpu_physical_memory_read, cpu_physical_memory_write and ldub_phys improves readability and allows removing some type casts. lduw_phys and ldl_phys were not used because both require aligned addresses. Therefore it is not possible to simply replace existing calls by one of these functions. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
| * exec: Remove a type cast which is no longer neededStefan Weil2011-04-121-1/+1
| | | | | | | | | | | | | | | | | | All other type casts in calls of cpu_physical_memory_write are used by hardware emulations and will be fixed by separate patches. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
| * exec: Handle registrations of the entire address spaceEdgar E. Iglesias2011-04-071-2/+6
| | | | | | | | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* | CPUPhysMemoryClient: Pass guest physical address not region offsetAlex Williamson2011-05-051-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we're trying to get a newly registered phys memory client updated with the current page mappings, we end up passing the region offset (a ram_addr_t) as the start address rather than the actual guest physical memory address (target_phys_addr_t). If your guest has less than 3.5G of memory, these are coincidentally the same thing. If there's more, the region offset for the memory above 4G starts over at 0, so the set_memory client will overwrite it's lower memory entries. Instead, keep track of the guest phsyical address as we're walking the tables and pass that to the set_memory client. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | CPUPhysMemoryClient: Fix typo in phys memory client registrationAlex Williamson2011-05-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | When we register a physical memory client, we try to walk the page tables, calling the set_memory hook for every entry. Effectively playing catchup for the client for everything already registered. With this type, we only walk the 2nd entry of the l1 table, typically missing all of the registered memory. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | cpu: add set_memory flag to request dirty loggingMichael S. Tsirkin2011-04-061-6/+8
|/ | | | | | | | Pass the flag to all cpu notifiers, doing nothing at this point. Will be used by follow-up patches. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Expose thread_id in info cpusJan Kiszka2011-03-161-0/+3
| | | | | | | | | | | Based on patch by Glauber Costa: To allow management applications like libvirt to apply CPU affinities to the VCPU threads, expose their ID via info cpus. This patch provides the pre-existing and used interface from qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* s390: Detect invalid invocations of qemu_ram_free/remapJan Kiszka2011-03-151-0/+4
| | | | | | | | | | This both detects invalid invocations of qemu_ram_free and qemu_ram_remap when mem_path is non-NULL and fixes a build error on s390 ("'area' may be used uninitialized in this function"). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Alexander Graf <agraf@suse.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Add qemu_ram_remapHuang Ying2011-03-151-1/+62
| | | | | | | | | | | | | qemu_ram_remap() unmaps the specified RAM pages, then re-maps these pages again. This is used by KVM HWPoison support to clear HWPoisoned page tables across guest rebooting, so that a new page may be allocated later to recover the memory error. [ Jan: style fixlets, WIN32 fix ] Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
OpenPOWER on IntegriCloud