From patchwork Mon Jan 21 10:45:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10773535 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 381201575 for ; Mon, 21 Jan 2019 10:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27CFF29E32 for ; Mon, 21 Jan 2019 10:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C64B29E35; Mon, 21 Jan 2019 10:46:12 +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 9D3D029E32 for ; Mon, 21 Jan 2019 10:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727721AbfAUKqK (ORCPT ); Mon, 21 Jan 2019 05:46:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52052 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727623AbfAUKqJ (ORCPT ); Mon, 21 Jan 2019 05:46:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DBACD4030; Mon, 21 Jan 2019 10:46:09 +0000 (UTC) Received: from thuth.com (ovpn-116-152.ams2.redhat.com [10.36.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C9A665922; Mon, 21 Jan 2019 10:46:07 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?b?UmFk?= =?utf-8?b?aW0gS3LEjW3DocWZ?= Cc: David Hildenbrand , Janosch Frank Subject: [kvm-unit-tests PULL 03/10] s390x: Add Sigp header file Date: Mon, 21 Jan 2019 11:45:48 +0100 Message-Id: <1548067555-15766-4-git-send-email-thuth@redhat.com> In-Reply-To: <1548067555-15766-1-git-send-email-thuth@redhat.com> References: <1548067555-15766-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 21 Jan 2019 10:46:09 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Janosch Frank 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 Signed-off-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..fbd94fc --- /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. + */ + +#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);