1. 10 6月, 2009 3 次提交
    • S
      KVM: Device assignment framework rework · e56d532f
      Sheng Yang 提交于
      After discussion with Marcelo, we decided to rework device assignment framework
      together. The old problems are kernel logic is unnecessary complex. So Marcelo
      suggest to split it into a more elegant way:
      
      1. Split host IRQ assign and guest IRQ assign. And userspace determine the
      combination. Also discard msi2intx parameter, userspace can specific
      KVM_DEV_IRQ_HOST_MSI | KVM_DEV_IRQ_GUEST_INTX in assigned_irq->flags to
      enable MSI to INTx convertion.
      
      2. Split assign IRQ and deassign IRQ. Import two new ioctls:
      KVM_ASSIGN_DEV_IRQ and KVM_DEASSIGN_DEV_IRQ.
      
      This patch also fixed the reversed _IOR vs _IOW in definition(by deprecated the
      old interface).
      
      [avi: replace homemade bitcount() by hweight_long()]
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      e56d532f
    • 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 4 次提交