From patchwork Tue Jul 2 16:35:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 13720068 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DDA2C3065C for ; Tue, 2 Jul 2024 16:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=26ibk6G5TBJ3+G8dW2FBwDssd+gYK6j25tet2PWM190=; b=IgmtvjdyMrLJcLMu1+ACEQ8UgX l1rFF3Jm8nZh5ImRYiTLGHMXVPb7ql5CXiUmujCL5IGTMm1kiwzb/pLti5Q5G0Ztf0ZrgZivT+TfF cxqsbwVny5YygZFsHLVA4bTnCyrynY1IL/3INl/PwlfINWznKB1SwLsdhZPaGFPbSw/KSxHEI57fP AVW8ENYAX/uSt5vtblpDVPLUB1wq8BM1Pxxr6weTtxAoftmgMtksn090ph63yKfne14nlLfV2IcXB RDQI0aCEk2OTCm8x3vkxta1CoPX+f/t7X4bBvKQdwjnj7ZIM3x4J7YY70hDHfM/9Zl+biWoZckEtG GcR+VjLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOgTb-00000007OLy-16c5; Tue, 02 Jul 2024 16:35:31 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOgTQ-00000007OI7-0zBt for linux-arm-kernel@lists.infradead.org; Tue, 02 Jul 2024 16:35:21 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-57cc30eaf0aso1126716a12.2 for ; Tue, 02 Jul 2024 09:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719938118; x=1720542918; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=26ibk6G5TBJ3+G8dW2FBwDssd+gYK6j25tet2PWM190=; b=iuHEkgVK8Z1ExitpLchUZ3ASRHK8w5iPxZq3jLL/cQHS+W2MNu8DkT9P9+weSEqkk1 RbZzXPD2z6tOBA5sAniWh6lAHDQO0UTq+SH/vOC8z05KsLYN/6HR7woof5zn9etBY8f0 KzZ9jACvlQyHwba4kExVLidK5m1G4k4V+oXGgtTif4MwbJtizp7VvKMAOuB0Yz03yHGO gnfCz4fn1DVTbaHSYnz54CMKon1Rcm/PTvKuE67NBiC75O2P+/PUNjwXSnljL4yOI5Tm pxZn9KEq0MOybM614SI9UBJb3J9KHIhVnGk3Mcr5Sc+EOUsJtZ1wB+lFldZsaTIXhn+J C/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719938118; x=1720542918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=26ibk6G5TBJ3+G8dW2FBwDssd+gYK6j25tet2PWM190=; b=cVzHYoaT6yZkXNND7OWb9jmBVfV/4+Fdf6lNuXwd8Oy+65z3oboWh15HhWDY3+j+Al CVZas307pFWiLVDdULAdfqJh14zBTU2i2TaYxAz1yYBWDRZ4x1DcFwQgugcLEnuJu5+z lxP+Q41edKCRTIRuFmxb5QhTIq4a+7WkN6Ids1VPD2S+ICwDkOXDGAAuWwC6M72sppYe jiSm+ehcbJ+vbGTMoJWu3zySiJnj+JK/yFQbrMh+Y/5xMKmSqx5Lveof7m88jH4+qKbk sxOB6tPfc48ze65wd47walTYy0yGIUMoxapLyJFT6ZiLf/BEnaV+1G6mkORlPiElWzmY 7VjQ== X-Forwarded-Encrypted: i=1; AJvYcCVF7JknPLuP5vCL2p4//7pxvqyhCN1FGzFcOLdRO38PQ/haBCndbQtJjxHZ8NzO4uyurPxJkuVfY1CMy78jbOflnDb38NcAyVCadZiaJ2opKWjsIQg= X-Gm-Message-State: AOJu0Ywjc/5k9vnI6YffY6152D9gCX/HStBKdVFELskD/dTsFcy+JnGJ 6wKE/VmWJzQgreH7W31Vkv37/+zmKDkLHXTYeexdVPPQQZ9JEez+WcZ/nkvyiec= X-Google-Smtp-Source: AGHT+IHBhfNB7jsgIlUoHE4OPYBRUkv0au3wXdb9DmRC6/b+bjRYvNJ2M/3/OHm9YVxoyt5+KFsgIg== X-Received: by 2002:a05:6402:5203:b0:57d:1696:fd14 with SMTP id 4fb4d7f45d1cf-5879ede2704mr8832949a12.8.1719938117526; Tue, 02 Jul 2024 09:35:17 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58614f3d3f1sm5874972a12.94.2024.07.02.09.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 09:35:16 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B60F55F8D1; Tue, 2 Jul 2024 17:35:15 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: pbonzini@redhat.com, drjones@redhat.com, thuth@redhat.com Cc: kvm@vger.kernel.org, qemu-arm@nongnu.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@arm.com, maz@kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Anders Roxell , Andrew Jones , Alexandru Elisei , Eric Auger , kvmarm@lists.linux.dev (open list:ARM) Subject: [kvm-unit-tests PATCH v1 1/2] arm/pmu: skip the PMU introspection test if missing Date: Tue, 2 Jul 2024 17:35:14 +0100 Message-Id: <20240702163515.1964784-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240702163515.1964784-1-alex.bennee@linaro.org> References: <20240702163515.1964784-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_093520_305553_10B6E41B X-CRM114-Status: GOOD ( 14.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The test for number of events is not a substitute for properly checking the feature register. Fix the define and skip if PMUv3 is not available on the system. This includes emulator such as QEMU which don't implement PMU counters as a matter of policy. Signed-off-by: Alex Bennée Cc: Anders Roxell Signed-off-by: Alex Bennée --- arm/pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arm/pmu.c b/arm/pmu.c index 9ff7a301..66163a40 100644 --- a/arm/pmu.c +++ b/arm/pmu.c @@ -200,7 +200,7 @@ static void test_overflow_interrupt(bool overflow_at_64bits) {} #define ID_AA64DFR0_PERFMON_MASK 0xf #define ID_DFR0_PMU_NOTIMPL 0b0000 -#define ID_DFR0_PMU_V3 0b0001 +#define ID_DFR0_PMU_V3 0b0011 #define ID_DFR0_PMU_V3_8_1 0b0100 #define ID_DFR0_PMU_V3_8_4 0b0101 #define ID_DFR0_PMU_V3_8_5 0b0110 @@ -286,6 +286,11 @@ static void test_event_introspection(void) return; } + if (pmu.version < ID_DFR0_PMU_V3) { + report_skip("PMUv3 extensions not supported, skip ..."); + return; + } + /* PMUv3 requires an implementation includes some common events */ required_events = is_event_supported(SW_INCR, true) && is_event_supported(CPU_CYCLES, true) &&