From mboxrd@z Thu Jan 1 00:00:00 1970 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 BFC19C43334 for ; Tue, 21 Jun 2022 15:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349954AbiFUPft (ORCPT ); Tue, 21 Jun 2022 11:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351661AbiFUPfs (ORCPT ); Tue, 21 Jun 2022 11:35:48 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47C32A734; Tue, 21 Jun 2022 08:35:47 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25LFM35o011962; Tue, 21 Jun 2022 15:35:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=FOtXzGpb85PN4x2kcPAH0K4iqOhmMIKBo/UZbDkbBJI=; b=VuqUKyAUVwl4AtkxgiOCLc3KIE4Lgxi7RWUjoBStvT/zUNHwyUBFVHAxSqWW+QE3p8Fd zTOd46DC5DonW/sS4dOpP2F9arst5eLKMIKzCMnb5sguxARPyf+rEeYF3Y0+v2VBPaGU 26wDJuyNI63fttKmo6jvmQy2NG6XxT8BZo49Z05GQduL7Q8wuqTD7gr/Z/6rUeEU8s6w FGc8TlWfY9Dz9zlH49dpda4pMEA8LQ3R/y4V9/PadwDR3MSJ7RzLQQ/qhczwudvm9Lav ywVYO0hYZIOvRNgrytXMV3Eibtv6DaEXB21x4HA4Tnr0wfcr+vkM/ytDYg422p1mPWk+ 0Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gugjmge5x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 15:35:47 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 25LFPamk024372; Tue, 21 Jun 2022 15:35:47 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gugjmge4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 15:35:46 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25LFZVUq003705; Tue, 21 Jun 2022 15:35:44 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04fra.de.ibm.com with ESMTP id 3gs6b8ubps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 15:35:44 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25LFZfPM14877056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jun 2022 15:35:41 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1AFC52052; Tue, 21 Jun 2022 15:35:40 +0000 (GMT) Received: from p-imbrenda (unknown [9.145.4.76]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6DB3C5204E; Tue, 21 Jun 2022 15:35:40 +0000 (GMT) Date: Tue, 21 Jun 2022 17:35:36 +0200 From: Claudio Imbrenda To: Janis Schoetterl-Glausch Cc: Thomas Huth , Janosch Frank , David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [kvm-unit-tests PATCH v3 0/3] s390x: Rework TEID decoding and usage Message-ID: <20220621173536.21982a70@p-imbrenda> In-Reply-To: <20220621143015.748290-1-scgl@linux.ibm.com> References: <20220621143015.748290-1-scgl@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PoUmAp5UO98KE0rKrPvHfNoYvehc747t X-Proofpoint-GUID: mS6-I4dxeAnnjtl515CeFfMmCAq5KKPt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-21_08,2022-06-21_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206210066 Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Tue, 21 Jun 2022 16:30:12 +0200 Janis Schoetterl-Glausch wrote: > The translation-exception identification (TEID) contains information to > identify the cause of certain program exceptions, including translation > exceptions occurring during dynamic address translation, as well as > protection exceptions. > The meaning of fields in the TEID is complex, depending on the exception > occurring and various potentially installed facilities. thanks, queued > > Add function to query which suppression-on-protection facility is > installed. > Rework the type describing the TEID, in order to ease decoding. > Change the existing code interpreting the TEID and extend it to take the > installed suppression-on-protection facility into account. > > Also fix the sclp bit order. > > v2 -> v3 > * rename some identifiers > * implement Claudio's feedback to assert that the array for printing > has the correct number of elements. I kept the array inside the > printing function, tho, because I consider its content an implementation > detail > * ignore ancient machines without at least ESOP-1 > > v1 -> v2 > * pick up r-b > * get rid of esop1 alias of sop_teid_predictable > * assert that the esop2 protection code is valid > * use string literal array and indexing for protection code printing > * fix protection exception check in edat.c > > Janis Schoetterl-Glausch (3): > s390x: Fix sclp facility bit numbers > s390x: lib: SOP facility query function > s390x: Rework TEID decoding and usage > > lib/s390x/asm/facility.h | 21 +++++++++++++ > lib/s390x/asm/interrupt.h | 62 ++++++++++++++++++++++++++++++--------- > lib/s390x/fault.h | 30 +++++-------------- > lib/s390x/sclp.h | 18 +++++++----- > lib/s390x/fault.c | 58 +++++++++++++++++++++++------------- > lib/s390x/interrupt.c | 2 +- > lib/s390x/sclp.c | 2 ++ > s390x/edat.c | 25 +++++++++------- > 8 files changed, 142 insertions(+), 76 deletions(-) > > Range-diff against v2: > 1: 6427944a = 1: 189e03ca s390x: Fix sclp facility bit numbers > 2: a08fce3b = 2: 0783c2a4 s390x: lib: SOP facility query function > 3: eb268af1 ! 3: 615ec8df s390x: Rework TEID decoding and usage > @@ lib/s390x/asm/interrupt.h > + /* common fields DAT exc & protection exc */ > + struct { > + uint64_t addr : 52 - 0; > -+ uint64_t acc_exc_f_s : 54 - 52; > ++ uint64_t acc_exc_fetch_store : 54 - 52; > + uint64_t side_effect_acc : 55 - 54; > + uint64_t /* reserved */ : 62 - 55; > + uint64_t asce_id : 64 - 62; > @@ lib/s390x/asm/interrupt.h > }; > > +enum prot_code { > -+ PROT_KEY_LAP, > ++ PROT_KEY_OR_LAP, > + PROT_DAT, > + PROT_KEY, > + PROT_ACC_LIST, > + PROT_LAP, > + PROT_IEP, > ++ PROT_NUM_CODES /* Must always be last */ > +}; > + > +static inline enum prot_code teid_esop2_prot_code(union teid teid) > @@ lib/s390x/asm/interrupt.h > + teid.esop2_prot_code_1 << 1 | > + teid.esop2_prot_code_2); > + > -+ assert(code < 6); > ++ assert(code < PROT_NUM_CODES); > + return (enum prot_code)code; > +} > + > @@ lib/s390x/fault.c > - printf("Type: IEP\n"); > - return; > - } > -+static void print_decode_pgm_prot(union teid teid, bool dat) > ++static void print_decode_pgm_prot(union teid teid) > +{ > + switch (get_supp_on_prot_facility()) { > + case SOP_NONE: > -+ printf("Type: ?\n"); > -+ break; > + case SOP_BASIC: > -+ if (teid.sop_teid_predictable && dat && teid.sop_acc_list) > -+ printf("Type: ACC\n"); > -+ else > -+ printf("Type: ?\n"); > ++ printf("Type: ?\n"); /* modern/relevant machines have ESOP */ > + break; > + case SOP_ENHANCED_1: > + if (teid.sop_teid_predictable) {/* implies access list or DAT */ > @@ lib/s390x/fault.c > + "LAP", > + "IEP", > + }; > ++ _Static_assert(ARRAY_SIZE(prot_str) == PROT_NUM_CODES); > + int prot_code = teid_esop2_prot_code(teid); > > - if (prot_is_datp(teid)) { > - printf("Type: DAT\n"); > - return; > -+ assert(0 <= prot_code && prot_code < ARRAY_SIZE(prot_str)); > + printf("Type: %s\n", prot_str[prot_code]); > + } > } > @@ lib/s390x/fault.c > case AS_PRIM: > printf("Primary\n"); > break; > -@@ lib/s390x/fault.c: void print_decode_teid(uint64_t teid) > - } > - > - if (lowcore.pgm_int_code == PGM_INT_CODE_PROTECTION) > -- print_decode_pgm_prot(teid); > -+ print_decode_pgm_prot(teid, dat); > - > - /* > - * If teid bit 61 is off for these two exception the reported > @@ lib/s390x/fault.c: void print_decode_teid(uint64_t teid) > */ > if ((lowcore.pgm_int_code == PGM_INT_CODE_SECURE_STOR_ACCESS || > @@ s390x/edat.c: static bool check_pgm_prot(void *ptr) > - * field might or might not be meaningful when the m field is 0. > - */ > - if (!teid.m) > +- return true; > +- return (!teid.acc_list_prot && !teid.asce_id && > + switch (get_supp_on_prot_facility()) { > + case SOP_NONE: > - return true; > -- return (!teid.acc_list_prot && !teid.asce_id && > + case SOP_BASIC: > -+ if (!teid.sop_teid_predictable) > -+ return true; > -+ break; > ++ assert(false); /* let's ignore ancient/irrelevant machines */ > + case SOP_ENHANCED_1: > + if (!teid.sop_teid_predictable) /* implies key or low addr */ > + return false; > > base-commit: 610c15284a537484682adfb4b6d6313991ab954f