1. 10 6月, 2009 2 次提交
  2. 26 3月, 2009 2 次提交
    • H
      [S390] split/move machine check handler code · f5daba1d
      Heiko Carstens 提交于
      Split machine check handler code and move it to cio and kernel code
      where it belongs to. No functional change.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      f5daba1d
    • C
      [S390] Fix hypervisor detection for KVM · 92e6ecf3
      Christian Borntraeger 提交于
      Currently we use the cpuid (via STIDP instruction) to recognize LPAR,
      z/VM and KVM.
      The architecture states, that bit 0-7 of STIDP returns all zero, and
      if STIDP is executed in a virtual machine, the VM operating system
      will replace bits 0-7 with FF.
      
      KVM should not use FE to distinguish z/VM from KVM for interested
      guests. The proper way to detect the hypervisor is the STSI (Store
      System Information) instruction, which return information about the
      hypervisors via function code 3, selector1=2, selector2=2.
      
      This patch changes the detection routine of Linux to use STSI instead
      of STIDP. This detection is earlier than bootmem, we have to use a
      static buffer. Since STSI expects a 4kb block (4kb aligned) this
      patch also changes the init.data alignment for s390. As this section
      will be freed during boot, this should be no problem.
      
      Patch is tested with LPAR, z/VM, KVM on LPAR, and KVM under z/VM.
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      92e6ecf3
  3. 24 3月, 2009 1 次提交
    • J
      KVM: New guest debug interface · d0bfb940
      Jan Kiszka 提交于
      This rips out the support for KVM_DEBUG_GUEST and introduces a new IOCTL
      instead: KVM_SET_GUEST_DEBUG. The IOCTL payload consists of a generic
      part, controlling the "main switch" and the single-step feature. The
      arch specific part adds an x86 interface for intercepting both types of
      debug exceptions separately and re-injecting them when the host was not
      interested. Moveover, the foundation for guest debugging via debug
      registers is layed.
      
      To signal breakpoint events properly back to userland, an arch-specific
      data block is now returned along KVM_EXIT_DEBUG. For x86, the arch block
      contains the PC, the debug exception, and relevant debug registers to
      tell debug events properly apart.
      
      The availability of this new interface is signaled by
      KVM_CAP_SET_GUEST_DEBUG. Empty stubs for not yet supported archs are
      provided.
      
      Note that both SVM and VTX are supported, but only the latter was tested
      yet. Based on the experience with all those VTX corner case, I would be
      fairly surprised if SVM will work out of the box.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d0bfb940
  4. 15 2月, 2009 1 次提交
  5. 31 12月, 2008 3 次提交
  6. 27 7月, 2008 2 次提交
  7. 20 7月, 2008 5 次提交
  8. 07 6月, 2008 3 次提交
  9. 07 5月, 2008 1 次提交
    • C
      [S390] s390-kvm: leave sie context on work. Removes preemption requirement · 0eaeafa1
      Christian Borntraeger 提交于
      From: Martin Schwidefsky <schwidefsky@de.ibm.com>
      
      This patch fixes a bug with cpu bound guest on kvm-s390. Sometimes it
      was impossible to deliver a signal to a spinning guest. We used
      preemption as a circumvention. The preemption notifiers called
      vcpu_load, which checked for pending signals and triggered a host
      intercept. But even with preemption, a sigkill was not delivered
      immediately.
      
      This patch changes the low level host interrupt handler to check for the
      SIE  instruction, if TIF_WORK is set. In that case we change the
      instruction pointer of the return PSW to rerun the vcpu_run loop. The kvm
      code sees an intercept reason 0 if that happens. This patch adds accounting
      for these types of intercept as well.
      
      The advantages:
      - works with and without preemption
      - signals are delivered immediately
      - much better host latencies without preemption
      Acked-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0eaeafa1
  10. 27 4月, 2008 8 次提交
    • 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
    • H
      KVM: s390: Fix incorrect return value · 7e8e6ab4
      Heiko Carstens 提交于
      kvm_arch_vcpu_ioctl_run currently incorrectly always returns 0.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      7e8e6ab4
    • 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: interprocessor communication via sigp · 5288fbf0
      Christian Borntraeger 提交于
      This patch introduces in-kernel handling of _some_ sigp interprocessor
      signals (similar to ipi).
      kvm_s390_handle_sigp() decodes the sigp instruction and calls individual
      handlers depending on the operation requested:
      - sigp sense tries to retrieve information such as existence or running state
        of the remote cpu
      - sigp emergency sends an external interrupt to the remove cpu
      - sigp stop stops a remove cpu
      - sigp stop store status stops a remote cpu, and stores its entire internal
        state to the cpus lowcore
      - sigp set arch sets the architecture mode of the remote cpu. setting to
        ESAME (s390x 64bit) is accepted, setting to ESA/S390 (s390, 31 or 24 bit) is
        denied, all others are passed to userland
      - sigp set prefix sets the prefix register of a remote cpu
      
      For implementation of this, the stop intercept indication starts to get reused
      on purpose: a set of action bits defines what to do once a cpu gets stopped:
      ACTION_STOP_ON_STOP  really stops the cpu when a stop intercept is recognized
      ACTION_STORE_ON_STOP stores the cpu status to lowcore when a stop intercept is
                           recognized
      Acked-by: NMartin Schwidefsky <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: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      5288fbf0
    • C
      KVM: s390: intercepts for privileged instructions · 453423dc
      Christian Borntraeger 提交于
      This patch introduces in-kernel handling of some intercepts for privileged
      instructions:
      
      handle_set_prefix()        sets the prefix register of the local cpu
      handle_store_prefix()      stores the content of the prefix register to memory
      handle_store_cpu_address() stores the cpu number of the current cpu to memory
      handle_skey()              just decrements the instruction address and retries
      handle_stsch()             delivers condition code 3 "operation not supported"
      handle_chsc()              same here
      handle_stfl()              stores the facility list which contains the
                                 capabilities of the cpu
      handle_stidp()             stores cpu type/model/revision and such
      handle_stsi()              stores information about the system topology
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@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: NAvi Kivity <avi@qumranet.com>
      453423dc
    • 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
    • C
      KVM: s390: sie intercept handling · 8f2abe6a
      Christian Borntraeger 提交于
      This path introduces handling of sie intercepts in three flavors: Intercepts
      are either handled completely in-kernel by kvm_handle_sie_intercept(),
      or passed to userspace with corresponding data in struct kvm_run in case
      kvm_handle_sie_intercept() returns -ENOTSUPP.
      In case of partial execution in kernel with the need of userspace support,
      kvm_handle_sie_intercept() may choose to set up struct kvm_run and return
      -EREMOTE.
      
      The trivial intercept reasons are handled in this patch:
      handle_noop() just does nothing for intercepts that don't require our support
        at all
      handle_stop() is called when a cpu enters stopped state, and it drops out to
        userland after updating our vcpu state
      handle_validity() faults in the cpu lowcore if needed, or passes the request
        to userland
      Acked-by: NMartin Schwidefsky <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>
      8f2abe6a
    • H
      KVM: s390: arch backend for the kvm kernel module · b0c632db
      Heiko Carstens 提交于
      This patch contains the port of Qumranet's kvm kernel module to IBM zSeries
       (aka s390x, mainframe) architecture. It uses the mainframe's virtualization
      instruction SIE to run virtual machines with up to 64 virtual CPUs each.
      This port is only usable on 64bit host kernels, and can only run 64bit guest
      kernels. However, running 31bit applications in guest userspace is possible.
      
      The following source files are introduced by this patch
      arch/s390/kvm/kvm-s390.c    similar to arch/x86/kvm/x86.c, this implements all
                                  arch callbacks for kvm. __vcpu_run calls back into
                                  sie64a to enter the guest machine context
      arch/s390/kvm/sie64a.S      assembler function sie64a, which enters guest
                                  context via SIE, and switches world before and after                            that
      include/asm-s390/kvm_host.h contains all vital data structures needed to run
                                  virtual machines on the mainframe
      include/asm-s390/kvm.h      defines kvm_regs and friends for user access to
                                  guest register content
      arch/s390/kvm/gaccess.h     functions similar to uaccess to access guest memory
      arch/s390/kvm/kvm-s390.h    header file for kvm-s390 internals, extended by
                                  later patches
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@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: NAvi Kivity <avi@qumranet.com>
      b0c632db