From patchwork Sat Apr 4 14:37:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 11474333 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 13CC9912 for ; Sat, 4 Apr 2020 14:38:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E648E20731 for ; Sat, 4 Apr 2020 14:38:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aCUlivbY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgDDOiY (ORCPT ); Sat, 4 Apr 2020 10:38:24 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:22287 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726504AbgDDOiX (ORCPT ); Sat, 4 Apr 2020 10:38:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586011102; 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=jy3EuHQ8mrgm29Jc3heu5uVEvCyCy6E0d+tEjOyDI0g=; b=aCUlivbYe9ZUKI/X3uillq04DTTK6xA6vhtDqDC0HUV9C5byVrr5vKfke/Aynqb0UETXCv qcJvjrnkVJoPk/9dhJx5j5LRr5q+sgBL2ZQARIeSM4uq8BJt9Y6s5HQ56eB0aQ0+Su6J27 mVSMgb924foFDzMcylD9kLLf3HPuCpg= 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-186-iHCQ4S7VPaW9pGzK5X48WQ-1; Sat, 04 Apr 2020 10:38:20 -0400 X-MC-Unique: iHCQ4S7VPaW9pGzK5X48WQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C33F8017F4; Sat, 4 Apr 2020 14:38:19 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.40.192.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36E4A9B912; Sat, 4 Apr 2020 14:38:15 +0000 (UTC) From: Andrew Jones To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Eric Auger , Andre Przywara Subject: [PULL kvm-unit-tests 16/39] arm: pmu: Let pmu tests take a sub-test parameter Date: Sat, 4 Apr 2020 16:37:08 +0200 Message-Id: <20200404143731.208138-17-drjones@redhat.com> In-Reply-To: <20200404143731.208138-1-drjones@redhat.com> References: <20200404143731.208138-1-drjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Eric Auger As we intend to introduce more PMU tests, let's add a sub-test parameter that will allow to categorize them. Existing tests are in the cycle-counter category. Signed-off-by: Eric Auger Reviewed-by: Andre Przywara Signed-off-by: Andrew Jones --- arm/pmu.c | 25 ++++++++++++++++--------- arm/unittests.cfg | 7 ++++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/arm/pmu.c b/arm/pmu.c index d5a03a6ff0b3..0122f0a8a8a9 100644 --- a/arm/pmu.c +++ b/arm/pmu.c @@ -287,22 +287,29 @@ int main(int argc, char *argv[]) { int cpi = 0; - if (argc > 1) - cpi = atol(argv[1]); - if (!pmu_probe()) { printf("No PMU found, test skipped...\n"); return report_summary(); } - report_prefix_push("pmu"); + if (argc < 2) + report_abort("no test specified"); - report(check_pmcr(), "Control register"); - report(check_cycles_increase(), - "Monotonically increasing cycle count"); - report(check_cpi(cpi), "Cycle/instruction ratio"); + report_prefix_push("pmu"); - pmccntr64_test(); + if (strcmp(argv[1], "cycle-counter") == 0) { + report_prefix_push(argv[1]); + if (argc > 2) + cpi = atol(argv[2]); + report(check_pmcr(), "Control register"); + report(check_cycles_increase(), + "Monotonically increasing cycle count"); + report(check_cpi(cpi), "Cycle/instruction ratio"); + pmccntr64_test(); + report_prefix_pop(); + } else { + report_abort("Unknown sub-test '%s'", argv[1]); + } return report_summary(); } diff --git a/arm/unittests.cfg b/arm/unittests.cfg index 017958d28ffd..fe6515c6b2dc 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -61,21 +61,22 @@ file = pci-test.flat groups = pci # Test PMU support -[pmu] +[pmu-cycle-counter] file = pmu.flat groups = pmu +extra_params = -append 'cycle-counter 0' # Test PMU support (TCG) with -icount IPC=1 #[pmu-tcg-icount-1] #file = pmu.flat -#extra_params = -icount 0 -append '1' +#extra_params = -icount 0 -append 'cycle-counter 1' #groups = pmu #accel = tcg # Test PMU support (TCG) with -icount IPC=256 #[pmu-tcg-icount-256] #file = pmu.flat -#extra_params = -icount 8 -append '256' +#extra_params = -icount 8 -append 'cycle-counter 256' #groups = pmu #accel = tcg