From patchwork Wed Sep 19 13:14:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10605839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF12E14DA for ; Wed, 19 Sep 2018 13:14:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADD952B20A for ; Wed, 19 Sep 2018 13:14:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FE702B230; Wed, 19 Sep 2018 13:14:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1458A2B20A for ; Wed, 19 Sep 2018 13:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731270AbeISSwl (ORCPT ); Wed, 19 Sep 2018 14:52:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39904 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbeISSwl (ORCPT ); Wed, 19 Sep 2018 14:52:41 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8JDAfKe017516 for ; Wed, 19 Sep 2018 09:14:47 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mkpubs1gh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Sep 2018 09:14:46 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Sep 2018 14:14:44 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 19 Sep 2018 14:14:42 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8JDEfwv60948522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Sep 2018 13:14:41 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EB9B42041; Wed, 19 Sep 2018 16:14:28 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE1F94203F; Wed, 19 Sep 2018 16:14:27 +0100 (BST) Received: from s38lp20.lnxne.boe (unknown [9.145.184.145]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 19 Sep 2018 16:14:27 +0100 (BST) From: Janosch Frank To: thuth@redhat.com Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH v2] s390x: Add prefixes to pgm interrupt checks Date: Wed, 19 Sep 2018 15:14:14 +0200 X-Mailer: git-send-email 2.14.3 In-Reply-To: <33414dc8-3e85-6b2b-cd90-b74546d76a86@redhat.com> References: <33414dc8-3e85-6b2b-cd90-b74546d76a86@redhat.com> X-TM-AS-GCONF: 00 x-cbid: 18091913-0008-0000-0000-00000273848A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091913-0009-0000-0000-000021DBDE39 Message-Id: <20180919131414.6192-1-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-19_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809190133 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need the information about which of the checks failed if there are more than one and the prefixes provide that. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand --- Moved prefix_push to expect_pgm_int() in iep.c --- s390x/cmm.c | 4 ++++ s390x/diag10.c | 23 +++++++++++++++++++++++ s390x/gs.c | 8 ++++++++ s390x/iep.c | 2 ++ s390x/pfmf.c | 2 ++ s390x/skey.c | 7 +++++++ 6 files changed, 46 insertions(+) diff --git a/s390x/cmm.c b/s390x/cmm.c index 42dfda2..fe4d9df 100644 --- a/s390x/cmm.c +++ b/s390x/cmm.c @@ -29,17 +29,21 @@ static unsigned long essa(uint8_t state, unsigned long paddr) static void test_params(void) { + report_prefix_push("invalid ORC 8"); expect_pgm_int(); essa(8, (unsigned long)pagebuf); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); } static void test_priv(void) { + report_prefix_push("privileged"); expect_pgm_int(); enter_pstate(); essa(0, (unsigned long)pagebuf); check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); } /* Unfortunately the availability is not indicated by stfl bits, but diff --git a/s390x/diag10.c b/s390x/diag10.c index 806ebc6..7ee8945 100644 --- a/s390x/diag10.c +++ b/s390x/diag10.c @@ -32,43 +32,66 @@ static inline void diag10(unsigned long start, unsigned long end) /* Try freeing the prefix */ static void test_prefix(void) { + report_prefix_push("lowcore freeing"); + + report_prefix_push("0x0000/0x0000"); expect_pgm_int(); diag10(0, 0); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + + report_prefix_push("0x1000/0x1000"); expect_pgm_int(); diag10(0x1000, 0x1000); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + report_prefix_push("0x0000/0x1000"); expect_pgm_int(); diag10(0, 0x1000); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + + report_prefix_pop(); } static void test_params(void) { + report_prefix_push("start/end"); + /* end < start */ + report_prefix_push("end < start"); expect_pgm_int(); diag10(page1, page0); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); /* Unaligned start */ + report_prefix_push("unaligned start"); expect_pgm_int(); diag10((unsigned long) pagebuf + 42, page1); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); /* Unaligned end */ + report_prefix_push("unaligned end"); expect_pgm_int(); diag10(page0, (unsigned long) pagebuf + PAGE_SIZE + 42); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + + report_prefix_pop(); } static void test_priv(void) { + report_prefix_push("privileged"); expect_pgm_int(); enter_pstate(); diag10(page0, page0); check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); } int main(void) diff --git a/s390x/gs.c b/s390x/gs.c index bddc2b4..26f22e8 100644 --- a/s390x/gs.c +++ b/s390x/gs.c @@ -128,12 +128,20 @@ static void test_load(void) /* Test gs instructions without enablement resulting in an exception */ static void test_special(void) { + report_prefix_push("disabled gs"); + report_prefix_push("load gs"); expect_pgm_int(); load_gs_cb(&gs_cb); check_pgm_int_code(PGM_INT_CODE_SPECIAL_OPERATION); + report_prefix_pop(); + + report_prefix_push("store gs"); expect_pgm_int(); store_gs_cb(&gs_cb); check_pgm_int_code(PGM_INT_CODE_SPECIAL_OPERATION); + report_prefix_pop(); + + report_prefix_pop(); } static void init(void) diff --git a/s390x/iep.c b/s390x/iep.c index 8c1ea8f..7da78a3 100644 --- a/s390x/iep.c +++ b/s390x/iep.c @@ -35,10 +35,12 @@ static void test_iep(void) *code = 0x07fe; fn = (void *)code; + report_prefix_push("iep protection"); expect_pgm_int(); /* Jump into protected page */ fn(); check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report_prefix_pop(); unprotect_page(iepbuf, PAGE_ENTRY_IEP); ctl_clear_bit(0, 20); } diff --git a/s390x/pfmf.c b/s390x/pfmf.c index 2268fd0..5e61267 100644 --- a/s390x/pfmf.c +++ b/s390x/pfmf.c @@ -51,10 +51,12 @@ static inline unsigned long pfmf(unsigned long r1, unsigned long paddr) static void test_priv(void) { + report_prefix_push("privileged"); expect_pgm_int(); enter_pstate(); pfmf(0, (unsigned long) pagebuf); check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); } static void test_4k_key(void) diff --git a/s390x/skey.c b/s390x/skey.c index e4c2a43..1949533 100644 --- a/s390x/skey.c +++ b/s390x/skey.c @@ -68,18 +68,25 @@ static void test_priv(void) union skey skey; memset(pagebuf, 0, PAGE_SIZE * 2); + report_prefix_push("privileged"); + report_prefix_push("sske"); expect_pgm_int(); enter_pstate(); set_storage_key(page0, 0x30, 0); check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); skey.val = get_storage_key(page0); report("skey did not change on exception", skey.str.acc != 3); + report_prefix_push("iske"); expect_pgm_int(); enter_pstate(); get_storage_key(page0); check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); + + report_prefix_pop(); } int main(void)