From patchwork Thu Jan 16 12:05:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11336641 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 F271B1398 for ; Thu, 16 Jan 2020 12:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB1262073A for ; Thu, 16 Jan 2020 12:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbgAPMFh (ORCPT ); Thu, 16 Jan 2020 07:05:37 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55888 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726965AbgAPMFg (ORCPT ); Thu, 16 Jan 2020 07:05:36 -0500 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 00GBvSLY080856 for ; Thu, 16 Jan 2020 07:05:35 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xhff0fkdk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Jan 2020 07:05:35 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Jan 2020 12:05:33 -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) Thu, 16 Jan 2020 12:05:30 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00GC4eH623724462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jan 2020 12:04:40 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AAD452067; Thu, 16 Jan 2020 12:05:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.152.224.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 57F7B52059; Thu, 16 Jan 2020 12:05:28 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, david@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH v2 5/7] s390x: smp: Wait for cpu setup to finish Date: Thu, 16 Jan 2020 07:05:11 -0500 X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116120513.2244-1-frankja@linux.ibm.com> References: <20200116120513.2244-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20011612-0028-0000-0000-000003D1969A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20011612-0029-0000-0000-00002495BEC0 Message-Id: <20200116120513.2244-6-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-16_03:2020-01-16,2020-01-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 mlxlogscore=953 clxscore=1015 suspectscore=1 malwarescore=0 mlxscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-2001160103 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We store the user provided psw address into restart new, so a psw restart does not lead us through setup again. Also we wait on smp_cpu_setup() until the cpu has finished setup before returning. This is necessary for z/VM and LPAR where sigp is asynchronous. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand --- lib/s390x/smp.c | 2 ++ s390x/cstart64.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index f984a34..0a0bc1c 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -199,6 +199,8 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) /* Start processing */ smp_cpu_restart_nolock(addr, NULL); + /* Wait until the cpu has finished setup and started the provided psw */ + while (lc->restart_new_psw.addr != psw.addr) { mb(); } out: spin_unlock(&lock); return rc; diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 86dd4c4..9af6bb3 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -159,6 +159,8 @@ smp_cpu_setup_state: xgr %r1, %r1 lmg %r0, %r15, GEN_LC_SW_INT_GRS 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 pgm_int: