From patchwork Mon Jan 8 13:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13513483 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 F1EB945941; Mon, 8 Jan 2024 13:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Qutqw+7b" Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 408DLCrY020833; Mon, 8 Jan 2024 13:29:51 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 : mime-version : content-transfer-encoding; s=pp1; bh=gnwH4Al/JpPmcSuv8tPAr6O34tKZ0I9Uyzaa9KiSEIs=; b=Qutqw+7bm4RLoGLlgi/hL5aphSeseCS3CC1dgDor+Nh6Tt1KgcOP74zN3nFS0ua9U6RJ v5c2DyNIOH3EJa65cnrv5Q17OFl/48yph/+fO4q3gft7AGdzVYv1ZSmV3vKRh4SaY2qp DKeOZWi8eVCJ9z5u/TJ7PKNJrP42P2+5RK0V5twVG4cxPPqTNaNluaNZkrh7X6+e0Wll R+cuZ+iPHDgWmaLrSj2D/tDWcSNxqIZ7feGrRh2GyQgx+WhzjqwK8JsrWz7rdPsOTFJZ lsyxfkAqr/vGlJ2xn1AKLVtMNP9MivstpupdExiG/jyNEsj/jWykRWEgTWYXfTYaYxBW /g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vf1uypspw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 408DLOKv021001; Mon, 8 Jan 2024 13:29:50 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vf1uypsp4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 408D6370004407; Mon, 8 Jan 2024 13:29:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfjpkfxxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:49 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 408DTk9O19399394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 13:29:46 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2FD5F20043; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 091CF2004B; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jan 2024 13:29:45 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com, nrb@linux.ibm.com Subject: [kvm-unit-tests PATCH 1/5] lib: s390x: Add spm cc shift constant Date: Mon, 8 Jan 2024 13:29:17 +0000 Message-Id: <20240108132921.255769-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com> References: <20240108132921.255769-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: dtlsJvH_GHHfKYIWl1TTIsALMACOFZiU X-Proofpoint-GUID: SsOEN-vR7iCxklOCD2XjiaSYHhzc6CpZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-08_04,2024-01-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=458 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401080115 Set Program Mask expects the CC in bits 34 and 35 of a GPR. Adding a constant makes setting the CC in inline assembly a bit easier. Signed-off-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 745a3387..65ae1e93 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -84,6 +84,8 @@ struct cpu { bool in_interrupt_handler; }; +#define SPM_CC_SHIFT 28 + enum address_space { AS_PRIM = 0, AS_ACCR = 1, From patchwork Mon Jan 8 13:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13513484 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 257BE4595B; Mon, 8 Jan 2024 13:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="iBXA75HU" Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 408CHLB6015324; Mon, 8 Jan 2024 13:29:51 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 : mime-version : content-transfer-encoding; s=pp1; bh=fRcpG3K5aBySJZn0hYQ5lUtmriysL7b79gX2wLnVQWU=; b=iBXA75HUuYeW3rG+UY9FGQj9s4Pzm9KWCnnYx/38MrN68EFkvsqsfJImWzLpv6eNRDYn KoorAmg+GJe24tZha7clzr+K3BoPfPAzo5HE2WJZXeLlepXTJBuNLYWPvwCV/ZcrTsxu iF/58uEUHbJ1orWzrCZvY8dnpbhh1sQrFqYJ3s+xUmMcrxPC5IOk2XxIKUvneNXs+4y0 Fj704sr9ru+t+DfrKQwUn6ISse3I5IHCvgzlNJQVwBz5mQb4JOMk/zEvPSz8BVbfZAht FcnFMTwk0OP1SMEeCkEmaPkPZCrUGxQhVP90lJRK4uduQXVbAmotpfespd8imp/Twjv3 sA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vf7u8ru8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 408DGmSw028523; Mon, 8 Jan 2024 13:29:50 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vf7u8ru86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 408DOoD3004427; Mon, 8 Jan 2024 13:29:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfjpkfxxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:49 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 408DTknx19399396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 13:29:46 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5966220043; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 339EA2004D; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com, nrb@linux.ibm.com Subject: [kvm-unit-tests PATCH 2/5] lib: s390x: sigp: Dirty CC before sigp execution Date: Mon, 8 Jan 2024 13:29:18 +0000 Message-Id: <20240108132921.255769-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com> References: <20240108132921.255769-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: uC5Kto5jL1S7fRW1C2lILYnPlze9g5dy X-Proofpoint-ORIG-GUID: 0d7CO8QpE93fCXvAYaMCHV1NfXxUTa2t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-08_04,2024-01-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 impostorscore=0 mlxlogscore=614 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401080115 Dirtying the CC allows us to find missing CC changes when sigp is emulated. Signed-off-by: Janosch Frank --- lib/s390x/asm/sigp.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/s390x/asm/sigp.h b/lib/s390x/asm/sigp.h index 61d2c625..d73be1ef 100644 --- a/lib/s390x/asm/sigp.h +++ b/lib/s390x/asm/sigp.h @@ -49,13 +49,17 @@ static inline int sigp(uint16_t addr, uint8_t order, unsigned long parm, uint32_t *status) { register unsigned long reg1 asm ("1") = parm; + uint64_t spm_cc = SIGP_CC_NOT_OPERATIONAL << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" " sigp %1,%2,0(%3)\n" " ipm %0\n" " srl %0,28\n" - : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc"); + : "=d" (cc), "+d" (reg1) + : "d" (addr), "a" (order), [spm_cc] "d" (spm_cc) + : "cc"); if (status) *status = reg1; return cc; From patchwork Mon Jan 8 13:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13513485 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 A7E1044C9D; Mon, 8 Jan 2024 13:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sjfCBhiy" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 408CvG5V021699; Mon, 8 Jan 2024 13:29:51 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 : mime-version : content-transfer-encoding; s=pp1; bh=hS/1ad3y6cSKvdLRHZ3T1z1JWD7/5vHpgXbT6yw5v0Q=; b=sjfCBhiy6/R3T73ThsJJVftQgPQJkU7JTW1FVvUqhpzNpJwBJIrN/W/GVDzpZemYTijG aNorRTtT3cGSskhWPnbylraLRCy3SsjWzTvCPB0HC5AVn2lTm4bujKn1vBkJDwqq33mM pdtuEE7QtKg7hY9HSNWB6OaO7FcJm/zShpW3rKWfzZ82cazOaAObSBW2+H58anUVABZK /mCJ3Zk/5TwpFbRkeL2ThLvn9OnNz7Wd030L+CUI0NyfLk2zpXCIXv5cwe7THGbBylwA 3qiEFA28+/G0apJDkBLIKGqQf+49xRSPllkLQKwPP8QtoxEUXNxW5V6XrwUlfeSuOr/l yA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vghgk1282-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 408CvHcj021735; Mon, 8 Jan 2024 13:29:50 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vghgk127n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 408AUq41000902; Mon, 8 Jan 2024 13:29:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3vfkdjyrp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:49 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 408DTksv37159328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 13:29:46 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 835402004D; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D6162004E; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com, nrb@linux.ibm.com Subject: [kvm-unit-tests PATCH 3/5] lib: s390x: uv: Dirty CC before uvc execution Date: Mon, 8 Jan 2024 13:29:19 +0000 Message-Id: <20240108132921.255769-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com> References: <20240108132921.255769-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7dy7GlinoD3X4R9NqVIKDWb0MrOr4C1w X-Proofpoint-ORIG-GUID: -rnuyILKKjVKKSLmGcB5gYaEyIeSdT4i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-08_04,2024-01-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 spamscore=0 suspectscore=0 mlxlogscore=663 clxscore=1015 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401080115 Dirtying the CC allows us to find missing CC changes. Signed-off-by: Janosch Frank --- lib/s390x/asm/uv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index e9fb19af..85f7b060 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -9,6 +9,8 @@ * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2. */ +#include + #ifndef _ASMS390X_UV_H_ #define _ASMS390X_UV_H_ @@ -216,14 +218,16 @@ struct uv_cb_ssc { static inline int uv_call_once(unsigned long r1, unsigned long r2) { + uint64_t spm_cc = 1 << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" "0: .insn rrf,0xB9A40000,%[r1],%[r2],0,0\n" " ipm %[cc]\n" " srl %[cc],28\n" : [cc] "=d" (cc) - : [r1] "a" (r1), [r2] "a" (r2) + : [r1] "a" (r1), [r2] "a" (r2), [spm_cc] "d" (spm_cc) : "memory", "cc"); if (UVC_ERR_DEBUG && cc == 1) From patchwork Mon Jan 8 13:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13513487 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 19B0A4596E; Mon, 8 Jan 2024 13:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="cQW9tTos" Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 408Cge4T018811; Mon, 8 Jan 2024 13:29:51 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 : mime-version : content-transfer-encoding; s=pp1; bh=akrU+6VaQe2VywXn2XQALvQ9iELTfX0OeMWh7dFTqsw=; b=cQW9tTosEwKDTm7pOeprrlJcrr60HeZyykPtXxxDpzvFDo6HdCA5lnfKmBty2qjYsam6 03ZsZkX4jpncVLg4ixf7kFA33vcx/QAFyYgb7t1XN/qMo6CrdCDWTYDl3kkYgV0fjhyV 8/RXit7ggYtZq1km70uPywZCYkzb03PtrbWvKt16VvWFcFjKp36ekW4D3RhuOOcc/Yxf NFTywFHBUi/6AuF+UAbVlYAiocH9SbkVvcQI2SlVNRYGmB3QiHDQ6GXHxlTa4EdweT3w Au6IezXqf1aAxL3vxN4LUBFmMMKb5bdNui+YVLDDE5v9tEhTk/6uG3BOhI8mIFqDyMlA zg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vgh9u1frn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:51 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 408D09un002716; Mon, 8 Jan 2024 13:29:51 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vgh9u1fr9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:51 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 408Ccuk0022877; Mon, 8 Jan 2024 13:29:50 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfj6n82v5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 408DTk8H19399398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 13:29:46 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ABE782004D; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 873472005A; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com, nrb@linux.ibm.com Subject: [kvm-unit-tests PATCH 4/5] lib: s390x: css: Dirty CC before css instructions Date: Mon, 8 Jan 2024 13:29:20 +0000 Message-Id: <20240108132921.255769-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com> References: <20240108132921.255769-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 01tTxzFl0y6oLaPWZomNGWrraCmMzuPB X-Proofpoint-GUID: tpa2-QurFvjBWvLGYWhGytnQ5DH1lDhE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-08_04,2024-01-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=462 priorityscore=1501 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401080115 Dirtying the CC allows us to find missing CC changes when css instructions are emulated. Signed-off-by: Janosch Frank --- lib/s390x/css.h | 18 ++++++++++++++---- s390x/mvpg.c | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 0a19324b..47733d2d 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -6,6 +6,8 @@ * Author: Pierre Morel */ +#include + #ifndef _S390X_CSS_H_ #define _S390X_CSS_H_ @@ -147,14 +149,16 @@ static inline int ssch(unsigned long schid, struct orb *addr) static inline int stsch(unsigned long schid, struct schib *addr) { register unsigned long reg1 asm ("1") = schid; + uint64_t spm_cc = 1 << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" " stsch 0(%3)\n" " ipm %0\n" " srl %0,28" : "=d" (cc), "=m" (*addr) - : "d" (reg1), "a" (addr) + : "d" (reg1), "a" (addr), [spm_cc] "d" (spm_cc) : "cc"); return cc; } @@ -177,14 +181,16 @@ static inline int msch(unsigned long schid, struct schib *addr) static inline int tsch(unsigned long schid, struct irb *addr) { register unsigned long reg1 asm ("1") = schid; + uint64_t spm_cc = 2 << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" " tsch 0(%3)\n" " ipm %0\n" " srl %0,28" : "=d" (cc), "=m" (*addr) - : "d" (reg1), "a" (addr) + : "d" (reg1), "a" (addr), [spm_cc] "d" (spm_cc) : "cc"); return cc; } @@ -252,28 +258,32 @@ static inline int rsch(unsigned long schid) static inline int rchp(unsigned long chpid) { register unsigned long reg1 asm("1") = chpid; + uint64_t spm_cc = 1 << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" " rchp\n" " ipm %0\n" " srl %0,28" : "=d" (cc) - : "d" (reg1) + : "d" (reg1), [spm_cc] "d" (spm_cc) : "cc"); return cc; } static inline int stcrw(uint32_t *crw) { + uint64_t spm_cc = 1 << SPM_CC_SHIFT; int cc; asm volatile( + " spm %[spm_cc]\n" " stcrw %[crw]\n" " ipm %[cc]\n" " srl %[cc],28" : [cc] "=d" (cc) - : [crw] "Q" (*crw) + : [crw] "Q" (*crw), [spm_cc] "d" (spm_cc) : "cc", "memory"); return cc; } diff --git a/s390x/mvpg.c b/s390x/mvpg.c index 296338d4..21e3ecc7 100644 --- a/s390x/mvpg.c +++ b/s390x/mvpg.c @@ -40,12 +40,14 @@ static uint8_t *fresh; static inline int mvpg(unsigned long r0, void *dest, void *src) { register unsigned long reg0 asm ("0") = r0; + uint64_t spm_cc = 3 << SPM_CC_SHIFT; int cc; - asm volatile(" mvpg %1,%2\n" + asm volatile(" spm %[spm_cc]\n" + " mvpg %1,%2\n" " ipm %0\n" " srl %0,28" - : "=&d" (cc) : "a" (dest), "a" (src), "d" (reg0) + : "=&d" (cc) : "a" (dest), "a" (src), "d" (reg0), [spm_cc] "d" (spm_cc) : "memory", "cc"); return cc; } From patchwork Mon Jan 8 13:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13513486 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 B042544C86; Mon, 8 Jan 2024 13:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Gl7dQP7I" Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 408DHfwn028275; Mon, 8 Jan 2024 13:29:51 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 : mime-version : content-transfer-encoding; s=pp1; bh=e7+p19b4UQCnAzTIJnD6cayB2XAyQ2W1F6JCV9Zw7co=; b=Gl7dQP7IveYQa7BkfqbX/UuCFWXMH9ezNbNtYxZEx1Zwp0nl2pwNNbFcgtqNu0/uDMDg QvsQgveyT54qdTlbg7RfBsmvgBBmjQ6/qQNIGj9kNUtRuVy/7ds5uBXV/a2O2RjsklyR 7NktlfN0gyRtS3iYLr16jLEl1qcqgv/hXkdy8VIlz5splPQjFl9uhm+rARXaITxcvsVw yinh+qD48LXfZifTfZGeE2g28cxl9SpPqH/AQ9D/E7ohhHHN3IeAvL9q9zs0wSUeHeRg 8OUBvgLf+uXLQpV0DNiAk/tuxysO9tdk9xFMGQ/A7Hv6dIRh6FdnQEEhCOQVfJa4C3nR ZQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vght90g6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:51 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 408DHeLt028261; Mon, 8 Jan 2024 13:29:50 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 3vght90g62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:50 +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 408C2V6s022787; Mon, 8 Jan 2024 13:29:50 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfhjy8890-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jan 2024 13:29:49 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 408DTkuO19399400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 13:29:47 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CBFCC20043; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B00C82004E; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jan 2024 13:29:46 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com, nrb@linux.ibm.com Subject: [kvm-unit-tests PATCH 5/5] s390x: sclp: Dirty CC before sclp execution Date: Mon, 8 Jan 2024 13:29:21 +0000 Message-Id: <20240108132921.255769-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com> References: <20240108132921.255769-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: SmrwoCYeJPXRMqksv-7iz-rp0Y1EYKzj X-Proofpoint-GUID: cXf9sGag4m-S0CUp9w68kdgs6upJtq7e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-08_04,2024-01-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=676 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401080115 Dirtying the CC allows us to find missing CC changes when sclp is emulated. Signed-off-by: Janosch Frank --- s390x/sclp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/s390x/sclp.c b/s390x/sclp.c index 1abb9029..bc6477eb 100644 --- a/s390x/sclp.c +++ b/s390x/sclp.c @@ -399,6 +399,7 @@ out: static void test_instbits(void) { SCCBHeader *h = (SCCBHeader *)pagebuf; + uint64_t spm_cc = 1 << SPM_CC_SHIFT; int cc; sclp_mark_busy(); @@ -406,10 +407,12 @@ static void test_instbits(void) sclp_setup_int(); asm volatile( + " spm %[spm_cc]\n" " .insn rre,0xb2204200,%1,%2\n" /* servc %1,%2 */ " ipm %0\n" " srl %0,28" - : "=&d" (cc) : "d" (valid_code), "a" (__pa(pagebuf)) + : "=&d" (cc) + : "d" (valid_code), "a" (__pa(pagebuf)), [spm_cc] "d" (spm_cc) : "cc", "memory"); /* No exception, but also no command accepted, so no interrupt is * expected. We need to clear the flag manually otherwise we will