From patchwork Thu Apr 30 15:24:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520665 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 7707F139A for ; Thu, 30 Apr 2020 15:24:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FF542082E for ; Thu, 30 Apr 2020 15:24:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OI3BAgql" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbgD3PYm (ORCPT ); Thu, 30 Apr 2020 11:24:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:45875 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726343AbgD3PYm (ORCPT ); Thu, 30 Apr 2020 11:24:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Oo4ewZBzbISUXtmgWjNPvYau/73/ltqaZVuLGWCX/Co=; b=OI3BAgql7FGcrB4+Bd8csQCcG0nmTw8C447OSj8MiH2ypdXGleyYq1364RGLwsBbUpipXx s6crnMPP3zc/2qzB/28dI5GsVi4x9lmZhK+vyxXqaLVDVjiJuhqjckXEQ3OnxT1ojPGo5u 5N+F67O8ezZcRGDeJJ97ZQ0o0P1QPTQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-299-8fhCr_7IN-e_e8CfY9jjuw-1; Thu, 30 Apr 2020 11:24:38 -0400 X-MC-Unique: 8fhCr_7IN-e_e8CfY9jjuw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99481107ACCD; Thu, 30 Apr 2020 15:24:37 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C4235EDE3; Thu, 30 Apr 2020 15:24:35 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Janosch Frank , David Hildenbrand Subject: [kvm-unit-tests PULL 01/17] MAINTAINERS: Add Janosch as a s390x maintainer Date: Thu, 30 Apr 2020 17:24:14 +0200 Message-Id: <20200430152430.40349-2-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Thomas Huth Both, David and I, often do not have as much spare time for the kvm-unit-tests as we would like to have, so we could use a little bit of additional help here. Janosch did some excellent work for the s390x kvm-unit-tests in the past months and is listed as reviewer for these patches since quite a while already, so he's a very well suited for the maintainer job here, too. Signed-off-by: Thomas Huth Acked-by: Janosch Frank Acked-by: David Hildenbrand Message-Id: <20200205101935.19219-1-thuth@redhat.com> Signed-off-by: David Hildenbrand --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 48da1db..082be95 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -80,7 +80,7 @@ F: lib/ppc64/* S390X M: Thomas Huth M: David Hildenbrand -R: Janosch Frank +M: Janosch Frank L: kvm@vger.kernel.org F: s390x/* F: lib/s390x/* From patchwork Thu Apr 30 15:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520669 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 D898C15E6 for ; Thu, 30 Apr 2020 15:24:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B785E208CA for ; Thu, 30 Apr 2020 15:24:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Na/IVXj2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726878AbgD3PYo (ORCPT ); Thu, 30 Apr 2020 11:24:44 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58244 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726805AbgD3PYn (ORCPT ); Thu, 30 Apr 2020 11:24:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ucYm1NuI/VXAeGAVtOlvWxH+ORjiRCmatFstqqQZ7KU=; b=Na/IVXj2JqQwfuWYkIcUNM7UasjaehymPbTF80Lm4poCQ+3bDN4cqGq5NbRFwvG8S9+5TZ f+sDG/ciiVYNYaX0PTFIPx7QYZzqsanOA50iU7nezXSDeFwsmnk2zwth0APcAfP08uzl20 zPig1PWVLL+JT60isiiHkWpbd7RNwfg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-eNo0tr8iPluIq8yBEgmDrg-1; Thu, 30 Apr 2020 11:24:40 -0400 X-MC-Unique: eNo0tr8iPluIq8yBEgmDrg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74F4B462; Thu, 30 Apr 2020 15:24:39 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA0D15EDE3; Thu, 30 Apr 2020 15:24:37 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 02/17] MAINTAINERS: s390x: add myself as reviewer Date: Thu, 30 Apr 2020 17:24:15 +0200 Message-Id: <20200430152430.40349-3-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Cornelia Huck Signed-off-by: Cornelia Huck Acked-by: Janosch Frank Message-Id: <20200324121722.9776-2-cohuck@redhat.com> Signed-off-by: David Hildenbrand --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 082be95..4642909 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -81,6 +81,7 @@ S390X M: Thomas Huth M: David Hildenbrand M: Janosch Frank +R: Cornelia Huck L: kvm@vger.kernel.org F: s390x/* F: lib/s390x/* From patchwork Thu Apr 30 15:24:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520671 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 DA1A815E6 for ; Thu, 30 Apr 2020 15:24:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B958A208D5 for ; Thu, 30 Apr 2020 15:24:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CHRi/NCF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbgD3PYr (ORCPT ); Thu, 30 Apr 2020 11:24:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26180 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726933AbgD3PYr (ORCPT ); Thu, 30 Apr 2020 11:24:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DlSoJiivlfHDjecLcSWOaOhzGMAzFZnEl4plhwLg4rk=; b=CHRi/NCF9xFyq5j+A6pAuDnK6fES923JiUyEgvxadLzXyDAno8cI+LJM2HapMRyU0hImcg YgvcGxPdPAzQw4uMjAXz1oeOz9T7W1sMKlwBRgmgK04xD7sRAWTg0lQwPenb44qA2e51D0 pC43hEYvbOpbav8oWcSmehi76n9dYKg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-P7XBeYErMEmKjkj8VX1jLA-1; Thu, 30 Apr 2020 11:24:42 -0400 X-MC-Unique: P7XBeYErMEmKjkj8VX1jLA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 568668005B7; Thu, 30 Apr 2020 15:24:41 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id C55015EDE3; Thu, 30 Apr 2020 15:24:39 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 03/17] MAINTAINERS: s390x: add linux-s390 list Date: Thu, 30 Apr 2020 17:24:16 +0200 Message-Id: <20200430152430.40349-4-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Cornelia Huck It makes sense to cc: patches there as well. Signed-off-by: Cornelia Huck Message-Id: <20200324121722.9776-3-cohuck@redhat.com> Signed-off-by: David Hildenbrand --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4642909..52a3eb6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -83,6 +83,7 @@ M: David Hildenbrand M: Janosch Frank R: Cornelia Huck L: kvm@vger.kernel.org +L: linux-s390@vger.kernel.org F: s390x/* F: lib/s390x/* From patchwork Thu Apr 30 15:24:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520675 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 68087139A for ; Thu, 30 Apr 2020 15:24:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5277E2082E for ; Thu, 30 Apr 2020 15:24:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a8utEhas" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbgD3PYv (ORCPT ); Thu, 30 Apr 2020 11:24:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50994 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727023AbgD3PYu (ORCPT ); Thu, 30 Apr 2020 11:24:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q5GKqRnjYp5mTrr/vaK3WIjudXVRWTOcF+rQCTHEjYE=; b=a8utEhas7uYcRqXHDmvdk/xd17ofJmXRQMmqw7Bx5ivkrdxPfPl+0JgW/KJH4KWQqCnTRj ALn019zdu+yKROx7ouu00lr3FnzIFw8zQn4ssdVcG1vU2dLNIOyCcD3BzAUtwH6ojso+VT a7a/Z1UA7sRCCk/FhavvHwMFpkhe4X0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-zdbk4-LxPXKYXB-rP9WeQQ-1; Thu, 30 Apr 2020 11:24:44 -0400 X-MC-Unique: zdbk4-LxPXKYXB-rP9WeQQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31D8E1B18BC0; Thu, 30 Apr 2020 15:24:43 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id A42595EDE3; Thu, 30 Apr 2020 15:24:41 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 04/17] s390x: Add stsi 3.2.2 tests Date: Thu, 30 Apr 2020 17:24:17 +0200 Message-Id: <20200430152430.40349-5-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Subcode 3.2.2 is handled by KVM/QEMU and should therefore be tested a bit more thoroughly. In this test we set a custom name and uuid through the QEMU command line. Both parameters will be passed to the guest on a stsi subcode 3.2.2 call and will then be checked. We also compare the configured cpu numbers against the smp reported numbers and if the reserved + configured add up to the total number reported. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Message-Id: <20200331071456.3302-1-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/stsi.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 1 + 2 files changed, 74 insertions(+) diff --git a/s390x/stsi.c b/s390x/stsi.c index e9206bc..66b4257 100644 --- a/s390x/stsi.c +++ b/s390x/stsi.c @@ -14,7 +14,28 @@ #include #include #include +#include +struct stsi_322 { + uint8_t reserved[31]; + uint8_t count; + struct { + uint8_t reserved2[4]; + uint16_t total_cpus; + uint16_t conf_cpus; + uint16_t standby_cpus; + uint16_t reserved_cpus; + uint8_t name[8]; + uint32_t caf; + uint8_t cpi[16]; + uint8_t reserved5[3]; + uint8_t ext_name_encoding; + uint32_t reserved3; + uint8_t uuid[16]; + } vm[8]; + uint8_t reserved4[1504]; + uint8_t ext_names[8][256]; +}; static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2))); static void test_specs(void) @@ -76,11 +97,63 @@ static void test_fc(void) report(stsi_get_fc(pagebuf) >= 2, "query fc >= 2"); } +static void test_3_2_2(void) +{ + int rc; + /* EBCDIC for "kvm-unit" */ + const uint8_t vm_name[] = { 0x92, 0xa5, 0x94, 0x60, 0xa4, 0x95, 0x89, + 0xa3 }; + const uint8_t uuid[] = { 0x0f, 0xb8, 0x4a, 0x86, 0x72, 0x7c, + 0x11, 0xea, 0xbc, 0x55, 0x02, 0x42, 0xac, 0x13, + 0x00, 0x03 }; + /* EBCDIC for "KVM/" */ + const uint8_t cpi_kvm[] = { 0xd2, 0xe5, 0xd4, 0x61 }; + const char *vm_name_ext = "kvm-unit-test"; + struct stsi_322 *data = (void *)pagebuf; + + report_prefix_push("3.2.2"); + + /* Is the function code available at all? */ + if (stsi_get_fc(pagebuf) < 3) { + report_skip("Running under lpar, no level 3 to test."); + goto out; + } + + rc = stsi(pagebuf, 3, 2, 2); + report(!rc, "call"); + + /* For now we concentrate on KVM/QEMU */ + if (memcmp(&data->vm[0].cpi, cpi_kvm, sizeof(cpi_kvm))) { + report_skip("Not running under KVM/QEMU."); + goto out; + } + + report(!memcmp(data->vm[0].uuid, uuid, sizeof(uuid)), "uuid"); + report(data->vm[0].conf_cpus == smp_query_num_cpus(), "cpu # configured"); + report(data->vm[0].total_cpus == + data->vm[0].reserved_cpus + data->vm[0].conf_cpus, + "cpu # total == conf + reserved"); + report(data->vm[0].standby_cpus == 0, "cpu # standby"); + report(!memcmp(data->vm[0].name, vm_name, sizeof(data->vm[0].name)), + "VM name == kvm-unit-test"); + + if (data->vm[0].ext_name_encoding != 2) { + report_skip("Extended VM names are not UTF-8."); + goto out; + } + report(!memcmp(data->ext_names[0], vm_name_ext, sizeof(vm_name_ext)), + "ext VM name == kvm-unit-test"); + +out: + report_prefix_pop(); +} + int main(void) { report_prefix_push("stsi"); test_priv(); test_specs(); test_fc(); + test_3_2_2(); return report_summary(); } diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 07013b2..535db21 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -71,6 +71,7 @@ extra_params=-device diag288,id=watchdog0 --watchdog-action inject-nmi [stsi] file = stsi.elf +extra_params=-name kvm-unit-test --uuid 0fb84a86-727c-11ea-bc55-0242ac130003 -smp 1,maxcpus=8 [smp] file = smp.elf From patchwork Thu Apr 30 15:24:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520673 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 77C7A139A for ; Thu, 30 Apr 2020 15:24:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56E8620873 for ; Thu, 30 Apr 2020 15:24:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y/c6lPLR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727060AbgD3PYu (ORCPT ); Thu, 30 Apr 2020 11:24:50 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:55094 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726955AbgD3PYt (ORCPT ); Thu, 30 Apr 2020 11:24:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OqZ66/q53T5tsOQUwEg0/wWd28TgA4UfMH3dvKqQtN0=; b=Y/c6lPLRKV4odE6sD94A3AR7cg9QlIKzFBz5v8UZgY9rNU6Fw7PXDTh06SFTxrHCtj0Gks HiWTiFf3OPFUcsvGkyqCnEp92h6ezUykXHcx8RwYK2xSxZem4QMZEb4jOYTZDrcRIwLBQZ xioS69kQd0WY5TRnvx68kHtNqKkMKC8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-yb3pGOD9O2WgbJYKJkPe0w-1; Thu, 30 Apr 2020 11:24:46 -0400 X-MC-Unique: yb3pGOD9O2WgbJYKJkPe0w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59E42468; Thu, 30 Apr 2020 15:24:45 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CBED5EDE3; Thu, 30 Apr 2020 15:24:43 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Christian Borntraeger , Janosch Frank , Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 05/17] s390x/smp: fix detection of "running" Date: Thu, 30 Apr 2020 17:24:18 +0200 Message-Id: <20200430152430.40349-6-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Christian Borntraeger On s390x hosts with a single CPU, the smp test case hangs (loops). The check if our restart has finished is wrong. Sigp sense running status checks if the CPU is currently backed by a real CPU. This means that on single CPU hosts a sigp sense running will never claim that a target is running. We need to check for not being stopped instead. Reviewed-by: Janosch Frank Reviewed-by: Cornelia Huck Signed-off-by: Christian Borntraeger Message-Id: <20200330084911.34248-2-borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand --- lib/s390x/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 3f86243..203792a 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -128,7 +128,7 @@ static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) * 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_running(addr)) + while (smp_cpu_stopped(addr)) mb(); cpu->active = true; return 0; From patchwork Thu Apr 30 15:24:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520677 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 456B9139A for ; Thu, 30 Apr 2020 15:24:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EECE20873 for ; Thu, 30 Apr 2020 15:24:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CDB1a1zv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbgD3PYw (ORCPT ); Thu, 30 Apr 2020 11:24:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:24156 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726814AbgD3PYv (ORCPT ); Thu, 30 Apr 2020 11:24:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UD/j5+1iXGhqPUgR0TfBbEOD/BrP+tUkdBHy9BoUCs0=; b=CDB1a1zv13j/MWNZ4eNvFRoWOYeXg6hexpZpsa5l9cETy8UT3735vKXxGPnqO398hkesgS vbYEQFc2ua6PsiB1ve8ey9hdCgJxXjFWXU2xjQLRlbX6dN4NqiHeWWBGJL1N1eNIhrzOEM mCbDTdhc88mcAJNUNQtZ8PEZBdeXcLg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-Wmc_HmfENzO2xqsqOihI-A-1; Thu, 30 Apr 2020 11:24:48 -0400 X-MC-Unique: Wmc_HmfENzO2xqsqOihI-A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 311DC107ACCD; Thu, 30 Apr 2020 15:24:47 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6F5D5EDE3; Thu, 30 Apr 2020 15:24:45 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, David Hildenbrand , Christian Borntraeger Subject: [kvm-unit-tests PULL 06/17] s390x: STFLE operates on doublewords Date: Thu, 30 Apr 2020 17:24:19 +0200 Message-Id: <20200430152430.40349-7-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org STFLE operates on doublewords, not bytes. Passing in "256" resulted in some ignored bits getting set. Not bad, but also not clean. Let's just convert our stfle handling code to operate on doublewords. Reviewed-by: Christian Borntraeger Reviewed-by: Janosch Frank Message-Id: <20200401163305.31550-1-david@redhat.com> Signed-off-by: David Hildenbrand --- lib/s390x/asm/facility.h | 14 +++++++------- lib/s390x/io.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/s390x/asm/facility.h b/lib/s390x/asm/facility.h index e34dc2c..def2705 100644 --- a/lib/s390x/asm/facility.h +++ b/lib/s390x/asm/facility.h @@ -14,12 +14,12 @@ #include #include -#define NR_STFL_BYTES 256 -extern uint8_t stfl_bytes[]; +#define NB_STFL_DOUBLEWORDS 32 +extern uint64_t stfl_doublewords[]; static inline bool test_facility(int nr) { - return stfl_bytes[nr / 8] & (0x80U >> (nr % 8)); + return stfl_doublewords[nr / 64] & (0x8000000000000000UL >> (nr % 64)); } static inline void stfl(void) @@ -27,9 +27,9 @@ static inline void stfl(void) asm volatile(" stfl 0(0)\n" : : : "memory"); } -static inline void stfle(uint8_t *fac, unsigned int len) +static inline void stfle(uint64_t *fac, unsigned int nb_doublewords) { - register unsigned long r0 asm("0") = len - 1; + register unsigned long r0 asm("0") = nb_doublewords - 1; asm volatile(" .insn s,0xb2b00000,0(%1)\n" : "+d" (r0) : "a" (fac) : "memory", "cc"); @@ -40,9 +40,9 @@ static inline void setup_facilities(void) struct lowcore *lc = NULL; stfl(); - memcpy(stfl_bytes, &lc->stfl, sizeof(lc->stfl)); + memcpy(stfl_doublewords, &lc->stfl, sizeof(lc->stfl)); if (test_facility(7)) - stfle(stfl_bytes, NR_STFL_BYTES); + stfle(stfl_doublewords, NB_STFL_DOUBLEWORDS); } #endif diff --git a/lib/s390x/io.c b/lib/s390x/io.c index e091c37..c0f0bf7 100644 --- a/lib/s390x/io.c +++ b/lib/s390x/io.c @@ -19,7 +19,7 @@ #include "smp.h" extern char ipl_args[]; -uint8_t stfl_bytes[NR_STFL_BYTES] __attribute__((aligned(8))); +uint64_t stfl_doublewords[NB_STFL_DOUBLEWORDS]; static struct spinlock lock; From patchwork Thu Apr 30 15:24:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520679 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 59FA1139A for ; Thu, 30 Apr 2020 15:24:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42C192082E for ; Thu, 30 Apr 2020 15:24:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MhUTKqps" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbgD3PY4 (ORCPT ); Thu, 30 Apr 2020 11:24:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57834 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727110AbgD3PY4 (ORCPT ); Thu, 30 Apr 2020 11:24:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06QUopc2pdglVt4rmYY6zhlBwcqBRKBgP4bCflio89M=; b=MhUTKqps6mItOSDxTqKl1ro0bTtEHOtE0RAOFplrztEcITa6vBE+6uo4++ywJbpbrHj7Zh D6jfTsw25DKOLyq+Y9JW/l7l6J3OGxD914ZmRTToz++ZNQ99nVYprAtpM+ElK0TEt8+Geu 55GQ0gzi+RUCMkPZxwq3MHr4/dGH0YY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-IBIVG9lTM6ORqkpSIBNKjw-1; Thu, 30 Apr 2020 11:24:50 -0400 X-MC-Unique: IBIVG9lTM6ORqkpSIBNKjw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35C26107ACCA; Thu, 30 Apr 2020 15:24:49 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FB1E5D780; Thu, 30 Apr 2020 15:24:47 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Christian Borntraeger , Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 07/17] s390x/smp: add minimal test for sigp sense running status Date: Thu, 30 Apr 2020 17:24:20 +0200 Message-Id: <20200430152430.40349-8-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Christian Borntraeger Two minimal tests: - our own CPU should be running when we check ourselves - a CPU should at least have some times with a not running indication. To speed things up we stop CPU1 Also rename smp_cpu_running to smp_sense_running_status. Reviewed-by: Janosch Frank Reviewed-by: Cornelia Huck Signed-off-by: Christian Borntraeger Message-Id: <20200402154441.13063-1-borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand --- lib/s390x/smp.c | 2 +- lib/s390x/smp.h | 2 +- s390x/smp.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 203792a..df8dcd9 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -58,7 +58,7 @@ bool smp_cpu_stopped(uint16_t addr) return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED)); } -bool smp_cpu_running(uint16_t addr) +bool smp_sense_running_status(uint16_t addr) { if (sigp(addr, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) return true; diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index ce63a89..d66e39a 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -40,7 +40,7 @@ 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_cpu_running(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); diff --git a/s390x/smp.c b/s390x/smp.c index fa40753..1641979 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -182,6 +182,19 @@ static void test_emcall(void) report_prefix_pop(); } +static void test_sense_running(void) +{ + report_prefix_push("sense_running"); + /* we (CPU0) are running */ + report(smp_sense_running_status(0), "CPU0 sense claims running"); + /* stop the target CPU (CPU1) to speed up the not running case */ + smp_cpu_stop(1); + /* Make sure to have at least one time with a not running indication */ + while(smp_sense_running_status(1)); + report(true, "CPU1 sense claims not running"); + report_prefix_pop(); +} + static void test_reset_initial(void) { struct cpu_status *status = alloc_pages(0); @@ -251,6 +264,7 @@ int main(void) test_store_status(); test_ecall(); test_emcall(); + test_sense_running(); test_reset(); test_reset_initial(); smp_cpu_destroy(1); From patchwork Thu Apr 30 15:24:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520681 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 C94A517EF for ; Thu, 30 Apr 2020 15:24:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7F4320731 for ; Thu, 30 Apr 2020 15:24:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CvrSmEjA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727110AbgD3PY6 (ORCPT ); Thu, 30 Apr 2020 11:24:58 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:48783 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726814AbgD3PY6 (ORCPT ); Thu, 30 Apr 2020 11:24:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M8ZcT0j1duyJlrVxhoY+6SuYWTCgaNWIiADLekpznQ4=; b=CvrSmEjApNufkLja37rJkW14vTnWIftcAX4f/ihEMdhMZFEDQTk6ZJLu9681ga4okXWg8J XkTZ/iXbapqgaHaZy8HyWZWCqfex5eB/WOAHr07mFFjHakVZG7cg+LrTlV2hMWWQqztrxR T/8yKYqnyDkiX1HbFknXWrrJzzS2duQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-R04Z7BjrOoa9VA5N7tLTqA-1; Thu, 30 Apr 2020 11:24:54 -0400 X-MC-Unique: R04Z7BjrOoa9VA5N7tLTqA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67ED2872FE2; Thu, 30 Apr 2020 15:24:53 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8549A5EDE3; Thu, 30 Apr 2020 15:24:49 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Andrew Jones , David Hildenbrand Subject: [kvm-unit-tests PULL 08/17] s390x: unittests: Use smp parameter Date: Thu, 30 Apr 2020 17:24:21 +0200 Message-Id: <20200430152430.40349-9-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Andrew Jones Signed-off-by: Andrew Jones Reviewed-by: David Hildenbrand Reviewed-by: Janosch Frank Message-Id: <20200403094015.506838-1-drjones@redhat.com> Signed-off-by: David Hildenbrand --- s390x/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 535db21..b307329 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -75,7 +75,7 @@ extra_params=-name kvm-unit-test --uuid 0fb84a86-727c-11ea-bc55-0242ac130003 -sm [smp] file = smp.elf -extra_params =-smp 2 +smp = 2 [sclp-1g] file = sclp.elf From patchwork Thu Apr 30 15:24:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520683 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 38D8115E6 for ; Thu, 30 Apr 2020 15:25:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20B3720731 for ; Thu, 30 Apr 2020 15:25:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QoVEgM30" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbgD3PZC (ORCPT ); Thu, 30 Apr 2020 11:25:02 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:48512 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726810AbgD3PZB (ORCPT ); Thu, 30 Apr 2020 11:25:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=24P6Uxqd7YNzAWjyBnTTOqp3txQctstT3STnNs9jdmg=; b=QoVEgM30kHhYkLqiMe/54oh+kq7V+7Oy7y+hPkBf1oU5zWWfJkRV68SlU7WFuqWGTkYuL8 AW5dSU8Xd4nfpNrEsR+PKiQvO8tNCAE/sDk5qhvODEEh4FcJZBh8WZRaly00bNtAKkT08U nRR0qkk7eZIxQNVfXKFkkIfr07ORN8M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-123-OudTxjJRMYmkRWJu3ernvQ-1; Thu, 30 Apr 2020 11:24:56 -0400 X-MC-Unique: OudTxjJRMYmkRWJu3ernvQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B5D1107ACF4; Thu, 30 Apr 2020 15:24:55 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3C915EDE3; Thu, 30 Apr 2020 15:24:53 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , Christian Borntraeger , David Hildenbrand Subject: [kvm-unit-tests PULL 09/17] s390x: smp: Test all CRs on initial reset Date: Thu, 30 Apr 2020 17:24:22 +0200 Message-Id: <20200430152430.40349-10-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Reviewed-by: Christian Borntraeger Reviewed-by: David Hildenbrand Message-Id: <20200424093356.11931-1-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/smp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/s390x/smp.c b/s390x/smp.c index 1641979..08fa770 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -195,16 +195,28 @@ static void test_sense_running(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); struct psw psw; + int i; 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); @@ -215,6 +227,10 @@ static void test_reset_initial(void) report(!status->fpc, "fpc"); report(!status->cputm, "cpu timer"); report(!status->todpr, "todpr"); + for (i = 1; i <= 13; i++) { + report(status->crs[i] == 0, "cr%d == 0", i); + } + report(status->crs[15] == 0, "cr15 == 0"); report_prefix_pop(); report_prefix_push("initialized"); From patchwork Thu Apr 30 15:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520685 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 66271139A for ; Thu, 30 Apr 2020 15:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47B9A20731 for ; Thu, 30 Apr 2020 15:25:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UZbd5qht" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727118AbgD3PZE (ORCPT ); Thu, 30 Apr 2020 11:25:04 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38165 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbgD3PZE (ORCPT ); Thu, 30 Apr 2020 11:25:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9fI8qQ1cjxjAT4F1ugPxtSOTKx/agoKea/GBNE+nVVw=; b=UZbd5qhtGk5oTksQP3z07ipafzMBBGW3tw92g3KOacJDFwbqS55WFTweOuQLa4C1lkW8dd 879f5KH3xtMzfWd1ZiZHW+iVhD0nuqQRfR6Xf5ympETzprdls2urhNR+IQyYPCN3kLQP53 ppG6tmFtlaHXhrH3y79sx00yW0A57zs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-bddzle-gPzG2BH8KgUPumw-1; Thu, 30 Apr 2020 11:24:58 -0400 X-MC-Unique: bddzle-gPzG2BH8KgUPumw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42F5746B; Thu, 30 Apr 2020 15:24:57 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id B74F45EDE3; Thu, 30 Apr 2020 15:24:55 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 10/17] s390x: smp: Dirty fpc before initial reset test Date: Thu, 30 Apr 2020 17:24:23 +0200 Message-Id: <20200430152430.40349-11-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Message-Id: <20200429143518.1360468-3-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/s390x/smp.c b/s390x/smp.c index 08fa770..bf082d1 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -198,6 +198,7 @@ static void test_sense_running(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 Thu Apr 30 15:24:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520687 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 BC02E15E6 for ; Thu, 30 Apr 2020 15:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A47120873 for ; Thu, 30 Apr 2020 15:25:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iIub7+9+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbgD3PZF (ORCPT ); Thu, 30 Apr 2020 11:25:05 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27909 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727106AbgD3PZE (ORCPT ); Thu, 30 Apr 2020 11:25:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jZEGSLl0JZmQ17JeqZ0bSsFXXTWmCtNEI/q1OjLpaYk=; b=iIub7+9++g9SI5l15lbE+A/WuDZ3JBUN7kmqjdR7SxjAz3NqhPfXbEZK+YybOBiSNfcx2s ftD4nDkIpQpTuDVXb9G0nlgVqdOYr8TSW1E2Us9BMVcJWbVuAT6Ng8sXY+LNZJSh0deKi7 y8eJP2tkOTAfnKYOO4pAyAjueK2HU/w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-NLG_3CDrOIqA5GQDRgYUbg-1; Thu, 30 Apr 2020 11:25:00 -0400 X-MC-Unique: NLG_3CDrOIqA5GQDRgYUbg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60F91800D24; Thu, 30 Apr 2020 15:24:59 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ED205EDE3; Thu, 30 Apr 2020 15:24:57 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 11/17] s390x: smp: Test stop and store status on a running and stopped cpu Date: Thu, 30 Apr 2020 17:24:24 +0200 Message-Id: <20200430152430.40349-12-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Let's also test the stop portion of the "stop and store status" sigp order. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Message-Id: <20200429143518.1360468-4-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/smp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index bf082d1..57eacb2 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -76,6 +76,18 @@ 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); @@ -83,6 +95,8 @@ static void test_stop_store_status(void) report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); report_prefix_pop(); + + report_prefix_pop(); } static void test_store_status(void) From patchwork Thu Apr 30 15:24:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520691 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 8F410139A for ; Thu, 30 Apr 2020 15:25:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77D8B20873 for ; Thu, 30 Apr 2020 15:25:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D6b8Jk7I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727803AbgD3PZK (ORCPT ); Thu, 30 Apr 2020 11:25:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:59924 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727112AbgD3PZJ (ORCPT ); Thu, 30 Apr 2020 11:25:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QGdZkNa1iuJeTe+FUSCAEfNCQKynn56veEV55lQF5+w=; b=D6b8Jk7Im+D6j1GoTAcECYVsBRNszAaHECisTajACA7pDtMFkqx6ORqk/wYeqP2uJBVd8b h70D2Wqt1qkioQDAHkoZI3StAv8m7vryNADUEQ13KzWjB9KlCCemArmuz09P2F4VC0eVjt vpAcupmqKolc9cz40FP9dX3GHXJhBuQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-htrIRbJqOHCQHZmt2L9qhQ-1; Thu, 30 Apr 2020 11:25:05 -0400 X-MC-Unique: htrIRbJqOHCQHZmt2L9qhQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39E758005B7; Thu, 30 Apr 2020 15:25:01 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE40A5EDE3; Thu, 30 Apr 2020 15:24:59 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 12/17] s390x: smp: Test local interrupts after cpu reset Date: Thu, 30 Apr 2020 17:24:25 +0200 Message-Id: <20200430152430.40349-13-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Local interrupts (external and emergency call) should be cleared after any cpu reset. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Message-Id: <20200429143518.1360468-5-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/smp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index 57eacb2..447b998 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -258,6 +258,19 @@ static void test_reset_initial(void) report_prefix_pop(); } +static void test_local_ints(void) +{ + unsigned long mask; + + /* 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; @@ -266,10 +279,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 Thu Apr 30 15:24:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520689 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 E4032139A for ; Thu, 30 Apr 2020 15:25:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C19FE2082E for ; Thu, 30 Apr 2020 15:25:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BOIZRM2i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbgD3PZH (ORCPT ); Thu, 30 Apr 2020 11:25:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28364 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726774AbgD3PZH (ORCPT ); Thu, 30 Apr 2020 11:25:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=10Tt0UeRl/eVZhHqu2dZwuFRp8r/OOuFvrA0QZOYC34=; b=BOIZRM2iA00VMZC4eXGKX/GNsCNtGkgB1cgNozYvRvNCe91dfDCEOzOUid8vd6ZnJtAf+E Z8RixwmTkiG8PzIRZPFWJ3ynxOmk7kD73+8h5yR1GazX7ZHV3mX+uhVRKMLkqwNYJ+ghOV Yj+Qqq6d2S1BmJgXdFT5V2ESR9pHuQo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-92GmfHT9P0yoBRkVUwMdTQ-1; Thu, 30 Apr 2020 11:25:04 -0400 X-MC-Unique: 92GmfHT9P0yoBRkVUwMdTQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13288107ACCA; Thu, 30 Apr 2020 15:25:03 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 851335EDF1; Thu, 30 Apr 2020 15:25:01 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 13/17] s390x: smp: Loop if secondary cpu returns into cpu setup again Date: Thu, 30 Apr 2020 17:24:26 +0200 Message-Id: <20200430152430.40349-14-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Message-Id: <20200429143518.1360468-6-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/cstart64.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 9af6bb3..ecffbe0 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 Thu Apr 30 15:24:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520693 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 7B5DB15E6 for ; Thu, 30 Apr 2020 15:25:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59B9D20731 for ; Thu, 30 Apr 2020 15:25:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hLSp/Bm8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727790AbgD3PZP (ORCPT ); Thu, 30 Apr 2020 11:25:15 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:47805 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726701AbgD3PZO (ORCPT ); Thu, 30 Apr 2020 11:25:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vc4y+38sfY2AqjlWqsyiGmpTqIgBJ39IMpZ6Li1i2Ds=; b=hLSp/Bm8a/oj7WICYqUDBpTCvaH2f2IRRC/AX+k2MlY6idxMjSznM7wlNtkhJFX0aq6Wfg GoMbL1uPn94yi6lByUIUH2xpQIk6jM09dVjlq+15H5itRGD/3ZSOvZ4i5AjqkVUfdu6UE5 wmenXLOBXCWS/wyKTcoiDkRBa89vYGg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-0zj6lCzwPTWIF3zYuD78eA-1; Thu, 30 Apr 2020 11:25:08 -0400 X-MC-Unique: 0zj6lCzwPTWIF3zYuD78eA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14CD0872FE0; Thu, 30 Apr 2020 15:25:07 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D0885EDE3; Thu, 30 Apr 2020 15:25:03 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 14/17] s390x: smp: Remove unneeded cpu loops Date: Thu, 30 Apr 2020 17:24:27 +0200 Message-Id: <20200430152430.40349-15-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Message-Id: <20200429143518.1360468-7-frankja@linux.ibm.com> Signed-off-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 447b998..f2319c4 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) @@ -306,7 +300,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 Thu Apr 30 15:24:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520695 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 E1B6215E6 for ; Thu, 30 Apr 2020 15:25:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CAB6E20873 for ; Thu, 30 Apr 2020 15:25:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NquSnbYp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727802AbgD3PZQ (ORCPT ); Thu, 30 Apr 2020 11:25:16 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:20913 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727800AbgD3PZP (ORCPT ); Thu, 30 Apr 2020 11:25:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DyKdklucIGbvdhS2tGasIAFGNWO8hinN55TF/mpDW5E=; b=NquSnbYpDUCCe6sO3PNqtQJk+ulxBWbUOA/tqpyA63vBprB8GQ/vuRnePp6zUTFD6WG3Yj LWIwwNumvwPsgNgeEpZ9tFxo/tucGFIRNIXwvM4DegTBgo+A3wtsFs7PboqUWpArZTQCFu Tb4LOgGHe7xJUcOOTEHW6/lclyARqIs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-Jm2a-yd2MUqH6T-Ku0kofQ-1; Thu, 30 Apr 2020 11:25:12 -0400 X-MC-Unique: Jm2a-yd2MUqH6T-Ku0kofQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4452F1B18BC2; Thu, 30 Apr 2020 15:25:11 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 621FA5EDF1; Thu, 30 Apr 2020 15:25:07 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 15/17] s390x: smp: Use full PSW to bringup new cpu Date: Thu, 30 Apr 2020 17:24:28 +0200 Message-Id: <20200430152430.40349-16-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Reviewed-by: David Hildenbrand Message-Id: <20200429143518.1360468-8-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- 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 df8dcd9..2860e9c 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 ecffbe0..e084f13 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 Thu Apr 30 15:24:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520697 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 06088139A for ; Thu, 30 Apr 2020 15:25:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E30E220873 for ; Thu, 30 Apr 2020 15:25:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BRkeEPfI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbgD3PZV (ORCPT ); Thu, 30 Apr 2020 11:25:21 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:59491 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727801AbgD3PZU (ORCPT ); Thu, 30 Apr 2020 11:25:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfQ2wE+gD/G6WCu1cAhJmw6ubfumU3Ld2YMoCPO3gm0=; b=BRkeEPfIUlGEmlTLodkgtoy44+KCiYPXdS/tVgGSIfPwLbh2ZbutsM3KaN+PBR6BELXmUb XYi5MV+keySnwEUNFUgGDZaxwj0H0U9Y3/0qwH6THgA2gSIklhH/bxDvzx0rcRJxSOyPOZ fXBCjh2A1NwVAswNfcLIHgH3rH/5hJA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-qD6li75OP_G_LDY962uk7g-1; Thu, 30 Apr 2020 11:25:17 -0400 X-MC-Unique: qD6li75OP_G_LDY962uk7g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFE32108BD18; Thu, 30 Apr 2020 15:25:15 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93C885EDE3; Thu, 30 Apr 2020 15:25:11 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 16/17] s390x: smp: Add restart when running test Date: Thu, 30 Apr 2020 17:24:29 +0200 Message-Id: <20200430152430.40349-17-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank 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 Reviewed-by: David Hildenbrand Message-Id: <20200429143518.1360468-10-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- s390x/smp.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index f2319c4..ad30e3c 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -52,6 +52,34 @@ 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; + + /* Make sure cpu is running */ + smp_cpu_stop(0); + set_flag(0); + smp_cpu_restart(1); + wait_for_flag(); + + /* + * Wait until cpu 1 has set the flag because it executed the + * restart function. + */ + set_flag(0); + smp_cpu_restart(1); + wait_for_flag(); + report(1, "restart while running"); +} + static void test_stop(void) { smp_cpu_stop(1); @@ -305,6 +333,7 @@ int main(void) smp_cpu_stop(1); test_start(); + test_restart(); test_stop(); test_stop_store_status(); test_store_status(); From patchwork Thu Apr 30 15:24:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11520699 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 065F4139A for ; Thu, 30 Apr 2020 15:25:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAA652082E for ; Thu, 30 Apr 2020 15:25:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a4Oo9IPh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727842AbgD3PZY (ORCPT ); Thu, 30 Apr 2020 11:25:24 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43216 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbgD3PZY (ORCPT ); Thu, 30 Apr 2020 11:25:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588260323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x5LX3IMNTP6Rcba7covGCS7+BSgZGw3wQT8eS1u8v/Q=; b=a4Oo9IPhSyuNKAAQGJ2IKWk7fZwYAVOMeo38Zsl2iGkdSG44OoOyML5MUvC70yXcjF6UQw +SDXfn7HJK7cuzSNkGdrk5CgsxoR3Y2JWoA1WoTbR0FKl8Y30ngH/V/mCQZrRIQhUeLymn wxb4PFIDKyvIw7hAXoe3NnsudD4eQco= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-mgOFo7M7P2-i8WCxHwXqsA-1; Thu, 30 Apr 2020 11:25:20 -0400 X-MC-Unique: mgOFo7M7P2-i8WCxHwXqsA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07228462; Thu, 30 Apr 2020 15:25:19 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-172.ams2.redhat.com [10.36.113.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B7E55EDE3; Thu, 30 Apr 2020 15:25:16 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , Thomas Huth , Janosch Frank , linux-s390@vger.kernel.org, Christian Borntraeger , Cornelia Huck , David Hildenbrand Subject: [kvm-unit-tests PULL 17/17] s390x: Fix library constant definitions Date: Thu, 30 Apr 2020 17:24:30 +0200 Message-Id: <20200430152430.40349-18-david@redhat.com> In-Reply-To: <20200430152430.40349-1-david@redhat.com> References: <20200430152430.40349-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Seems like I uppercased the whole region instead of only the ULs when I added those definitions. Let's make the x lowercase again. Signed-off-by: Janosch Frank Reviewed-by: Christian Borntraeger Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Message-Id: <20200429143518.1360468-11-frankja@linux.ibm.com> Signed-off-by: David Hildenbrand --- 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 15a4d49..1b3bb0c 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 */