From nobody Sun Nov 24 19:27:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721118556; cv=none; d=zohomail.com; s=zohoarc; b=FePUeqYGxxKt+zl1R+HAYXmOHqzSWu+2Bb3GYcpfZOGrtyq8M82/6PW1+fBrUdlk7iOgITZW0ANBXu5Owgsiwrs0I3eWDCHT4oCvQ7FlF7cKhyF55acTUsMPP7X2svSGYlMXEHe+URIq3Hg+pIO0a+qtEFglz6LIeFDjglz20bQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721118556; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DvpsKqJKseTB8512E3EM/mcg58HxToRdE8EyOPRZHqA=; b=ILSpjifzs05TCjOQfCqZVqnAzfT99iBjH317fUJK0WVZ71H4pMKK1eRBOdxCLkIL4Pvw5RFY2ff6neYiniMoeUX36u1B03wu5YWC1HnaOPjwjdE/z7Up2MMAZdxxwTrAIQd6qnpOHV2nvmzVqYIL9jVEF/Qi0sEV5gA3JNZjfPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721118556984755.8641390728122; Tue, 16 Jul 2024 01:29:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTdXw-0005Xr-I3; Tue, 16 Jul 2024 04:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTdXt-0005RN-N7 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 04:28:25 -0400 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTdXr-0001xr-0d for qemu-devel@nongnu.org; Tue, 16 Jul 2024 04:28:24 -0400 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-e05992214f9so3462473276.3 for ; Tue, 16 Jul 2024 01:28:22 -0700 (PDT) Received: from localhost ([157.82.128.7]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-78e33cb61b7sm4469874a12.34.2024.07.16.01.28.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jul 2024 01:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721118502; x=1721723302; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DvpsKqJKseTB8512E3EM/mcg58HxToRdE8EyOPRZHqA=; b=1Bg2hrKJmQVqfGSg+S/1OX+3mK+ItTFNeCA60qIGN8y6vpI6ZnDqLj6+Mdb9pRdp/A xfCyvG4S1e/uEzSdByufncPZPu45GJmvbx6tu1kbSGYwsoNp7dOQ/NGKXa9TmrJu3+cf /L93qZXCE6nPNjX/UQT50FSFHw3F7IBz3tMa+aF7Gubm5McFiBFRi4DXv6XP/gC9++2b 8+etHDp9HsIxlwKTIJYpgw28hZiNyFyEZmjyhjPVOpM8rFoKGOeogUImIxxbCjPKDGNt 1y8qybyLlFzOnuoJ/Jz5JF9OpoTtlv449DtMmbRiTLymHe17+v9bHMhhKW8zfZ4OZD7F HN6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721118502; x=1721723302; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DvpsKqJKseTB8512E3EM/mcg58HxToRdE8EyOPRZHqA=; b=HUSync+669YAlmBchKQg/Vb6ihmsG/jJflvUBKFl2hWPtBx3JtXkC4NosMgtx79Tq8 curZXpBOgYiJLSBfrhwo0dJ6fkp2+94sFda70bqePshnxu6jF2N1tz7RNlLaWdBlYSC5 M3Eh+7wx/oKmBK6RpsyhwZWvKFV6jDmUjx+ssJo93v5gvrI8GHqfpMQmKeAiHi8L8X2Q OiffHxYwMZGWS6NZQtmahmWxDXwOqC35oVBwhyt0pUIwR2s35Q3RO+6n2eVfb0r8Q6Xu Xfy3+8SHBYXArqy+KBcqBtVJdFd0PAA+UKNocP1y4Nf/DtSbsqtJTPMH7zeosbvIkQWH cOXA== X-Forwarded-Encrypted: i=1; AJvYcCV3CCIpl3ji3XSFrzOjIXZ1l8myCBjZU/USIQQDRd+56GHb7YnqAT3vmbTIgTKs2GuP2gfjT5Wu6o2fSJigUr/sEwpnbS8= X-Gm-Message-State: AOJu0YzI1ANJzMVw/SfNSP1j2A4CFRzZKRBdjaE1UCnNF7pVgwuJild4 rAy19h5MUnLJkdQJVYNRnNEiBZQHfy0mXzXEDHxyZehz6OTKNudjU4rJJc/4E/T2aNPcySnk9cR 6IUs= X-Google-Smtp-Source: AGHT+IFQ05MlplzP52qduKBfnd0ESRUZ3kDwmIURls30SB1PZNzPsUScFaoWpSnOmJbhKqG6+l2Hnw== X-Received: by 2002:a05:6902:118c:b0:e03:617c:b0ca with SMTP id 3f1490d57ef6-e05d57b9547mr1740748276.46.1721118501903; Tue, 16 Jul 2024 01:28:21 -0700 (PDT) From: Akihiko Odaki Date: Tue, 16 Jul 2024 17:28:13 +0900 Subject: [PATCH v2 1/5] tests/arm-cpu-features: Do not assume PMU availability MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240716-pmu-v2-1-f3e3e4b2d3d5@daynix.com> References: <20240716-pmu-v2-0-f3e3e4b2d3d5@daynix.com> In-Reply-To: <20240716-pmu-v2-0-f3e3e4b2d3d5@daynix.com> To: Peter Maydell , Thomas Huth , Laurent Vivier , Paolo Bonzini Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::b2a; envelope-from=akihiko.odaki@daynix.com; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721118558693116600 Asahi Linux supports KVM but lacks PMU support. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/arm-cpu-features.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index 966c65d5c3e4..cfd6f7735354 100644 --- a/tests/qtest/arm-cpu-features.c +++ b/tests/qtest/arm-cpu-features.c @@ -509,6 +509,7 @@ static void test_query_cpu_model_expansion_kvm(const vo= id *data) assert_set_feature(qts, "host", "kvm-no-adjvtime", false); =20 if (g_str_equal(qtest_get_arch(), "aarch64")) { + bool kvm_supports_pmu; bool kvm_supports_steal_time; bool kvm_supports_sve; char max_name[8], name[8]; @@ -537,11 +538,6 @@ static void test_query_cpu_model_expansion_kvm(const v= oid *data) =20 assert_has_feature_enabled(qts, "host", "aarch64"); =20 - /* Enabling and disabling pmu should always work. */ - assert_has_feature_enabled(qts, "host", "pmu"); - assert_set_feature(qts, "host", "pmu", false); - assert_set_feature(qts, "host", "pmu", true); - /* * Some features would be enabled by default, but they're disabled * because this instance of KVM doesn't support them. Test that the @@ -551,11 +547,18 @@ static void test_query_cpu_model_expansion_kvm(const = void *data) assert_has_feature(qts, "host", "sve"); =20 resp =3D do_query_no_props(qts, "host"); + kvm_supports_pmu =3D resp_get_feature(resp, "pmu"); kvm_supports_steal_time =3D resp_get_feature(resp, "kvm-steal-time= "); kvm_supports_sve =3D resp_get_feature(resp, "sve"); vls =3D resp_get_sve_vls(resp); qobject_unref(resp); =20 + if (kvm_supports_pmu) { + /* If we have pmu then we should be able to toggle it. */ + assert_set_feature(qts, "host", "pmu", false); + assert_set_feature(qts, "host", "pmu", true); + } + if (kvm_supports_steal_time) { /* If we have steal-time then we should be able to toggle it. = */ assert_set_feature(qts, "host", "kvm-steal-time", false); --=20 2.45.2