From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: [PATCH 1/2]: kvm-s390: use guest flush inline function Date: Tue, 20 Dec 2011 12:40:25 +0100 Message-ID: <4EF07429.2000203@de.ibm.com> References: <4EF0577D.6010902@de.ibm.com> <4EF05AD0.8050808@redhat.com> <4EF05C9D.6040306@de.ibm.com> <4EF05EDA.2040604@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , KVM list , Alexander Graf , Cornelia Huck , Jens Freimann , Martin Schwidefsky , Heiko Carstens , Carsten Otte To: Avi Kivity Return-path: Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:42122 "EHLO e06smtp16.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771Ab1LTLky (ORCPT ); Tue, 20 Dec 2011 06:40:54 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Dec 2011 11:40:52 -0000 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBKBeonc2642022 for ; Tue, 20 Dec 2011 11:40:50 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBKBemCS012925 for ; Tue, 20 Dec 2011 04:40:50 -0700 In-Reply-To: <4EF05EDA.2040604@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Christian Borntraeger Move all open-coded guest flush operations into an inline function. Signed-off-by: Christian Borntraeger --- arch/s390/kvm/interrupt.c | 2 +- arch/s390/kvm/kvm-s390.c | 2 +- arch/s390/kvm/kvm-s390.h | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) Index: b/arch/s390/kvm/interrupt.c =================================================================== --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -237,7 +237,7 @@ static void __do_deliver_interrupt(struc inti->prefix.address); vcpu->stat.deliver_prefix_signal++; vcpu->arch.sie_block->prefix = inti->prefix.address; - vcpu->arch.sie_block->ihcpu = 0xffff; + flush_guest_cpu(vcpu); break; case KVM_S390_RESTART: Index: b/arch/s390/kvm/kvm-s390.c =================================================================== --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -291,7 +291,6 @@ static void kvm_s390_vcpu_initial_reset( vcpu->arch.sie_block->gpsw.mask = 0UL; vcpu->arch.sie_block->gpsw.addr = 0UL; vcpu->arch.sie_block->prefix = 0UL; - vcpu->arch.sie_block->ihcpu = 0xffff; vcpu->arch.sie_block->cputm = 0UL; vcpu->arch.sie_block->ckc = 0UL; vcpu->arch.sie_block->todpr = 0; @@ -301,6 +300,7 @@ static void kvm_s390_vcpu_initial_reset( vcpu->arch.guest_fpregs.fpc = 0; asm volatile("lfpc %0" : : "Q" (vcpu->arch.guest_fpregs.fpc)); vcpu->arch.sie_block->gbea = 1; + flush_guest_cpu(vcpu); } int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) Index: b/arch/s390/kvm/kvm-s390.h =================================================================== --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h @@ -1,7 +1,7 @@ /* * kvm_s390.h - definition for kvm on s390 * - * Copyright IBM Corp. 2008,2009 + * Copyright IBM Corp. 2008,2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2 only) @@ -47,6 +47,11 @@ static inline int __cpu_is_stopped(struc return atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOP_INT; } +static inline void flush_guest_cpu(struct kvm_vcpu *vcpu) +{ + vcpu->arch.sie_block->ihcpu = 0xffff; +} + int kvm_s390_handle_wait(struct kvm_vcpu *vcpu); enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer); void kvm_s390_tasklet(unsigned long parm);