From patchwork Tue Feb 9 13:49:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA1D8C433E0 for ; Tue, 9 Feb 2021 13:53:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 980CC64ED5 for ; Tue, 9 Feb 2021 13:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbhBINws (ORCPT ); Tue, 9 Feb 2021 08:52:48 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52150 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231825AbhBINvb (ORCPT ); Tue, 9 Feb 2021 08:51:31 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DaJVb075325; Tue, 9 Feb 2021 08:50:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=jgwAdQZx8Y11Zg7Rn/YHMxUc8hbJO/Y0dOkZhegUqxQ=; b=YxUeny8CezI/adGWGD/OugHDmbbz8hjbzjiw+cEoqrFmI7P23j0lClhK+p20xscbjkXF K99mF78XiXju8xqWYXQafPi6lemQeUOe9b24eWlsyMfVmb0M9Mow6PYscVkLJig25xbz iZmoooQbVQbnnGfCK+rNddsCE83eNMM8fwEyyk+5p+O1IBM+wQebt4VzwWAhXxXc/i06 mQ8g0nYq87b2zDPkuVXEJWvxNWzyPwQT8X54J/lG0RwfonkCEPJak6e44oNeZ5mRWUuZ 84g5DELGEFxi7dGJOM5rUa5kS0uCOHWvIeVbkXLSGkododPFsHJVCypvyEm5veuJrZOa Yw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 36ku3211bx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:48 -0500 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DaM1X075402; Tue, 9 Feb 2021 08:50:46 -0500 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 36ku3211b4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:46 -0500 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DRB9E031294; Tue, 9 Feb 2021 13:50:45 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 36hjr7sr4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:44 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DoWcR30736692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:32 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13281A4040; Tue, 9 Feb 2021 13:50:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 558D0A4057; Tue, 9 Feb 2021 13:50:41 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:41 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 1/8] s390x: Fix fpc store address in RESTORE_REGS_STACK Date: Tue, 9 Feb 2021 08:49:18 -0500 Message-Id: <20210209134925.22248-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090067 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The efpc stores in bits 32-63 of a register and we store a full 8 bytes to have the stack 8 byte aligned. This means that the fpc is stored at offset 4 but we load it from offset 0. Lets replace efpc with stfpc and get rid of the stg to store at offset 0. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Pierre Morel Reviewed-by: Thomas Huth --- s390x/macros.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/s390x/macros.S b/s390x/macros.S index 37a6a63e..e51a557a 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -54,8 +54,7 @@ .endr /* Save fpc, but keep stack aligned on 64bits */ slgfi %r15, 8 - efpc %r0 - stg %r0, 0(%r15) + stfpc 0(%r15) .endm /* Restore the register in reverse order */ From patchwork Tue Feb 9 13:49:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DDBBC433E6 for ; Tue, 9 Feb 2021 13:53:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2502564ED5 for ; Tue, 9 Feb 2021 13:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231998AbhBINxC (ORCPT ); Tue, 9 Feb 2021 08:53:02 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:2784 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231627AbhBINvc (ORCPT ); Tue, 9 Feb 2021 08:51:32 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DmVZI123000; Tue, 9 Feb 2021 08:50:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=acDEV1y9HGbYW54nGpND9mukG8jP4sy1FqCfQaP95+U=; b=RKw2TySUjC/QRhmqNpVlm1kPT8Kmd160b0OsbjC4KoyMvr9eVOYPYO+oDCZTDuJmsrx0 ge7q1x0ROhOG2AV68NUqR3JCz6AP8+mg0wFyrL5lht576TrbzdKXb6AC43/7Niw6Hj27 vwl2u9uh+sKAkmQ7wsDe/n9mnE5++sY3i5mCP7ivxF9KQrjMp0Ty3ZffjGwEVcMsqvJG m+mshySFZ/tfAEFZ4117m8zs9nny0QYNEjbCiB8L6S4bev4+2LnlbujTooOAgKgDiH9U F0eXDCs7qG8A+mXsiNmkYBFvJXuLgBlvjhHoEsOwfEDIjTwM6xbphsYd3uVq8pQXdy2F aQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 36kuktg185-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:47 -0500 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119Dol8V131580; Tue, 9 Feb 2021 08:50:47 -0500 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 36kuktg17t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:47 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DSYWL011149; Tue, 9 Feb 2021 13:50:45 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 36hqda36qr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:45 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DoXGJ32309554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:33 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2C64A4055; Tue, 9 Feb 2021 13:50:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AB99A4040; Tue, 9 Feb 2021 13:50:42 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:42 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 2/8] s390x: Fully commit to stack save area for exceptions Date: Tue, 9 Feb 2021 08:49:19 -0500 Message-Id: <20210209134925.22248-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090067 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Having two sets of macros for saving registers on exceptions makes maintaining harder. Also we have limited space in the lowcore to save stuff and by using the stack as a save area, we can stack exceptions. So let's use the SAVE/RESTORE_REGS_STACK as the default. When we also move the diag308 macro over we can remove the old SAVE/RESTORE_REGS macros. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/asm-offsets.c | 14 ++++++++---- lib/s390x/asm/arch_def.h | 29 ++++++++++++++++++----- lib/s390x/asm/interrupt.h | 4 ++-- lib/s390x/interrupt.c | 14 ++++++------ s390x/cstart64.S | 19 +++++++++------- s390x/macros.S | 48 +++++++++++++++++++++++---------------- 6 files changed, 82 insertions(+), 46 deletions(-) diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c index a19f14b9..a8942395 100644 --- a/lib/s390x/asm-offsets.c +++ b/lib/s390x/asm-offsets.c @@ -70,16 +70,22 @@ int main(void) OFFSET(GEN_LC_ARS_SA, lowcore, ars_sa); OFFSET(GEN_LC_CRS_SA, lowcore, crs_sa); OFFSET(GEN_LC_PGM_INT_TDB, lowcore, pgm_int_tdb); - OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[0]); - OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[1]); - OFFSET(__SF_SIE_REASON, stack_frame, empty1[2]); - OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[3]); + OFFSET(__SF_SIE_CONTROL, stack_frame, argument_area[0]); + OFFSET(__SF_SIE_SAVEAREA, stack_frame, argument_area[1]); + OFFSET(__SF_SIE_REASON, stack_frame, argument_area[2]); + OFFSET(__SF_SIE_FLAGS, stack_frame, argument_area[3]); OFFSET(SIE_SAVEAREA_HOST_GRS, vm_save_area, host.grs[0]); OFFSET(SIE_SAVEAREA_HOST_FPRS, vm_save_area, host.fprs[0]); OFFSET(SIE_SAVEAREA_HOST_FPC, vm_save_area, host.fpc); OFFSET(SIE_SAVEAREA_GUEST_GRS, vm_save_area, guest.grs[0]); OFFSET(SIE_SAVEAREA_GUEST_FPRS, vm_save_area, guest.fprs[0]); OFFSET(SIE_SAVEAREA_GUEST_FPC, vm_save_area, guest.fpc); + OFFSET(STACK_FRAME_INT_BACKCHAIN, stack_frame_int, back_chain); + OFFSET(STACK_FRAME_INT_FPC, stack_frame_int, fpc); + OFFSET(STACK_FRAME_INT_FPRS, stack_frame_int, fprs); + OFFSET(STACK_FRAME_INT_CR0, stack_frame_int, cr0); + OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0); + OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1); return 0; } diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 9c4e330a..eb6a961f 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -8,13 +8,30 @@ #ifndef _ASM_S390X_ARCH_DEF_H_ #define _ASM_S390X_ARCH_DEF_H_ -/* - * We currently only specify the stack frame members needed for the - * SIE library code. - */ struct stack_frame { - unsigned long back_chain; - unsigned long empty1[5]; + struct stack_frame *back_chain; + u64 reserved; + /* GRs 2 - 5 */ + unsigned long argument_area[4]; + /* GRs 6 - 15 */ + unsigned long grs[10]; + /* FPRs 0, 2, 4, 6 */ + s64 fprs[4]; +}; + +struct stack_frame_int { + struct stack_frame *back_chain; + u64 reserved; + /* + * The GRs are offset compatible with struct stack_frame so we + * can easily fetch GR14 for backtraces. + */ + u64 grs0[14]; + u64 grs1[2]; + u32 res; + u32 fpc; + u64 fprs[16]; + u64 cr0; }; struct psw { diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h index 1a2e2cd8..31e4766d 100644 --- a/lib/s390x/asm/interrupt.h +++ b/lib/s390x/asm/interrupt.h @@ -14,8 +14,8 @@ #define EXT_IRQ_SERVICE_SIG 0x2401 void register_pgm_cleanup_func(void (*f)(void)); -void handle_pgm_int(void); -void handle_ext_int(void); +void handle_pgm_int(struct stack_frame_int *stack); +void handle_ext_int(struct stack_frame_int *stack); void handle_mcck_int(void); void handle_io_int(void); void handle_svc_int(void); diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 1ce36073..94a2cf9c 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -56,7 +56,7 @@ void register_pgm_cleanup_func(void (*f)(void)) pgm_cleanup_func = f; } -static void fixup_pgm_int(void) +static void fixup_pgm_int(struct stack_frame_int *stack) { /* If we have an error on SIE we directly move to sie_exit */ if (lc->pgm_old_psw.addr >= (uint64_t)&sie_entry && @@ -76,7 +76,7 @@ static void fixup_pgm_int(void) /* Handling for iep.c test case. */ if (lc->trans_exc_id & 0x80UL && lc->trans_exc_id & 0x04UL && !(lc->trans_exc_id & 0x08UL)) - lc->pgm_old_psw.addr = lc->sw_int_grs[14]; + lc->pgm_old_psw.addr = stack->grs0[12]; break; case PGM_INT_CODE_SEGMENT_TRANSLATION: case PGM_INT_CODE_PAGE_TRANSLATION: @@ -115,7 +115,7 @@ static void fixup_pgm_int(void) /* suppressed/terminated/completed point already at the next address */ } -void handle_pgm_int(void) +void handle_pgm_int(struct stack_frame_int *stack) { if (!pgm_int_expected) { /* Force sclp_busy to false, otherwise we will loop forever */ @@ -130,10 +130,10 @@ void handle_pgm_int(void) if (pgm_cleanup_func) (*pgm_cleanup_func)(); else - fixup_pgm_int(); + fixup_pgm_int(stack); } -void handle_ext_int(void) +void handle_ext_int(struct stack_frame_int *stack) { if (!ext_int_expected && lc->ext_int_code != EXT_IRQ_SERVICE_SIG) { @@ -143,13 +143,13 @@ void handle_ext_int(void) } if (lc->ext_int_code == EXT_IRQ_SERVICE_SIG) { - lc->sw_int_crs[0] &= ~(1UL << 9); + stack->cr0 &= ~(1UL << 9); sclp_handle_ext(); } else { ext_int_expected = false; } - if (!(lc->sw_int_crs[0] & CR0_EXTM_MASK)) + if (!(stack->cr0 & CR0_EXTM_MASK)) lc->ext_old_psw.mask &= ~PSW_MASK_EXT; } diff --git a/s390x/cstart64.S b/s390x/cstart64.S index ace0c0d9..35d20293 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -92,33 +92,36 @@ memsetxc: .section .text pgm_int: - SAVE_REGS + SAVE_REGS_STACK + lgr %r2, %r15 brasl %r14, handle_pgm_int - RESTORE_REGS + RESTORE_REGS_STACK lpswe GEN_LC_PGM_OLD_PSW ext_int: - SAVE_REGS + SAVE_REGS_STACK + lgr %r2, %r15 brasl %r14, handle_ext_int - RESTORE_REGS + RESTORE_REGS_STACK lpswe GEN_LC_EXT_OLD_PSW mcck_int: - SAVE_REGS + SAVE_REGS_STACK brasl %r14, handle_mcck_int - RESTORE_REGS + RESTORE_REGS_STACK lpswe GEN_LC_MCCK_OLD_PSW io_int: SAVE_REGS_STACK + lgr %r2, %r15 brasl %r14, handle_io_int RESTORE_REGS_STACK lpswe GEN_LC_IO_OLD_PSW svc_int: - SAVE_REGS + SAVE_REGS_STACK brasl %r14, handle_svc_int - RESTORE_REGS + RESTORE_REGS_STACK lpswe GEN_LC_SVC_OLD_PSW .align 8 diff --git a/s390x/macros.S b/s390x/macros.S index e51a557a..1c8a0f7c 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -3,9 +3,10 @@ * s390x assembly macros * * Copyright (c) 2017 Red Hat Inc - * Copyright (c) 2020 IBM Corp. + * Copyright (c) 2020, 2021 IBM Corp. * * Authors: + * Janosch Frank * Pierre Morel * David Hildenbrand */ @@ -41,36 +42,45 @@ /* Save registers on the stack (r15), so we can have stacked interrupts. */ .macro SAVE_REGS_STACK - /* Allocate a stack frame for 15 general registers */ - slgfi %r15, 15 * 8 + /* Allocate a full stack frame */ + slgfi %r15, 32 * 8 + 4 * 8 /* Store registers r0 to r14 on the stack */ - stmg %r0, %r14, 0(%r15) - /* Allocate a stack frame for 16 floating point registers */ - /* The size of a FP register is the size of an double word */ - slgfi %r15, 16 * 8 + stmg %r2, %r15, STACK_FRAME_INT_GRS0(%r15) + stg %r0, STACK_FRAME_INT_GRS1(%r15) + stg %r1, STACK_FRAME_INT_GRS1 + 8(%r15) + /* Store the gr15 value before we allocated the new stack */ + lgr %r0, %r15 + algfi %r0, 32 * 8 + 4 * 8 + stg %r0, 13 * 8 + STACK_FRAME_INT_GRS0(%r15) + stg %r0, STACK_FRAME_INT_BACKCHAIN(%r15) + /* + * Store CR0 and load initial CR0 so AFP is active and we can + * access all fprs to save them. + */ + stctg %c0,%c0,STACK_FRAME_INT_CR0(%r15) + larl %r1, initial_cr0 + lctlg %c0, %c0, 0(%r1) /* Save fp register on stack: offset to SP is multiple of reg number */ .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - std \i, \i * 8(%r15) + std \i, \i * 8 + STACK_FRAME_INT_FPRS(%r15) .endr - /* Save fpc, but keep stack aligned on 64bits */ - slgfi %r15, 8 - stfpc 0(%r15) + /* Save fpc */ + stfpc STACK_FRAME_INT_FPC(%r15) .endm /* Restore the register in reverse order */ .macro RESTORE_REGS_STACK /* Restore fpc */ - lfpc 0(%r15) - algfi %r15, 8 + lfpc STACK_FRAME_INT_FPC(%r15) /* Restore fp register from stack: SP still where it was left */ /* and offset to SP is a multiple of reg number */ .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - ld \i, \i * 8(%r15) + ld \i, \i * 8 + STACK_FRAME_INT_FPRS(%r15) .endr - /* Now that we're done, rewind the stack pointer by 16 double word */ - algfi %r15, 16 * 8 + /* Load CR0 back */ + lctlg %c0, %c0, STACK_FRAME_INT_CR0(%r15) /* Load the registers from stack */ - lmg %r0, %r14, 0(%r15) - /* Rewind the stack by 15 double word */ - algfi %r15, 15 * 8 + lg %r0, STACK_FRAME_INT_GRS1(%r15) + lg %r1, STACK_FRAME_INT_GRS1 + 8(%r15) + lmg %r2, %r15, STACK_FRAME_INT_GRS0(%r15) .endm From patchwork Tue Feb 9 13:49:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BC53C433DB for ; Tue, 9 Feb 2021 13:53:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0CC864EE1 for ; Tue, 9 Feb 2021 13:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231739AbhBINww (ORCPT ); Tue, 9 Feb 2021 08:52:52 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14460 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231837AbhBINvb (ORCPT ); Tue, 9 Feb 2021 08:51:31 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119Dm0Gf126293; Tue, 9 Feb 2021 08:50:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=vr4Kycj4qsLBCKkAS63hmKfgiCRSaTd1pHFQ1yUBA8I=; b=k+n84joCIHuVp8zHY9Y3a5x/c8SlGOQFh4rrT1jNXdrvorDWP6PxaGJKyM4CyPjEInCE MxMZsvfNos9hYOTtLY4yoOMddU88FNiNkf3kIb5JAFutU65v6x1N558LP+i6YpN/gcUs 3zcwc+nbeaIVR9s49EP4CRG+wZMvjzjQNFI+rXnmTHo3dqwl/+FG/ae8ND0ElUiFzcXh QJtvBiuG6PJfmg4xZWy6rRHGRBXIqcoOPEhjsfThHunJ2XrlTMr2+UjyT3hpL1u2gMQw /XJZshsU9+uQlp2PlWAU+vMAkdnsLZbumYth5z9hSAyqxko0pSeQ4TKwdkcNo3zIVQ7K Xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 36kuke834g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:49 -0500 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119Dmu4n133720; Tue, 9 Feb 2021 08:50:49 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 36kuke833m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:48 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DSjWv024906; Tue, 9 Feb 2021 13:50:47 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 36j94wjm1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:46 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DoXlf35782988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:33 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0142A4051; Tue, 9 Feb 2021 13:50:43 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1679FA4059; Tue, 9 Feb 2021 13:50:43 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:42 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 3/8] RFC: s390x: Define STACK_FRAME_INT_SIZE macro Date: Tue, 9 Feb 2021 08:49:20 -0500 Message-Id: <20210209134925.22248-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090068 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Using sizeof is safer than using magic constants. However, it doesn't really fit into asm-offsets.h as it's not an offset so I'm happy to receive suggestions on where to put it. Signed-off-by: Janosch Frank --- lib/s390x/asm-offsets.c | 1 + s390x/macros.S | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c index a8942395..8eeb6dea 100644 --- a/lib/s390x/asm-offsets.c +++ b/lib/s390x/asm-offsets.c @@ -86,6 +86,7 @@ int main(void) OFFSET(STACK_FRAME_INT_CR0, stack_frame_int, cr0); OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0); OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1); + DEFINE(STACK_FRAME_INT_SIZE, sizeof(struct stack_frame_int)); return 0; } diff --git a/s390x/macros.S b/s390x/macros.S index 1c8a0f7c..9810d2ff 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -43,14 +43,14 @@ /* Save registers on the stack (r15), so we can have stacked interrupts. */ .macro SAVE_REGS_STACK /* Allocate a full stack frame */ - slgfi %r15, 32 * 8 + 4 * 8 + slgfi %r15, STACK_FRAME_INT_SIZE /* Store registers r0 to r14 on the stack */ stmg %r2, %r15, STACK_FRAME_INT_GRS0(%r15) stg %r0, STACK_FRAME_INT_GRS1(%r15) stg %r1, STACK_FRAME_INT_GRS1 + 8(%r15) /* Store the gr15 value before we allocated the new stack */ lgr %r0, %r15 - algfi %r0, 32 * 8 + 4 * 8 + algfi %r0, STACK_FRAME_INT_SIZE stg %r0, 13 * 8 + STACK_FRAME_INT_GRS0(%r15) stg %r0, STACK_FRAME_INT_BACKCHAIN(%r15) /* From patchwork Tue Feb 9 13:49:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F58C433DB for ; Tue, 9 Feb 2021 13:53:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91F4164EE1 for ; Tue, 9 Feb 2021 13:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231536AbhBINw4 (ORCPT ); Tue, 9 Feb 2021 08:52:56 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:6070 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231838AbhBINvc (ORCPT ); Tue, 9 Feb 2021 08:51:32 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DWTa7036302; Tue, 9 Feb 2021 08:50:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ByvLnKrYY+rMkq0ReAiSiW4ZyteOVq1bmi+FGSYuKBc=; b=YSW5KNTA63rVCAX6fPcC9084/Goj8Jvt7YFNORUZsL9ygb6mCfD8fgbIDJMqNUPiPq+O PMHNIZ8OVuPirve0wdW0Of86aRdvSpCaxNbPOwl/4EW/nSQ6P1XzRpMLIclH7sAFLbeL YCEoK/J0zQigaQq4PRC1TnjIg9erc5ZpkCvvt3mt0yvyS57cYoaovu3DzXhYMRXPpn+R dNER3sfLXqUEo+jwr8KnGwgnmFgO65lSZLC3cTJPZYrQSg3NMNyvJsl3U5kPzpjaEueC tko64w0bNtS+KV2q3EFrAIAHILiuhY0vlPcHh69Y2KpWZHvGd+DkImQUSHwd9BxQ1cvE ig== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku30h6jx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:50 -0500 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DX6hI039462; Tue, 9 Feb 2021 08:50:50 -0500 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku30h6j2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:50 -0500 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DTVFn011235; Tue, 9 Feb 2021 13:50:47 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 36hjr81r9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:47 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DoiHN38469940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:44 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B5B3A404D; Tue, 9 Feb 2021 13:50:44 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E76B4A4051; Tue, 9 Feb 2021 13:50:43 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:43 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 4/8] s390x: Introduce and use CALL_INT_HANDLER macro Date: Tue, 9 Feb 2021 08:49:21 -0500 Message-Id: <20210209134925.22248-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 mlxlogscore=940 mlxscore=0 bulkscore=0 suspectscore=0 impostorscore=0 phishscore=0 malwarescore=0 priorityscore=1501 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090067 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The ELF ABI dictates that we need to allocate 160 bytes of stack space for the C functions we're calling. Since we would need to do that for every interruption handler which, combined with the new stack argument being saved in GR2, makes cstart64.S look a bit messy. So let's introduce the CALL_INT_HANDLER macro that handles all of that, calls the C interrupt handler and handles cleanup afterwards. Signed-off-by: Janosch Frank --- s390x/cstart64.S | 28 +++++----------------------- s390x/macros.S | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 35d20293..666a9567 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -92,37 +92,19 @@ memsetxc: .section .text pgm_int: - SAVE_REGS_STACK - lgr %r2, %r15 - brasl %r14, handle_pgm_int - RESTORE_REGS_STACK - lpswe GEN_LC_PGM_OLD_PSW + CALL_INT_HANDLER handle_pgm_int, GEN_LC_PGM_OLD_PSW ext_int: - SAVE_REGS_STACK - lgr %r2, %r15 - brasl %r14, handle_ext_int - RESTORE_REGS_STACK - lpswe GEN_LC_EXT_OLD_PSW + CALL_INT_HANDLER handle_ext_int, GEN_LC_EXT_OLD_PSW mcck_int: - SAVE_REGS_STACK - brasl %r14, handle_mcck_int - RESTORE_REGS_STACK - lpswe GEN_LC_MCCK_OLD_PSW + CALL_INT_HANDLER handle_mcck_int, GEN_LC_MCCK_OLD_PSW io_int: - SAVE_REGS_STACK - lgr %r2, %r15 - brasl %r14, handle_io_int - RESTORE_REGS_STACK - lpswe GEN_LC_IO_OLD_PSW + CALL_INT_HANDLER handle_io_int, GEN_LC_IO_OLD_PSW svc_int: - SAVE_REGS_STACK - brasl %r14, handle_svc_int - RESTORE_REGS_STACK - lpswe GEN_LC_SVC_OLD_PSW + CALL_INT_HANDLER handle_svc_int, GEN_LC_SVC_OLD_PSW .align 8 initial_psw: diff --git a/s390x/macros.S b/s390x/macros.S index 9810d2ff..1678c821 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -11,6 +11,23 @@ * David Hildenbrand */ #include +/* + * Exception handler macro that saves registers on the stack, + * allocates stack space and calls the C handler function. Afterwards + * we re-load the registers and load the old PSW. + */ + .macro CALL_INT_HANDLER c_func, old_psw + SAVE_REGS_STACK + /* Save the stack address in GR2 which is the first function argument */ + lgr %r2, %r15 + /* Allocate stack pace for called C function, as specified in s390 ELF ABI */ + slgfi %r15, 160 + brasl %r14, \c_func + algfi %r15, 160 + RESTORE_REGS_STACK + lpswe \old_psw + .endm + .macro SAVE_REGS /* save grs 0-15 */ stmg %r0, %r15, GEN_LC_SW_INT_GRS From patchwork Tue Feb 9 13:49:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E902C433E0 for ; Tue, 9 Feb 2021 13:53:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E66D364EE1 for ; Tue, 9 Feb 2021 13:53:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231626AbhBINxL (ORCPT ); Tue, 9 Feb 2021 08:53:11 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:10634 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231842AbhBINvd (ORCPT ); Tue, 9 Feb 2021 08:51:33 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DWOwi172569; Tue, 9 Feb 2021 08:50:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=S8dvXIiy8agDEsyKoDBFzvGlDklevfSpUoONrKYP2gA=; b=tRuSOrzVFPODbGBJXvdu5UggD9jb5iG/0ulE48JP+24csmQcfrF/4uJ7z9dhZwA9zhuq /fdvLYxBrClG6GH3reiE5U6oigLwq9JdWG1Fl6KcRFcihilbVSIKgpQO3VBkVTjehsNr GDa4GPZV9SvHu3gfryXXskHdHFJWBbyerXs4h/M8rQs4wEEtXKBe2vhBQMz9+6iTOjSm cgibOeGr+Y28UQ2m4F0UXQiUrGwmM3EWFPToUbge7cc9SXpb+CVKhDkiubptbhoC2xVh SkJREWxXI+ud8YWAvTUqgoMMZu1gHjJ2B8rva0ZGafVS7Z3ilz39K+ZfamB5OHAvys/1 uw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36kts6a1yn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:51 -0500 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DWnwb174105; Tue, 9 Feb 2021 08:50:51 -0500 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 36kts6a1xn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:50 -0500 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DRBvY031291; Tue, 9 Feb 2021 13:50:48 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 36hjr7sr4n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:48 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DojSK47317454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77305A404D; Tue, 9 Feb 2021 13:50:45 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2D01A4059; Tue, 9 Feb 2021 13:50:44 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:44 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 5/8] s390x: Provide preliminary backtrace support Date: Tue, 9 Feb 2021 08:49:22 -0500 Message-Id: <20210209134925.22248-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090067 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org After the stack changes we can finally use -mbackchain and have a working backtrace. Signed-off-by: Janosch Frank --- lib/s390x/interrupt.c | 12 ++++++++++++ lib/s390x/stack.c | 20 ++++++++++++++------ s390x/Makefile | 1 + 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 94a2cf9c..49f98759 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -115,6 +115,18 @@ static void fixup_pgm_int(struct stack_frame_int *stack) /* suppressed/terminated/completed point already at the next address */ } +static void print_pgm_info(struct stack_frame_int *stack) + +{ + printf("\n"); + printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n", + lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, + lc->pgm_int_id); + dump_stack(); + report_summary(); + abort(); +} + void handle_pgm_int(struct stack_frame_int *stack) { if (!pgm_int_expected) { diff --git a/lib/s390x/stack.c b/lib/s390x/stack.c index 0fcd1afb..4cf80dae 100644 --- a/lib/s390x/stack.c +++ b/lib/s390x/stack.c @@ -3,24 +3,32 @@ * s390x stack implementation * * Copyright (c) 2017 Red Hat Inc + * Copyright 2021 IBM Corp * * Authors: * Thomas Huth * David Hildenbrand + * Janosch Frank */ #include #include +#include int backtrace_frame(const void *frame, const void **return_addrs, int max_depth) { - printf("TODO: Implement backtrace_frame(%p, %p, %d) function!\n", - frame, return_addrs, max_depth); - return 0; + int depth = 0; + struct stack_frame *stack = (struct stack_frame *)frame; + + for (depth = 0; stack && depth < max_depth; depth++) { + return_addrs[depth] = (void *)stack->grs[8]; + stack = stack->back_chain; + } + + return depth; } int backtrace(const void **return_addrs, int max_depth) { - printf("TODO: Implement backtrace(%p, %d) function!\n", - return_addrs, max_depth); - return 0; + return backtrace_frame(__builtin_frame_address(0), + return_addrs, max_depth); } diff --git a/s390x/Makefile b/s390x/Makefile index f3b0fccf..20bb5683 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -39,6 +39,7 @@ CFLAGS += -ffreestanding CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/s390x -I lib CFLAGS += -O2 CFLAGS += -march=zEC12 +CFLAGS += -mbackchain CFLAGS += -fno-delete-null-pointer-checks LDFLAGS += -nostdlib -Wl,--build-id=none From patchwork Tue Feb 9 13:49:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 340F9C433E0 for ; Tue, 9 Feb 2021 13:53:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDDE264ED5 for ; Tue, 9 Feb 2021 13:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbhBINxe (ORCPT ); Tue, 9 Feb 2021 08:53:34 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60746 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbhBINve (ORCPT ); Tue, 9 Feb 2021 08:51:34 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DZs3n018691; Tue, 9 Feb 2021 08:50:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ffN4dtclYl3195sk0gn9Qn9wjyD/yV2GyFtw3X7TPMA=; b=YdYog6dKblkz+Targ7w5iX/9cEZNsEAXiofGoIkc0gKQVbSQkWmq3E7U7bhdnkIuCBAk L2Gwub+0i5ma/8nWYSkY4m4+eYJ8oTZPLCHwdPcsz8q1MP6D33Ddwu27OTCF4N1kozPz enLuW9CBad+qx8AFf2l5z3nTOpa/XzoV9KA3rMAU8EqYx3awGA/ZdjKe7nivrHAg/b8m X2fzc8/S9tx7hC+X9BHOjjg+MP9BnVvrY7rMLhX3+f1aNOzfH48/ZoVIIN3nqGbwU9sN WiEXFJOocdRrTLfNP9NtfYBhYaHIRVk7/7nVom5SNGasKXn2JjH4tah1Ghvy0b0I7isG og== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku628rf6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:52 -0500 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DjUDh058313; Tue, 9 Feb 2021 08:50:51 -0500 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku628re1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:51 -0500 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DTVFo011235; Tue, 9 Feb 2021 13:50:49 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 36hjr81r9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:49 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119DokuE42598908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:46 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5237DA4051; Tue, 9 Feb 2021 13:50:46 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E6F1A4040; Tue, 9 Feb 2021 13:50:45 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:45 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 6/8] s390x: Print more information on program exceptions Date: Tue, 9 Feb 2021 08:49:23 -0500 Message-Id: <20210209134925.22248-7-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090068 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Currently we only get a single line of output if a test runs in a unexpected program exception. Let's also print the general registers to give soem more context. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Acked-by: Pierre Morel --- lib/s390x/interrupt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 49f98759..1686551a 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -115,6 +115,21 @@ static void fixup_pgm_int(struct stack_frame_int *stack) /* suppressed/terminated/completed point already at the next address */ } +static void print_int_regs(struct stack_frame_int *stack) +{ + printf("\n"); + printf("GPRS:\n"); + printf("%016lx %016lx %016lx %016lx\n", + stack->grs1[0], stack->grs1[1], stack->grs0[0], stack->grs0[1]); + printf("%016lx %016lx %016lx %016lx\n", + stack->grs0[2], stack->grs0[3], stack->grs0[4], stack->grs0[5]); + printf("%016lx %016lx %016lx %016lx\n", + stack->grs0[6], stack->grs0[7], stack->grs0[8], stack->grs0[9]); + printf("%016lx %016lx %016lx %016lx\n", + stack->grs0[10], stack->grs0[11], stack->grs0[12], stack->grs0[13]); + printf("\n"); +} + static void print_pgm_info(struct stack_frame_int *stack) { @@ -122,6 +137,7 @@ static void print_pgm_info(struct stack_frame_int *stack) printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n", lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, lc->pgm_int_id); + print_int_regs(stack); dump_stack(); report_summary(); abort(); @@ -132,6 +148,7 @@ void handle_pgm_int(struct stack_frame_int *stack) if (!pgm_int_expected) { /* Force sclp_busy to false, otherwise we will loop forever */ sclp_handle_ext(); + print_pgm_info(stack); report_abort("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n", lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, lc->pgm_int_id); From patchwork Tue Feb 9 13:49:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B407CC433E0 for ; Tue, 9 Feb 2021 13:53:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7572864ED5 for ; Tue, 9 Feb 2021 13:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbhBINxY (ORCPT ); Tue, 9 Feb 2021 08:53:24 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15938 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbhBINvd (ORCPT ); Tue, 9 Feb 2021 08:51:33 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DWHd2172020; Tue, 9 Feb 2021 08:50:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=+FTc0w1vsiAc14D6ch6Syf+UBspagILGDJ+zCsUiVTM=; b=pTs6+3mx441soC6THKdbK8nqxSiZy14IwC5HRoxtSbGyKsR/vP/Bib89ZSlZ4S3stnAm gZLSIS43rJOJt2D7zr/Rr/V+mKg34aBszEB+VUz5vo7fKbhm0RX77wzDYFIuPigmccHc dA3b5kJ/fJO/XmeAeu1mhW/jCUZtx8o5bekQRBFFz8MuDT+cruyhNSYKunHvcANu0Nie d7xymASaTQ0+Bv/E/Z7AF7TjNIFmPv5FT8VL1IRurpg7MpNjgX0ztVRZrnmDLOhq+cIF aMX+eeV0dJT+MrEq2hevd4t+FwFiXW/uMK0LhFAiAUfYJSSQpbi9O65R8aS4LJwKh1mu Ug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36kts6a202-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:52 -0500 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DWv36174620; Tue, 9 Feb 2021 08:50:51 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 36kts6a1yc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:51 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DSl8d024913; Tue, 9 Feb 2021 13:50:50 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 36j94wjm21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:50 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119Doll746006682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:47 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 379B8A404D; Tue, 9 Feb 2021 13:50:47 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79C2EA4040; Tue, 9 Feb 2021 13:50:46 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:46 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 7/8] s390x: Move diag308_load_reset to stack saving Date: Tue, 9 Feb 2021 08:49:24 -0500 Message-Id: <20210209134925.22248-8-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090067 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org By moving the last user of SAVE/RESTORE_REGS to the macros that use the stack we can finally remove these macros. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Pierre Morel --- s390x/cpu.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/s390x/cpu.S b/s390x/cpu.S index 5267f029..e2ad56c8 100644 --- a/s390x/cpu.S +++ b/s390x/cpu.S @@ -18,7 +18,7 @@ */ .globl diag308_load_reset diag308_load_reset: - SAVE_REGS + SAVE_REGS_STACK /* Backup current PSW mask, as we have to restore it on success */ epsw %r0, %r1 st %r0, GEN_LC_SW_INT_PSW @@ -31,6 +31,7 @@ diag308_load_reset: ogr %r0, %r1 /* Store it at the reset PSW location (real 0x0) */ stg %r0, 0 + stg %r15, GEN_LC_SW_INT_GRS + 15 * 8 /* Do the reset */ diag %r0,%r2,0x308 /* Failure path */ @@ -40,7 +41,8 @@ diag308_load_reset: /* load a cr0 that has the AFP control bit which enables all FPRs */ 0: larl %r1, initial_cr0 lctlg %c0, %c0, 0(%r1) - RESTORE_REGS + lg %r15, GEN_LC_SW_INT_GRS + 15 * 8 + RESTORE_REGS_STACK lhi %r2, 1 larl %r0, 1f stg %r0, GEN_LC_SW_INT_PSW + 8 From patchwork Tue Feb 9 13:49:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12078277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 508C3C433E0 for ; Tue, 9 Feb 2021 13:54:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDE3F64ED5 for ; Tue, 9 Feb 2021 13:54:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbhBINxj (ORCPT ); Tue, 9 Feb 2021 08:53:39 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38830 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231728AbhBINvf (ORCPT ); Tue, 9 Feb 2021 08:51:35 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 119DXa50041784; Tue, 9 Feb 2021 08:50:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=1w2R0H+zZaPAxNLebxHCGdeAQtUfmwDXW3jtsS2J85w=; b=cWo/KBEXTA0rlbcJlVnCwqUJHRUVw2pMls/cO7P1IUw1bUVBNPPfpXo8ZFtZg/SUoMCJ 4upiVr2pemGTx4Fivew6GwZ1+uU1FsEM3XTP/qVxxo696sm49fS2/rdH9Ngo2PI6InRT kaPWG2UzvK3SMywmW3fhOn0sJuplrRqtv0LVnhl8Mi9YlO6v42VRx4/9x/nKvNoR2u44 jq64rSvF4OZIwWrPeYhsi4vPmA5Lk51KiahMIMZ/gFtzYyEVN/Bl3bADvBku+kmoj3dA 3jj3NV9lpw+MwrQDrGymETi3RtFylBQgoG0gN2zqFdf4JYssoX27Ffn1h35kIZn512MH eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku3j1744-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:54 -0500 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 119DXfEq042497; Tue, 9 Feb 2021 08:50:54 -0500 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 36ku3j1731-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 08:50:53 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 119DShbi011212; Tue, 9 Feb 2021 13:50:51 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 36hqda36qt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Feb 2021 13:50:51 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 119Domki28180792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Feb 2021 13:50:48 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13F88A4053; Tue, 9 Feb 2021 13:50:48 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F307A4040; Tue, 9 Feb 2021 13:50:47 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 9 Feb 2021 13:50:47 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com, pmorel@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH 8/8] s390x: Remove SAVE/RESTORE_stack Date: Tue, 9 Feb 2021 08:49:25 -0500 Message-Id: <20210209134925.22248-9-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210209134925.22248-1-frankja@linux.ibm.com> References: <20210209134925.22248-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-09_03:2021-02-09,2021-02-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=813 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 impostorscore=0 clxscore=1015 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102090068 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org There are no more users. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Pierre Morel --- s390x/macros.S | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/s390x/macros.S b/s390x/macros.S index 1678c821..90a842d9 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -28,35 +28,6 @@ lpswe \old_psw .endm - .macro SAVE_REGS - /* save grs 0-15 */ - stmg %r0, %r15, GEN_LC_SW_INT_GRS - /* save crs 0-15 */ - stctg %c0, %c15, GEN_LC_SW_INT_CRS - /* load a cr0 that has the AFP control bit which enables all FPRs */ - larl %r1, initial_cr0 - lctlg %c0, %c0, 0(%r1) - /* save fprs 0-15 + fpc */ - la %r1, GEN_LC_SW_INT_FPRS - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - std \i, \i * 8(%r1) - .endr - stfpc GEN_LC_SW_INT_FPC - .endm - - .macro RESTORE_REGS - /* restore fprs 0-15 + fpc */ - la %r1, GEN_LC_SW_INT_FPRS - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - ld \i, \i * 8(%r1) - .endr - lfpc GEN_LC_SW_INT_FPC - /* restore crs 0-15 */ - lctlg %c0, %c15, GEN_LC_SW_INT_CRS - /* restore grs 0-15 */ - lmg %r0, %r15, GEN_LC_SW_INT_GRS - .endm - /* Save registers on the stack (r15), so we can have stacked interrupts. */ .macro SAVE_REGS_STACK /* Allocate a full stack frame */