1. 27 4月, 2008 4 次提交
    • 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