cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user
The functions cpu_clone_regs() and cpu_set_tls() are not purely CPUrelated -- they are specific to the TLS ABI for a a particular OS.Move them into the linux-user/ tree where they belong....
cpu: Drop unnecessary dynamic casts in *_env_get_cpu()
A transition from CPUFooState to FooCPU can be considered safe,just like FooCPU::env access in the opposite direction.The only benefit of the FOO_CPU() casts would be protection againstbogus CPUFooState pointers, but then surrounding code would likely...
kvm: Free current_cpu identifier
Since CPU loops are done as last step in kvm_{insert,remove}_breakpoint()and kvm_remove_all_breakpoints(), we do not need to distinguish betweeninvoking CPU and iterated CPUs and can thereby free the identifier foruse as a global variable....
cpu: Replace cpu_single_env with CPUState current_cpu
Move it to qom/cpu.h.
Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm: Change kvm_remove_all_breakpoints() argument to CPUState
Acked-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
linux-user: Clean up do_syscall() Coding Style for TARGET_NR_exit
In particular fix 6-/10-char indentation.
Revert "gdbstub: Simplify find_cpu()"
This reverts commit c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3, whichreplaced cpu_index() with cpu_index field, leading to deviation fromthread ID for NTPL and off-by-one otherwise.
Reported-by: Max Filippov <jcmvbkbc@gmail.com>...
target-openrisc: Fix typename in openrisc_cpu_class_by_name()
Commit 478032a93d908e59085c1ac56f10979942e7dc4f (target-openrisc:Rename CPU subtypes) suffixed CPU sub-types with "-or32-cpu" but forgotto update openrisc_cpu_class_by_name(), so that it was still looking for...
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci,misc enhancements
This includes some pci enhancements:
Better support for systems with multiple PCI root busesFW cfg interface for more robust pci programming in BIOSMinor fixes/cleanups for fw cfg and cross-version migration -...
pci: Use helper to find device's root bus in pci_find_domain()
Currently pci_find_domain() performs two functions - it locates the PCIroot bus above the given bus, then looks up that root bus's domain number.This patch adds a helper function to perform the first task, finding the...
pci: Replace pci_find_domain() with more general pci_root_bus_path()
pci_find_domain() is used in a number of places where we want an id for awhole PCI domain (i.e. the subtree under a PCI root bus). The trouble isthat many platforms may support multiple independent host bridges with no...
pci: Add root bus argument to pci_get_bus_devfn()
pci_get_bus_devfn() interprets a full PCI address string to give a PCIBus *and device/function number within that bus. Currently it assumes it isworking on an address under the primary PCI root bus. This patch extends...
pci: Add root bus parameter to pci_nic_init()
At present, pci_nic_init() and pci_nic_init_nofail() assume that they willonly create a NIC under the primary PCI root. As we add support formultiple PCI roots, that may no longer be the case. This patch adds a root...
pci: Simpler implementation of primary PCI bus
Currently pci_find_primary_bus() searches the list of root buses for onewith domain 0. But since host buses are always registered with domain 0,this just amounts to finding the only PCI host bus. The only remaining...
pci: Remove domain from PCIHostBus
There are now no users of the domain field of PCIHostBus, so remove itfrom the structure, and as a parameter from the pci_host_bus_register()function which sets it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
pci: Fold host_buses list into PCIHostState functionality
The host_buses list is an odd structure - a list of pointers to PCI rootbuses existing in parallel to the normal qdev tree structure. This patchremoves it, instead putting the link pointers into the PCIHostState...
pci: Abolish pci_find_root_bus()
pci_find_root_bus() takes a domain parameter. Currently PCI root buseswith domain other than 0 can't be created, so this is more or less a longwinded way of retrieving the main PCI root bus. Numbered domains don'tactually properly cover the (non x86) possibilities for multiple PCI root...
MAINTAINERS: Add myself into MAINTAINERS file
Add myself into MAINTAINERS file, I'll looking at target-openriscand hw/openrisc.
Signed-off-by: Jia Liu <proljc@gmail.com>Message-id: 1372769717-852-1-git-send-email-proljc@gmail.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
MAINTAINERS: fix bad F: patterns
This patch fixes a number of incorrect F: patterns which didn'tmatch any files in the source tree. This was caused by a mixof minor typos (- for _ and the like) and a few entries whichhadn't been correctly updated following the rearrangement of hw/....
Merge remote-tracking branch 'stefanha/block' into staging
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
block: fix bdrv_flush() ordering in bdrv_close()
Since 80ccf93b we flush the block device during close. Thebdrv_drain_all() call should come before bdrv_flush() to ensure guestwrite requests have completed. Otherwise we may miss pending writeswhen flushing....
vmdk: Implement .bdrv_has_zero_init
Depending on the subformat, has_zero_init queries underlying storage forflat extent. If it has a flat extent and its underlying storage doesn'thave zero init, return 0. Otherwise return 1.
Aligns the operator assignments....
curl: refuse to open URL from HTTP server without range support
CURL driver requests partial data from server on guest IO req. For HTTPand HTTPS, it uses "Range: ***" in requests, and this will not work ifserver not accepting range. This patch does this check when open....
exec: remove cur_map
cur_map is not used anymore; instead, each AddressSpaceDispatchhas its own nodes/sections pair. The priorities of theMemoryListeners, and in the future RCU, guarantee that thenodes/sections are not freed while they are still in use....
exec: change some APIs to take AddressSpaceDispatch
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
add a header file for atomic operations
We're already using them in several places, but __sync builtins are justtoo ugly to type, and do not provide seqcst load/store operations.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: access FlatView from a local variable
We will soon require accesses to as->current_map to be placed undera lock (with reference counting so as to keep the critical sectionsmall). To simplify this change, always fetch as->current_map intoa local variable and access it through that variable....
memory: use a new FlatView pointer on every topology update
This is the first step towards converting as->current_map toRCU-style updates, where the FlatView updates run concurrentlywith uses of an old FlatView.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
memory: add reference counting to FlatView
With this change, a FlatView can be used even after a concurrentupdate has replaced it. Because we do not yet have RCU, we use amutex to protect the small critical sections that read/write theas->current_map pointer. Accesses to the FlatView can be done...
qom: Use atomics for object refcounting
Object reference counts will soon be changed outside the BQL. So we needto use atomics in object_ref/unref.
Based on a patch by Liu Ping Fan.
Signed-off-by: Liu Ping Fan <qemulist@gmail.com>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
exec: change well-known physical sections to macros
Sections like phys_section_unassigned always have fixed addressin phys_sections. Declared as macro, so we can use themwhen having more than one phys_sections array.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>...
exec: separate current memory map from the one being built
Currently, phys_node_map and phys_sections are shared by allof the AddressSpaceDispatch. When updating mem topology, allAddressSpaceDispatch will rebuild dispatch tables sequentiallyon them. In order to prepare for RCU access, leave the old...
memory: move MemoryListener declaration earlier
exec: move listener from AddressSpaceDispatch to AddressSpace
This will help having two copies of AddressSpaceDispatch during therecreation of the radix tree (one being built, and one that is completeand will be protected by RCU). We do not want to have to unregister and...
exec: separate current radix tree from the one being built
This same treatment previously done to phys_node_map and phys_sectionsis now applied to the dispatch field of AddressSpace. Topology updatesuse as->next_dispatch while accesses use as->dispatch....
exec: put memory map in AddressSpaceDispatch
After this patch, AddressSpaceDispatch holds a constistent tuple of(phys_map, nodes, sections). This will be important when updatesof the topology will run concurrently with reads.
cur_map is not used anymore except for freeing it at the end of the...
hw/i*: pass owner to memory_region_init* functions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/m*: pass owner to memory_region_init* functions
hw/n*: pass owner to memory_region_init* functions
hw/p*: pass owner to memory_region_init* functions
hw/s*: pass owner to memory_region_init* functions
hw/t*: pass owner to memory_region_init* functions
hw/[u-x]*: pass owner to memory_region_init* functions
vfio: pass device to vfio_mmap_bar and use it to set owner
Cc: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
spapr_iommu: pass device to spapr_tce_new_table and use it to set owner
pam: pass device to init_pam and use it to set owner
piolist: add owner argument to initialization functions and pass devices
hw/a*: pass owner to memory_region_init* functions
hw/block: pass owner to memory_region_init* functions
hw/c*: pass owner to memory_region_init* functions
hw/d*: pass owner to memory_region_init* functions
hw/gpio: pass owner to memory_region_init* functions
memory: return MemoryRegion from qemu_ram_addr_from_host
It will be needed in the next patch.
exec: reorganize address_space_map
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) {...
memory: ref/unref memory across address_space_map/unmap
The iothread mutex might be released between map and unmap, so themapped region might disappear.
escc: rename struct to ESCCState
We are using the same struct name for two devices. 8250 is widespreadenough that this causes some confusion, rename the other instance.
Reviewed-by: Andreas Faerber <afaerber@suse.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
vga: pass owner to vga_init
vga: pass owner to vga_common_init
vga: pass owner to cirrus_init_common
vga: pass owner to vga_init_vbe
vga: pass owner to vga_init_io
vga: set owner in vga_update_memory_access
ne2000: pass device to ne2000_setup_io, use it as owner
exec: simplify destruction of the phys map
Do not bother visiting the radix tree when an address space is destroyed.After the previous patch, this has become a pointless exercise. Whencalled from address_space_destroy_dispatch, all you're doing is zeroing...
memory: add getter for owner
Whenever memory regions are accessed outside the BQL, they need to bepreserved against hot-unplug. MemoryRegions actually do not have theirown reference count; they piggyback on a QOM object, their "owner".The owner is set at creation time, and there is a function to retrieve...
memory: add ref/unref
memory: introduce memory_region_present
This new API will avoid having too many memory_region_ref/unrefin paths that currently use memory_region_find.
memory: add ref/unref calls
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...
exec: check MRU in qemu_ram_addr_from_host
This function is not used outside the iothread mutex, so itcan use ram_list.mru_block.
exec: move qemu_ram_addr_from_host_nofail to cputlb.c
After the next patch it would not be used elsewhere anyway. Also,the _nofail and the standard versions of this function return differentthings, which is confusing. Removing the function from the public headers...
ioport: Switch dispatching to memory core layer
The current ioport dispatcher is a complex beast, mostly due to theneed to deal with old portio interface users. But we can overcome itwithout converting all portio users by embedding the required baseaddress of a MemoryRegionPortio access into that data structure. That...
ioport: Remove unused old dispatching services
Remove unused ioport_register and isa_unassign_ioport along witheverything that only those services used.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
vmport: Disentangle read handler type from portio
In case the latter may vanish one day, make sure the vmport read handlertype will remain unaffected. This is also conceptually cleaner.
ioport: Move portio types to ioport.h
This decouples memory.h from ioport.h, concentrating all portio relatedtypes in a single header.
memory: add owner argument to initialization functions
memory: destroy phys_sections one by one
phys_sections_clear is invoked after the dispatch tree has beendestroyed. This leaves a window where phys_sections_nb > 0 but thesubpages are not valid anymore, which is a recipe for use-after-freebugs.
Move the destruction of subpages in phys_sections_clear. We will...
adlib: replace register_ioport*
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>
applesmc: replace register_ioport*
wdt_ib700: replace register_ioport*
i82374: replace register_ioport*
prep: replace register_ioport*
vt82c686: replace register_ioport*
Privatize register_ioport_read/write
No more users outside of ioport.c.
isa: implement isa_is_ioport_assigned via memory_region_find
Open-code isa_is_ioport_assigned via a memory region lookup. As all IOports are now directly or indirectly registered via the memory API, thisbecomes possible and will finally allow us to drop the ioport tables....
vmware-vga: Accept unaligned I/O accesses
Before switching to the memory core dispatcher, we need to make surethat this pv-device will continue to receive unaligned portio accesses.
xen: Mark fixed platform I/O as unaligned
dma: keep a device alive while it has SGLists
Reviewed-by: Anthony Liguori <aliguori@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scsi: keep device alive while it has requests
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pci: Cleanup configuration for pci-hotplug.c
pci-hotplug.c and the CONFIG_PCI_HOTPLUG variable which controls itscompilation are misnamed. They're not about PCI hotplug in general, butrather about the pci_add/pci_del interface which are now deprecated in...
pci: Move pci_read_devaddr to pci-hotplug-old.c
pci_read_devaddr() is only used by the legacy functions for the old PCIhotplug interface in pci-hotplug-old.c. So we move the function there,and make it static.
MAINTAINERS: s/Marcelo/Paolo/
Marcelo doesn't maintain kvm anymore,Paolo is taking over the job.Update MAINTAINERS to stop flooding Marcelo with mail.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pvpanic: initialization cleanup
Avoid use of static variables: PC systemsinitialize pvpanic device through pvpanic_init,so we can simply create the fw_cfg file at that point.This also makes it possible to skip devicecreation completely if fw_cfg is not there, e.g. for xen -...
pvpanic: fix fwcfg for big endian hosts
Convert port number to little endian whenexposing it in fw cfg.
range: add Range structure
Sometimes we need to pass ranges around, add ahandy structure for this purpose.
Note: memory.c defines its own concept of AddrRange structure forworking with 128 addresses. It's necessary there for doing range math.This is not needed for most users: struct Range is...
pci: store PCI hole ranges in guestinfo structure
Will be used to pass hole ranges to guests.
pc: pass PCI hole ranges to Guests
Guest currently has to jump through lots of hoops to guess the PCI holeranges. It's fragile, and makes us change BIOS each time we add a newchipset. Let's report the window in a ROM file, to make BIOS do exactlywhat QEMU intends....
pc_piix: cleanup init compat handling
Make sure 1.4 calls 1.5, 1.3 calls 1.4 etc.This way it's enough to add enough new compat hookin a single place in piix.
e1000: cleanup process_tx_desc
Coverity complains about two overruns in process_tx_desc(). Thecomplaints are false positives, but we might as well eliminatethem. The problem is that "hdr" is defined as an unsigned int,but then used to offset an array of size 65536, and another of...