From patchwork Fri Nov 10 13:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13452436 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E769F38DC2 for ; Fri, 10 Nov 2023 13:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="o37cCGy2" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1083D38226 for ; Fri, 10 Nov 2023 05:54:45 -0800 (PST) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AADqKe2017246; Fri, 10 Nov 2023 13:54:43 GMT 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 : content-transfer-encoding : mime-version; s=pp1; bh=N2PIdxQAZpfw+VlE3EuuEnYNabnmkqKyef2yiXTTP1o=; b=o37cCGy2+T3vJB9ZzpJ43N9S8DHI7g6bL9c2VfKBirZtMyszoKGqx3lJxzyQvGRyQgHw RKPUhfVVgAlnlvf8Z+qkMVJV3NBsrAufSS2KOHr2TNYiGhH3A0uveU/K/P/kh9MfRTXp OD0UPDOoIqGEPMnKoAINN/i2WHdc8gBgWqGDOn2omHorAF0qNCi9cgymB4PmN+IfL39G VZKQp1wVjoCjIBzR1rXJDODY6MaFtQr1lchqFuWaiSGwnoloMxmmPly1tQZmYkHW9Ggu U1YG4u23f8/tlaDIMHY8bifgWCSlpDtDf6zSdwKoNM670JHik7Af6VX8LUHp2QZdmJgP NA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u9nsjr1jn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 13:54:42 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AADrGNp019912; Fri, 10 Nov 2023 13:54:42 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u9nsjr1hs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 13:54:41 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAB3Cp3028299; Fri, 10 Nov 2023 13:54:40 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3u7w22u75e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 13:54:40 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AADsbaY44237212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Nov 2023 13:54:37 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78CAC20040; Fri, 10 Nov 2023 13:54:37 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 216F020043; Fri, 10 Nov 2023 13:54:37 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.179.18.113]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 10 Nov 2023 13:54:37 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 22/26] s390x: lib: don't forward PSW when handling exception in SIE Date: Fri, 10 Nov 2023 14:52:31 +0100 Message-ID: <20231110135348.245156-23-nrb@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231110135348.245156-1-nrb@linux.ibm.com> References: <20231110135348.245156-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TI2pdzFMnU1VGCFHgqZvymgO2AOdDD4H X-Proofpoint-ORIG-GUID: wkLvHCYyD5Lhv1E0BCaFvjw1I9OK8KKe X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_10,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100114 When we're handling a pgm int in SIE, we want to return to the SIE cleanup after handling the exception. That's why we set pgm_old_psw to the sie_exit label in fixup_pgm_int. On nullifing pgm ints, fixup_pgm_int will also forward the old PSW such that we don't cause an pgm int again. However, when we want to return to the sie_exit label, this is not needed (since we've manually set pgm_old_psw). Instead, forwarding the PSW might cause us to skip an instruction or end up in the middle of an instruction. So, let's just skip the rest of the fixup in case we're inside SIE. Note that we're intentionally not fixing up the PSW in the guest; that's best left to the test at hand by registering their own psw fixup. Reviewed-by: Janosch Frank Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20231106163738.1116942-5-nrb@linux.ibm.com Signed-off-by: Nico Boehr --- lib/s390x/interrupt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index e990c18..f7843a8 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -145,6 +145,7 @@ static void fixup_pgm_int(struct stack_frame_int *stack) if (lowcore.pgm_old_psw.addr >= (uint64_t)&sie_entry && lowcore.pgm_old_psw.addr <= (uint64_t)&sie_exit) { lowcore.pgm_old_psw.addr = (uint64_t)&sie_exit; + return; } switch (lowcore.pgm_int_code) {