1. 12 6月, 2012 1 次提交
    • M
      consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset() · 3d9b4925
      Michael Tokarev 提交于
      This patch combines two functions into one, and replaces
      the implementation with already existing iov_memset() from
      iov.c.
      
      The new prototype of qemu_iovec_memset():
        size_t qemu_iovec_memset(qiov, size_t offset, int fillc, size_t bytes)
      It is different from former qemu_iovec_memset_skip(), and
      I want to make other functions to be consistent with it
      too: first how much to skip, second what, and 3rd how many
      of it.  It also returns actual number of bytes filled in,
      which may be less than the requested `bytes' if qiov is
      smaller than offset+bytes, in the same way iov_memset()
      does.
      
      While at it, use utility function iov_memset() from
      iov.h in posix-aio-compat.c, where qiov was used.
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      3d9b4925
  2. 08 6月, 2012 3 次提交
    • M
      rewrite iov_* functions · 2278a69e
      Michael Tokarev 提交于
      This changes implementations of all iov_*
      functions, completing the previous step.
      
      All iov_* functions now ensure that this offset
      argument is within the iovec (using assertion),
      but lets to specify `bytes' value larger than
      actual length of the iovec - in this case they
      stops at the actual end of iovec.  It is also
      suggested to use convinient `-1' value as `bytes'
      to mean just this -- "up to the end".
      
      There's one very minor semantic change here: new
      requiriment is that `offset' points to inside of
      iovec.  This is checked just at the end of functions
      (assert()), it does not actually need to be enforced,
      but using any of these functions with offset pointing
      past the end of iovec is wrong anyway.
      
      Note: the new code in iov.c uses arithmetic with
      void pointers.  I thought this is not supported
      everywhere and is a GCC extension (indeed, the C
      standard does not define void arithmetic).  However,
      the original code already use void arith in
      iov_from_buf() function:
        (memcpy(..., buf + buf_off,...)
      which apparently works well so far (it is this
      way in qemu 1.0).  So I left it this way and used
      it in other places.
      
      While at it, add a unit-test file test-iov.c,
      to check various corner cases with iov_from_buf(),
      iov_to_buf() and iov_memset().
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      2278a69e
    • M
      change iov_* function prototypes to be more appropriate · dcf6f5e1
      Michael Tokarev 提交于
      Reorder arguments to be more natural, readable and
      consistent with other iov_* functions, and change
      argument names, from:
       iov_from_buf(iov, iov_cnt, buf, iov_off, size)
      to
       iov_from_buf(iov, iov_cnt, offset, buf, bytes)
      
      The result becomes natural English:
      
       copy data to this `iov' vector with `iov_cnt'
       elements starting at byte offset `offset'
       from memory buffer `buf', processing `bytes'
       bytes max.
      
      (Try to read the original prototype this way).
      
      Also change iov_clear() to more general iov_memset()
      (it uses memset() internally anyway).
      
      While at it, add comments to the header file
      describing what the routines actually does.
      
      The patch only renames argumens in the header, but
      keeps old names in the implementation.  The next
      patch will touch actual code to match.
      
      Now, it might look wrong to pay so much attention
      to so small things.  But we've so many badly designed
      interfaces already so the whole thing becomes rather
      confusing or error prone.  One example of this is
      previous commit and small discussion which emerged
      from it, with an outcome that the utility functions
      like these aren't well-understdandable, leading to
      strange usage cases.  That's why I paid quite some
      attention to this set of functions and a few
      others in subsequent patches.
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      dcf6f5e1
    • M
      virtio-serial-bus: use correct lengths in control_out() message · 45270ad8
      Michael Tokarev 提交于
      Original code has one thing to process (cur_len), requests to
      convert from iovec to buf another thing (len which is actually max_len),
      and processes something else (copied).  Whole thing is very difficult
      to understand, even if it does a right thing.  The iov_to_buf()
      conversion in this case will always return cur_len, because it is
      the length of the iovec it was asked to process, and the size we
      asked to convert is the same or larger, and iov_to_buf() will stop
      at reaching either iov or buf.
      
      Make the code saner by doing the only sane thing: dropping `copied'
      which is always the same as `cur_len' but just introduces questions.
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      45270ad8
  3. 07 6月, 2012 1 次提交
  4. 06 6月, 2012 4 次提交
    • A
      Merge remote-tracking branch 'qmp/queue/qmp' into staging · 34941700
      Anthony Liguori 提交于
      * qmp/queue/qmp: (29 commits)
        Add 'query-events' command to QMP to query async events
        qapi: convert netdev_del
        qapi: convert netdev_add
        net: net_client_init(): use error_set()
        net: purge the monitor object from all init functions
        qemu-config: introduce qemu_find_opts_err()
        qemu-config: find_list(): use error_set()
        qerror: introduce QERR_INVALID_OPTION_GROUP
        qemu-option: qemu_opts_from_qdict(): use error_set()
        qemu-option: introduce qemu_opt_set_err()
        qemu-option: opt_set(): use error_set()
        qemu-option: qemu_opts_validate(): use error_set()
        qemu-option: qemu_opt_parse(): use error_set()
        qemu-option: parse_option_size(): use error_set()
        qemu-option: parse_option_bool(): use error_set()
        qemu-option: parse_option_number(): use error_set()
        qemu-option: qemu_opts_create(): use error_set()
        introduce a new monitor command 'dump-guest-memory' to dump guest's memory
        make gdb_id() generally avialable and rename it to cpu_index()
        target-i386: Add API to get note's size
        ...
      34941700
    • A
      Merge remote-tracking branch 'afaerber-or/qom-cpu-3' into staging · e1ae9a7a
      Anthony Liguori 提交于
      * afaerber-or/qom-cpu-3: (74 commits)
        Kill off cpu_state_reset()
        linux-user: Use cpu_reset() after cpu_init() / cpu_copy()
        bsd-user: Use cpu_reset() in after cpu_init()
        leon3: Store SPARCCPU in ResetData
        leon3: Use cpu_sparc_init() to obtain SPARCCPU
        sun4u: Store SPARCCPU in ResetData
        sun4u: Let cpu_devinit() return SPARCCPU
        sun4u: Use cpu_sparc_init() to obtain SPARCCPU
        sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset()
        sun4m: Use cpu_sparc_init() to obtain SPARCCPU
        target-sparc: Let cpu_sparc_init() return SPARCCPU
        cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPC
        virtex_ml507: Pass PowerPCCPU to main_cpu_reset()
        virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPU
        virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPU
        ppc_prep: Pass PowerPCCPU to ppc_prep_reset()
        ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU
        ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset()
        ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU
        ppc_newworld: Pass PowerPCCPU to ppc_core99_reset()
        ...
      e1ae9a7a
    • A
      Merge remote-tracking branch 'qemu-kvm/uq/master' into staging · 6e72ae46
      Anthony Liguori 提交于
      * qemu-kvm/uq/master:
        kvm: Fix build for non-CAP_IRQ_ROUTING targets
      6e72ae46
    • J
      kvm: Fix build for non-CAP_IRQ_ROUTING targets · d3d3bef0
      Jan Kiszka 提交于
      A type definition and a KVMState field initialization escaped the
      required wrapping with KVM_CAP_IRQ_ROUTING. Also, we need to provide a
      dummy kvm_irqchip_release_virq as virtio-pci references (but does not
      use) it.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Acked-by: NBen Collins <bcollins@ubuntu.com>
      Tested-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d3d3bef0
  5. 05 6月, 2012 31 次提交