From nobody Sat May 18 19:12:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615915502; cv=none; d=zohomail.com; s=zohoarc; b=PB72QI47jPWa1utxS6Ype874777JG8RG3lGe7b56u1UviQPHVQ+Vv1y9SKio09toMzmDO2v4Y7nio2fEA+8f2/aJhyQa1VurWLh+IWlyAGiVmG2mbNzj+Zl1WHVvJJUUg8UvB6pWgF7uvmCpTPgNmmdEIDPav4L6OrvplNCNvH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615915502; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=P9HOtQxBV/bG+GuI8aHNav7iJtNSHx8uTsMF5lguS5k=; b=SkXfOdxEOqkMBcATVH4Uy40oLvw8mZvBCb+3b0AeP6Ca8v1ajtSTWzhTz062QMpFMFYr/hKTUrOAsadF1k/Bm+gVFIeMr9myBOyjK9W0y3CgG7GbmfwtfFDuOeOb0/DxP3jxhM7QMccHpBT6/kPLMOyxBvX/LzW5oZzK9CTh00A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615915502231835.0454026319001; Tue, 16 Mar 2021 10:25:02 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-oTbM1opZM5WwKBfkFpn58g-1; Tue, 16 Mar 2021 13:24:59 -0400 Received: by mail-wm1-f72.google.com with SMTP id i14so9865052wmq.7 for ; Tue, 16 Mar 2021 10:24:59 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id v18sm24427294wrf.41.2021.03.16.10.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 10:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615915501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P9HOtQxBV/bG+GuI8aHNav7iJtNSHx8uTsMF5lguS5k=; b=WBieNe5dVqaXS00megdIor8VPZHdJAQpxO6gykqgNANL6Lqp2nRzBHIybbLe8aOahjwGem QoUuPRTu1BMiO83k4MWV279nQvgq2ZSoLBRzJMLc6t3CuiMpE238wWF3409Xim2IIEK+TE BRmR5nyZ3ohpdtvw/jVTZ6imTRaxq14= X-MC-Unique: oTbM1opZM5WwKBfkFpn58g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P9HOtQxBV/bG+GuI8aHNav7iJtNSHx8uTsMF5lguS5k=; b=kUHN0WVBSHJu98KZSqCdJe9uB+hhSUfIlc2ixgNGL74FRnPhsRXtY3z3vHgyZYYvHg 8+pxGQaSnW29HOEBLq6XUyAMMWzaACxLb+uMqktXjP2c0Y4pMr0obaciuV/8U0C2cN55 XXvN/OnCix9P1PMmsM8e1HuWmUSSVOcLEcSL7676Xw5yHeupxira+BE4qtJnitp4wrFW vSnvD0wmXIbMMUegF6CK0X5uBLDgwEJKpEo+DLmJoZdnh5qH4ly6jzaoHoml2xNRxupv KQWANnhgA9gOKfu/17iKPub5pwgzOyFEnMULoZ1qhw1T9Xr69yBhlYFjW/PMDnT+jYFU jikg== X-Gm-Message-State: AOAM531WXSNvCpEbAxO8UZQc7lrkocWjpDzd3+J0BEapjzSVGzTnHaRq IJcw9VWa/I+MWhV1CWFBu0r4xM8PQwbaUmip8HKjz1CLxGdZPtertT8D5wiL/QcJDYVJJ/b6+AC 1Cq32xvXKms/Shg== X-Received: by 2002:adf:ea0e:: with SMTP id q14mr43310wrm.389.1615915498291; Tue, 16 Mar 2021 10:24:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwy2pE4aQj+uWuWtKpHIDCCqqKI5Y0oeAjbejpCBZc34UdnssSi8XP9nUo2qvv89oWJY0SrA== X-Received: by 2002:adf:ea0e:: with SMTP id q14mr43289wrm.389.1615915498087; Tue, 16 Mar 2021 10:24:58 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , Laurent Vivier , Marcel Apfelbaum , Claudio Fontana , Thomas Huth , Markus Armbruster , Richard Henderson , qemu-arm@nongnu.org, Andrew Jones , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Date: Tue, 16 Mar 2021 18:24:46 +0100 Message-Id: <20210316172449.3148634-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210316172449.3148634-1-philmd@redhat.com> References: <20210316172449.3148634-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce the 'query-accels' QMP command which returns a list of built-in accelerator names. - Accelerator is a QAPI enum of all existing accelerators, - AcceleratorInfo is a QAPI structure providing accelerator specific information. Currently the common structure base provides the name of the accelerator, while the specific part is empty, but each accelerator can expand it. - 'query-accels' QMP command returns a list of @AcceleratorInfo For example on a KVM-only build we get: { "execute": "query-accels" } { "return": [ { "name": "qtest" }, { "name": "kvm" } ] } Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- Since v1: 'type' -> 'name' in comments --- qapi/machine.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++ accel/accel-qmp.c | 49 +++++++++++++++++++++++++++++++++++++++++ accel/meson.build | 2 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 accel/accel-qmp.c diff --git a/qapi/machine.json b/qapi/machine.json index 330189efe3d..610252fc25c 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1471,3 +1471,58 @@ ## { 'event': 'MEM_UNPLUG_ERROR', 'data': { 'device': 'str', 'msg': 'str' } } + +## +# @Accelerator: +# +# An enumeration of accelerator names. +# +# Since: 6.0 +## +{ 'enum': 'Accelerator', + 'data': [ { 'name': 'qtest' }, + { 'name': 'tcg' }, + { 'name': 'kvm' }, + { 'name': 'hax' }, + { 'name': 'hvf' }, + { 'name': 'whpx' }, + { 'name': 'xen' } ] } + +## +# @AcceleratorInfo: +# +# Accelerator information. +# +# @name: The accelerator name. +# +# Since: 6.0 +## +{ 'union': 'AcceleratorInfo', + 'base': {'name': 'Accelerator'}, + 'discriminator': 'name', + 'data': { } } + +## +# @query-accels: +# +# Get a list of AcceleratorInfo for all built-in accelerators. +# +# Returns: a list of @AcceleratorInfo describing each accelerator. +# +# Since: 6.0 +# +# Example: +# +# -> { "execute": "query-accels" } +# <- { "return": [ +# { +# "name": "qtest" +# }, +# { +# "name": "kvm" +# } +# ] } +# +## +{ 'command': 'query-accels', + 'returns': ['AcceleratorInfo'] } diff --git a/accel/accel-qmp.c b/accel/accel-qmp.c new file mode 100644 index 00000000000..426737b3f9a --- /dev/null +++ b/accel/accel-qmp.c @@ -0,0 +1,49 @@ +/* + * QEMU accelerators, QMP commands + * + * Copyright (c) 2021 Red Hat Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/qapi-commands-machine.h" + +static const bool accel_builtin_list[ACCELERATOR__MAX] =3D { + [ACCELERATOR_QTEST] =3D true, +#ifdef CONFIG_TCG + [ACCELERATOR_TCG] =3D true, +#endif +#ifdef CONFIG_KVM + [ACCELERATOR_KVM] =3D true, +#endif +#ifdef CONFIG_HAX + [ACCELERATOR_HAX] =3D true, +#endif +#ifdef CONFIG_HVF + [ACCELERATOR_HVF] =3D true, +#endif +#ifdef CONFIG_WHPX + [ACCELERATOR_WHPX] =3D true, +#endif +#ifdef CONFIG_XEN_BACKEND + [ACCELERATOR_XEN] =3D true, +#endif +}; + +AcceleratorInfoList *qmp_query_accels(Error **errp) +{ + AcceleratorInfoList *list =3D NULL, **tail =3D &list; + + for (Accelerator accel =3D 0; accel < ACCELERATOR__MAX; accel++) { + if (accel_builtin_list[accel]) { + AcceleratorInfo *info =3D g_new0(AcceleratorInfo, 1); + + info->name =3D accel; + + QAPI_LIST_APPEND(tail, info); + } + } + + return list; +} diff --git a/accel/meson.build b/accel/meson.build index b44ba30c864..7a48f6d568d 100644 --- a/accel/meson.build +++ b/accel/meson.build @@ -1,4 +1,4 @@ -specific_ss.add(files('accel-common.c')) +specific_ss.add(files('accel-common.c', 'accel-qmp.c')) softmmu_ss.add(files('accel-softmmu.c')) user_ss.add(files('accel-user.c')) =20 --=20 2.26.2 From nobody Sat May 18 19:12:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615915509; cv=none; d=zohomail.com; s=zohoarc; b=VGL/fjonsFyyY0NTfV04AQ325zA0+BG+G3xi8boib+ii1wLC6kDbDjrygQJOVxn2D4JNJgsxsvf0SSeT62eCTMUXQ1pYPNSECEv+wfNf9/tv8n+8hBZY6mmqlXcku05ABU52M8yf5jfR2uxXWz5OLbzmtJsdlROEd19DRAfXzyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615915509; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=n83T+8pJtXHVyLWFyezdG65ds62knC/7EziKXgLHqlc=; b=b0pfzP/pjL5mo19dxeg/EyEt/yTuqB1XDCOtVLWvkh6xqwIhL7rgwHdUQmt1CeIbG6UpHRr2MYKq63wYKPgIxNABwndo/toOeGLMDmZQvQ7Sy43f3VnlCryXoLgxydU28kdxEx8olj3Ql6Xa1LkLzDnEUiT8d8uJE1a2S7Ndi0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161591550919387.67830440506486; Tue, 16 Mar 2021 10:25:09 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-ktN2DBgQOBCWmxBNGunMMw-1; Tue, 16 Mar 2021 13:25:04 -0400 Received: by mail-wr1-f72.google.com with SMTP id p12so14426642wrn.18 for ; Tue, 16 Mar 2021 10:25:04 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id g9sm23621457wrp.14.2021.03.16.10.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 10:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615915506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n83T+8pJtXHVyLWFyezdG65ds62knC/7EziKXgLHqlc=; b=YrbKZUrlgIowjiG144OP4fisi3jIb1//aYAbuJ7lT1kI0vUXvl4Nk7hQ5U0O2p+ZTSJFHx UL/An0CHQEYzTsSXc9M4FK2DMxj63/WLU5Cz5PpjFzkW+icW8vIUwup+H/qz0OsGCuxf4d RZVFIWQWeC1Le49jIix61cnFvQoxgS4= X-MC-Unique: ktN2DBgQOBCWmxBNGunMMw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n83T+8pJtXHVyLWFyezdG65ds62knC/7EziKXgLHqlc=; b=PkvyDqwD1Y/4PJ1aytnW6dtJYvGpd3KBJNyLNDhox05BKJGrYHDHXZc2J1p77F+NZm a+h9NdrR/QEjdBwwb3p0ZKsAp0p2D9a3lfZe/F85lK7ukfBeGQwiLNwCSdXc06nNAQaf Jqmc/54eQhRLUey/clWvxRRRQ4Jr8jWcmEVuG1TSLz71yzabIhL7Q/iQULdWcHJBTaEv IwoDQfionkM+1nKJRZ5u0aDpHozGEK7xC7rAWSxb2wcAKzFlTcw4nyMuJk/wzl7xIfov XRnzCfoYo7JTzWdFI9pz3zfPSfcQd2j+jEHOPm+MmmpXH2fDCCND2M3fbCP5gBOiQMfn URpQ== X-Gm-Message-State: AOAM533H/HtTaC2g+y9dFjDWvo1pCPrrFX9StMLZXpbfavigXmUEiZrH 7jArNK73l13C3F9f73BvjLr13IfdhzLzzYC5RWiKtRL5Udjo1gvEPiKrglTZH+o98NhfSItrPtQ FbtK6sRKCQZ6C8Q== X-Received: by 2002:a5d:67cf:: with SMTP id n15mr72678wrw.95.1615915503232; Tue, 16 Mar 2021 10:25:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUELAEUWvF83uk7TuLD0mvkv57jXQUtCUcv67bs/lra0Zwjchk66YQ/qVdJgkhlD/1Mki0eg== X-Received: by 2002:a5d:67cf:: with SMTP id n15mr72658wrw.95.1615915503118; Tue, 16 Mar 2021 10:25:03 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , Laurent Vivier , Marcel Apfelbaum , Claudio Fontana , Thomas Huth , Markus Armbruster , Richard Henderson , qemu-arm@nongnu.org, Andrew Jones , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method Date: Tue, 16 Mar 2021 18:24:47 +0100 Message-Id: <20210316172449.3148634-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210316172449.3148634-1-philmd@redhat.com> References: <20210316172449.3148634-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce the qtest_has_accel() method which allows to query at runtime if a QEMU instance has an accelerator built-in. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- Since v1: - rename qtest_probe_accel() -> qtest_has_accel() - run with -machine none before creating QTestState --- tests/qtest/libqos/libqtest.h | 8 ++++++++ tests/qtest/libqtest.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h index a68dcd79d44..d80c618c18d 100644 --- a/tests/qtest/libqos/libqtest.h +++ b/tests/qtest/libqos/libqtest.h @@ -763,6 +763,14 @@ void qmp_expect_error_and_unref(QDict *rsp, const char= *class); */ bool qtest_probe_child(QTestState *s); =20 +/** + * qtest_has_accel: + * @accel_name: Accelerator name to check for. + * + * Returns: true if the accelerator is built in. + */ +bool qtest_has_accel(const char *accel_name); + /** * qtest_set_expected_status: * @s: QTestState instance to operate on. diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 71e359efcd3..2156b7e3972 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -393,6 +393,35 @@ QTestState *qtest_init_with_serial(const char *extra_a= rgs, int *sock_fd) return qts; } =20 +bool qtest_has_accel(const char *accel_name) +{ + bool has_accel =3D false; + QDict *response; + QList *accels; + QListEntry *accel; + QTestState *qts; + + qts =3D qtest_initf("-accel qtest -machine none"); + response =3D qtest_qmp(qts, "{'execute': 'query-accels'}"); + accels =3D qdict_get_qlist(response, "return"); + + QLIST_FOREACH_ENTRY(accels, accel) { + QDict *accel_dict =3D qobject_to(QDict, qlist_entry_obj(accel)); + const char *name =3D qdict_get_str(accel_dict, "name"); + + if (g_str_equal(name, accel_name)) { + has_accel =3D true; + break; + } + } + qobject_unref(response); + + qtest_quit(qts); + + return has_accel; +} + + void qtest_quit(QTestState *s) { qtest_remove_abrt_handler(s); --=20 2.26.2 From nobody Sat May 18 19:12:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615915512; cv=none; d=zohomail.com; s=zohoarc; b=mD0DA4/x4W0VBq2NIhsXMSbZANsB4c8+tIbFpuzfxTiYBlbumpPyiJruL4C9Bcqr7IkF0OtXgf28KFSgN2sfBuZn6lStNU9nLBRwV7QY1hXQBdEcbQ2mOWwIJspRKUvJ2UmyICkptjfqnzR76UR3oGm3M7zdrC4Z7trn52LIQ38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615915512; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=K8BJo/26emKOzTViZLjTILM8WZDfyElz+uQ2fAjq3CA=; b=Zw1xVlcQ6cgzz+bnmbjZ7Ef2hk1ep3mWRiJ3H1u71c+lckg1QZgpzChx/1d0T+/ClclmVJTA7RhP4zrg9fTf+ZrcqiftuaoRHPaOJF3/+iPEWzxBqUoSWz2CbIoX3r9ecMWpi+SCQBFwMZvPD4EGT/Wnw1wNFYqLaDG+7Dottbs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615915512405373.78087748807854; Tue, 16 Mar 2021 10:25:12 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-j24ZTWkeNAKxr_vqbie1Wg-1; Tue, 16 Mar 2021 13:25:09 -0400 Received: by mail-wr1-f70.google.com with SMTP id m9so17040292wrx.6 for ; Tue, 16 Mar 2021 10:25:09 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id p17sm34574wmq.47.2021.03.16.10.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 10:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615915511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K8BJo/26emKOzTViZLjTILM8WZDfyElz+uQ2fAjq3CA=; b=OvtSC5TLQ/QW2sXun63/kpJhqr3LduJKXddY7RuRzqqD+iiOYaek0dDWCE08cwHm9wajcO lOECS98wFoL/Zn1nEGffLNTy9ZCB6lHGwPAcO9mF6x6a8WGV3s5MXuJu8KXnI6tzaM1eDG MKxptUm9sgFrhEoueHOuap6EsV7tjqE= X-MC-Unique: j24ZTWkeNAKxr_vqbie1Wg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K8BJo/26emKOzTViZLjTILM8WZDfyElz+uQ2fAjq3CA=; b=T44NdxcA5dIYTcGz1UaZaNp3eeRccrd4vXyp0NYCPCQFUteQpV1svqEKLQ7Jj9hZeY 1+xfTJ/UZFHNvbmBpi0WFsrvs5vxmoPMfdo/3EpgCToEcAm4tM1Cfs6cCBNaxwOAVz9U 5IaKYypwan9HSyp7ner5QOG26xDq52MFZDLHSmEVebKZjY/wwmv4YCIiDVwVYql6d0GC 82HBJMsKluyIGiNJYFs33mD2t5jR4CS08rix6hoaGLHNg5sVlVPFZCuZBTbw9LJkJ8UU /RBCcNaTwrt871YcYiQ9qWiHoTv9+Y4GfLOjj+Va3R1GUWg73CoxjUNQZF+KkPC7hDD5 t+zA== X-Gm-Message-State: AOAM533QXih/SNPdu1kA6VA246XeBjGKa5DtIqaOinWELA0irBCAbXUD ov5gdy/LsMJVsEpcq80Plf8APL7R2cGRXpzUsG2czNREDhhYEUr1L77kkGTO10gK16hhCJPuWpg Mz2UtbAz4q0ma5w== X-Received: by 2002:a5d:4e52:: with SMTP id r18mr143089wrt.28.1615915508140; Tue, 16 Mar 2021 10:25:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuYo1PDe2mgnPdR1bwIVAawoeLpKwnIx5y7maNdD8qLqoNSupsHDrn3YXGrn+TJFDc4hIGng== X-Received: by 2002:a5d:4e52:: with SMTP id r18mr143074wrt.28.1615915507993; Tue, 16 Mar 2021 10:25:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , Laurent Vivier , Marcel Apfelbaum , Claudio Fontana , Thomas Huth , Markus Armbruster , Richard Henderson , qemu-arm@nongnu.org, Andrew Jones , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator Date: Tue, 16 Mar 2021 18:24:48 +0100 Message-Id: <20210316172449.3148634-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210316172449.3148634-1-philmd@redhat.com> References: <20210316172449.3148634-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Now than we can probe if the TCG accelerator is available at runtime with a QMP command, do it once at the beginning and only register the tests we can run. We can then replace the #ifdef'ry by an assertion. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- v2: use global tcg_accel_available, call qtest_has_accel() once --- tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index e020c83d2a5..52587aeb6b1 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -97,6 +97,7 @@ typedef struct { QTestState *qts; } test_data; =20 +static bool tcg_accel_available; static char disk[] =3D "tests/acpi-test-disk-XXXXXX"; static const char *data_dir =3D "tests/data/acpi"; #ifdef CONFIG_IASL @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_da= ta *data) char *args; bool use_uefi =3D data->uefi_fl1 && data->uefi_fl2; =20 -#ifndef CONFIG_TCG - if (data->tcg_only) { - g_test_skip("TCG disabled, skipping ACPI tcg_only test"); - return; - } -#endif /* CONFIG_TCG */ + assert(!data->tcg_only || tcg_accel_available); =20 args =3D test_acpi_create_args(data, params, use_uefi); data->qts =3D qtest_init(args); + test_acpi_load_tables(data, use_uefi); =20 if (getenv(ACPI_REBUILD_EXPECTED_AML)) { @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[]) const char *arch =3D qtest_get_arch(); int ret; =20 + tcg_accel_available =3D qtest_has_accel("tcg"); + g_test_init(&argc, &argv, NULL); =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[]) return ret; } qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35); - qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis); - qtest_add_func("acpi/piix4", test_acpi_piix4_tcg); qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc); - qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge); + qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_mic= rovm); qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug", test_acpi_piix4_no_root_hotplug); qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug", test_acpi_piix4_no_bridge_hotplug); qtest_add_func("acpi/piix4/pci-hotplug/off", test_acpi_piix4_no_acpi_pci_hotplug); - qtest_add_func("acpi/q35", test_acpi_q35_tcg); - qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge); - qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64); - qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi); - qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi); - qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp); - qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp); - qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp); - qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp); - qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem); - qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem); - qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm); - qtest_add_func("acpi/piix4/smm-compat", - test_acpi_piix4_tcg_smm_compat); - qtest_add_func("acpi/piix4/smm-compat-nosmm", - test_acpi_piix4_tcg_smm_compat_nosmm); - qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet); - qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm); - qtest_add_func("acpi/q35/smm-compat", - test_acpi_q35_tcg_smm_compat); - qtest_add_func("acpi/q35/smm-compat-nosmm", - test_acpi_q35_tcg_smm_compat_nosmm); - qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet); - qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm); - qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); - qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hma= t); - qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat); - qtest_add_func("acpi/microvm", test_acpi_microvm_tcg); - qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg); - qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg); - qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_t= cg); - qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_mic= rovm); - if (strcmp(arch, "x86_64") =3D=3D 0) { - qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg= ); + if (tcg_accel_available) { + qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis); + qtest_add_func("acpi/piix4", test_acpi_piix4_tcg); + qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge= ); + qtest_add_func("acpi/q35", test_acpi_q35_tcg); + qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge); + qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64); + qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi); + qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi); + qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp); + qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp); + qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp); + qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp); + qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numam= em); + qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem); + qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm); + qtest_add_func("acpi/piix4/smm-compat", + test_acpi_piix4_tcg_smm_compat); + qtest_add_func("acpi/piix4/smm-compat-nosmm", + test_acpi_piix4_tcg_smm_compat_nosmm); + qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet= ); + qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm); + qtest_add_func("acpi/q35/smm-compat", + test_acpi_q35_tcg_smm_compat); + qtest_add_func("acpi/q35/smm-compat-nosmm", + test_acpi_q35_tcg_smm_compat_nosmm); + qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet); + qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_= pxm); + qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); + qtest_add_func("acpi/piix4/acpihmat", + test_acpi_piix4_tcg_acpi_hmat); + qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hma= t); + qtest_add_func("acpi/microvm", test_acpi_microvm_tcg); + qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg); + qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg); + qtest_add_func("acpi/microvm/ioapic2", + test_acpi_microvm_ioapic2_tcg); + if (strcmp(arch, "x86_64") =3D=3D 0) { + qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie= _tcg); + } } } else if (strcmp(arch, "aarch64") =3D=3D 0) { - qtest_add_func("acpi/virt", test_acpi_virt_tcg); - qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem); - qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); - qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); + if (tcg_accel_available) { + qtest_add_func("acpi/virt", test_acpi_virt_tcg); + qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem= ); + qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); + qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); + } qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); } ret =3D g_test_run(); --=20 2.26.2 From nobody Sat May 18 19:12:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615915516; cv=none; d=zohomail.com; s=zohoarc; b=JACEgDgNIq+CoomQLJyT2hNJ8Ffo/7XP81G7biZsw2lYs0RHbbBwgUP3Ck47D46qEmVNQoe0k17NvcusISNeS23sY27hbyf2yTRqyo9GiGvFSkv7fpvIweTOasXBoq49Tbg7Xxy4KKqzwg0pBzh/sYQL1ATAGHtWekJCpM1TcC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615915516; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ef99CGiVPIoBJ1DNt6ZdEeS2PoHSPZ74D2ug+Z1Mo6I=; b=ExmevJFeAW7IIuP/XQ7paZnhSKdgMHolBH+NEYhwAVSHyz9JjIy9+smVmIo36eyLcAqAKFoyJBRv8won9VXr/7i4/z6I7XvZd321ueq49Tomt3E0C6puFamJVWbSYbSHmf4zc390XWHYNJ8NXUvKaNQszWjtYbVm8/xzmKb6b70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615915516845471.9362090657462; Tue, 16 Mar 2021 10:25:16 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-_0YeuUbBN2O5bOYdcSoHNw-1; Tue, 16 Mar 2021 13:25:14 -0400 Received: by mail-wr1-f70.google.com with SMTP id z6so16973530wrh.11 for ; Tue, 16 Mar 2021 10:25:14 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id 12sm40097wmw.43.2021.03.16.10.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 10:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615915515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ef99CGiVPIoBJ1DNt6ZdEeS2PoHSPZ74D2ug+Z1Mo6I=; b=OERcq71b9YLKbExaWr9zX+g8iDN0RjwUdkF+IaaOAvtbLjQudMlNoycVT9NYhq5s5z1hpE fmdTeD5wAlK9VISoccVjRoiTZoY1IFzJvv1qtxc+AsCiXx648rXNduqpG1XG9qw8MLFXaL r1s7MwOMfFwrkQMfhw4JH6dS+Jd6fqs= X-MC-Unique: _0YeuUbBN2O5bOYdcSoHNw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ef99CGiVPIoBJ1DNt6ZdEeS2PoHSPZ74D2ug+Z1Mo6I=; b=DvHMcq8Ly+S7R5QyJYw6pU+4BQJ35H4iP6uZxiaxtuVsrm3Zt9wosHI9yQEj9Xc0u8 A1olJyBrMhUKATyxLGY6tQxblvJ4lVs7oPm3L5WTsNa4gCOjH+T90b+K8uPU3oWZNfAP iKzRywgiEEntJJgPiPEMKmfQDXjXDLAbpa91JKTCTAAcBDVvUNnx9NDsnvIU3eeWEmye jr2ARsFzR+9UM2vlnbQaylBLZfAyN5rRVDVpD1u18928g95WiUHyGhd/rNiz/TlKeXmg 3pwOTUsyLFt0IaIydf+FwHIjxIK5q/siRq8z53JXn+mGYoYXcw1dt71llXt5hQevyg9A 0TWQ== X-Gm-Message-State: AOAM533pqrrchHbVbNnSZxsLexZoyC2iwTf6lP5UAgIYfQMFxcVEf/D2 2+66j2FJL80LTVosiROGswl5n8qQoOesIove3H1WiqjIOo3F8WrZnUZDCZ6cMy0XxtqdbRJrxuw VshOEeeaVN6re2Q== X-Received: by 2002:adf:d851:: with SMTP id k17mr112715wrl.254.1615915512914; Tue, 16 Mar 2021 10:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGQsUIYmLkFMpqv4PkmVovmHwArB3e9hY5ULAePM0VQ4Rwb+rVUNzEwC7WmI9bWhsIE1TJ9Q== X-Received: by 2002:adf:d851:: with SMTP id k17mr112693wrl.254.1615915512741; Tue, 16 Mar 2021 10:25:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , Laurent Vivier , Marcel Apfelbaum , Claudio Fontana , Thomas Huth , Markus Armbruster , Richard Henderson , qemu-arm@nongnu.org, Andrew Jones , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Date: Tue, 16 Mar 2021 18:24:49 +0100 Message-Id: <20210316172449.3148634-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210316172449.3148634-1-philmd@redhat.com> References: <20210316172449.3148634-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Since commit 82bf7ae84ce ("target/arm: Remove KVM support for 32-bit Arm hosts") we can remove the comment / check added in commit ab6b6a77774 and directly run the bios-tables-test. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- tests/qtest/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 66ee9fbf450..82e92d33f82 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -173,14 +173,13 @@ 'boot-serial-test', 'hexloader-test'] =20 -# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-tes= t unconditional qtests_aarch64 =3D \ - (cpu !=3D 'arm' ? ['bios-tables-test'] : []) + = \ (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-= test'] : []) + \ (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-= swtpm-test'] : []) + \ ['arm-cpu-features', 'numa-test', 'boot-serial-test', + 'bios-tables-test', 'xlnx-can-test', 'migration-test'] =20 --=20 2.26.2