From patchwork Tue Mar 24 08:12:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F4AC139A for ; Tue, 24 Mar 2020 08:13:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C47820870 for ; Tue, 24 Mar 2020 08:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbgCXING (ORCPT ); Tue, 24 Mar 2020 04:13:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48438 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727066AbgCXINF (ORCPT ); Tue, 24 Mar 2020 04:13:05 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O83xVu009116 for ; Tue, 24 Mar 2020 04:13:05 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywewtr7ms-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:05 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:03 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:00 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D07l20512888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:00 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2251EA4064; Tue, 24 Mar 2020 08:13:00 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AB5EA4060; Tue, 24 Mar 2020 08:12:59 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:12:58 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 01/10] s390x: smp: Test all CRs on initial reset Date: Tue, 24 Mar 2020 04:12:42 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0028-0000-0000-000003EA6E2D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0029-0000-0000-000024AFD6F2 Message-Id: <20200324081251.28810-2-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=1 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org All CRs are set to 0 and CRs 0 and 14 are set to pre-defined values, so we also need to test 1-13 and 15 for 0. And while we're at it, let's also set some values to cr 1, 7 and 13, so we can actually be sure that they will be zeroed. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- s390x/smp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/s390x/smp.c b/s390x/smp.c index fa40753524f321d4..8c9b98aabd9e8222 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -182,16 +182,28 @@ static void test_emcall(void) report_prefix_pop(); } +/* Used to dirty registers of cpu #1 before it is reset */ +static void test_func_initial(void) +{ + lctlg(1, 0x42000UL); + lctlg(7, 0x43000UL); + lctlg(13, 0x44000UL); + set_flag(1); +} + static void test_reset_initial(void) { struct cpu_status *status = alloc_pages(0); + uint64_t nullp[12] = {}; struct psw psw; psw.mask = extract_psw_mask(); - psw.addr = (unsigned long)test_func; + psw.addr = (unsigned long)test_func_initial; report_prefix_push("reset initial"); + set_flag(0); smp_cpu_start(1, psw); + wait_for_flag(); sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL); sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); @@ -202,6 +214,8 @@ static void test_reset_initial(void) report(!status->fpc, "fpc"); report(!status->cputm, "cpu timer"); report(!status->todpr, "todpr"); + report(!memcmp(&status->crs[1], nullp, sizeof(status->crs[1]) * 12), "cr1-13 == 0"); + report(status->crs[15] == 0, "cr15 == 0"); report_prefix_pop(); report_prefix_push("initialized"); From patchwork Tue Mar 24 08:12:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63590139A for ; Tue, 24 Mar 2020 08:13:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E71B20775 for ; Tue, 24 Mar 2020 08:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbgCXINI (ORCPT ); Tue, 24 Mar 2020 04:13:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36786 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727054AbgCXINH (ORCPT ); Tue, 24 Mar 2020 04:13:07 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O82UMn072173 for ; Tue, 24 Mar 2020 04:13:06 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ywf2gp8ew-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:06 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:03 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:00 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D1Gx52166668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:02 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2F48A405F; Tue, 24 Mar 2020 08:13:01 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C508A405C; Tue, 24 Mar 2020 08:13:00 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:00 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 02/10] s390x: smp: Dirty fpc before initial reset test Date: Tue, 24 Mar 2020 04:12:43 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0020-0000-0000-000003BA0126 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0021-0000-0000-00002212808E Message-Id: <20200324081251.28810-3-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 suspectscore=1 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=883 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's dirty the fpc, before we test if the initial reset sets it to 0. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand --- s390x/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/s390x/smp.c b/s390x/smp.c index 8c9b98aabd9e8222..95df8c49d2495391 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -185,6 +185,7 @@ static void test_emcall(void) /* Used to dirty registers of cpu #1 before it is reset */ static void test_func_initial(void) { + asm volatile("sfpc %0" :: "d" (0x11)); lctlg(1, 0x42000UL); lctlg(7, 0x43000UL); lctlg(13, 0x44000UL); From patchwork Tue Mar 24 08:12:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D1B6139A for ; Tue, 24 Mar 2020 08:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6933320842 for ; Tue, 24 Mar 2020 08:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbgCXINK (ORCPT ); Tue, 24 Mar 2020 04:13:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:63646 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727116AbgCXINJ (ORCPT ); Tue, 24 Mar 2020 04:13:09 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O82VIR072312 for ; Tue, 24 Mar 2020 04:13:08 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ywf2gp8ff-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:08 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:04 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:02 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D3EV43057410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:03 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66936A4054; Tue, 24 Mar 2020 08:13:03 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6562EA405C; Tue, 24 Mar 2020 08:13:02 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:02 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 03/10] s390x: smp: Test stop and store status on a running and stopped cpu Date: Tue, 24 Mar 2020 04:12:44 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-4275-0000-0000-000003B1F872 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-4276-0000-0000-000038C73170 Message-Id: <20200324081251.28810-4-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 suspectscore=1 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's also test the stop portion of the "stop and store status" sigp order. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- s390x/smp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index 95df8c49d2495391..8a6cd1d8b17d76c6 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -76,12 +76,26 @@ static void test_stop_store_status(void) struct lowcore *lc = (void *)0x0; report_prefix_push("stop store status"); + report_prefix_push("running"); + smp_cpu_restart(1); lc->prefix_sa = 0; lc->grs_sa[15] = 0; smp_cpu_stop_store_status(1); mb(); report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); + report(smp_cpu_stopped(1), "cpu stopped"); + report_prefix_pop(); + + report_prefix_push("stopped"); + lc->prefix_sa = 0; + lc->grs_sa[15] = 0; + smp_cpu_stop_store_status(1); + mb(); + report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); + report(lc->grs_sa[15], "stack"); + report_prefix_pop(); + report_prefix_pop(); } From patchwork Tue Mar 24 08:12:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B168B159A for ; Tue, 24 Mar 2020 08:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DED320842 for ; Tue, 24 Mar 2020 08:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727110AbgCXINM (ORCPT ); Tue, 24 Mar 2020 04:13:12 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53650 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727150AbgCXINL (ORCPT ); Tue, 24 Mar 2020 04:13:11 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O82Vxh072287 for ; Tue, 24 Mar 2020 04:13:10 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ywf2gp8gn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:09 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:08 -0000 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:05 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8C3MY21365174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:12:03 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCFBFA405C; Tue, 24 Mar 2020 08:13:04 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE937A405B; Tue, 24 Mar 2020 08:13:03 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:03 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 04/10] s390x: smp: Test local interrupts after cpu reset Date: Tue, 24 Mar 2020 04:12:45 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0028-0000-0000-000003EA6E30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0029-0000-0000-000024AFD6F4 Message-Id: <20200324081251.28810-5-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 suspectscore=1 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=889 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Local interrupts (external and emergency call) should be cleared after any cpu reset. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- s390x/smp.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index 8a6cd1d8b17d76c6..a8e3dd7aac0c788c 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -243,6 +243,20 @@ static void test_reset_initial(void) report_prefix_pop(); } +static void test_local_ints(void) +{ + unsigned long mask; + + expect_ext_int(); + /* Open masks for ecall and emcall */ + ctl_set_bit(0, 13); + ctl_set_bit(0, 14); + mask = extract_psw_mask(); + mask |= PSW_MASK_EXT; + load_psw_mask(mask); + set_flag(1); +} + static void test_reset(void) { struct psw psw; @@ -251,10 +265,18 @@ static void test_reset(void) psw.addr = (unsigned long)test_func; report_prefix_push("cpu reset"); + sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); + sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); smp_cpu_start(1, psw); sigp_retry(1, SIGP_CPU_RESET, 0, NULL); report(smp_cpu_stopped(1), "cpu stopped"); + + set_flag(0); + psw.addr = (unsigned long)test_local_ints; + smp_cpu_start(1, psw); + wait_for_flag(); + report(true, "local interrupts cleared"); report_prefix_pop(); } From patchwork Tue Mar 24 08:12:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454773 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0767E139A for ; Tue, 24 Mar 2020 08:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E766A20775 for ; Tue, 24 Mar 2020 08:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727188AbgCXINN (ORCPT ); Tue, 24 Mar 2020 04:13:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:62474 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727116AbgCXINM (ORCPT ); Tue, 24 Mar 2020 04:13:12 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O83w5Q009073 for ; Tue, 24 Mar 2020 04:13:11 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywewtr7rv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:11 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:09 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:06 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D61d65994950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:06 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33178A405C; Tue, 24 Mar 2020 08:13:06 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3580CA4060; Tue, 24 Mar 2020 08:13:05 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:05 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 05/10] s390x: smp: Loop if secondary cpu returns into cpu setup again Date: Tue, 24 Mar 2020 04:12:46 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0012-0000-0000-00000396B387 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0013-0000-0000-000021D3A6BA Message-Id: <20200324081251.28810-6-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=1 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=840 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Up to now a secondary cpu could have returned from the function it was executing and ending up somewhere in cstart64.S. This was mostly circumvented by an endless loop in the function that it executed. Let's add a loop to the end of the cpu setup, so we don't have to rely on added loops in the tests. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- s390x/cstart64.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 9af6bb3f28399fbc..ecffbe05c707fd7c 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -161,7 +161,9 @@ smp_cpu_setup_state: lctlg %c0, %c0, GEN_LC_SW_INT_CRS /* We should only go once through cpu setup and not for every restart */ stg %r14, GEN_LC_RESTART_NEW_PSW + 8 - br %r14 + brasl %r14, %r14 + /* If the function returns, just loop here */ +0: j 0 pgm_int: SAVE_REGS From patchwork Tue Mar 24 08:12:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2BC414B4 for ; Tue, 24 Mar 2020 08:13:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFA6520775 for ; Tue, 24 Mar 2020 08:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgCXINO (ORCPT ); Tue, 24 Mar 2020 04:13:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49600 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727161AbgCXINN (ORCPT ); Tue, 24 Mar 2020 04:13:13 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O83B7o053807 for ; Tue, 24 Mar 2020 04:13:12 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ywd2rrwqk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:12 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:09 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Tue, 24 Mar 2020 08:13:07 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D7pq49610792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:07 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5A5FA4060; Tue, 24 Mar 2020 08:13:07 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95C60A405F; Tue, 24 Mar 2020 08:13:06 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:06 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 06/10] s390x: smp: Remove unneeded cpu loops Date: Tue, 24 Mar 2020 04:12:47 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0008-0000-0000-00000362DE31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0009-0000-0000-00004A84497F Message-Id: <20200324081251.28810-7-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 suspectscore=1 spamscore=0 mlxscore=0 adultscore=0 priorityscore=1501 malwarescore=0 phishscore=0 mlxlogscore=896 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Now that we have a loop which is executed after we return from the main function of a secondary cpu, we can remove the surplus loops. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Acked-by: David Hildenbrand --- s390x/smp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index a8e3dd7aac0c788c..74622113a2c4ad92 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -35,15 +35,9 @@ static void set_flag(int val) mb(); } -static void cpu_loop(void) -{ - for (;;) {} -} - static void test_func(void) { set_flag(1); - cpu_loop(); } static void test_start(void) @@ -292,7 +286,7 @@ int main(void) /* Setting up the cpu to give it a stack and lowcore */ psw.mask = extract_psw_mask(); - psw.addr = (unsigned long)cpu_loop; + psw.addr = (unsigned long)test_func; smp_cpu_setup(1, psw); smp_cpu_stop(1); From patchwork Tue Mar 24 08:12:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF12F139A for ; Tue, 24 Mar 2020 08:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA92320842 for ; Tue, 24 Mar 2020 08:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbgCXINX (ORCPT ); Tue, 24 Mar 2020 04:13:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:14782 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbgCXINP (ORCPT ); Tue, 24 Mar 2020 04:13:15 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O846pp025988 for ; Tue, 24 Mar 2020 04:13:14 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywbtgcd2s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:14 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:09 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8D9wQ52428906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:09 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BCABA4065; Tue, 24 Mar 2020 08:13:09 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24693A4062; Tue, 24 Mar 2020 08:13:08 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:07 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 07/10] s390x: smp: Use full PSW to bringup new cpu Date: Tue, 24 Mar 2020 04:12:48 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0012-0000-0000-00000396B389 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0013-0000-0000-000021D3A6BD Message-Id: <20200324081251.28810-8-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 phishscore=0 impostorscore=0 priorityscore=1501 spamscore=0 bulkscore=0 mlxlogscore=927 lowpriorityscore=0 clxscore=1015 adultscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Up to now we ignored the psw mask and only used the psw address when bringing up a new cpu. For DAT we need to also load the mask, so let's do that. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- lib/s390x/smp.c | 2 ++ s390x/cstart64.S | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 3f8624318f1aa5a1..6ef0335954fd4832 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -202,6 +202,8 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) cpu->stack = (uint64_t *)alloc_pages(2); /* Start without DAT and any other mask bits. */ + cpu->lowcore->sw_int_psw.mask = psw.mask; + cpu->lowcore->sw_int_psw.addr = psw.addr; cpu->lowcore->sw_int_grs[14] = psw.addr; cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4); lc->restart_new_psw.mask = 0x0000000180000000UL; diff --git a/s390x/cstart64.S b/s390x/cstart64.S index ecffbe05c707fd7c..e084f1305aa90e45 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -161,7 +161,8 @@ smp_cpu_setup_state: lctlg %c0, %c0, GEN_LC_SW_INT_CRS /* We should only go once through cpu setup and not for every restart */ stg %r14, GEN_LC_RESTART_NEW_PSW + 8 - brasl %r14, %r14 + larl %r14, 0f + lpswe GEN_LC_SW_INT_PSW /* If the function returns, just loop here */ 0: j 0 From patchwork Tue Mar 24 08:12:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B2A514B4 for ; Tue, 24 Mar 2020 08:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1857520870 for ; Tue, 24 Mar 2020 08:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgCXINV (ORCPT ); Tue, 24 Mar 2020 04:13:21 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:5284 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbgCXINQ (ORCPT ); Tue, 24 Mar 2020 04:13:16 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O84B2B022323 for ; Tue, 24 Mar 2020 04:13:15 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yxw7d1q07-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:15 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:11 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:10 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8DAxX13042102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:10 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CAD5EA405B; Tue, 24 Mar 2020 08:13:10 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF72EA4054; Tue, 24 Mar 2020 08:13:09 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:09 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 08/10] s390x: smp: Wait for sigp completion Date: Tue, 24 Mar 2020 04:12:49 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0016-0000-0000-000002F6B850 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0017-0000-0000-0000335A5507 Message-Id: <20200324081251.28810-9-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=1 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Sigp orders are not necessarily finished when the processor finished the sigp instruction. We need to poll if the order has been finished before we continue. For (re)start and stop we already use sigp sense running and sigp sense loops. But we still lack completion checks for stop and store status, as well as the cpu resets. Let's add them. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- lib/s390x/smp.c | 8 ++++++++ lib/s390x/smp.h | 1 + s390x/smp.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 6ef0335954fd4832..2555bf4f5e73d762 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -154,6 +154,14 @@ int smp_cpu_start(uint16_t addr, struct psw psw) return rc; } +void smp_cpu_wait_for_completion(uint16_t addr) +{ + uint32_t status; + + /* Loops when cc == 2, i.e. when the cpu is busy with a sigp order */ + sigp_retry(1, SIGP_SENSE, 0, &status); +} + int smp_cpu_destroy(uint16_t addr) { struct cpu *cpu; diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index ce63a89880c045f3..a8b98c0fcf2b451c 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -45,6 +45,7 @@ int smp_cpu_restart(uint16_t addr); int smp_cpu_start(uint16_t addr, struct psw psw); int smp_cpu_stop(uint16_t addr); int smp_cpu_stop_store_status(uint16_t addr); +void smp_cpu_wait_for_completion(uint16_t addr); int smp_cpu_destroy(uint16_t addr); int smp_cpu_setup(uint16_t addr, struct psw psw); void smp_teardown(void); diff --git a/s390x/smp.c b/s390x/smp.c index 74622113a2c4ad92..48321f4e346dc71d 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -75,6 +75,7 @@ static void test_stop_store_status(void) lc->prefix_sa = 0; lc->grs_sa[15] = 0; smp_cpu_stop_store_status(1); + smp_cpu_wait_for_completion(1); mb(); report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); @@ -85,6 +86,7 @@ static void test_stop_store_status(void) lc->prefix_sa = 0; lc->grs_sa[15] = 0; smp_cpu_stop_store_status(1); + smp_cpu_wait_for_completion(1); mb(); report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); @@ -215,6 +217,7 @@ static void test_reset_initial(void) wait_for_flag(); sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL); + smp_cpu_wait_for_completion(1); sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); report_prefix_push("clear"); @@ -264,6 +267,7 @@ static void test_reset(void) smp_cpu_start(1, psw); sigp_retry(1, SIGP_CPU_RESET, 0, NULL); + smp_cpu_wait_for_completion(1); report(smp_cpu_stopped(1), "cpu stopped"); set_flag(0); From patchwork Tue Mar 24 08:12:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B2B9139A for ; Tue, 24 Mar 2020 08:13:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 371EE20870 for ; Tue, 24 Mar 2020 08:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727199AbgCXINT (ORCPT ); Tue, 24 Mar 2020 04:13:19 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45350 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727256AbgCXINS (ORCPT ); Tue, 24 Mar 2020 04:13:18 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O83iSS092057 for ; Tue, 24 Mar 2020 04:13:17 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywet39cqa-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:17 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:14 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:12 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8DC9o56819888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:12 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2826CA4054; Tue, 24 Mar 2020 08:13:12 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36195A405F; Tue, 24 Mar 2020 08:13:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:10 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 09/10] s390x: smp: Add restart when running test Date: Tue, 24 Mar 2020 04:12:50 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0012-0000-0000-00000396B38A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0013-0000-0000-000021D3A6BE Message-Id: <20200324081251.28810-10-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_02:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 spamscore=0 clxscore=1015 phishscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 suspectscore=1 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240042 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's make sure we can restart a cpu that is already running. Restarting it if it is stopped is implicitely tested by the the other restart calls in the smp test. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- s390x/smp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index 48321f4e346dc71d..79cdc1f6a4b0b491 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -52,6 +52,24 @@ static void test_start(void) report(1, "start"); } +/* + * Does only test restart when the target is running. + * The other tests do restarts when stopped multiple times already. + */ +static void test_restart(void) +{ + struct cpu *cpu = smp_cpu_from_addr(1); + struct lowcore *lc = cpu->lowcore; + + lc->restart_new_psw.mask = extract_psw_mask(); + lc->restart_new_psw.addr = (unsigned long)test_func; + + set_flag(0); + smp_cpu_restart(1); + wait_for_flag(); + report(1, "restart while running"); +} + static void test_stop(void) { smp_cpu_stop(1); @@ -295,6 +313,7 @@ int main(void) smp_cpu_stop(1); test_start(); + test_restart(); test_stop(); test_stop_store_status(); test_store_status(); From patchwork Tue Mar 24 08:12:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11454771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A787517EF for ; Tue, 24 Mar 2020 08:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93D7520870 for ; Tue, 24 Mar 2020 08:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbgCXINV (ORCPT ); Tue, 24 Mar 2020 04:13:21 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33746 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbgCXINU (ORCPT ); Tue, 24 Mar 2020 04:13:20 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02O83VXt019564 for ; Tue, 24 Mar 2020 04:13:19 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywdr5utjk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 24 Mar 2020 04:13:19 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2020 08:13:15 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 24 Mar 2020 08:13:12 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02O8DDaF64159946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 08:13:13 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F9AAA405C; Tue, 24 Mar 2020 08:13:13 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 75774A405B; Tue, 24 Mar 2020 08:13:12 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.40]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 Mar 2020 08:13:12 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com Subject: [kvm-unit-tests PATCH 10/10] s390x: Fix library constant definitions Date: Tue, 24 Mar 2020 04:12:51 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324081251.28810-1-frankja@linux.ibm.com> References: <20200324081251.28810-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032408-0020-0000-0000-000003BA012C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032408-0021-0000-0000-000022128093 Message-Id: <20200324081251.28810-11-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-24_01:2020-03-23,2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=1 mlxlogscore=853 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240039 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Seems like I uppercased the whole region instead of only the ULs when I added those definitions. Lets make the x lowercase again. Signed-off-by: Janosch Frank Reviewed-by: Christian Borntraeger Reviewed-by: Cornelia Huck --- lib/s390x/asm/arch_def.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 15a4d49ca97c9964..1b3bb0c1e7e1b626 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -19,10 +19,10 @@ struct psw { #define PSW_MASK_DAT 0x0400000000000000UL #define PSW_MASK_PSTATE 0x0001000000000000UL -#define CR0_EXTM_SCLP 0X0000000000000200UL -#define CR0_EXTM_EXTC 0X0000000000002000UL -#define CR0_EXTM_EMGC 0X0000000000004000UL -#define CR0_EXTM_MASK 0X0000000000006200UL +#define CR0_EXTM_SCLP 0x0000000000000200UL +#define CR0_EXTM_EXTC 0x0000000000002000UL +#define CR0_EXTM_EMGC 0x0000000000004000UL +#define CR0_EXTM_MASK 0x0000000000006200UL struct lowcore { uint8_t pad_0x0000[0x0080 - 0x0000]; /* 0x0000 */