1. 10 6月, 2009 2 次提交
    • S
      KVM: Enable MSI-X for KVM assigned device · d510d6cc
      Sheng Yang 提交于
      This patch finally enable MSI-X.
      
      What we need for MSI-X:
      1. Intercept one page in MMIO region of device. So that we can get guest desired
      MSI-X table and set up the real one. Now this have been done by guest, and
      transfer to kernel using ioctl KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY.
      
      2. Information for incoming interrupt. Now one device can have more than one
      interrupt, and they are all handled by one workqueue structure. So we need to
      identify them. The previous patch enable gsi_msg_pending_bitmap get this done.
      
      3. Mapping from host IRQ to guest gsi as well as guest gsi to real MSI/MSI-X
      message address/data. We used same entry number for the host and guest here, so
      that it's easy to find the correlated guest gsi.
      
      What we lack for now:
      1. The PCI spec said nothing can existed with MSI-X table in the same page of
      MMIO region, except pending bits. The patch ignore pending bits as the first
      step (so they are always 0 - no pending).
      
      2. The PCI spec allowed to change MSI-X table dynamically. That means, the OS
      can enable MSI-X, then mask one MSI-X entry, modify it, and unmask it. The patch
      didn't support this, and Linux also don't work in this way.
      
      3. The patch didn't implement MSI-X mask all and mask single entry. I would
      implement the former in driver/pci/msi.c later. And for single entry, userspace
      should have reposibility to handle it.
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d510d6cc
    • S
      KVM: Ioctls for init MSI-X entry · c1e01514
      Sheng Yang 提交于
      Introduce KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY two ioctls.
      
      This two ioctls are used by userspace to specific guest device MSI-X entry
      number and correlate MSI-X entry with GSI during the initialization stage.
      
      MSI-X should be well initialzed before enabling.
      
      Don't support change MSI-X entry number for now.
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      c1e01514
  2. 22 4月, 2009 1 次提交
  3. 24 3月, 2009 11 次提交
  4. 15 2月, 2009 1 次提交
  5. 16 1月, 2009 1 次提交
  6. 31 12月, 2008 5 次提交
  7. 28 10月, 2008 1 次提交
  8. 15 10月, 2008 9 次提交
  9. 25 8月, 2008 1 次提交
    • A
      KVM: fix userspace ABI breakage · 1327138e
      Adrian Bunk 提交于
      The following part of commit 9ef621d3
      (KVM: Support mixed endian machines) changed on the size of a struct
      that is exported to userspace:
      
      include/linux/kvm.h:
      
      @@ -318,14 +318,14 @@ struct kvm_trace_rec {
       	__u32 vcpu_id;
       	union {
       		struct {
      -			__u32 cycle_lo, cycle_hi;
      +			__u64 cycle_u64;
       			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
       		} cycle;
       		struct {
       			__u32 extra_u32[KVM_TRC_EXTRA_MAX];
       		} nocycle;
       	} u;
      -};
      +} __attribute__((packed));
      
      Packing a struct was the correct idea, but it packed the wrong struct.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      1327138e
  10. 29 7月, 2008 1 次提交
  11. 20 7月, 2008 2 次提交
    • T
      KVM: Support mixed endian machines · 9ef621d3
      Tan, Li 提交于
      Currently kvmtrace is not portable. This will prevent from copying a
      trace file from big-endian target to little-endian workstation for analysis.
      In the patch, kernel outputs metadata containing a magic number to trace
      log, and changes 64-bit words to be u64 instead of a pair of u32s.
      Signed-off-by: NTan Li <li.tan@intel.com>
      Acked-by: NJerone Young <jyoung5@us.ibm.com>
      Acked-by: NHollis Blanchard <hollisb@us.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      9ef621d3
    • L
      KVM: Add coalesced MMIO support (common part) · 5f94c174
      Laurent Vivier 提交于
      This patch adds all needed structures to coalesce MMIOs.
      Until an architecture uses it, it is not compiled.
      
      Coalesced MMIO introduces two ioctl() to define where are the MMIO zones that
      can be coalesced:
      
      - KVM_REGISTER_COALESCED_MMIO registers a coalesced MMIO zone.
        It requests one parameter (struct kvm_coalesced_mmio_zone) which defines
        a memory area where MMIOs can be coalesced until the next switch to
        user space. The maximum number of MMIO zones is KVM_COALESCED_MMIO_ZONE_MAX.
      
      - KVM_UNREGISTER_COALESCED_MMIO cancels all registered zones inside
        the given bounds (bounds are also given by struct kvm_coalesced_mmio_zone).
      
      The userspace client can check kernel coalesced MMIO availability by asking
      ioctl(KVM_CHECK_EXTENSION) for the KVM_CAP_COALESCED_MMIO capability.
      The ioctl() call to KVM_CAP_COALESCED_MMIO will return 0 if not supported,
      or the page offset where will be stored the ring buffer.
      The page offset depends on the architecture.
      
      After an ioctl(KVM_RUN), the first page of the KVM memory mapped points to
      a kvm_run structure. The offset given by KVM_CAP_COALESCED_MMIO is
      an offset to the coalesced MMIO ring expressed in PAGE_SIZE relatively
      to the address of the start of th kvm_run structure. The MMIO ring buffer
      is defined by the structure kvm_coalesced_mmio_ring.
      
      [akio: fix oops during guest shutdown]
      Signed-off-by: NLaurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: NAkio Takebe <takebe_akio@jp.fujitsu.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      5f94c174
  12. 27 4月, 2008 5 次提交
    • H
      KVM: ppc: Add DCR access information to struct kvm_run · b2312f05
      Hollis Blanchard 提交于
      Device Control Registers are essentially another address space found on PowerPC
      4xx processors, analogous to PIO on x86. DCRs are always 32 bits, and can be
      identified by a 32-bit number. We forward most DCR accesses to userspace for
      emulation (with the exception of CPR0 registers, which can be read directly
      for simplicity in timebase frequency determination).
      Signed-off-by: NHollis Blanchard <hollisb@us.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      b2312f05
    • M
      KVM: add ioctls to save/store mpstate · 62d9f0db
      Marcelo Tosatti 提交于
      So userspace can save/restore the mpstate during migration.
      
      [avi: export the #define constants describing the value]
      [christian: add s390 stubs]
      [avi: ditto for ia64]
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      62d9f0db
    • F
      KVM: Add trace markers · 2714d1d3
      Feng (Eric) Liu 提交于
      Trace markers allow userspace to trace execution of a virtual machine
      in order to monitor its performance.
      Signed-off-by: NFeng (Eric) Liu <eric.e.liu@intel.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      2714d1d3
    • C
      KVM: s390: intercepts for diagnose instructions · e28acfea
      Christian Borntraeger 提交于
      This patch introduces interpretation of some diagnose instruction intercepts.
      Diagnose is our classic architected way of doing a hypercall. This patch
      features the following diagnose codes:
      - vm storage size, that tells the guest about its memory layout
      - time slice end, which is used by the guest to indicate that it waits
        for a lock and thus cannot use up its time slice in a useful way
      - ipl functions, which a guest can use to reset and reboot itself
      
      In order to implement ipl functions, we also introduce an exit reason that
      causes userspace to perform various resets on the virtual machine. All resets
      are described in the principles of operation book, except KVM_S390_RESET_IPL
      which causes a reboot of the machine.
      Acked-by: NMartin Schwidefsky <martin.schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      e28acfea
    • C
      KVM: s390: interrupt subsystem, cpu timer, waitpsw · ba5c1e9b
      Carsten Otte 提交于
      This patch contains the s390 interrupt subsystem (similar to in kernel apic)
      including timer interrupts (similar to in-kernel-pit) and enabled wait
      (similar to in kernel hlt).
      
      In order to achieve that, this patch also introduces intercept handling
      for instruction intercepts, and it implements load control instructions.
      
      This patch introduces an ioctl KVM_S390_INTERRUPT which is valid for both
      the vm file descriptors and the vcpu file descriptors. In case this ioctl is
      issued against a vm file descriptor, the interrupt is considered floating.
      Floating interrupts may be delivered to any virtual cpu in the configuration.
      
      The following interrupts are supported:
      SIGP STOP       - interprocessor signal that stops a remote cpu
      SIGP SET PREFIX - interprocessor signal that sets the prefix register of a
                        (stopped) remote cpu
      INT EMERGENCY   - interprocessor interrupt, usually used to signal need_reshed
                        and for smp_call_function() in the guest.
      PROGRAM INT     - exception during program execution such as page fault, illegal
                        instruction and friends
      RESTART         - interprocessor signal that starts a stopped cpu
      INT VIRTIO      - floating interrupt for virtio signalisation
      INT SERVICE     - floating interrupt for signalisations from the system
                        service processor
      
      struct kvm_s390_interrupt, which is submitted as ioctl parameter when injecting
      an interrupt, also carrys parameter data for interrupts along with the interrupt
      type. Interrupts on s390 usually have a state that represents the current
      operation, or identifies which device has caused the interruption on s390.
      
      kvm_s390_handle_wait() does handle waitpsw in two flavors: in case of a
      disabled wait (that is, disabled for interrupts), we exit to userspace. In case
      of an enabled wait we set up a timer that equals the cpu clock comparator value
      and sleep on a wait queue.
      
      [christian: change virtio interrupt to 0x2603]
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      ba5c1e9b