From patchwork Thu Jan 10 15:41:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10756081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D1F46C2 for ; Thu, 10 Jan 2019 15:43:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C34329AED for ; Thu, 10 Jan 2019 15:43:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 300D529B07; Thu, 10 Jan 2019 15:43:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFFFC29AED for ; Thu, 10 Jan 2019 15:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729640AbfAJPnN (ORCPT ); Thu, 10 Jan 2019 10:43:13 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43212 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729534AbfAJPnM (ORCPT ); Thu, 10 Jan 2019 10:43:12 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0AFdrhd045475 for ; Thu, 10 Jan 2019 10:43:11 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2px8m6s12y-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Jan 2019 10:43:10 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Jan 2019 15:43:08 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 10 Jan 2019 15:43:06 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0AFh5i765929230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Jan 2019 15:43:05 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A2ABA4054; Thu, 10 Jan 2019 15:43:05 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9F2EA4062; Thu, 10 Jan 2019 15:43:04 +0000 (GMT) Received: from s38lp20.lnxne.boe (unknown [9.145.49.69]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 10 Jan 2019 15:43:04 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com Subject: [kvm-unit-tests PATCH v5 01/11] s390x: Add Sigp header file Date: Thu, 10 Jan 2019 16:41:41 +0100 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190110154151.24233-1-frankja@linux.ibm.com> References: <20190110154151.24233-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011015-0012-0000-0000-000002E60175 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011015-0013-0000-0000-0000211D0840 Message-Id: <20190110154151.24233-2-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-10_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100123 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The magic numbers for SIGP are not nice to read, so let's put them in a new header file. Also move sigp_stop() there, it will later be joined by more sigp functions and definitions. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth --- lib/s390x/asm/sigp.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/s390x/io.c | 11 +--------- 2 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 lib/s390x/asm/sigp.h diff --git a/lib/s390x/asm/sigp.h b/lib/s390x/asm/sigp.h new file mode 100644 index 0000000..899a66b --- /dev/null +++ b/lib/s390x/asm/sigp.h @@ -0,0 +1,60 @@ +/* + * SIGP related definitions. + * + * Copied from the Linux kernel file arch/s390/include/asm/sigp.h + * + * This work is licensed under the terms of the GNU GPL, version + * 2. See the COPYING file in the top-level directory. + */ + +#ifndef _ASM_S390X_SIGP_H_ +#define _ASM_S390X_SIGP_H_ + +/* SIGP order codes */ +#define SIGP_SENSE 1 +#define SIGP_EXTERNAL_CALL 2 +#define SIGP_EMERGENCY_SIGNAL 3 +#define SIGP_START 4 +#define SIGP_STOP 5 +#define SIGP_RESTART 6 +#define SIGP_STOP_AND_STORE_STATUS 9 +#define SIGP_INITIAL_CPU_RESET 11 +#define SIGP_CPU_RESET 12 +#define SIGP_SET_PREFIX 13 +#define SIGP_STORE_STATUS_AT_ADDRESS 14 +#define SIGP_SET_ARCHITECTURE 18 +#define SIGP_COND_EMERGENCY_SIGNAL 19 +#define SIGP_SENSE_RUNNING 21 +#define SIGP_SET_MULTI_THREADING 22 +#define SIGP_STORE_ADDITIONAL_STATUS 23 + +/* SIGP condition codes */ +#define SIGP_CC_ORDER_CODE_ACCEPTED 0 +#define SIGP_CC_STATUS_STORED 1 +#define SIGP_CC_BUSY 2 +#define SIGP_CC_NOT_OPERATIONAL 3 + +/* SIGP cpu status bits */ + +#define SIGP_STATUS_INVALID_ORDER 0x00000002UL +#define SIGP_STATUS_CHECK_STOP 0x00000010UL +#define SIGP_STATUS_STOPPED 0x00000040UL +#define SIGP_STATUS_EXT_CALL_PENDING 0x00000080UL +#define SIGP_STATUS_INVALID_PARAMETER 0x00000100UL +#define SIGP_STATUS_INCORRECT_STATE 0x00000200UL +#define SIGP_STATUS_NOT_RUNNING 0x00000400UL + +#ifndef __ASSEMBLER__ + +static inline void sigp_stop(void) +{ + register unsigned long status asm ("1") = 0; + register unsigned long cpu asm ("2") = 0; + + asm volatile( + " sigp %0,%1,0(%2)\n" + : "+d" (status) : "d" (cpu), "d" (SIGP_STOP) : "cc"); +} + +#endif /* __ASSEMBLER__ */ +#endif /* _ASM_S390X_SIGP_H_ */ diff --git a/lib/s390x/io.c b/lib/s390x/io.c index 7bca637..fd33623 100644 --- a/lib/s390x/io.c +++ b/lib/s390x/io.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "sclp.h" extern char ipl_args[]; @@ -30,16 +31,6 @@ void puts(const char *s) spin_unlock(&lock); } -static void sigp_stop(void) -{ - register unsigned long status asm ("1") = 0; - register unsigned long cpu asm ("2") = 0; - - asm volatile( - " sigp %0,%1,0(%2)\n" - : "+d" (status) : "d" (cpu), "d" (5) : "cc"); -} - void setup(void) { setup_args_progname(ipl_args);