From patchwork Thu Feb 28 16:51:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 1049618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 449JW73l48z9s9L for ; Fri, 1 Mar 2019 03:52:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387439AbfB1QwS (ORCPT ); Thu, 28 Feb 2019 11:52:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387434AbfB1QwS (ORCPT ); Thu, 28 Feb 2019 11:52:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 14EE3A12F7; Thu, 28 Feb 2019 16:52:18 +0000 (UTC) Received: from thuth.com (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 956D313ACF; Thu, 28 Feb 2019 16:52:15 +0000 (UTC) From: Thomas Huth To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, David Hildenbrand , Laurent Vivier , Janosch Frank Subject: [kvm-unit-tests PULL 4/5] s390x: Beautify pfmf report strings Date: Thu, 28 Feb 2019 17:51:59 +0100 Message-Id: <1551372720-17321-5-git-send-email-thuth@redhat.com> In-Reply-To: <1551372720-17321-1-git-send-email-thuth@redhat.com> References: <1551372720-17321-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 28 Feb 2019 16:52:18 +0000 (UTC) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org From: Janosch Frank Use a 4k/1m prefix rather than mangling it into the report string. Signed-off-by: Janosch Frank [thuth: Changed "clear 1m" into "clear memory", too] Signed-off-by: Thomas Huth --- s390x/pfmf.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/s390x/pfmf.c b/s390x/pfmf.c index 4cc6bd1..9bf434a 100644 --- a/s390x/pfmf.c +++ b/s390x/pfmf.c @@ -64,6 +64,7 @@ static void test_4k_key(void) union r1 r1; union skey skey; + report_prefix_push("4K"); r1.val = 0; r1.reg.sk = 1; r1.reg.fsc = FSC_4K; @@ -71,15 +72,18 @@ static void test_4k_key(void) pfmf(r1.val, (unsigned long) pagebuf); skey.val = get_storage_key((unsigned long) pagebuf); skey.val &= SKEY_ACC | SKEY_FP; - report("set 4k", skey.val == 0x30); + report("set storage keys", skey.val == 0x30); + report_prefix_pop(); } static void test_1m_key(void) { int i; + bool rp = true; union r1 r1; union skey skey; + report_prefix_push("1M"); r1.val = 0; r1.reg.sk = 1; r1.reg.fsc = FSC_1M; @@ -89,11 +93,12 @@ static void test_1m_key(void) skey.val = get_storage_key((unsigned long) pagebuf + i * PAGE_SIZE); skey.val &= SKEY_ACC | SKEY_FP; if (skey.val != 0x30) { - report("set 1M", false); - return; + rp = false; + break; } } - report("set 1M", true); + report("set storage keys", rp); + report_prefix_pop(); } static void test_4k_clear(void) @@ -104,9 +109,11 @@ static void test_4k_clear(void) r1.reg.cf = 1; r1.reg.fsc = FSC_4K; + report_prefix_push("4K"); memset(pagebuf, 42, PAGE_SIZE); pfmf(r1.val, (unsigned long) pagebuf); - report("clear 4k", !memcmp(pagebuf, pagebuf + PAGE_SIZE, PAGE_SIZE)); + report("clear memory", !memcmp(pagebuf, pagebuf + PAGE_SIZE, PAGE_SIZE)); + report_prefix_pop(); } static void test_1m_clear(void) @@ -119,11 +126,13 @@ static void test_1m_clear(void) r1.reg.cf = 1; r1.reg.fsc = FSC_1M; + report_prefix_push("1M"); memset(pagebuf, 42, PAGE_SIZE * 256); pfmf(r1.val, (unsigned long) pagebuf); for (i = 0; i < PAGE_SIZE * 256; i++) sum |= pagebuf[i]; - report("clear 1m", !sum); + report("clear memory", !sum); + report_prefix_pop(); } int main(void) @@ -141,8 +150,8 @@ int main(void) memset(pagebuf, 0, PAGE_SIZE * 256); test_4k_key(); - test_1m_key(); test_4k_clear(); + test_1m_key(); test_1m_clear(); done: