From patchwork Fri Feb 4 13:08:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735053 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 3FEC1C433EF for ; Fri, 4 Feb 2022 13:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344641AbiBDNJF (ORCPT ); Fri, 4 Feb 2022 08:09:05 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43204 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235167AbiBDNJD (ORCPT ); Fri, 4 Feb 2022 08:09:03 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214ChJii007048 for ; Fri, 4 Feb 2022 13:09:03 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=G6MUxAE93v3vdyjC8QwrqNPuBqpJgQJFV4BdOjis5Qk=; b=lOJyaTO1I/zUoVA081l8ACmE5lc6iVLa5eEhDsVoI3rn9P0iK+q6QCIsZuhoGXi/Ubk4 OCLHXF+5Plgi6cpEIrMfmhk1VzrF8ueO/CYuiEftnWb9yQSZulAK040aCcZXKSdtyU+V h5VOKn8Bqrzpjl9XqDZHIBkKzpu0Plb7m3Rm+LzMKsZU2l4q+/rlTSuLDc1rX+cXjUJL qMgPtAyLj4WH3wN+LN7sm7Ro3K3OMAjTmsPPcaB5ZVdAZiqJlccCYwMB2ayEI7SKCpTL ECJUXyrigfL357g0YJh4uQSDBnWJsa2q5+rsXyxGRJyxOV6TFwAjiIQNtfZGRahxsY2B Pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0rj5mk9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:02 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214CjPSf025718 for ; Fri, 4 Feb 2022 13:09:02 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0rj5mk97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:02 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214D7VDC019530; Fri, 4 Feb 2022 13:09:00 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 3e0r10d0t8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D8v9140632666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:08:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 686B44C075; Fri, 4 Feb 2022 13:08:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02B0D4C040; Fri, 4 Feb 2022 13:08:57 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:56 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 1/6] lib: s390x: smp: guarantee that boot CPU has index 0 Date: Fri, 4 Feb 2022 14:08:50 +0100 Message-Id: <20220204130855.39520-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: oyayI_4OfnV1fdhzFVzgRPNBT4w6rUyn X-Proofpoint-GUID: xH3-SdLgEmfHd1b6_gYjMYpSdKWvKVWj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Guarantee that the boot CPU has index 0. This simplifies the implementation of tests that require multiple CPUs. Also fix a small bug in the allocation of the cpus array. Signed-off-by: Claudio Imbrenda Fixes: f77c0515 ("s390x: Add initial smp code") Fixes: 52076a63 ("s390x: Consolidate sclp read info") Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- lib/s390x/smp.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index b753eab5..eae742d2 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -25,7 +25,6 @@ #include "sclp.h" static struct cpu *cpus; -static struct cpu *cpu0; static struct spinlock lock; extern void smp_cpu_setup_state(void); @@ -69,7 +68,7 @@ static int smp_cpu_stop_nolock(uint16_t addr, bool store) uint8_t order = store ? SIGP_STOP_AND_STORE_STATUS : SIGP_STOP; cpu = smp_cpu_from_addr(addr); - if (!cpu || cpu == cpu0) + if (!cpu || addr == cpus[0].addr) return -1; if (sigp_retry(addr, order, 0, NULL)) @@ -193,7 +192,7 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) sigp_retry(cpu->addr, SIGP_SET_PREFIX, (unsigned long )lc, NULL); /* Copy all exception psws. */ - memcpy(lc, cpu0->lowcore, 512); + memcpy(lc, cpus[0].lowcore, 512); /* Setup stack */ cpu->stack = (uint64_t *)alloc_pages(2); @@ -251,15 +250,27 @@ void smp_setup(void) if (num > 1) printf("SMP: Initializing, found %d cpus\n", num); - cpus = calloc(num, sizeof(cpus)); + cpus = calloc(num, sizeof(*cpus)); for (i = 0; i < num; i++) { cpus[i].addr = entry[i].address; cpus[i].active = false; + /* + * Fill in the boot CPU. If the boot CPU is not at index 0, + * swap it with the one at index 0. This guarantees that the + * boot CPU will always have index 0. If the boot CPU was + * already at index 0, a few extra useless assignments are + * performed, but everything will work ok. + * Notice that there is no guarantee that the list of CPUs + * returned by the Read SCP Info command is in any + * particular order, or that its order will stay consistent + * across multiple invocations. + */ if (entry[i].address == cpu0_addr) { - cpu0 = &cpus[i]; - cpu0->stack = stackptr; - cpu0->lowcore = (void *)0; - cpu0->active = true; + cpus[i].addr = cpus[0].addr; + cpus[0].addr = cpu0_addr; + cpus[0].stack = stackptr; + cpus[0].lowcore = (void *)0; + cpus[0].active = true; } } spin_unlock(&lock); From patchwork Fri Feb 4 13:08:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735054 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 BDD2DC433FE for ; Fri, 4 Feb 2022 13:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346796AbiBDNJG (ORCPT ); Fri, 4 Feb 2022 08:09:06 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50800 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238982AbiBDNJE (ORCPT ); Fri, 4 Feb 2022 08:09:04 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214BXJUD016036 for ; Fri, 4 Feb 2022 13:09:03 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=5qpitrVnkeNmTcVcv2EPEcPoSneci/heRfe2AHJ0sn0=; b=pYIUEkYz3Lv3saPd3XBbWw6gGemVBySp4owYMakMSuYM3JIQoc+HewHBicnCtqMJMVxC hEn6THHppj6Wc4LbDu0+6jy4Y+armifHTu1sV/+3w19hhEBE06kyX4gkXMmwbT8SG9q1 o8xEsGegdDqdZHj9+4Zuy3GMg7RDhNECZ3JaUrgRMRKvP+KhRqI9dMs6JeH2x5byLZlq eYF8WDu+pJLInW0OsUj5NB1/vu93vcN+9/vG6AIgdqvzdpNtCwXjyvZfHC0ZR243OZDS 0bmRK83ECEEp0VOEeHUECVqGiMhzRGbUv1Z6jCFSIdq06wi154/LFrr7+F4E8dkSguba 1Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e0rt5c71q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:03 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214BU6sv014145 for ; Fri, 4 Feb 2022 13:09:03 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e0rt5c71e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:03 +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 214D7DTo005244; Fri, 4 Feb 2022 13:09:01 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 3e0r0u4rt8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:01 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D8w4M41484712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:08:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F32D44C063; Fri, 4 Feb 2022 13:08:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A6474C040; Fri, 4 Feb 2022 13:08:57 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:57 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 2/6] lib: s390x: smp: refactor smp functions to accept indexes Date: Fri, 4 Feb 2022 14:08:51 +0100 Message-Id: <20220204130855.39520-3-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xr7hPJqxJ6OzXng7fA_x8YBMVlMnlOrr X-Proofpoint-ORIG-GUID: klXsHTt90HSyU0dowC7b2Smq2i7G7qpy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Refactor all the smp_* functions to accept CPU indexes instead of CPU addresses. Add SIGP wrappers to use indexes instead of addresses. Raw SIGP calls using addresses are still possible. Add a few other useful functions to deal with CPU indexes. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- lib/s390x/smp.h | 20 ++++--- lib/s390x/smp.c | 148 ++++++++++++++++++++++++++++-------------------- 2 files changed, 99 insertions(+), 69 deletions(-) diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index a2609f11..1e69a7de 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -37,15 +37,19 @@ struct cpu_status { int smp_query_num_cpus(void); struct cpu *smp_cpu_from_addr(uint16_t addr); -bool smp_cpu_stopped(uint16_t addr); -bool smp_sense_running_status(uint16_t addr); -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); -int smp_cpu_destroy(uint16_t addr); -int smp_cpu_setup(uint16_t addr, struct psw psw); +struct cpu *smp_cpu_from_idx(uint16_t idx); +uint16_t smp_cpu_addr(uint16_t idx); +bool smp_cpu_stopped(uint16_t idx); +bool smp_sense_running_status(uint16_t idx); +int smp_cpu_restart(uint16_t idx); +int smp_cpu_start(uint16_t idx, struct psw psw); +int smp_cpu_stop(uint16_t idx); +int smp_cpu_stop_store_status(uint16_t idx); +int smp_cpu_destroy(uint16_t idx); +int smp_cpu_setup(uint16_t idx, struct psw psw); void smp_teardown(void); void smp_setup(void); +int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status); +int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status); #endif diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index eae742d2..dde79274 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -29,11 +29,28 @@ static struct spinlock lock; extern void smp_cpu_setup_state(void); +static void check_idx(uint16_t idx) +{ + assert(idx < smp_query_num_cpus()); +} + int smp_query_num_cpus(void) { return sclp_get_cpu_num(); } +int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status) +{ + check_idx(idx); + return sigp(cpus[idx].addr, order, parm, status); +} + +int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status) +{ + check_idx(idx); + return sigp_retry(cpus[idx].addr, order, parm, status); +} + struct cpu *smp_cpu_from_addr(uint16_t addr) { int i, num = smp_query_num_cpus(); @@ -45,174 +62,183 @@ struct cpu *smp_cpu_from_addr(uint16_t addr) return NULL; } -bool smp_cpu_stopped(uint16_t addr) +struct cpu *smp_cpu_from_idx(uint16_t idx) +{ + check_idx(idx); + return &cpus[idx]; +} + +uint16_t smp_cpu_addr(uint16_t idx) +{ + check_idx(idx); + return cpus[idx].addr; +} + +bool smp_cpu_stopped(uint16_t idx) { uint32_t status; - if (sigp(addr, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) + if (smp_sigp(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) return false; return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED)); } -bool smp_sense_running_status(uint16_t addr) +bool smp_sense_running_status(uint16_t idx) { - if (sigp(addr, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) + if (smp_sigp(idx, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) return true; /* Status stored condition code is equivalent to cpu not running. */ return false; } -static int smp_cpu_stop_nolock(uint16_t addr, bool store) +static int smp_cpu_stop_nolock(uint16_t idx, bool store) { - struct cpu *cpu; uint8_t order = store ? SIGP_STOP_AND_STORE_STATUS : SIGP_STOP; - cpu = smp_cpu_from_addr(addr); - if (!cpu || addr == cpus[0].addr) + /* refuse to work on the boot CPU */ + if (idx == 0) return -1; - if (sigp_retry(addr, order, 0, NULL)) + if (smp_sigp_retry(idx, order, 0, NULL)) return -1; - while (!smp_cpu_stopped(addr)) + while (!smp_cpu_stopped(idx)) mb(); - cpu->active = false; + /* idx has been already checked by the smp_* functions called above */ + cpus[idx].active = false; return 0; } -int smp_cpu_stop(uint16_t addr) +int smp_cpu_stop(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, false); + rc = smp_cpu_stop_nolock(idx, false); spin_unlock(&lock); return rc; } -int smp_cpu_stop_store_status(uint16_t addr) +int smp_cpu_stop_store_status(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, true); + rc = smp_cpu_stop_nolock(idx, true); spin_unlock(&lock); return rc; } -static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) +static int smp_cpu_restart_nolock(uint16_t idx, struct psw *psw) { int rc; - struct cpu *cpu = smp_cpu_from_addr(addr); - if (!cpu) - return -1; + check_idx(idx); if (psw) { - cpu->lowcore->restart_new_psw.mask = psw->mask; - cpu->lowcore->restart_new_psw.addr = psw->addr; + cpus[idx].lowcore->restart_new_psw.mask = psw->mask; + cpus[idx].lowcore->restart_new_psw.addr = psw->addr; } /* * Stop the cpu, so we don't have a race between a running cpu * and the restart in the test that checks if the cpu is * running after the restart. */ - smp_cpu_stop_nolock(addr, false); - rc = sigp(addr, SIGP_RESTART, 0, NULL); + smp_cpu_stop_nolock(idx, false); + rc = sigp(cpus[idx].addr, SIGP_RESTART, 0, NULL); if (rc) return rc; /* * The order has been accepted, but the actual restart may not * have been performed yet, so wait until the cpu is running. */ - while (smp_cpu_stopped(addr)) + while (smp_cpu_stopped(idx)) mb(); - cpu->active = true; + cpus[idx].active = true; return 0; } -int smp_cpu_restart(uint16_t addr) +int smp_cpu_restart(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_restart_nolock(addr, NULL); + rc = smp_cpu_restart_nolock(idx, NULL); spin_unlock(&lock); return rc; } -int smp_cpu_start(uint16_t addr, struct psw psw) +int smp_cpu_start(uint16_t idx, struct psw psw) { int rc; spin_lock(&lock); - rc = smp_cpu_restart_nolock(addr, &psw); + rc = smp_cpu_restart_nolock(idx, &psw); spin_unlock(&lock); return rc; } -int smp_cpu_destroy(uint16_t addr) +int smp_cpu_destroy(uint16_t idx) { - struct cpu *cpu; int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, false); + rc = smp_cpu_stop_nolock(idx, false); if (!rc) { - cpu = smp_cpu_from_addr(addr); - free_pages(cpu->lowcore); - free_pages(cpu->stack); - cpu->lowcore = (void *)-1UL; - cpu->stack = (void *)-1UL; + free_pages(cpus[idx].lowcore); + free_pages(cpus[idx].stack); + cpus[idx].lowcore = (void *)-1UL; + cpus[idx].stack = (void *)-1UL; } spin_unlock(&lock); return rc; } -int smp_cpu_setup(uint16_t addr, struct psw psw) +static int smp_cpu_setup_nolock(uint16_t idx, struct psw psw) { struct lowcore *lc; - struct cpu *cpu; - int rc = -1; - - spin_lock(&lock); - - if (!cpus) - goto out; - cpu = smp_cpu_from_addr(addr); - - if (!cpu || cpu->active) - goto out; + if (cpus[idx].active) + return -1; - sigp_retry(cpu->addr, SIGP_INITIAL_CPU_RESET, 0, NULL); + sigp_retry(cpus[idx].addr, SIGP_INITIAL_CPU_RESET, 0, NULL); lc = alloc_pages_flags(1, AREA_DMA31); - cpu->lowcore = lc; - memset(lc, 0, PAGE_SIZE * 2); - sigp_retry(cpu->addr, SIGP_SET_PREFIX, (unsigned long )lc, NULL); + cpus[idx].lowcore = lc; + sigp_retry(cpus[idx].addr, SIGP_SET_PREFIX, (unsigned long )lc, NULL); /* Copy all exception psws. */ memcpy(lc, cpus[0].lowcore, 512); /* Setup stack */ - cpu->stack = (uint64_t *)alloc_pages(2); + cpus[idx].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->sw_int_psw.mask = psw.mask; + lc->sw_int_psw.addr = psw.addr; + lc->sw_int_grs[14] = psw.addr; + lc->sw_int_grs[15] = (uint64_t)cpus[idx].stack + (PAGE_SIZE * 4); lc->restart_new_psw.mask = PSW_MASK_64; lc->restart_new_psw.addr = (uint64_t)smp_cpu_setup_state; lc->sw_int_crs[0] = BIT_ULL(CTL0_AFP); /* Start processing */ - smp_cpu_restart_nolock(addr, NULL); + smp_cpu_restart_nolock(idx, NULL); /* Wait until the cpu has finished setup and started the provided psw */ while (lc->restart_new_psw.addr != psw.addr) mb(); - rc = 0; -out: + + return 0; +} + +int smp_cpu_setup(uint16_t idx, struct psw psw) +{ + int rc = -1; + + spin_lock(&lock); + if (cpus) { + check_idx(idx); + rc = smp_cpu_setup_nolock(idx, psw); + } spin_unlock(&lock); return rc; } From patchwork Fri Feb 4 13:08:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735055 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 D05EAC433F5 for ; Fri, 4 Feb 2022 13:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348080AbiBDNJH (ORCPT ); Fri, 4 Feb 2022 08:09:07 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49212 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245574AbiBDNJF (ORCPT ); Fri, 4 Feb 2022 08:09:05 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214BO23I006592 for ; Fri, 4 Feb 2022 13:09:05 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=jS/F51NfnRLW5sTIWoaNtv2/LnQFx3oTKOAZDLA1lck=; b=NvI0Rcs3qqkKKgi2a3fPZf5V4enqCEOHeQATpmFDs/4azL31s+HO3bDIW0PoRahy+K1u cBhAAnDzRKwoWwcfGQOay32n5nrFWRf2l8pY506iO1Te1fSKAUZoHY6OeYFX6fPc2mwf 0Hif9IVtwUNichIZ51xw8HKDO1O7AIwN3wzPjn8YIgkld64y0+E4bxwsIjnMc7z9SC20 +cD7SOhn6fB3slk6AaB0rlFa7uNtEdg48fWIbH8foYV7Yq0awTMovEXE8wclBU4T5YaR TkKQRjAFxpP9ZQcB5yiNC3Z6PnxAWbzy5CMBmvj85TeF1lV/Iq4RZasCiMA1cH4xfHyX DQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx0n24k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:05 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214CTLIY000794 for ; Fri, 4 Feb 2022 13:09:05 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx0n241-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:04 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214D7LCj018234; Fri, 4 Feb 2022 13:09:02 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 3e0r0u50u8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D8wlS41484716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:08:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85CDE4C063; Fri, 4 Feb 2022 13:08:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20B0B4C040; Fri, 4 Feb 2022 13:08:58 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:58 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 3/6] s390x: smp: use CPU indexes instead of addresses Date: Fri, 4 Feb 2022 14:08:52 +0100 Message-Id: <20220204130855.39520-4-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: IebGomkrKCNX086_auhc9slMSEzVqWdk X-Proofpoint-ORIG-GUID: o56k_xkgAhl_xIqaIscG3zMWMDfyKaj6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/smp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index 1bbe4c31..068ac74d 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -56,7 +56,7 @@ static void test_start(void) */ static void test_restart(void) { - struct cpu *cpu = smp_cpu_from_addr(1); + struct cpu *cpu = smp_cpu_from_idx(1); struct lowcore *lc = cpu->lowcore; lc->restart_new_psw.mask = extract_psw_mask(); @@ -92,7 +92,7 @@ static void test_stop(void) static void test_stop_store_status(void) { - struct cpu *cpu = smp_cpu_from_addr(1); + struct cpu *cpu = smp_cpu_from_idx(1); struct lowcore *lc = (void *)0x0; report_prefix_push("stop store status"); @@ -129,7 +129,7 @@ static void test_store_status(void) report_prefix_push("running"); smp_cpu_restart(1); - sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, &r); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, &r); report(r == SIGP_STATUS_INCORRECT_STATE, "incorrect state"); report(!memcmp(status, (void *)status + PAGE_SIZE, PAGE_SIZE), "status not written"); @@ -138,7 +138,7 @@ static void test_store_status(void) memset(status, 0, PAGE_SIZE); report_prefix_push("stopped"); smp_cpu_stop(1); - sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); while (!status->prefix) { mb(); } report_pass("status written"); free_pages(status); @@ -176,7 +176,7 @@ static void test_ecall(void) smp_cpu_start(1, psw); wait_for_flag(); set_flag(0); - sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); @@ -210,7 +210,7 @@ static void test_emcall(void) smp_cpu_start(1, psw); wait_for_flag(); set_flag(0); - sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); + smp_sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); @@ -253,8 +253,8 @@ static void test_reset_initial(void) 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); + smp_sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); report_prefix_push("clear"); report(!status->psw.mask && !status->psw.addr, "psw"); @@ -299,11 +299,11 @@ 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_sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); smp_cpu_start(1, psw); - sigp_retry(1, SIGP_CPU_RESET, 0, NULL); + smp_sigp_retry(1, SIGP_CPU_RESET, 0, NULL); report(smp_cpu_stopped(1), "cpu stopped"); set_flag(0); From patchwork Fri Feb 4 13:08:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735056 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 99AF7C433EF for ; Fri, 4 Feb 2022 13:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349187AbiBDNJI (ORCPT ); Fri, 4 Feb 2022 08:09:08 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48762 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244412AbiBDNJF (ORCPT ); Fri, 4 Feb 2022 08:09:05 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214Aq7XD005893 for ; Fri, 4 Feb 2022 13:09:05 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=AfCcHh2cM+nbQMxVPJYHjkRjkI4BxauQ9hhre2bDi8U=; b=Ib2YL0jOc6ms/tL1RQfGjqwD6OYwMPuTFtC2sj4JdXTvfZQ91MOVf9OLrNliBhlwa8pO 1DlYYPCPWhKsZbeYtNmI64Sgua1acXyBpBG23Ty+4ebdF5U8dlRTFdBpJL2ei7mEHkk/ j5EnEpT2FzhS2JbcKsjM+7pcy14vRV26d0xzRj/n16rlkplW5HOxtO/7LGGz1T3Tkio4 qt1/lV+H6kF1NtxvS4NTIt43HOujASNng1HWSy0QOVV45AbLKj+TtCrfn/P2ehQdd400 7s/Ap5LeOSh0u5FeFBiYrew2gxmpif3oGal5MoXHhCuL2WpdN6LcBIcYWUU2tZqKqQZh iA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx453a7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:05 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214CT5tu031486 for ; Fri, 4 Feb 2022 13:09:04 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx4539r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:04 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214D7dKL009103; Fri, 4 Feb 2022 13:09:02 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 3e0r11mree-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D8x9743516308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:08:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DC0C4C063; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A79BB4C04A; Fri, 4 Feb 2022 13:08:58 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:58 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 4/6] s390x: firq: use CPU indexes instead of addresses Date: Fri, 4 Feb 2022 14:08:53 +0100 Message-Id: <20220204130855.39520-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KryYjSIoseq2ZI_kh-Vj04vW0WBYcB_9 X-Proofpoint-ORIG-GUID: Bnbw1SGvO46Fg0a6BvHHiJRdE5IepLjb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=831 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. replace the checks with asserts, the 3 CPUs are guaranteed to be there. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/firq.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/s390x/firq.c b/s390x/firq.c index fb9a2906..b4b3542e 100644 --- a/s390x/firq.c +++ b/s390x/firq.c @@ -44,24 +44,13 @@ static void test_wait_state_delivery(void) goto out; } - if (stap()) { - report_skip("need to start on CPU #0"); - goto out; - } - - /* - * We want CPU #2 to be stopped. This should be the case at this - * point, however, we want to sense if it even exists as well. - */ + /* Stop CPU #2. It must succeed because we have at least 3 CPUs */ ret = smp_cpu_stop(2); - if (ret) { - report_skip("CPU #2 not found"); - goto out; - } + assert(!ret); /* - * We're going to perform an SCLP service call but expect - * the interrupt on CPU #1 while it is in the wait state. + * We're going to perform an SCLP service call but expect the + * interrupt on CPU #1 while it is in the wait state. */ sclp_mark_busy(); @@ -69,11 +58,8 @@ static void test_wait_state_delivery(void) psw.mask = extract_psw_mask(); psw.addr = (unsigned long)wait_for_sclp_int; ret = smp_cpu_setup(1, psw); - if (ret) { - sclp_clear_busy(); - report_skip("cpu #1 not found"); - goto out; - } + /* This must not fail because we have at least 3 CPUs */ + assert(!ret); /* * We'd have to jump trough some hoops to sense e.g., via SIGP From patchwork Fri Feb 4 13:08:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735058 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 6613CC4332F for ; Fri, 4 Feb 2022 13:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349762AbiBDNJI (ORCPT ); Fri, 4 Feb 2022 08:09:08 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:7298 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238982AbiBDNJG (ORCPT ); Fri, 4 Feb 2022 08:09:06 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214CPVt9029475 for ; Fri, 4 Feb 2022 13:09:06 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=rvj6lbyfxp5wITaQbvGgyT/HEiaQEXxA/1vRcrKVI1I=; b=e0/4gS1IDBgM0m8juc8VFzd62f8lqQkMGXND1HYM1S4dkKLVOnKAMvFJ4a1aFDueiJoC i9JrJXSZRbZ7peVaI0lxa73lF0OKQtAwQprFQ2zl8zTySFGfTubFwjZlJ2nTUIn/Yyjj gDOEFrNSswsQ+jsbTSRt17o1ex9GWEPev04O5EOlBAynNxptmFxV5NpWlGhfSYS9qT1l w3S0siPgFdlZfBBkhPZ08RWdqf9s70OST+icpErc8Y33mwLYcZp2bRnpWm2x0qEW4RTe 585ZMRfqyWGGJYkUJwop/mRYW49GNfj0qLB3qgAEV6Xfy7GYBPl/4dSI97JV9ljKgnk5 aQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx3wc63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:06 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214C8V3c025283 for ; Fri, 4 Feb 2022 13:09:05 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx3wc5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:05 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214D7Qul026895; Fri, 4 Feb 2022 13:09:03 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3e0r0x4rs7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:03 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D8xpw11469208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:08:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7AE44C04A; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FF6C4C071; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 5/6] s390x: skrf: use CPU indexes instead of addresses Date: Fri, 4 Feb 2022 14:08:54 +0100 Message-Id: <20220204130855.39520-6-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: n3hcXgJgLjo2S0XG4KhsUlj6tXe4ayT3 X-Proofpoint-GUID: TWSmaZxBHBSKHpJYC9Ya1jv_rhk_q80x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=907 lowpriorityscore=0 phishscore=0 clxscore=1015 impostorscore=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/skrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/skrf.c b/s390x/skrf.c index ca4efbf1..b9a2e902 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -176,7 +176,7 @@ static void test_exception_ext_new(void) wait_for_flag(); set_flag(0); - sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); From patchwork Fri Feb 4 13:08:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12735057 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 E39D8C433FE for ; Fri, 4 Feb 2022 13:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244412AbiBDNJJ (ORCPT ); Fri, 4 Feb 2022 08:09:09 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20426 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245574AbiBDNJH (ORCPT ); Fri, 4 Feb 2022 08:09:07 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214BpVrm026612 for ; Fri, 4 Feb 2022 13:09:07 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=W7sjWEgfnr9ZhuChNkS6O2kWjcMN8iho3Eo5eLpl5nk=; b=E5K/sPx2+iPkSdNMOtGmFg8omU5Ut8zJF52mnjEhk8WVFj0h3RbuQ2ASn/CVg4JzQj8j nY89ojgD7QiukWRCEwtmzo2+2aamPSySyKZ9KO2IP5TK7v8HkSmaj4lJJUD640wsNG30 Z15uPtbIky5zLWJA9hBCEGkYzvJibnp48yfLNDrYZ6SXLHbbF6csa2UjhtWLcodY4tbn P6DY+lLF2cEk+9ZdpPNegv3P8y+8Y2DL0t8Lg1TgsasFlwVX65hUcyk1W4pg+NOV2CPA q3yosqkpbcnaAxYBe9jd5RPqaYbYFMJHe+6dv/OL8f2+H8cJ43v19efrXYtC8vzWllBD Iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx1d7j4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 Feb 2022 13:09:07 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214Cs2kC017509 for ; Fri, 4 Feb 2022 13:09:06 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx1d7hm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:06 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214D7VDH019530; Fri, 4 Feb 2022 13:09:04 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3e0r10d0th-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 13:09:03 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214D90L346661918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 13:09:00 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51B9A4C046; Fri, 4 Feb 2022 13:09:00 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF83A4C062; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 13:08:59 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 6/6] s390x: uv-host: use CPU indexes instead of addresses Date: Fri, 4 Feb 2022 14:08:55 +0100 Message-Id: <20220204130855.39520-7-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204130855.39520-1-imbrenda@linux.ibm.com> References: <20220204130855.39520-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: lgQm3TLaCJDxG6WOvUPPHBZCnP6fML-r X-Proofpoint-GUID: uILMjb-RTNFUTeaKCsVutYFmf1tEtbtA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_04,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. Signed-off-by: Claudio Imbrenda Reviewed-by: Steffen Eiden --- s390x/uv-host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 92a41069..a3d45d63 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -267,12 +267,12 @@ static void test_config_create(void) uvcb_cgc.conf_base_stor_origin = tmp; if (smp_query_num_cpus() == 1) { - sigp_retry(1, SIGP_SET_PREFIX, + smp_sigp_retry(1, SIGP_SET_PREFIX, uvcb_cgc.conf_var_stor_origin + PAGE_SIZE, NULL); rc = uv_call(0, (uint64_t)&uvcb_cgc); report(uvcb_cgc.header.rc == 0x10e && rc == 1 && !uvcb_cgc.guest_handle, "variable storage area contains lowcore"); - sigp_retry(1, SIGP_SET_PREFIX, 0x0, NULL); + smp_sigp_retry(1, SIGP_SET_PREFIX, 0x0, NULL); } tmp = uvcb_cgc.guest_sca;