01 May, 2012

1 commit


08 Mar, 2012

1 commit

  • In handle_stop() handle the stop bit before doing the store status as
    described for "Stop and Store Status" in the Principles of Operation.
    We have to give up the local_int.lock before calling kvm store status
    since it calls gmap_fault() which might sleep. Since local_int.lock
    only protects local_int.* and not guest memory we can give up the lock.

    Signed-off-by: Jens Freimann
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Marcelo Tosatti
    Signed-off-by: Avi Kivity

    Jens Freimann
     

05 Mar, 2012

1 commit


17 Nov, 2011

1 commit

  • CPUSTAT_RUNNING was implemented signifying that a vcpu is not stopped.
    This is not, however, what the architecture says: RUNNING should be
    set when the host is acting on the behalf of the guest operating
    system.

    CPUSTAT_RUNNING has been changed to be set in kvm_arch_vcpu_load()
    and to be unset in kvm_arch_vcpu_put().

    For signifying stopped state of a vcpu, a host-controlled bit has
    been used and is set/unset basically on the reverse as the old
    CPUSTAT_RUNNING bit (including pushing it down into stop handling
    proper in handle_stop()).

    Cc: stable@kernel.org
    Signed-off-by: Cornelia Huck
    Signed-off-by: Carsten Otte
    Signed-off-by: Avi Kivity

    Cornelia Huck
     

24 Jul, 2011

3 commits

  • This patch removes kvm-s390 internal assumption of a linear mapping
    of guest address space to user space. Previously, guest memory was
    translated to user addresses using a fixed offset (gmsor). The new
    code uses gmap_fault to resolve guest addresses.

    Signed-off-by: Carsten Otte
    Signed-off-by: Martin Schwidefsky

    Carsten Otte
     
  • This patch switches kvm from using (Qemu's) user address space to
    Martin's gmap address space. This way QEMU does not have to use a
    linker script in order to fit large guests at low addresses in its
    address space.

    Signed-off-by: Carsten Otte
    Signed-off-by: Martin Schwidefsky

    Carsten Otte
     
  • When running a kvm guest we can get intercepts for tprot, if the host
    page table is read-only or not populated. This patch implements the
    most common case (linux memory detection).
    This also allows host copy on write for guest memory on newer systems.

    Signed-off-by: Christian Borntraeger
    Signed-off-by: Martin Schwidefsky

    Christian Borntraeger
     

01 Aug, 2010

1 commit


27 Feb, 2010

1 commit


25 Jan, 2010

1 commit

  • kvm_handle_sie_intercept uses a jump table to get the intercept handler
    for a SIE intercept. Static code analysis revealed a potential problem:
    the intercept_funcs jump table was defined to contain (0x48 >> 2) entries,
    but we only checked for code > 0x48 which would cause an off-by-one
    array overflow if code == 0x48.

    Use the compiler and ARRAY_SIZE to automatically set the limits.

    Cc: stable@kernel.org
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Marcelo Tosatti

    Christian Borntraeger
     

10 Sep, 2009

2 commits

  • This patch relocates the variables kvm-s390 uses to track guest mem addr/size.
    As discussed dropping the variables at struct kvm_arch level allows to use the
    common vcpu->request based mechanism to reload guest memory if e.g. changes
    via set_memory_region.

    The kick mechanism introduced in this series is used to ensure running vcpus
    leave guest state to catch the update.

    Signed-off-by: Christian Ehrhardt
    Signed-off-by: Avi Kivity

    Christian Ehrhardt
     
  • To ensure vcpu's come out of guest context in certain cases this patch adds a
    s390 specific way to kick them out of guest context. Currently it kicks them
    out to rerun the vcpu_run path in the s390 code, but the mechanism itself is
    expandable and with a new flag we could also add e.g. kicks to userspace etc.

    Signed-off-by: Christian Ehrhardt
    Signed-off-by: Avi Kivity

    Christian Ehrhardt
     

10 Jun, 2009

1 commit

  • This patch adds a sanity check for the content of the guest
    prefix register content before faulting in the cpu lowcore
    that it refers to. The guest might end up in an endless loop
    where SIE complains about missing lowcore with incorrect
    content of the prefix register without this fix.

    Reported-by: Mijo Safradin
    Signed-off-by: Carsten Otte
    Signed-off-by: Christian Ehrhardt
    Signed-off-by: Avi Kivity

    Carsten Otte
     

24 Mar, 2009

1 commit

  • The kernel handles some priviledged instruction exits. While I was
    unable to trigger such an exit from guest userspace, the code should
    check for supervisor state before emulating a priviledged instruction.

    I also renamed kvm_s390_handle_priv to kvm_s390_handle_b2. After all
    there are non priviledged b2 instructions like stck (store clock).

    Signed-off-by: Christian Borntraeger
    Signed-off-by: Avi Kivity

    Christian Borntraeger
     

27 Jul, 2008

2 commits


07 May, 2008

1 commit

  • From: Martin Schwidefsky

    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: Carsten Otte
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Martin Schwidefsky

    Christian Borntraeger
     

27 Apr, 2008

5 commits

  • 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: Martin Schwidefsky
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Carsten Otte
    Signed-off-by: Avi Kivity

    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: Martin Schwidefsky
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Carsten Otte
    Signed-off-by: Carsten Otte
    Signed-off-by: Avi Kivity

    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: Martin Schwidefsky
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Heiko Carstens
    Signed-off-by: Carsten Otte
    Signed-off-by: Avi Kivity

    Christian Borntraeger
     
  • 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: Martin Schwidefsky
    Signed-off-by: Heiko Carstens
    Signed-off-by: Carsten Otte
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Avi Kivity

    Carsten Otte
     
  • 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: Martin Schwidefsky
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Carsten Otte
    Signed-off-by: Avi Kivity

    Christian Borntraeger