aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-02-29memory: replace phys_page_find_alloc() with phys_page_set()Avi Kivity
By giving the function the value we want to set, we make it more flexible for the next patch. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: simplify multipage/subpage registrationAvi Kivity
Instead of considering subpage on a per-page basis, split each section into a subpage head, multipage body, and subpage tail, and register each separately. This simplifies the registration functions. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: give phys_page_find() its own tree search loopAvi Kivity
We'll change phys_page_find_alloc() soon, but phys_page_find() doesn't need to bear the consequences. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: make phys_page_find() return a MemoryRegionSectionAvi Kivity
We no longer describe memory in terms of individual pages; use sections throughout instead. PhysPageDesc no longer used - remove. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: move tlb flush to MemoryListener commit callbackAvi Kivity
This way, if we have several changes in a single transaction, we flush just once. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: unify the two branches of cpu_register_physical_memory_log()Avi Kivity
Identical except that the second branch knows its not modifying an existing subpage. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: fix RAM subpages in newly initialized pagesAvi Kivity
If the first subpage installed in a page is RAM, then we install it as a full page, instead of a subpage. Fix by not special casing RAM. The issue dates to commit db7b5426a4b4242, which introduced subpages. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: compress phys_map node pointers to 16 bitsAvi Kivity
Use an expanding vector to store nodes. Allocation is baroque to g_renew() potentially invalidating pointers; this will be addressed later. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: store MemoryRegionSection pointers in phys_mapAvi Kivity
Instead of storing PhysPageDesc, store pointers to MemoryRegionSections. The various offsets (phys_offset & ~TARGET_PAGE_MASK, PHYS_OFFSET & TARGET_PAGE_MASK, region_offset) can all be synthesized from the information in a MemoryRegionSection. Adjust phys_page_find() to synthesize a PhysPageDesc. The upshot is that phys_map now contains uniform values, so it's easier to generate and compress. The end result is somewhat clumsy but this will be improved as we we propagate MemoryRegionSections throughout the code instead of transforming them to PhysPageDesc. The MemoryRegionSection pointers are stored as uint16_t offsets in an array. This saves space (when we also compress node pointers) and is more cache friendly. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: unify phys_map last level with intermediate levelsAvi Kivity
This lays the groundwork for storing leaf data in intermediate levels, saving space. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: remove first level of l1_phys_mapAvi Kivity
L1 and the lower levels in l1_phys_map are equivalent, except that L1 has a different size, and is always allocated. Simplify the code by removing L1. This leaves us with a tree composed solely of L2 tables, but that problem can be renamed away later. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: change memory registration to rebuild the memory map on each changeAvi Kivity
Instead of incrementally building the memory map, rebuild it every time. This allows later simplification, since the code need not consider overlaying a previous mapping. It is also RCU friendly. With large memory guests this can get expensive, since the operation is O(mem size), but this will be optimized later. As a side effect subpage and L2 leaks are fixed here. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: support stateless memory listenersAvi Kivity
Current memory listeners are incremental; that is, they are expected to maintain their own state, and receive callbacks for changes to that state. This patch adds support for stateless listeners; these work by receiving a ->begin() callback (which tells them that new state is coming), a sequence of ->region_add() and ->region_nop() callbacks, and then a ->commit() callback which signifies the end of the new state. They should ignore ->region_del() callbacks. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: split memory listener for the two address spacesAvi Kivity
The memory and I/O address spaces do different things, so split them into two memory listeners. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29xen: ignore I/O memory regionsAvi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: allow MemoryListeners to observe a specific address spaceAvi Kivity
Ignore any regions not belonging to a specified address space. Signed-off-by: Avi Kivity <avi@redhat.com>
2012-02-29memory: drop AddressSpaceOpsAvi Kivity
All functionality has been moved to various MemoryListeners. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: use a MemoryListener for core memory map updates tooAvi Kivity
This transforms memory.c into a library which can then be unit tested easily, by feeding it inputs and listening to its outputs. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: don't pass ->readable attribute to cpu_register_physical_memory_logAvi Kivity
It can be derived from the MemoryRegion itself (which is why it is not used there). Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: add a readonly attribute to MemoryRegionSectionAvi Kivity
.readonly cannot be obtained from the MemoryRegion, since it is inherited from aliases (so you can have a MemoryRegion mapped RW at one address and RO at another). Record it in a MemoryRegionSection for listeners. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: move ioeventfd ops to MemoryListenerAvi Kivity
This way the accelerator (kvm) can handle them directly. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: code motion: move MEMORY_LISTENER_CALL()Avi Kivity
So it can be used in earlier code. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: switch memory listeners to a QTAILQAvi Kivity
This allows reverse iteration, which in turns allows consistent ordering among multiple listeners: l1->add l2->add l2->del l1->del Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: add shorthand for invoking a callback on all listenersAvi Kivity
Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29memory: remove memory_region_set_offset()Avi Kivity
memory_region_set_offset() complicates the API, and has been deprecated since its introduction. Now that it is no longer used, remove it. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-29ioport: change portio_list not to use memory_region_set_offset()Avi Kivity
memory_region_set_offset() will be going away soon, so don't use it. Use an alias instead. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2012-02-28qxl: properly handle upright and non-shared surfacesGerd Hoffmann
Although qxl creates a shared displaysurface when the qxl surface is upright and doesn't need to be flipped there is no guarantee that the surface doesn't become unshared for some reason. Rename qxl_flip to qxl_blit and fix it to handle both flip and non-flip cases. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-28Error out when tls-channel option is used without TLSChristophe Fergeau
It's currently possible to setup spice channels using TLS when no TLS port has been specified (ie TLS is disabled). This cannot work, so better to error out in such a situation. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-28spice: use error_report to report errorsChristophe Fergeau
Error message reporting during spice startup wasn't consistent, it was done with fprintf(stderr, "") but sometimes the message didn't have a trailing \n. Using error_report make the intent of the message clearer and deal with the final \n for us. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-28qxl: add optinal 64bit vram barGerd Hoffmann
This patch adds an 64bit pci bar for vram. It is turned off by default. It can be enabled by setting the size of the 64bit bar to be larger than the 32bit bar. Both 32bit and 64bit bar refer to the same memory. Only the first part of the memory is available via 32bit bar. The intention is to allow large vram sizes for 64bit guests, by allowing the vram bar being mapped above 4G, so we don't have to squeeze it into the pci I/O window below 4G. With vram_size_mb=16 and vram64_size_mb=256 it looks like this: 00:02.0 VGA compatible controller: Red Hat, Inc. Device 0100 (rev 02) (prog-if 00 [VGA controller]) Subsystem: Red Hat, Inc Device 1100 Physical Slot: 2 Flags: fast devsel, IRQ 10 Memory at f8000000 (32-bit, non-prefetchable) [size=64M] Memory at fc000000 (32-bit, non-prefetchable) [size=16M] Memory at fd020000 (32-bit, non-prefetchable) [size=8K] I/O ports at c5a0 [size=32] Memory at ffe0000000 (64-bit, prefetchable) [size=256M] Expansion ROM at fd000000 [disabled] [size=64K] [ mapping above 4G needs patched seabios: http://www.kraxel.org/cgit/seabios/commit/?h=pci64 ]
2012-02-27Merge remote-tracking branch 'aneesh/for-upstream' into stagingAnthony Liguori
* aneesh/for-upstream: hw/9pfs: Endian fixes for virtfs ./configure: add option for disabling VirtFS
2012-02-27usb: Resolve warnings about unassigned bus on usb device creationJan Kiszka
When creating an USB device the old way, there is no way to specify the target bus. Thus the warning issued by usb_create makes no sense and rather confuses our users. Resolve this by passing a bus reference to the usbdevice_init handler and letting those handlers forward it to usb_create. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27slirp: Fix assertion failure on rejected DHCP requestsDavid Gibson
The guest network stack might DHCPREQUEST an address that the slirp built in dhcp server can't let it have - for example if the guest has an old leases file from another network configuration. In this case the dhcp server should and does reject the request and prepares to send a DHCPNAK to the client. However, in this case the daddr variable in bootp_reply() is set to 0.0.0.0. Shortly afterwards, it unconditionally attempts to pre-insert the new client address into the ARP table. This causes an assertion failure in arp_address_add() because of the 0.0.0.0 address. According to RFC2131, DHCPNAK messages for clients on the same subnet must be sent to the broadcast address (S3.2, subpoint 2). Cc: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27slirp: Refactor if_startJan Kiszka
Replace gotos with a while loop, fix coding style. CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> CC: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27slirp: Fix requeuing of batchq packets in if_startJan Kiszka
In case we requeued a packet that was the head of a longer session queue, we failed to restore this ordering. Also, we did not properly deal with changes to Slirp::next_m. Instead of a cumbersome roll back, this fix simply avoids any changes until we know if the packet was actually sent. Both fixes crashes due to inconsistent queues and simplifies the logic. Thanks to Zhi Yong Wu who found the reason for these crashes. CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> CC: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27slirp: Clean up ifs_initJan Kiszka
Remove duplicate ifs_init macros, reimplement the logic as static inline in mbuf.h. CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> CC: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpointHans de Goede
We should return USB_RET_NAK, rather then a 0 sized packet, when we've no data for an interrupt IN endpoint. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-redir: Limit return values returned by iso packetsHans de Goede
The usbredir protocol uses a status of usb_redir_stall to indicate that an iso data stream has stopped (ie because the urbs failed on resubmit), but iso packets should never return a result of USB_RET_STALL, since iso endpoints cannot stall. So instead simply always return USB_RET_NAK on iso stream errors. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-redir: Let the usb-host know about our device filteringHans de Goede
libusbredirparser-0.3.4 adds 2 new packets which allows us to notify the usb-host: -about the usb device filter we have (if any), so that it knows not the even try to redirect certain devices -when we reject a device based on filtering (in case it tries anyways) Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-redir: Always clear device state on filter rejectHans de Goede
Always call usbredir_device_disconnect() when usbredir_check_filter() fails to clean up all the device state (ie received endpoint info). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-redir: Fix printing of device versionHans de Goede
The device version is in bcd format, which requires some special handling to print. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27ehci: drop old stuffGerd Hoffmann
Drop the "ehci under development" banner. Drop unused & inactive (#if 0) code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-ehci: Handle ISO packets failing with an error other then NAKHans de Goede
Before this patch the ehci code was not checking for any other errors other then USB_RET_NAK. This causes 2 problems: 1) Other errors are not reported to the guest. 2) When transactions with the ITD_XACT_IOC bit set completing with another error would not result in USBSTS_INT getting set. I hit this problem when unplugging devices while iso data was streaming from the device to the guest. When this happens it takes a while for the guest to process the unplugging and remove ISO transactions from the ehci schedule, in the mean time these transactions would complete with a result of USB_RET_NODEV, which was not handled. This lead to the Linux guest's usb subsystem "hanging", that is it would no longer see new usb devices getting plugged in and running for example lsusb would lead to a stuck (D state) lsusb process. This patch fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27libcacard: fix reported ATR lengthAlon Levy
Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-ccid: advertise SELF_POWEREDAlon Levy
Before commit ed5a83ddd8c1d8ec7b1015315530cf29949e7c48 each device provided it's own response to USB_REQ_GET_STATUS, but after it that response was based on bmAttributes, which was errounously set for usb-ccid as 0xa0 and not 0xe0. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27libcacard: link with glib for g_strndupAlon Levy
Without it the produced library for make libcacard.la has an unresolved symbol. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-desc: fix user trigerrable segfaults (!config)Alon Levy
Check for dev->config being NULL in two places: USB_REQ_GET_CONFIGURATION and USB_REQ_GET_STATUS. The behavior of USB_REQ_GET_STATUS is unspecified in the Default state, that corresponds to dev->config being NULL (it defaults to NULL and is reset whenever a SET_CONFIGURATION with value 0, or attachment). I implemented it to correspond with the state before ed5a83ddd8c1d8ec7b1015315530cf29949e7c48, the commit moving SET_STATUS to usb-desc; if dev->config is not set we return whatever is in the first configuration. The behavior of USB_REQ_GET_CONFIGURATION is also undefined before any SET_CONFIGURATION, but here we just return 0 (same as specified for the Address state). A win7 guest failed to initialize the device before this patch, segfaulting when GET_STATUS was called with dev->config == NULL. With this patch the passthrough device still doesn't work but the failure is unrelated. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-ehci: sanity-check iso xfersGerd Hoffmann
This patch adds a sanity check to itd processing to make sure the endpoint addressed by the guest is actually an iso endpoint. Also verify that usb drivers don't return USB_RET_ASYNC which is illegal for iso xfers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb: add tracepoint for usb packet state changes.Gerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-27usb-xhci: enable packet queuingGerd Hoffmann
qemu usb core has packet queues now, so flip lets the switch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>