1. 13 3月, 2012 31 次提交
    • G
      uhci: renumber uhci_handle_td return codes · 0cd178ca
      Gerd Hoffmann 提交于
      Step #2 (separate for better bisectability): renumber so the silly '-1'
      goes away.  Pick a range which doesn't overlap the old values.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      0cd178ca
    • G
      uhci: use enum for uhci_handle_td return codes · 60e1b2a6
      Gerd Hoffmann 提交于
      Step #1 (separate for better bisectability): replace numbers with names.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      60e1b2a6
    • G
      uhci: tracing support · 50dcc0f8
      Gerd Hoffmann 提交于
      Zap DPRINTF, add tracepoints instead.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      50dcc0f8
    • G
      uhci: cancel on schedule stop. · d9a528db
      Gerd Hoffmann 提交于
      Cancel any in-flight transaction when the guest stops the uhci schedule.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      d9a528db
    • G
      uhci: fix uhci_async_cancel_all · 60f8afcb
      Gerd Hoffmann 提交于
      It should also free all queues.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      60f8afcb
    • G
      uhci: pass addr to uhci_async_alloc · 16ce543e
      Gerd Hoffmann 提交于
      Also do async->td initialization in uhci_async_alloc now.
      Prepares for adding tracepoints.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      16ce543e
    • G
      usb: improve packet state sanity checks · 5ac2731c
      Gerd Hoffmann 提交于
      Add a new function to check whenever the packet state is as expected,
      log more informations in case it isn't.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      5ac2731c
    • W
      usb-ohci: DMA writeback bug fixes · 86e18cae
      Wei Yang 提交于
      This patch fixes two bugs in the OHCI device where the device writes
      back data to system memory that should be exclusively under the
      control of the guest side driver.
      
      In OHCI specification Section 5.2.7, it mentioned "In all cases, Host
      Controller Driver is responsible for the insertion and removal of all
      Endpoint Descriptors in the various Host Controller Endpoint
      Descriptor lists".  In the ohci_frame_boundary(), ohci_put_hcca()
      writes the entire hcca back including the interrupt ED lists which
      should be under driver control. This violates the specification and
      can race with a host driver updating that list at the same time.
      
      In the OHCI Spec Section 4.6, Transfer Descriptor Queue Processing, it
      mentioned "Since the TD pointed to by TailP is not accessed by the HC,
      the Host Controller Driver can initialize that TD and link at least
      one other to it without creating a coherency or synchronization
      problem".  While the function ohci_put_ed() writes the entire endpoint
      descriptor back including the TailP which should under driver
      control. This violate the specification and can race with a host
      driver updating the TD list at the same time.
      
      In each case the solution is to make sure we don't write data which is
      under driver control.
      
      Cc: Gerd Hoffman <kraxel@redhat.com>
      Signed-off-by: NWei Yang <weiyang@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      86e18cae
    • H
      usb-ehci: drop unused isoch_pause variable · fcb70eca
      Hans de Goede 提交于
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      fcb70eca
    • G
      usb: zap hw/ush-{ohic,uhci}.h + init wrappers · afb9a60e
      Gerd Hoffmann 提交于
      Remove the uhci and ohci init wrappers, which all wrapped a
      pci_create_simple() one-liner.  Switch callsites to call
      pci_create_simple directly.  Remove the header files where
      the wrappers where declared.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      afb9a60e
    • G
      usb: the big rename · f1ae32a1
      Gerd Hoffmann 提交于
      Reorganize usb source files.  Create a new hw/usb/ directory and move
      all usb source code to that place.  Also make filenames a bit more
      descriptive.  Host adapters are prefixed with "hch-" now, usb device
      emulations are prefixed with "dev-".  Fixup paths Makefile and include
      paths to make it compile.  No code changes.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      f1ae32a1
    • A
      Merge remote-tracking branch 'mdroth/qga-pull-3-12-2012' into staging · cb72b758
      Anthony Liguori 提交于
      * mdroth/qga-pull-3-12-2012:
        qemu-ga: add guest-sync-delimited
        qemu-ga: add guest-network-get-interfaces command
        qemu-ga: add win32 guest-suspend-ram command
        qemu-ga: add win32 guest-suspend-disk command.
        qemu-ga: add guest-suspend-hybrid
        qemu-ga: add guest-suspend-ram
        qemu-ga: add guest-suspend-disk
      cb72b758
    • A
      Merge remote-tracking branch 'kwolf/for-anthony' into staging · fb23ae6e
      Anthony Liguori 提交于
      * kwolf/for-anthony:
        test-coroutine: add performance test for nesting
        coroutine: adding configure option for sigaltstack coroutine backend
        coroutine: adding configure choose mechanism for coroutine backend
        coroutine: adding sigaltstack method (.c source)
        qcow2: Reduce number of I/O requests
        qcow2: Add qcow2_alloc_clusters_at()
        qcow2: Factor out count_cow_clusters
        qmp: convert blockdev-snapshot-sync to a wrapper around transactions
        add mode field to blockdev-snapshot-sync transaction item
        rename blockdev-group-snapshot-sync
        qapi: complete implementation of unions
        use QSIMPLEQ_FOREACH_SAFE when freeing list elements
        Add 'make check-block'
        make check: Add qemu-iotests subset
        qemu-iotests: Mark some tests as quick
        qcow2: Add error messages in qcow2_truncate
        block: handle -EBUSY in bdrv_commit_all()
        qcow2: Add some tracing
        qed: do not evict in-use L2 table cache entries
        Group snapshot: Fix format name for backing file
      fb23ae6e
    • A
      Merge remote-tracking branch 'qemu-kvm/memory/core' into staging · 79122e93
      Anthony Liguori 提交于
      * qemu-kvm/memory/core:
        memory: get rid of cpu_register_io_memory()
        memory: dispatch directly via MemoryRegion
        exec: fix code tlb entry misused as iotlb in get_page_addr_code()
        memory: store section indices in iotlb instead of io indices
        memory: make phys_page_find() return an unadjusted section
      79122e93
    • A
      Merge remote-tracking branch 'stefanha/tracing' into staging · cbedde09
      Anthony Liguori 提交于
      * stefanha/tracing:
        vga: add trace event for ppm_save
        console: add some trace events
        maintainers: Add docs/tracing.txt to Tracing
        docs: correct ./configure line in tracing.txt
        trace: make trace_thread_create() use its function arg
        tracetool: Omit useless QEMU_*_ENABLED() check
        trace: Provide a per-event status define for conditional compilation
      cbedde09
    • A
      Merge remote-tracking branch 'qmp/queue/qmp' into staging · 1d2cb1a2
      Anthony Liguori 提交于
      * qmp/queue/qmp:
        qapi-schema.json: fix comment for type ObjectPropretyInfo
        qapi-schema: fix typos and explain 'spice' auth
        qjson.h: include compiler.h for GCC_FMT_ATTR
      1d2cb1a2
    • M
      qemu-ga: add guest-sync-delimited · 3cf0bed8
      Michael Roth 提交于
      guest-sync leaves it as an exercise to the user as to how to reliably
      obtain the response to guest-sync if the client had previously read in a
      partial response (due qemu-ga previously being restarted mid-"sentence"
      due to reboot, forced restart, etc).
      
      qemu-ga handles this situation on its end by having a client precede
      their guest-sync request with a 0xFF byte (invalid UTF-8), which
      qemu-ga/QEMU JSON parsers will treat as a flush event. Thus we can
      reliably flush the qemu-ga parser state in preparation for receiving
      the guest-sync request.
      
      guest-sync-delimited provides the same functionality for a client: when
      a guest-sync-delimited is issued, qemu-ga will precede it's response
      with a 0xFF byte that the client can use as an indicator to flush its
      buffer/parser state in preparation for reliably receiving the
      guest-sync-delimited response.
      
      It is also useful as an optimization for clients, since, after issuing a
      guest-sync-delimited, clients can safely discard all stale data read
      from the channel until the 0xFF is found.
      
      More information available on the wiki:
      
      http://wiki.qemu.org/Features/QAPI/GuestAgent#QEMU_Guest_Agent_ProtocolSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      3cf0bed8
    • M
      qemu-ga: add guest-network-get-interfaces command · 3424fc9f
      Michal Privoznik 提交于
      This command returns an array of:
      
       [ifname, hwaddr, [ipaddr, ipaddr_family, prefix] ]
      
      for each interface in the system.
      Currently, only IPv4 and IPv6 are supported.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3424fc9f
    • M
      qemu-ga: add win32 guest-suspend-ram command · f54603b6
      Michael Roth 提交于
      S3 sleep implementation for windows.
      f54603b6
    • G
      qemu-ga: add win32 guest-suspend-disk command. · aa59637e
      Gal Hammer 提交于
      Implement guest-suspend-disk RPC for Windows. Functionally this should be
      equivalent to the posix implementation.
      Signed-off-by: NGal Hammer <ghammer@redhat.com>
      aa59637e
    • L
      qemu-ga: add guest-suspend-hybrid · 95f4f404
      Luiz Capitulino 提交于
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      95f4f404
    • L
      qemu-ga: add guest-suspend-ram · fbf42210
      Luiz Capitulino 提交于
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      fbf42210
    • L
      qemu-ga: add guest-suspend-disk · 11d0f125
      Luiz Capitulino 提交于
      As the command name implies, this command suspends the guest to disk.
      
      The suspend operation is implemented by two functions: bios_supports_mode()
      and guest_suspend(). Both functions are generic enough to be used by
      other suspend modes (introduced by next commits).
      
      Both functions will try to use the scripts provided by the pm-utils
      package if it's available. If it's not available, a manual method,
      which consists of directly writing to '/sys/power/state', will be used.
      
      To reap terminated children, a new signal handler is installed in the
      parent to catch SIGCHLD signals and a non-blocking call to waitpid()
      is done to collect their exit statuses. The statuses, however, are
      discarded.
      
      The approach used to query the guest for suspend support deserves some
      explanation. It's implemented by bios_supports_mode() and shown below:
      
        qemu-ga
           |
       create pipe
           |
         fork()
           -----------------
           |               |
           |               |
           |             fork()
           |               --------------------------
           |               |                        |
           |               |                        |
           |               |               exec('pm-is-supported')
           |               |
           |              wait()
           |       write exit status to pipe
           |              exit
           |
        read pipe
      
      This might look complex, but the resulting code is quite simple.
      The purpose of that approach is to allow qemu-ga to reap its children
      (semi-)automatically from its SIGCHLD handler.
      
      Implementing this the obvious way, that's, doing the exec() call from
      the first child process, would force us to introduce a more complex way
      to reap qemu-ga's children. Like registering PIDs to be reaped and
      having a way to wait for them when returning their exit status to
      qemu-ga is necessary. The approach explained above avoids that complexity.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      11d0f125
    • P
      cpu-all.h: Don't accidentally sign extend in g2h() · 8d9dde94
      Peter Maydell 提交于
      Cast the argument of the g2h() macro to a target_ulong so that
      it isn't accidentally sign-extended if it is a signed 32 bit
      type and long is a 64 bit type. In particular, this fixes a
      bug where it would return the wrong value for 32 bit guests
      on 64 bit hosts when passed in one of the arg* values from
      do_syscall() [which are all abi_long and thus signed types].
      This could result in spurious failure of mlock(), among others.
      Reviewed-by: NAndreas F=E4rber <afaerber@suse.de>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8d9dde94
    • G
      implement vnc_dpy_setdata · 1d3323de
      Gerd Hoffmann 提交于
      The comment is wrong, we have to do something in the setdata callback.
      Changing the framebuffer backing storage (happens when the guest pans
      the display) renders the whole screen content invalid.
      
      Trigger #1: cirrus vga + 32bit linux guest + vesafb with ypan enabled.
      Trigger #2: std vga + http://patchwork.ozlabs.org/patch/145479/Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      1d3323de
    • E
      initialize CPU model list after handling -readconfig options · ecf40bea
      Eduardo Habkost 提交于
      To properly load cpudefs using -readconfig, we have to call
      cpudef_init() after finishing the command-line option handling.
      
      Consequently, the handling of "-cpu ?" has to be done after the
      command-line option handling loop, too.
      
      Without this patch, "-readconfig configfile -cpu ?" fails to list the
      CPU definitions read from 'configfile'.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ecf40bea
    • E
      add Opteron_G4 CPU model (v2) · 885bb036
      Eduardo Habkost 提交于
      This patch addes a Bulldozer-based Opteron_G4 CPU model.
      
      This version has the ffxsr bit actually disabled, to match what was
      documented below. Thanks to Andre Przywara for spotting the bug.
      
      I am trying to be conservative with the new model, so I am enabling only
      features known to be useful to guests, and not enabling anything that
      was not tested or found to be useful to a guest.
      
      List of missing flags in comparison to real hardware:
      
      - vme: host-specific feature.
      - osxsave: it is not set here because it is set by the guest OS, not by KVM
      - monitor: this is filtered out by the KVM module, so no point in
        enabling it.
      - mmxext: untested, so not enabled.
      - Perf*, Topology*, lwp, ibs: not emulated by KVM.
      - wdt, skinit, osvw, altmovcr8, extapicspace, cmplegacy: untested,
        so not enabled.
      
      List of new flags, in comparison to the Opteron_G3 model:
      
      - xsave: xsave feature, already implemented by Qemu
      - avx, aes, sse4.x, ssse3, pclmulqdq: all new state the new instructions
        could use is handled by the xsave state loading/saving code on Qemu.
      - pdpe1gb: 1GB pages, supported by the KVM kernel module.
      - ffxsr: untested, so not enabled
      - fma4, xop: all new state the new instructions could use is handled by
        the xsave loading/saving code on Qemu.
      - 3dnowprefetch: safe to pass through, though the flag is not used by
        Linux guests, at least.
      
      Below is the comparison between the current Opteron_G3 model
      and the new model being added.
      
      - The "full" line contains the flags found on actual hardware.
      - The "missing" line shows the flags that are present on actual
        hardware, but not on the added Opteron_G4 model.
      - The "new" line shows the flags that were not on the Opteron_G3 model
        but are on Opteron_G4.
      
      feature_edx:
        Opteron_G3: sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de     fpu
        full:       sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de vme fpu
        Opteron_G4: sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de     fpu
        missing:                                                                                              vme
      
      feature_ecx:
        Opteron_G3:                       popcnt               cx16       monitor           sse3
        full:       avx osxsave xsave aes popcnt sse4.2 sse4.1 cx16 ssse3 monitor pclmulqdq sse3
        Opteron_G4: avx         xsave aes popcnt sse4.2 sse4.1 cx16 ssse3         pclmulqdq sse3
        missing:        osxsave                                           monitor
        new:        avx         xsave aes        sse4.2 sse4.1      ssse3         pclmulqdq
      
      extfeature_edx:
        Opteron_G3: lm rdtscp               fxsr mmx        nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de     fpu
        full:       lm rdtscp pdpe1gb ffxsr fxsr mmx mmxext nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de vme fpu
        Opteron_G4: lm rdtscp pdpe1gb       fxsr mmx        nx pse36 pat cmov mca pge mtrr syscall apic cx8 mce pae msr tsc pse de     fpu
        missing:                                     mmxext                                                                        vme
        new:                  pdpe1gb
      
      extfeature_ecx:
        Opteron_G3:                                                                misalignsse sse4a abm                        svm           lahf_lm
        full:       Perf* Topology* fma4 lwp wdt skinit xop ibs osvw 3dnowprefetch misalignsse sse4a abm altmovcr8 extapicspace svm cmplegacy lahf_lm
        Opteron_G4:                 fma4                xop          3dnowprefetch misalignsse sse4a abm                        svm           lahf_lm
        new:                        fma4                xop          3dnowprefetch
        missing:    Perf* Topology*      lwp wdt skinit     ibs osvw                                     altmovcr8 extapicspace     cmplegacy
      
      Changes v1 -> v2:
       - Actually disable ffxsr bit
      
      Cc: Andre Przywara <andre.przywara@amd.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      885bb036
    • E
      add SandyBridge CPU model · c34ea314
      Eduardo Habkost 提交于
      This patches add the definition of a SandyBridge CPU model.
      
      Summary of differences:
      
      Flags present on actual hardware, but not on the added model definition:
      
      - pbe, tm, ht, ss, acpi, vme, xTPR, tm2, eist, smx: host-specific
        features, not exposed to guest.
      - ds, ds-cpl, dtes64, pdcm: emulation not supported by KVM (although it
        may be added in the future if implementing PMU virtualization)
      - pcid, vmx, monitor: not emulated by Qemu/KVM right now.
      - osxsave: set by the guest OS, not by Qemu.
      
      Flags added, that were not present on Westmere model:
      
      - xsave: already supported by Qemu
      - avx, pclmulqdq: all new state the new instructions could use is
        handled by xsave state loading/saving code.
      - tsc-deadline, x2apic, rdtscp: already supported by Qemu/KVM.
      
      Below there's a comparison of the features on the current Westmere CPU
      model, and the SandyBridge CPU model.
      
      - The "full" line contains the flags found on actual hardware.
      - The "missing" line shows the flags that are present on actual
        hardware, but not on the added SandyBridge model.
      - The "new" line shows the flags that were not on the Westmere model,
        but are on SandyBridge.
      
      feature_edx:
        Westmere:                 sse2 sse fxsr mmx         clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de     fpu
        full:        pbe tm ht ss sse2 sse fxsr mmx ds acpi clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pge msr tsc pse de vme fpu
        SandyBridge:              sse2 sse fxsr mmx         clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de     fpu
        missing:     pbe tm ht ss                   ds acpi                                                                         vme
      
      feature_ecx:
        Westmere:                      aes              popcnt        sse4.2 sse4.1                cx16 ssse3                                                  sse3
        full:        avx osxsave xsave aes tsc-deadline popcnt x2apic sse4.2 sse4.1 pcid pdcm xTPR cx16 ssse3 tm2 eist smx vmx ds-cpl monitor dtes64 pclmulqdq sse3
        SandyBridge: avx         xsave aes tsc-deadline popcnt x2apic sse4.2 sse4.1                cx16 ssse3                                        pclmulqdq sse3
        missing:         osxsave                                                    pcid pdcm xTPR            tm2 eist smx vmx ds-cpl monitor dtes64
        new:         avx         xsave     tsc-deadline        x2apic                                                                                pclmulqdq
      
      extfeature_edx:
        Westmere:    i64        nx syscall
        full:        i64 rdtscp nx syscall
        SandyBridge: i64 rdtscp nx syscall
        new:             rdtscp
      
      extfeature_ecx:
        Westmere:    lahf_lm
        full:        lahf_lm
        SandyBridge: lahf_lm
      
      Cc: "Dugger, Donald D" <donald.d.dugger@intel.com>
      Cc: "Zhang, Xiantao" <xiantao.zhang@intel.com>
      Acked-by: NXiantao Zhang <xiantao.zhang@intel.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      c34ea314
    • E
      eaf3f097
    • P
      qom: fix device hot-unplug · 6c1fdcf9
      Paolo Bonzini 提交于
      Property removal modifies the list, so it is not safe to continue
      iteration.  We know anyway that each object can have only one
      parent (see object_property_add_child), so exit after finding
      the requested object.
      Reported-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      6c1fdcf9
    • P
      qdev: accept empty string properties · 66d341e5
      Paolo Bonzini 提交于
      These were stored as NULL due to wrong cut-and-paste from set_pointer.
      Reported-by: NGerhard Wiesinger <lists@wiesinger.com>
      Tested-by: NGerhard Wiesinger <lists@wiesinger.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      66d341e5
  2. 12 3月, 2012 9 次提交