From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFKy-0001UX-3t for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQFKu-0002Lg-9i for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:44 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:33765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFKt-0002LB-VD for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:15:40 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Feb 2015 13:15:37 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 94E442190046 for ; Tue, 24 Feb 2015 13:15:29 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1ODFah93932504 for ; Tue, 24 Feb 2015 13:15:36 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1ODFYBh025135 for ; Tue, 24 Feb 2015 06:15:35 -0700 From: Jens Freimann Date: Tue, 24 Feb 2015 14:15:25 +0100 Message-Id: <1424783731-43426-5-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1424783731-43426-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1424783731-43426-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 04/10] s390x/kvm: helper to set the SIGP status in SigpInfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Alexander Graf , Cornelia Huck Cc: David Hildenbrand , Jens Freimann , qemu-devel@nongnu.org From: David Hildenbrand Whenever we set the SIGP status in the status register, we have to wipe out the lower 4 bytes and keep the higher 4 bytes. Also the condition code will always be set to STATUS_STORED. Let's introduce the wrapper for SigpInfo, as this will avoid most duplicate code in the future. Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Jens Freimann Signed-off-by: David Hildenbrand --- target-s390x/kvm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 1f4a4b1..fb0ce6d 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -1105,6 +1105,13 @@ typedef struct SigpInfo { uint64_t *status_reg; } SigpInfo; +static void set_sigp_status(SigpInfo *si, uint64_t status) +{ + *si->status_reg &= 0xffffffff00000000ULL; + *si->status_reg |= status; + si->cc = SIGP_CC_STATUS_STORED; +} + static void sigp_start(void *arg) { SigpInfo *si = arg; @@ -1189,9 +1196,7 @@ static int handle_sigp_single_dst(S390CPU *dst_cpu, uint8_t order, break; default: DPRINTF("KVM: unknown SIGP: 0x%x\n", order); - *status_reg &= 0xffffffff00000000ULL; - *status_reg |= SIGP_STAT_INVALID_ORDER; - si.cc = SIGP_CC_STATUS_STORED; + set_sigp_status(&si, SIGP_STAT_INVALID_ORDER); } return si.cc; -- 2.1.4