From patchwork Fri Apr 21 11:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13219858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CDDDC7618E for ; Fri, 21 Apr 2023 11:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbjDULjV (ORCPT ); Fri, 21 Apr 2023 07:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbjDULjS (ORCPT ); Fri, 21 Apr 2023 07:39:18 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84753C141; Fri, 21 Apr 2023 04:38:35 -0700 (PDT) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33LBZJ0o013457; Fri, 21 Apr 2023 11:37:27 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=J8MXHooEbZxLg10nF8GMHYpehdtFuKcjNFlsO2dpEmU=; b=IS64x1PyXYZrpI5kpm0VghFAFp9oecpvzRDsChc1XRXeGHOm2ilQPPKSmlVSbn1+yn71 XZ+xGoqK3CmwUsOqSPpGr/esnUsSdmh+RXEZrVzaPPzwjGRsMdhzpac6U6A/Uk8RBS/L PySzTldjMX1pUed9VKutG79N/k0fhjCd8nTKZk0p/AO5culZNEUcIAVRRee6lWa322f9 i2PPYGfP2I6MLNaXCpgGhDTYkJEraJqL6QPC5bjm/ckSzTaJ7nzANgjMO7fUQJ8gQu7A pcIhV/Rp2ltL/8vz8ilJkChcKDk1j/WWPPTrTaqCmLVF81ACh54CrMTDD5e7VJ4iABQC PA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q3rhc2qhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Apr 2023 11:37:26 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33LBZpsN017309; Fri, 21 Apr 2023 11:37:25 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q3rhc2qbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Apr 2023 11:37:25 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33L5KFrO015894; Fri, 21 Apr 2023 11:37:21 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3pyk6fkanr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Apr 2023 11:37:21 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33LBbH4S54722950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Apr 2023 11:37:17 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2D8D20040; Fri, 21 Apr 2023 11:37:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB38D20043; Fri, 21 Apr 2023 11:37:16 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 21 Apr 2023 11:37:16 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, nrb@linux.ibm.com, david@redhat.com Subject: [kvm-unit-tests PATCH v3 1/7] lib: s390x: uv: Introduce UV validity function Date: Fri, 21 Apr 2023 11:36:41 +0000 Message-Id: <20230421113647.134536-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230421113647.134536-1-frankja@linux.ibm.com> References: <20230421113647.134536-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0dtU0NfLJaGp-spZDAVG8NocDfz3D_Qr X-Proofpoint-ORIG-GUID: 6tghTix5-5-8Uy2Rdl2uZHGHKEURROXr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-21_05,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 mlxscore=0 clxscore=1015 impostorscore=0 adultscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304210100 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org PV related validities are in the 0x20** range but the last byte might be implementation specific, so everytime we check for a UV validity we need to mask the last byte. Let's add a function that checks for a UV validity and returns a boolean. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Nico Boehr --- lib/s390x/uv.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h index 5fe29bda..78b979b7 100644 --- a/lib/s390x/uv.h +++ b/lib/s390x/uv.h @@ -35,4 +35,11 @@ static inline void uv_setup_asces(void) lctlg(13, asce); } +static inline bool uv_validity_check(struct vm *vm) +{ + uint16_t vir = sie_get_validity(vm); + + return vm->sblk->icptcode == ICPT_VALIDITY && (vir & 0xff00) == 0x2000; +} + #endif /* UV_H */