1. 20 6月, 2016 1 次提交
    • E
      coccinelle: Remove unnecessary variables for function return value · 9be38598
      Eduardo Habkost 提交于
      Use Coccinelle script to replace 'ret = E; return ret' with
      'return E'. The script will do the substitution only when the
      function return type and variable type are the same.
      
      Manual fixups:
      
      * audio/audio.c: coding style of "read (...)" and "write (...)"
      * block/qcow2-cluster.c: wrap line to make it shorter
      * block/qcow2-refcount.c: change indentation of wrapped line
      * target-tricore/op_helper.c: fix coding style of
        "remainder|quotient"
      * target-mips/dsp_helper.c: reverted changes because I don't
        want to argue about checkpatch.pl
      * ui/qemu-pixman.c: fix line indentation
      * block/rbd.c: restore blank line between declarations and
        statements
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1465855078-19435-4-git-send-email-ehabkost@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Unused Coccinelle rule name dropped along with a redundant comment;
      whitespace touched up in block/qcow2-cluster.c; stale commit message
      paragraph deleted]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9be38598
  2. 17 6月, 2016 2 次提交
    • C
      target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data · 494e95e9
      Chao Peng 提交于
      KVM_GET_SUPPORTED_CPUID ioctl is called frequently when initializing
      CPU. Depends on CPU features and CPU count, the number of calls can be
      extremely high which slows down QEMU booting significantly. In our
      testing, we saw 5922 calls with switches:
      
          -cpu SandyBridge -smp 6,sockets=6,cores=1,threads=1
      
      This ioctl takes more than 100ms, which is almost half of the total
      QEMU startup time.
      
      While for most cases the data returned from two different invocations
      are not changed, that means, we can cache the data to avoid trapping
      into kernel for the second time. To make sure the cache safe one
      assumption is desirable: the ioctl is stateless. This is not true for
      CPUID leaves in general (such as CPUID leaf 0xD, whose value depends
      on guest XCR0 and IA32_XSS) but it is true of KVM_GET_SUPPORTED_CPUID,
      which runs before there is a value for XCR0 and IA32_XSS.
      Signed-off-by: NChao Peng <chao.p.peng@linux.intel.com>
      Message-Id: <1465784487-23482-1-git-send-email-chao.p.peng@linux.intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      494e95e9
    • P
      os-posix: include sys/mman.h · 02d0e095
      Paolo Bonzini 提交于
      qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check
      is bogus without a previous inclusion of sys/mman.h.  Include it in
      sysemu/os-posix.h and remove it from everywhere else.
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      02d0e095
  3. 29 5月, 2016 1 次提交
  4. 24 5月, 2016 7 次提交
  5. 19 5月, 2016 1 次提交
  6. 05 4月, 2016 2 次提交
  7. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  8. 15 3月, 2016 1 次提交
    • D
      hyperv: cpu hotplug fix with HyperV enabled · 4467c6c1
      Denis V. Lunev 提交于
      With Hyper-V enabled CPU hotplug stops working. The CPU appears
      in device manager on Windows but does not appear in peformance
      monitor and control panel.
      
      The root of the problem is the following. Windows checks
      HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE bit in CPUID. The
      presence of this bit is enough to cure the situation.
      
      The bit should be set when CPU hotplug is allowed for HyperV VM.
      The check that hot_add_cpu callback is defined is enough from the
      protocol point of view. Though this callback is defined almost
      always thus there is no need to export that knowledge in the
      other way.
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Reviewed-by: NRoman Kagan <rkagan@virtuozzo.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Eduardo Habkost <ehabkost@redhat.com>
      CC: "Andreas Färber" <afaerber@suse.de>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      4467c6c1
  9. 13 2月, 2016 2 次提交
  10. 29 1月, 2016 1 次提交
    • P
      x86: Clean up includes · b6a0aa05
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1453832250-766-11-git-send-email-peter.maydell@linaro.org
      b6a0aa05
  11. 21 1月, 2016 5 次提交
  12. 18 12月, 2015 2 次提交
    • M
      target-i386: kvm: clear unusable segments' flags in migration · 4cae9c97
      Michael Chapman 提交于
      This commit fixes migration of a QEMU/KVM guest from kernel >= v3.9 to
      kernel <= v3.7 (e.g. from RHEL 7 to RHEL 6). Without this commit a guest
      migrated across these kernel versions fails to resume on the target host
      as its segment descriptors are invalid.
      
      Two separate kernel commits combined together to result in this bug:
      
        commit f0495f9b9992f80f82b14306946444b287193390
        Author: Avi Kivity <avi@redhat.com>
        Date:   Thu Jun 7 17:06:10 2012 +0300
      
            KVM: VMX: Relax check on unusable segment
      
            Some userspace (e.g. QEMU 1.1) munge the d and g bits of segment
            descriptors, causing us not to recognize them as unusable segments
            with emulate_invalid_guest_state=1.  Relax the check by testing for
            segment not present (a non-present segment cannot be usable).
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      
        commit 25391454e73e3156202264eb3c473825afe4bc94
        Author: Gleb Natapov <gleb@redhat.com>
        Date:   Mon Jan 21 15:36:46 2013 +0200
      
            KVM: VMX: don't clobber segment AR of unusable segments.
      
            Usability is returned in unusable field, so not need to clobber entire
            AR. Callers have to know how to deal with unusable segments already
            since if emulate_invalid_guest_state=true AR is not zeroed.
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      
      The first commit changed the KVM_SET_SREGS ioctl so that it did no treat
      segment flags == 0 as an unusable segment, instead only looking at the
      "present" flag.
      
      The second commit changed KVM_GET_SREGS so that it did not clear the
      flags of an unusable segment.
      
      Since QEMU does not itself maintain the "unusable" flag across a
      migration, the end result is that unusable segments read from a kernel
      with these commits and loaded into a kernel without these commits are
      not properly recognised as being unusable.
      
      This commit updates both get_seg and set_seg so that the problem is
      avoided even when migrating to or migrating from a QEMU without this
      commit. In get_seg, we clear the segment flags if the segment is marked
      unusable. In set_seg, we mark the segment unusable if the segment's
      "present" flag is not set.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      Message-Id: <1449464047-17467-1-git-send-email-mike@very.puzzling.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4cae9c97
    • P
      kvm: x86: add support for KVM_CAP_SPLIT_IRQCHIP · 15eafc2e
      Paolo Bonzini 提交于
      This patch adds support for split IRQ chip mode. When
      KVM_CAP_SPLIT_IRQCHIP is enabled:
      
          1.) The PIC, PIT, and IOAPIC are implemented in userspace while
          the LAPIC is implemented by KVM.
      
          2.) The software IOAPIC delivers interrupts to the KVM LAPIC via
          kvm_set_irq. Interrupt delivery is configured via the MSI routing
          table, for which routes are reserved in target-i386/kvm.c then
          configured in hw/intc/ioapic.c
      
          3.) KVM delivers IOAPIC EOIs via a new exit KVM_EXIT_IOAPIC_EOI,
          which is handled in target-i386/kvm.c and relayed to the software
          IOAPIC via ioapic_eoi_broadcast.
      Signed-off-by: NMatt Gingell <gingell@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      15eafc2e
  13. 17 12月, 2015 3 次提交
    • A
      target-i386/kvm: Hyper-V SynIC timers MSR's support · ff99aa64
      Andrey Smetanin 提交于
      Hyper-V SynIC timers are host timers that are configurable
      by guest through corresponding MSR's (HV_X64_MSR_STIMER*).
      Guest setup and use fired by host events(SynIC interrupt
      and appropriate timer expiration message) as guest clock
      events.
      
      The state of Hyper-V SynIC timers are stored in corresponding
      MSR's. This patch seria implements such MSR's support and migration.
      Signed-off-by: NAndrey Smetanin <asmetanin@virtuozzo.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Eduardo Habkost <ehabkost@redhat.com>
      CC: "Andreas Färber" <afaerber@suse.de>
      CC: Marcelo Tosatti <mtosatti@redhat.com>
      CC: Denis V. Lunev <den@openvz.org>
      CC: Roman Kagan <rkagan@virtuozzo.com>
      CC: kvm@vger.kernel.org
      
      Message-Id: <1448464885-8300-3-git-send-email-asmetanin@virtuozzo.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ff99aa64
    • A
      target-i386/hyperv: Hyper-V SynIC SINT routing and vcpu exit · 50efe82c
      Andrey Smetanin 提交于
      Hyper-V SynIC(synthetic interrupt controller) helpers for
      Hyper-V SynIC irq routing setup, irq injection, irq ack
      notifications event/message pages changes tracking for future use.
      Signed-off-by: NAndrey Smetanin <asmetanin@virtuozzo.com>
      Reviewed-by: NRoman Kagan <rkagan@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Eduardo Habkost <ehabkost@redhat.com>
      CC: "Andreas Färber" <afaerber@suse.de>
      CC: Marcelo Tosatti <mtosatti@redhat.com>
      CC: Roman Kagan <rkagan@virtuozzo.com>
      CC: Denis V. Lunev <den@openvz.org>
      CC: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      50efe82c
    • A
      target-i386/kvm: Hyper-V SynIC MSR's support · 866eea9a
      Andrey Smetanin 提交于
      This patch does Hyper-V Synthetic interrupt
      controller(Hyper-V SynIC) MSR's support and
      migration. Hyper-V SynIC is enabled by cpu's
      'hv-synic' option.
      
      This patch does not allow cpu creation if
      'hv-synic' option specified but kernel
      doesn't support Hyper-V SynIC.
      
      Changes v3:
      * removed 'msr_hv_synic_version' migration because
      it's value always the same
      * moved SynIC msr's initialization into kvm_arch_init_vcpu
      Signed-off-by: NAndrey Smetanin <asmetanin@virtuozzo.com>
      Reviewed-by: NRoman Kagan <rkagan@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Richard Henderson <rth@twiddle.net>
      CC: Eduardo Habkost <ehabkost@redhat.com>
      CC: "Andreas Färber" <afaerber@suse.de>
      CC: Marcelo Tosatti <mtosatti@redhat.com>
      CC: Roman Kagan <rkagan@virtuozzo.com>
      CC: Denis V. Lunev <den@openvz.org>
      CC: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      866eea9a
  14. 26 11月, 2015 3 次提交
  15. 05 11月, 2015 1 次提交
    • L
      kvmclock: add a new function to update env->tsc. · 0fd7e098
      Liang Li 提交于
      The commit 317b0a6d fixed an issue which caused by the outdated
      env->tsc value, but the fix lead to 'cpu_synchronize_all_states()'
      called twice during live migration. The 'cpu_synchronize_all_states()'
      takes about 130us for a VM which has 4 vcpus, it's a bit expensive.
      
      Synchronize the whole CPU context just for updating env->tsc is too
      wasting, this patch use a new function to update the env->tsc.
      Comparing to 'cpu_synchronize_all_states()', it only takes about 20us.
      Signed-off-by: NLiang Li <liang.z.li@intel.com>
      Message-Id: <1446695464-27116-2-git-send-email-liang.z.li@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0fd7e098
  16. 19 10月, 2015 3 次提交
  17. 13 10月, 2015 3 次提交
  18. 03 10月, 2015 1 次提交